{"uid":"cap_VyofPvR-8XLctoqgrRLoP","slug":"chat-completions-api-llama-3-1-8b-x402-367aa44c","name":"Chat Completions API (Llama 3.1 8B, x402)","description":"Exact EVM address, calldata, Uniswap V2/V3 and impermanent-loss math. Pay per call in USDC on Base via x402.","url":"https://golf-evm-math.x402-evm-math.workers.dev/v1/chat/completions?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","method","bodyType","body"],"properties":{"body":{"properties":{}},"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"}}}}},"responseSchema":{"type":"json","example":{"usage":{},"choices":[{"message":{"role":"assistant","content":"Hi there, friend!"}}]}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_4PQ7sRzAS_799AhocS-i9","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"OpenAI-compatible chat completions endpoint running Llama 3.1 8B inference, billed per-call in USDC via x402 with no API key required.","exampleAgentPrompt":"Ask the Llama 3.1 8B model this question: 'What are three concise tips for writing better Python code?' — use the cheap pay-per-call inference endpoint, no API key needed.","exampleUseCases":[{"title":"Agent sub-task cheap text generation","prompt":"I need you to use a cheap LLM to summarize this paragraph in one sentence: 'Cloudflare Workers allow serverless code execution at the edge, reducing latency for global users by running computations close to the end user rather than in a centralized data center.'"},{"title":"Classify customer feedback at low cost","prompt":"Classify the sentiment of this customer review as positive, negative, or neutral using the cheap Llama 3.1 inference endpoint: 'The product arrived on time but the packaging was damaged and the manual was missing.'"},{"title":"Draft a short email reply","prompt":"Use the Llama 3.1 8B model to draft a polite two-sentence reply to this email: 'Hi, I wanted to follow up on my refund request from last week — any updates?'"}],"resultDescription":"Returns a JSON object with a 'choices' array containing the assistant's reply message (role and content), plus a 'usage' object with token counts. No streaming — the full response is returned in one payload.","failureModes":["Payment failure via x402 if USDC balance is insufficient or the x402 header is malformed","Malformed request body (missing required 'messages' field) returns a 4xx error","Model context length exceeded for very long conversation histories","Cloudflare Worker timeout for unusually complex prompts","No streaming support — clients expecting SSE will not receive incremental tokens"],"whenToPreferThis":"Choose this endpoint when you need cheap, keyless LLM inference at $0.001/call and can accept Llama 3.1 8B quality output. Ideal for agent pipelines where sub-tasks need text generation at scale without managing API keys or subscriptions. Prefer over OpenAI or Anthropic APIs when cost minimization and pay-per-call micropayment (x402/USDC) billing are priorities, and when streaming is not required.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-31T00:30:27.017Z","isFirstParty":false,"canonicalSlug":"chat-completions-api-llama-3-1-8b-x402-367aa44c"}