# Code Toll

> Code Toll is a paid API for AI agents from code-toll-production.up.railway.app, paid per call via x402, $0.02/call, status unknown (last checked 2026-10-22).

Generates code from a natural language prompt, returning the generated source code for AI agent use.

## Facts

- Endpoint: POST https://code-toll-production.up.railway.app/generate?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-22
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/code-toll-a16aca53
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_VzwV7cPgZCoY9gtYXuzfw

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 code-toll-a16aca53 -d '<json body>'
```

Example prompt: Can you write me a Python function that takes a list of dictionaries and filters out entries where the 'status' field is not 'active', then returns the filtered list?

## When to prefer this

Choose this endpoint when an AI agent needs to dynamically generate code snippets or functions on demand from natural language descriptions, especially in automated pipelines where writing code programmatically is a bottleneck. It is well-suited for lightweight, per-call code generation tasks where $0.02 USDC per call is acceptable and latency needs to be low.

## Known failure modes

- Empty or ambiguous prompt leading to generic or incorrect code output
- Prompt too complex for single-call generation resulting in incomplete code
- Service unavailability returning a non-200 HTTP response
- Payment failure or x402 protocol issues preventing call completion
- Rate limiting or quota exceeded errors

## How this service works

Code generation. Send a prompt, get back generated code. POST /generate {"prompt":"..."}

## Output

Returns generated source code corresponding to the input prompt, typically as a plain text or structured response containing the code ready for use or further processing.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "prompt"
 ],
 "properties": {
  "prompt": {
   "type": "string",
   "description": "What code to generate"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/code-toll-a16aca53/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from code-toll-production.up.railway.app](https://www.zero.xyz/host/code-toll-production.up.railway.app/llms.txt)
