{"uid":"cap_fFxjNwZ_9GOtDQISGlWmD","slug":"x402-gateway-production-up-railway-app-06b69221","name":"Claude Opus via x402 Gateway","description":"Anthropic's most powerful model — best for complex analysis, coding, and extended thinking","url":"https://x402-gateway-production.up.railway.app/api/llm/claude-opus?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"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":"array","items":{"type":"object","anyOf":[{"required":["content"]},{"required":["tool_calls"]}],"required":["role"],"properties":{"name":{"type":"string"},"role":{"enum":["system","developer","user","assistant","tool"],"type":"string"},"content":{"oneOf":[{"type":"string"},{"type":"null"},{"type":"array","items":{"type":"object","required":["type"],"properties":{"type":{"enum":["text","image_url","file"],"type":"string"}},"additionalProperties":true},"maxItems":100,"minItems":1}]},"refusal":{"type":["string","null"]},"reasoning":{"type":"string"},"tool_calls":{"type":"array","items":{"type":"object"}},"annotations":{"type":"array","items":{"type":"object"}},"tool_call_id":{"type":"string"},"cache_control":{"type":"object"},"reasoning_details":{"type":"array","items":{"type":"object"}}},"additionalProperties":false},"maxItems":100,"minItems":1,"description":"Text or model-supported multimodal messages; assistant tool calls may have null content"},"reasoning":{"type":"object","description":"Model-supported reasoning; see /docs/llm-capabilities.md."},"verbosity":{"type":"string","description":"Model-supported verbosity; see /docs/llm-capabilities.md."},"max_tokens":{"type":"integer","example":1024,"description":"Total output budget, including reasoning. Use this or max_completion_tokens."},"temperature":{"type":"number","description":"Model-supported temperature; see /docs/llm-capabilities.md."},"tool_choice":{"oneOf":[{"enum":["auto","none","required"],"type":"string"},{"type":"object"}],"description":"Model-supported tool_choice; see /docs/llm-capabilities.md."},"stream_options":{"type":"object","description":"Optional include_usage boolean; usage is always requested upstream."},"response_format":{"type":"object","description":"Model-supported response_format; see /docs/llm-capabilities.md."},"reasoning_effort":{"type":"string","description":"Model-supported reasoning_effort; see /docs/llm-capabilities.md."},"include_reasoning":{"type":"boolean","description":"Model-supported include_reasoning; see /docs/llm-capabilities.md."},"max_completion_tokens":{"type":"integer","description":"Alias for total output budget; bounded by model maxOutputTokens."}},"additionalProperties":false},"type":{"type":"string","const":"http"},"method":{"enum":["POST"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","required":["choices","content"],"properties":{"model":{"type":"string"},"usage":{"type":"object","description":"Provider token and usage accounting, when returned."},"choices":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"message":{"type":"object","properties":{"role":{"type":"string"},"content":{"type":["string","null"]},"tool_calls":{"type":"array","items":{"type":"object"}}}},"finish_reason":{"type":["string","null"]}}}},"content":{"type":"string","description":"Convenience copy of the first assistant message's text."}}}}}}},"responseSchema":null,"example":{"request":{"messages":[{"role":"user","content":"Explain the concept of recursion in programming with a simple example."}]},"response":{"model":"anthropic/claude-4.6-opus-20260205","usage":{"cost":0.015755,"is_byok":false,"cost_details":{"upstream_inference_cost":0.015755,"upstream_inference_prompt_cost":0.000105,"upstream_inference_completions_cost":0.01565},"total_tokens":647,"prompt_tokens":21,"completion_tokens":626,"prompt_tokens_details":{"audio_tokens":0,"video_tokens":0,"cached_tokens":0,"cache_write_tokens":0},"completion_tokens_details":{"audio_tokens":0,"image_tokens":0,"reasoning_tokens":0}},"content":"# Recursion in Programming\n\n## What is Recursion?\n\n**Recursion** is a technique where a function **calls itself** to solve a problem by breaking it down into smaller, simpler sub-problems. It continues until it reaches a **base case** — a condition that stops the recursion.\n\n## Two Essential Components\n\n1. **Base Case** — The stopping condition (prevents infinite loops)\n2. **Recursive Case** — The function calling itself with a *simpler* version of the problem\n\n---\n\n## Simple Example: Factorial\n\nThe factorial of a number (e.g., `5! = 5 × 4 × 3 × 2 × 1 = 120`)\n\n```python\ndef factorial(n):\n    # Base case: stop when n is 0 or 1\n    if n <= 1:\n        return 1\n\n    # Recursive case: n * factorial of (n-1)\n    return n * factorial(n - 1)\n\nprint(factorial(5))  # Output: 120\n```\n\n## How It Works (Step by Step)\n\n```\nfactorial(5)\n│\n├── 5 * factorial(4)\n│       ├── 4 * factorial(3)\n│       │       ├── 3 * factorial(2)\n│       │       │       ├── 2 * factorial(1)\n│       │       │       │       └── returns 1  ← BASE CASE\n│       │       │       └── returns 2 * 1 = 2\n│       │       └── returns 3 * 2 = 6\n│       └── returns 4 * 6 = 24\n└── returns 5 * 24 = 120\n```\n\n## Analogy\n\nThink of **Russian nesting dolls** 🪆 — you keep opening a smaller doll inside until you reach the tiniest one (the base case), then you put them all back together.\n\n---\n\n## Key Warnings\n\n| Issue | Description |\n|-------|-------------|\n| **Missing base case** | Causes infinite recursion → **stack overflow** |\n| **Deep recursion** | Too many calls can exceed memory (call stack limit) |\n| **Performance** | Can be slower than loops without optimization (e.g., memoization) |\n\n## When to Use Recursion\n\n- **Tree/graph traversal** (file systems, DOM)\n- **Divide and conquer** algorithms (merge sort, quicksort)\n- Problems with **naturally recursive structure** (Fibonacci, fractals)\n\n> **Rule of thumb:** If a problem can be defined in terms of a *smaller version of itself*, recursion is a natural fit."}},"exampleRequest":{"messages":[{"role":"user","content":"Explain the concept of recursion in programming with a simple example."}]},"tags":["x402"],"displayCostAmount":"0.090000","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"settled","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"1.00","reviews":0,"stars":null,"state":"rated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.090000/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.09","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.09","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_97bjzLGJzPXZ6jtFcCO7m","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.09","costPer":"request","priority":0,"asset":null,"unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Runs a prompt through Anthropic's Claude Opus (most powerful model) and returns a high-quality completion, billed per-call via x402 micropayment","exampleAgentPrompt":"Ask Claude Opus to analyze the trade-offs between microservices and monolithic architectures for a fintech startup handling high transaction volumes — I need a thorough, nuanced breakdown with specific recommendations.","exampleUseCases":null,"resultDescription":"Returns a JSON object containing the model's text completion, the model version used (e.g. anthropic/claude-4.6-opus), and detailed usage stats including total tokens, prompt tokens, completion tokens, and itemized cost breakdown in USD. The main answer is in the 'content' field.","failureModes":["Insufficient USDC balance or failed x402 payment — HTTP 402 with payment required error","Prompt exceeds context window limit — HTTP 400 with token count error","Upstream Anthropic API unavailable — HTTP 502 or 503 from gateway","Malformed messages array — HTTP 400 with schema validation error","Rate limiting on gateway — HTTP 429 with retry-after header"],"whenToPreferThis":"Choose this endpoint when the task demands maximum reasoning depth, extended thinking, nuanced analysis, or complex multi-step coding — situations where cheaper/faster models fall short. Prefer Claude Opus over Claude Sonnet or Haiku siblings when quality matters more than cost or latency. Use when the user explicitly requests the most powerful Claude model or when prior attempts with lighter models produced unsatisfactory results.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":15,"lastUsedAt":"2026-04-19T16:43:04.605Z","lastSuccessfullyRanAt":"2026-04-19T16:43:04.605Z","lastHealthCheckAt":"2026-10-30T12:30:54.696Z","isFirstParty":false,"canonicalSlug":"x402-gateway-production-up-railway-app-06b69221"}