# 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-10).

Executes source code in a sandboxed environment across 60+ programming languages and returns the program output

## Facts

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

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-ec558582 -d '<json body>'
```

Example prompt: Run this Python 3 script for me — here's the source code: `print(sum(int(x) for x in input().split()))` — with stdin set to '1 2 3 4 5', and tell me what it outputs.

## When to prefer this

Choose this endpoint when you need to execute arbitrary source code in a sandboxed, isolated environment without provisioning your own infrastructure. It is ideal for AI agents that need to validate code correctness, run user-submitted scripts, power online judges for competitive programming, or produce computed results from code within an automated workflow. Supports 60+ languages including Python, JavaScript, C++, Java, and many more. Prefer this over self-hosted runners when you want per-call micropayment billing via x402 and zero infrastructure management.

## Known failure modes

- Invalid language_id returns an error or unsupported language response
- Source code that exceeds memory_limit results in a memory limit exceeded status
- Programs running longer than cpu_time_limit or wall_time_limit return a time limit exceeded status
- Compilation errors in statically typed languages (C++, Java) return a compile error status with compiler output
- Runtime errors (exceptions, segfaults) return a runtime error status
- Malformed JSON body or missing source_code field returns a 400-level error
- Insufficient USDC payment or x402 payment failure blocks execution

## How this service works

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

## Output

Returns a JSON object containing the program's stdout, stderr, execution status (accepted, wrong answer, time limit exceeded, runtime error, etc.), runtime and memory usage metrics, plus payment confirmation details (settled USDC amount) and a request ID for status polling.

## 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-ec558582/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)
