# Judge0 Execute Code

> Judge0 Execute Code is a paid API for AI agents from Judge0 at judge0.mpp.paywithlocus.com, paid per call via MPP, $0.006/call, status unknown (last checked 2026-10-10).

Synchronously executes source code in a sandboxed environment across 60+ programming languages and returns stdout, stderr, status, and runtime metrics.

## Facts

- Endpoint: POST https://judge0.mpp.paywithlocus.com/judge0/execute-code?utm_source=zero.xyz
- Price: $0.006/call
- Payment: MPP
- Status: unknown
- Last checked: 2026-10-10
- Activations on Zero: 0
- Provider: Judge0
- Docs: https://ce.judge0.com
- Website: https://judge0.com
- Tags: code-execution, sandbox, programming-languages, compute
- Canonical page: https://www.zero.xyz/c/judge0-execute-code-bc68dfe4
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_2z6v44QMg0ZKXq4Nv346E

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability judge0-execute-code-bc68dfe4 -d '<json body>'
```

Example prompt: Run this Python 3 code for me in a sandbox and tell me what it prints: 'nums = [1,2,3]; print(sum(nums))' — use language ID 71 and pass '5' as stdin.

## When to prefer this

Use this endpoint when you need immediate, synchronous code execution results without polling — ideal for short-lived scripts, quick evaluations, or automated test checking. Prefer this over the async Submit Code endpoint when you want the result in a single request. Choose Judge0 when you need broad language support (60+ languages) with configurable resource limits and optional expected output matching.

## Known failure modes

- Unsupported language_id returns an error or empty result
- Time Limit Exceeded when cpu_time_limit is too low for the program
- Runtime Error when the program crashes or throws an unhandled exception
- Compilation Error when source_code has syntax errors, returned in compile_output
- Memory Limit Exceeded when program exceeds memory_limit
- Wrong Answer status when expected_output is provided but output does not match
- Empty stdout when program produces no output or writes only to stderr

## How this service works

Submit source code for synchronous execution. Returns stdout, stderr, compile output, execution time, and memory usage.

## Output

Returns a JSON object with stdout (program output), stderr (error stream), compile_output (compiler messages), execution status (e.g. Accepted, Time Limit Exceeded, Runtime Error), wall time in seconds, memory usage in KB, and a submission token for reference.

## Example request

```json
{
 "stdin": "",
 "language_id": "71",
 "source_code": "print('Hello, World!')\nprint('Testing code execution')\nresult = 2 + 2\nprint(f'2 + 2 = {result}')",
 "expected_output": "Hello, World!\nTesting code execution\n2 + 2 = 4"
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "source_code",
  "language_id"
 ],
 "properties": {
  "stdin": {
   "type": "string",
   "description": "Standard input for the program"
  },
  "language_id": {
   "type": "integer",
   "description": "Language ID (e.g., 71 for Python 3, 63 for JavaScript, 54 for C++, 62 for Java). Use list-languages to find IDs."
  },
  "source_code": {
   "type": "string",
   "description": "Program source code to execute"
  },
  "stack_limit": {
   "type": "number",
   "description": "Stack size limit in kilobytes"
  },
  "memory_limit": {
   "type": "number",
   "description": "Memory limit in kilobytes"
  },
  "cpu_time_limit": {
   "type": "number",
   "description": "CPU time limit in seconds (default: instance-dependent)"
  },
  "enable_network": {
   "type": "boolean",
   "description": "Allow network access inside the sandbox"
  },
  "expected_output": {
   "type": "string",
   "description": "Expected output — if provided, status will indicate whether output matches"
  },
  "wall_time_limit": {
   "type": "number",
   "description": "Wall clock time limit in seconds"
  },
  "compiler_options": {
   "type": "string",
   "description": "Compiler flags (max 512 chars, e.g., \"-O2 -Wall\")"
  },
  "command_line_arguments": {
   "type": "string",
   "description": "Command-line arguments passed to the program (max 512 chars)"
  },
  "redirect_stderr_to_stdout": {
   "type": "boolean",
   "description": "Redirect stderr to stdout in the output"
  }
 },
 "additionalProperties": true
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/judge0-execute-code-bc68dfe4/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from judge0.mpp.paywithlocus.com](https://www.zero.xyz/host/judge0.mpp.paywithlocus.com/llms.txt)
