# Judge0 via Locus x402 — Code Execution

> Judge0 via Locus x402 — Code Execution is a paid API for AI agents from judge0.x402.paywithlocus.com, paid per call via x402, $0.006/call, status unknown (last checked 2026-10-13).

Executes source code in a sandboxed environment supporting 60+ programming languages and returns stdout, stderr, and execution metadata

## Facts

- Endpoint: POST https://judge0.x402.paywithlocus.com/judge0/execute-code?utm_source=zero.xyz
- Price: $0.006/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/judge0-via-locus-x402-code-execution-8af11f26
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_thPpX76rjbmlkp-6oHD2G

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-via-locus-x402-code-execution-8af11f26 -d '<json body>'
```

Example prompt: Run this Python 3 script (language ID 71) for me and return the output — the code reads two numbers from stdin and prints their sum, and I want to pass '3 5' as the input.

## When to prefer this

Choose this endpoint when you need remote, sandboxed code execution across a wide variety of programming languages (60+) without provisioning your own infrastructure, and when micropayment-per-execution billing via x402/USDC is acceptable. Ideal for AI agents that need to run untrusted or user-supplied code safely, evaluate algorithm correctness, or power coding assistants and educational tools. Prefer this over self-hosted runners when isolation, multi-language support, and pay-per-use economics matter.

## Known failure modes

- Invalid language_id returns an error indicating unsupported language
- Source code that exceeds CPU or wall time limit returns a Time Limit Exceeded status
- Memory usage beyond memory_limit returns Memory Limit Exceeded
- Compilation errors for statically-typed languages are returned in compile_output field
- Network errors within the sandbox if enable_network is false and code attempts network calls
- Malformed JSON body or missing source_code field returns a 400-level error
- Payment failure (insufficient funds or x402 protocol error) prevents execution

## How this service works

Online code execution — run source code in 60+ programming languages with sandboxed isolation.

## Output

A JSON object containing a 'data' field with execution results (stdout, stderr, status code, compile output, execution time, memory used), a 'payment' object confirming USDC settled, a 'request' object with a UUID and status URL for async polling, and a 'success' boolean.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "stdin": {
   "type": "string"
  },
  "language_id": {
   "type": "integer"
  },
  "source_code": {
   "type": "string"
  },
  "stack_limit": {
   "type": "number"
  },
  "memory_limit": {
   "type": "number"
  },
  "cpu_time_limit": {
   "type": "number"
  },
  "enable_network": {
   "type": "boolean"
  },
  "expected_output": {
   "type": "string"
  },
  "wall_time_limit": {
   "type": "number"
  },
  "compiler_options": {
   "type": "string"
  },
  "command_line_arguments": {
   "type": "string"
  },
  "redirect_stderr_to_stdout": {
   "type": "boolean"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "data": {},
  "payment": {
   "scheme": "exact",
   "settledUsdc": "0.001000",
   "authorizedMaxUsdc": "0.001000"
  },
  "request": {
   "id": "00000000-0000-4000-8000-000000000000",
   "statusUrl": "/requests/00000000-0000-4000-8000-000000000000"
  },
  "success": true
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/judge0-via-locus-x402-code-execution-8af11f26/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from judge0.x402.paywithlocus.com](https://www.zero.xyz/host/judge0.x402.paywithlocus.com/llms.txt)
