{"uid":"cap_wHleA_oGJQoAmnJGqwRtQ","slug":"x402-gateway-production-up-railway-app-2269cf55","name":"Claude Sonnet 4.6 via x402 Gateway","description":"Anthropic's latest balanced model — excellent coding, reasoning, and creative writing","url":"https://x402-gateway-production.up.railway.app/api/llm/claude-sonnet-4.6?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":{"model":"claude-sonnet-4.6","messages":[{"role":"user","content":"Write a Python function that validates email addresses using regex and returns True if valid, False otherwise. Include docstring and basic test cases."}],"max_tokens":1024},"response":{"model":"anthropic/claude-4.6-sonnet-20260217","usage":{"cost":0.015462,"is_byok":false,"cost_details":{"upstream_inference_cost":0.015462,"upstream_inference_prompt_cost":0.000102,"upstream_inference_completions_cost":0.01536},"total_tokens":1058,"prompt_tokens":34,"completion_tokens":1024,"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":"# Email Address Validator\n\n## Implementation\n\n```python\nimport re\n\n\ndef validate_email(email: str) -> bool:\n    \"\"\"\n    Validate an email address using regex.\n\n    An email is considered valid if it follows the standard format:\n    - Local part: alphanumeric characters, dots, underscores, plus signs, hyphens\n    - @ symbol (required, exactly one)\n    - Domain: alphanumeric characters and hyphens\n    - At least one dot in the domain part\n    - TLD: 2-7 alphabetic characters (e.g., .com, .org, .museum)\n\n    Args:\n        email (str): The email address to validate.\n\n    Returns:\n        bool: True if the email is valid, False otherwise.\n\n    Examples:\n        >>> validate_email(\"user@example.com\")\n        True\n        >>> validate_email(\"invalid-email\")\n        False\n        >>> validate_email(\"\")\n        False\n    \"\"\"\n    if not isinstance(email, str) or not email:\n        return False\n\n    pattern = r'^[a-zA-Z0-9][a-zA-Z0-9._%+\\-]*@[a-zA-Z0-9\\-]+(\\.[a-zA-Z0-9\\-]+)*\\.[a-zA-Z]{2,7}$'\n\n    return bool(re.match(pattern, email))\n\n\ndef run_tests() -> None:\n    \"\"\"Run test cases to verify the validate_email function.\"\"\"\n\n    test_cases = [\n        # (email, expected_result, description)\n\n        # ✅ Valid emails\n        (\"user@example.com\",           True,  \"Standard email\"),\n        (\"user.name@example.com\",      True,  \"Dot in local part\"),\n        (\"user+tag@example.com\",       True,  \"Plus sign in local part\"),\n        (\"user_name@example.com\",      True,  \"Underscore in local part\"),\n        (\"user123@example.com\",        True,  \"Numbers in local part\"),\n        (\"user@sub.example.com\",       True,  \"Subdomain\"),\n        (\"user@example.co.uk\",         True,  \"Country-code TLD\"),\n        (\"user@example.museum\",        True,  \"Long TLD\"),\n        (\"user-name@example.com\",      True,  \"Hyphen in local part\"),\n        (\"123user@example.com\",        True,  \"Starts with number\"),\n        (\"USER@EXAMPLE.COM\",           True,  \"All uppercase\"),\n        (\"user@my-domain.com\",         True,  \"Hyphen in domain\"),\n\n        # ❌ Invalid emails\n        (\"\",                           False, \"Empty string\"),\n        (\"plainaddress\",               False, \"No @ symbol\"),\n        (\"@missinglocal.com\",          False, \"Missing local part\"),\n        (\"user@\",                      False, \"Missing domain\"),\n        (\"user@.com\",                  False, \"Domain starts with dot\"),\n        (\"user@com\",                   False, \"No dot in domain\"),\n        (\"user@@example.com\",          False, \"Double @ symbol\"),\n        (\"user @example.com\",          False, \"Space in email\"),\n        (\"user@example..com\",          False, \"Double dot in domain\"),\n        (\"user@example.c\",             False, \"TLD too short (1 char)\"),\n        (\"user@example.toolongtld\",    False, \"TLD too long (>7 chars)\"),\n        (\".user@example.com\",          False, \"Starts with dot\"),\n        (\"user@-example.com\",          False, \"Domain starts with hyphen\"),\n        (None,                         False, \"None input\"),\n        (12345,                        False, \"Integer input\"),\n    ]\n\n    passed = 0\n    failed = 0\n\n    print(\"=\" * 65)\n    print(f\"{'EMAIL VALIDATION TEST RESULTS':^65}\")\n    print(\"=\" * 65)\n    print(f\"{'Email':<35} {'Expected':<10} {'Got':<10} {'Status'}\")\n    print(\"-\" * 65)\n\n    for email, expected, description in test_cases:\n        result = validate_email(email)\n        status = \"✅ PASS\" if result == expected else \"❌"}},"exampleRequest":{"model":"claude-sonnet-4.6","messages":[{"role":"user","content":"Write a Python function that validates email addresses using regex and returns True if valid, False otherwise. Include docstring and basic test cases."}],"max_tokens":1024},"tags":["x402"],"displayCostAmount":"0.060000","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"settled","requiresHandshake":false,"reviewCount":2,"rating":{"score":"0.50","successRate":"0.71","reviews":2,"stars":"3.0","state":"rated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.060000/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.06","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.06","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_Jh-kp3tLORR_mdsqrRv3V","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.06","costPer":"request","priority":0,"asset":null,"unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Calls Anthropic's Claude Sonnet 4.6 model for balanced high-quality coding, reasoning, and creative writing tasks via a pay-per-call x402 gateway","exampleAgentPrompt":"Write me a Python function that parses a JSON file and returns a summary of its top-level keys and value types — use Claude Sonnet for this since it's great at coding tasks.","exampleUseCases":null,"resultDescription":"A generated text response from Claude Sonnet 4.6 containing the model's answer, code, analysis, or creative output based on the input prompt, billed at $0.06 USDC per call via x402 protocol.","failureModes":["Payment not processed — x402 payment required before response is returned","Invalid or malformed prompt payload — returns 400 error","Model overload or upstream Anthropic API error — returns 503 or timeout","Insufficient USDC balance — payment failure blocks the call","Rate limiting from gateway — returns 429 if usage quota exceeded"],"whenToPreferThis":"Choose this endpoint when you need Anthropic's Claude Sonnet 4.6 specifically — Anthropic's balanced model known for strong coding, reasoning, and creative writing — and want pay-per-call pricing via x402 without a direct Anthropic API subscription. Prefer over Claude Opus when cost efficiency matters and over lighter models when task complexity demands strong reasoning. Prefer over GPT-4o or Gemini Flash when Claude's particular strengths in nuanced coding or extended reasoning are desired.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":42,"lastUsedAt":"2026-06-27T20:16:34.094Z","lastSuccessfullyRanAt":"2026-06-20T18:45:44.673Z","lastHealthCheckAt":"2026-12-02T00:36:23.842Z","isFirstParty":false,"canonicalSlug":"x402-gateway-production-up-railway-app-2269cf55"}