# Claude Sonnet via x402 Gateway

> Claude Sonnet via x402 Gateway is a paid API for AI agents from x402-gateway-production.up.railway.app, paid per call via x402, $0.060000/call, status unknown (last checked 2026-10-10, last successful call 2026-06-16).

Calls Anthropic's Claude Sonnet model for coding, reasoning, and creative writing tasks, billed per-call via x402 micropayment protocol

## Facts

- Endpoint: POST https://x402-gateway-production.up.railway.app/api/llm/claude-sonnet?utm_source=zero.xyz
- Price: $0.060000/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-10
- Last successful call: 2026-06-16
- Success rate: 50% of calls made through Zero
- Rating: 4.7 / 5 from 2 reviews
- Activations on Zero: 9
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-gateway-production-up-railway-app-f1a981d4
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Fo6haF246aEkCbQClzoWx

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 x402-gateway-production-up-railway-app-f1a981d4 -d '<json body>'
```

Example prompt: Ask Claude Sonnet to write a Python function that parses a CSV file and returns a dictionary grouped by the first column — I'll pay the $0.06 per call fee automatically.

## When to prefer this

Choose this endpoint when you need a high-quality, balanced LLM (Claude Sonnet) for coding, reasoning, or creative writing tasks and want pay-per-call micropayment billing via x402 rather than a subscription. Prefer over GPT or other models when Anthropic's reasoning style or safety characteristics are desired. Ideal for agentic workflows where inference cost should be metered per invocation.

## Known failure modes

- Payment failure or insufficient USDC balance — payment rejected before inference runs
- Invalid or malformed prompt payload — 400 error returned
- Model unavailable or gateway timeout — 503 or timeout error
- Exceeded token context limit — response truncated or error returned
- Authentication/x402 protocol mismatch — payment handshake fails

## How this service works

Anthropic's balanced model — excellent coding, reasoning, and creative writing

## Output

Returns a text completion from Claude Sonnet (Anthropic's balanced model), including generated code, written prose, reasoning chains, or structured outputs depending on the prompt provided.

## Example request

```json
{
 "model": "claude-sonnet",
 "messages": [
  {
   "role": "user",
   "content": "Write a Python function that validates email addresses using regex and returns True if valid, False otherwise. Include docstring and example usage."
  }
 ],
 "max_tokens": 500
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "bodyType",
    "body",
    "method"
   ],
   "properties": {
    "body": {
     "type": "object",
     "required": [
      "messages"
     ],
     "properties": {
      "stop": {
       "oneOf": [
        {
         "type": "string"
        },
        {
         "type": "array",
         "items": {
          "type": "string"
         },
         "maxItems": 4
        }
       ],
       "description": "Model-supported stop; see /docs/llm-capabilities.md."
      },
      "tools": {
       "type": "array",
       "items": {
        "type": "object",
        "required": [
         "function"
        ],
        "properties": {
         "type": {
          "enum": [
           "function"
          ],
          "type": "string"
         },
         "function": {
          "type": "object",
          "properties": {
           "name": {
            "type": "string"
           },
           "strict": {
            "type": "boolean"
           },
           "parameters": {
            "type": "object"
           },
           "description": {
            "type": "string"
           }
          }
         }
        }
       },
       "description": "Client-executed function definitions; return results using role=tool and tool_call_id."
      },
      "top_k": {
       "type": "integer",
       "description": "Model-supported top_k; see /docs/llm-capabilities.md."
      },
      "top_p": {
       "type": "number",
       "description": "Model-supported top_p; see /docs/llm-capabilities.md."
      },
      "stream": {
       "type": "boolean",
       "description": "Return live OpenAI-compatible SSE after payment settlement."
      },
      "plugins": {
       "type": "array",
       "items": {
        "type": "object",
        "required": [
         "pdf"
        ],
        "properties": {
         "id": {
          "enum": [
           "file-parser"
          ],
          "type": "string"
         },
         "pdf": {
          "type": "object",
          "properties": {
           "engine": {
            "enum": [
             "native"
            ],
            "type": "string"
           }
          }
         }
        }
       },
       "description": "Optional native PDF parser only; automatically enabled for file inputs."
      },
      "messages": {
       "type": "ar
… (truncated)
```

## More

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