Compare online code execution APIs side-by-side. Run code in 40-80+ languages via a simple HTTP request. Support for competitive programming, AI agents, and coding interviews.
Code execution APIs replace self-hosted runtime environments with a single HTTP call. Here are the most common use cases:
Feature matrix across all 6 code execution APIs. Scroll horizontally on mobile.
| Provider | Free Tier | Languages | Timeout | stdin/stdout | Session State | Pricing |
|---|---|---|---|---|---|---|
| Judge0 | 2,000/day Free | 60+ | 2-15s | Yes | Stateless | €27/mo |
| OneCompiler | 10,000/mo Free | 70+ | 7-20s | Yes | Stateless | $5/mo |
| Sphere Engine | Contact Trial | 80+ | 5-10s | Yes | Stateless | Custom |
| Piston | No free Paid only | 50+ | 10-30s | Yes | Stateless | Contact |
| E2B | $100 credit Free | Any | 24h sessions | Yes | Stateful | $0.05/hr |
| Frostbyte Best Value | 200 credits Free | 4 (Python, JS, TS, Bash) | 30s | Yes | Stateless | $1 = 500 |
Detailed pros/cons for each code execution API. Click provider names for their documentation.
How to execute code with each API. Click tabs to see different languages.
# 1. Submit code for execution
curl -X POST https://judge0-ce.p.rapidapi.com/submissions \
-H 'Content-Type: application/json' \
-H 'X-RapidAPI-Key: YOUR_KEY' \
-H 'X-RapidAPI-Host: judge0-ce.p.rapidapi.com' \
-d '{
"language_id": 71,
"source_code": "print(\"Hello, World!\")",
"stdin": "test input"
}'
# Returns token, e.g. "token": "abc123def456"
# 2. Get execution result
curl https://judge0-ce.p.rapidapi.com/submissions/abc123def456 \
-H 'X-RapidAPI-Key: YOUR_KEY' \
-H 'X-RapidAPI-Host: judge0-ce.p.rapidapi.com'const fetch = await import('node-fetch');
const code = `
print("Hello, World!")
print(input())
`;
// Submit code
const submitRes = await fetch.default(
'https://judge0-ce.p.rapidapi.com/submissions',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-RapidAPI-Key': process.env.RAPIDAPI_KEY
},
body: JSON.stringify({
language_id: 71, // Python
source_code: code,
stdin: 'test'
})
}
);
const { token } = await submitRes.json();
// Poll for result
const resultRes = await fetch.default(
`https://judge0-ce.p.rapidapi.com/submissions/${token}`,
{ headers: { 'X-RapidAPI-Key': process.env.RAPIDAPI_KEY } }
);
const result = await resultRes.json();
console.log('stdout:', result.stdout);
console.log('stderr:', result.stderr);import requests
import time
code = """
print("Hello, World!")
print(input())
"""
headers = {
'X-RapidAPI-Key': 'YOUR_KEY',
'Content-Type': 'application/json'
}
# Submit
resp = requests.post(
'https://judge0-ce.p.rapidapi.com/submissions',
headers=headers,
json={'language_id': 71, 'source_code': code, 'stdin': 'test'}
)
token = resp.json()['token']
# Poll result
for _ in range(10):
result = requests.get(
f'https://judge0-ce.p.rapidapi.com/submissions/{token}',
headers=headers
).json()
if result['status']['id'] > 2:
print(result['stdout'])
break
time.sleep(0.5)# OneCompiler API - Execute code
curl -X POST https://api.onecompiler.com/api/v1/code/exec \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-d '{
"language": "python",
"code": "print(\"Hello, World!\")",
"stdin": ""
}'const apiKey = process.env.ONECOMPILER_API_KEY;
const response = await fetch(
'https://api.onecompiler.com/api/v1/code/exec',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${apiKey}`
},
body: JSON.stringify({
language: 'python',
code: 'print("Hello from OneCompiler")',
stdin: ''
})
}
);
const result = await response.json();
console.log(result.stdout);
console.log(result.stderr);# No API key needed for basic use
curl -X POST https://agent-gateway-kappa.vercel.app/v1/agent-coderunner/api/execute \
-H 'Content-Type: application/json' \
-d '{
"language": "python",
"code": "print(42 + 58)"
}'
# With API key (for higher limits)
curl -X POST https://agent-gateway-kappa.vercel.app/api/keys/create
# Then add: -H 'Authorization: Bearer YOUR_KEY'// Execute code (no API key needed for basic use)
const result = await fetch(
'https://agent-gateway-kappa.vercel.app/v1/agent-coderunner/api/execute',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
language: 'python',
code: 'import sys\nprint(f"Python {sys.version}")\nprint(42 + 58)'
})
}
).then(r => r.json());
console.log(result.stdout); // "Python 3.12.x\n100"
console.log(result.exitCode); // 0
console.log(result.duration); // ~12msWhat you pay at each tier. Free options are limited; consider paid plans for production use.
| Provider | 1K executions | 10K executions | 100K executions |
|---|---|---|---|
| Judge0 | €27/mo (2K/day included) | €27/mo | €27/mo |
| OneCompiler | $5/mo | $5/mo | $25/mo (100K) |
| Sphere Engine | Contact | Contact | Contact |
| Piston | Contact | Contact | Contact |
| E2B | ~$1.25 (25 min) | ~$12.50 | ~$125 |
| Frostbyte | $2 | $20 | $200 |
Choose based on your specific requirements:
Use Judge0 or OneCompiler. Both support 60-70+ languages, stdin/stdout, and have low-latency APIs optimized for rapid-fire code submissions. OneCompiler cheaper at $5/mo, Judge0 more language-rich.
Use E2B for stateful sandboxes with file system access (perfect for Claude Code, autonomous agents). Use Frostbyte if you just need simple Python/JavaScript execution in pipelines.
Use OneCompiler (70+ languages, challenges API) or Judge0 (60+ languages, webhooks for async results). Both scale well for high-volume submissions.
Use OneCompiler (embedded editor widget, web interface) or Sphere Engine (enterprise solution with web components). Judge0 is API-only.
Use OneCompiler or Sphere Engine for assessment features (auto-grading, problem sets, student tracking). Both have tools/APIs for building classroom platforms.
Use Frostbyte (no signup form, one API call to get key). Next best: Judge0 or OneCompiler on RapidAPI.
Execute code right now using the Frostbyte Code Runner API. No signup required.