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.
/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 snippetsLetโs go through examples for each endpoint:
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.
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')"
}
To upload code, make a POST request to /upload
with a filename and data.
{
"filename": "hello.py",
"data": "print('This is test file data')"
}
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.
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,
]
}
]
}
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
}