onlinecompiler.io

SandboxFusion-compatible API

A hosted endpoint in the shape of SandboxFusion's run_code, at https://api.onlinecompiler.io/api/sandboxfusion/run_code, for training and evaluation tools that grade generated code: the same request and answer, with your API key, and no sandbox server of your own.

Tools written for a SandboxFusion server work here with two changes: point their run_code URL at https://api.onlinecompiler.io/api/sandboxfusion/run_code, and send your API key in the Authorization header, bare or after Bearer. The request and the answer keep SandboxFusion's fields.

POST /api/sandboxfusion/run_code
Terminal
curl -X POST https://api.onlinecompiler.io/api/sandboxfusion/run_code \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "print(sum(map(int, input().split())))",
    "language": "python",
    "stdin": "1 2",
    "run_timeout": 5
  }'

Response (200)

Response
{
  "status": "Success",
  "message": "",
  "compile_result": null,
  "run_result": {
    "status": "Finished",
    "execution_time": 0.03,
    "return_code": 0,
    "stdout": "3\n",
    "stderr": ""
  },
  "executor_pod_name": null,
  "files": {}
}

status is Success when the program exits with 0, and Failed for a non-zero exit, a compile error, the time limit (with run_result.status TimeLimitExceeded) or an output or process limit. SandboxError, with run_result.status Error and the reason in message, means the sandbox failed on our side; such a run is not charged.

Languages

languageRuns on
pythonPython 3.14
cppC++ G++ 15
nodejsJavaScript Node.js 24
goGo 1.26
javaJava OpenJDK 25
phpPHP 8.5
csharpC# .NET SDK 10
bashBash 5.2
typescriptTypeScript Deno
sqlSQL SQLite 3
rustRust 1.93
luaLua 5.5
RR 4.6
perlPerl 5.44
rubyRuby 4.0
scalaScala 3.10
juliaJulia 1.13
swiftSwift 6.4
racketRacket 9.3
pytestPython 3.14 with pytest: the code is written to test_solution.py and its tests are run

SandboxFusion's other modes (jest, junit, go_test, D_ut, kotlin_script, and the GPU, Verilog and Lean ones) answer 400 with the list above. Languages run on the versions shown, which can be newer than a SandboxFusion image's.

Differences from SandboxFusion

  • Refusals are HTTP errors with {"error": "..."}, where a SandboxFusion server answers 200: 400 for a bad request, 403 for a missing or wrong key, and 429 when a plan limit is reached or every sandbox is busy, with a Retry-After header whenever waiting helps.
  • run_timeout is 10 seconds when not sent, as on SandboxFusion, and at most 30 seconds: a longer one runs for 30. Compiling does not count, and Java OpenJDK 25 (1 s), Groovy 6.0 (1.5 s) and F# .NET SDK 10 (2.5 s) get a start-up allowance on top. compile_timeout is accepted and ignored.
  • memory_limit_MB, when above 0, is the run's memory limit, from 16 MB to your plan's ceiling (512 MB, or up to 2048 MB on Pro and above); -1 or no value gives 512 MB.
  • files (paths to base64 content) are written beside the program under the input file limits: up to 20 files and 1 MB in total; a null entry is skipped. fetch_files is accepted, and files in the answer is always {}.
  • There is no separate compile stage: compile_result is null, and compiler errors arrive in run_result.stderr with a non-zero return_code.
  • stdout and stderr are cut at 64 KB each.
  • Other fields, such as an expected_stdout a tool compares itself, are ignored, as SandboxFusion ignores them.

Using it from a tool

  • Point the tool's SandboxFusion URL at https://api.onlinecompiler.io/api/sandboxfusion/run_code, or its base URL at https://api.onlinecompiler.io/api/sandboxfusion if it adds /run_code itself, and give it your key for the Authorization header. A tool that takes only a URL and sends no headers needs a header option before it can use a key.
  • Keep its concurrency at or under your plan's runs at once (4 on Free, 8 on Starter, 10 on Pro, 20 on Business and 100 on Platform), and pick a plan whose runs a minute and a month cover a training step or an eval run: see limits.
  • One request is one run: a tool that sends one request per test case uses one run per test.

Questions

Is this SandboxFusion itself?
No. It is OnlineCompiler.io's own runner answering in the shape of SandboxFusion's run_code, so a tool written for a SandboxFusion server needs only a new URL and an API key. Every run gets a fresh gVisor sandbox with no network access, deleted afterwards. OnlineCompiler.io is not affiliated with ByteDance, which publishes SandboxFusion.
What does a call cost?
Each call is one run of your plan's monthly runs, as on run-code, whatever its language, pytest included. A run that fails on our side (status "SandboxError") is not charged.
How many calls can run at once?
Your plan's runs at once: 4 on Free, 8 on Starter, 10 on Pro, 20 on Business and 100 on Platform. Set the tool's concurrency at or under that number; calls above it answer 429 with a Retry-After header.
Can I get files back?
Not on this endpoint yet: fetch_files is accepted, and files in the answer is always empty. The run endpoints return files a program writes to $OUTPUT_DIR.