Code Runner

फ्रीमियम
द्वारा Haseeb Mir | अपडेट किया गया 2 महीने पहले | Tools
Health Check

N/A

सभी ट्यूटोरियल पर वापस जाएं (1)

Code Runner Tutorial

Tutorial on Code Runner API

Code Runner is a plugin that allows you to run and save code in over 70 programming languages directly in your ChatGPT browser. This handy API makes it easy to leverage Code Runner’s capabilities.

Endpoints

  • /run_code - Run code
  • /save_code - Save code
  • /download/{filename} - Download saved code
  • /help - Get help
  • /credit_limit - Check credit limit
  • /upload - Upload files
  • /quick_chart - Generate charts
  • /show_snippet - Display code snippets

Let’s go through examples for each endpoint:

Run Code

To run code, make a POST request to /run_code with a JSON body containing the code and language:

{
  "code": "print('Hello World')", 
  "language": "python"
}

The response will contain the output of running the code.

Save Code

To save code, make a POST request to /save_code with a JSON body containing the filename and code:

{
  "filename": "hello.py",
  "code": "print('Hello World')"
}

Upload Code

To upload code, make a POST request to /upload with a filename and data.

{
    "filename": "hello.py",
    "data": "print('This is test file data')"
}

Download Code

To download code, make a POST request to /download/{filename} with a filename

/download/hello.py

The response will contain a download_link to download the saved file.

Generate Chart

To generate chart, make a POST request to /quick_chart with a this data.

{
  "chart_type": "scatter",
  "labels": [
    "May",
    "March",
  ],
  "datasets": [
    {
      "label": "Random Data",
      "data": [
        69,
        63,
      ]
    }
  ]
}

Generate Code Snippet Image

To generate code snippet, make a POST request to /show_snippet with a this data.

{
    "code": "print('Hello World')",
    "title": "Prime Numbers",
    "theme": "Monokai",
    "language": "python",
    "opacity": 0,
    "blurLines": 0,
    "showNums": true
}