{"uid":"cap_zJat0ebrHoX1hMh6mryuA","slug":"llm402-ai-chat-completions-e1aae106","name":"llm402.ai Chat Completions","description":"LLM inference","url":"https://llm402.ai/v1/chat/completions","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"model":{"type":"string","description":"Model ID or \"auto\" for autorouting across frontier LLMs."},"top_k":{"type":"integer","minimum":1},"top_p":{"type":"number","maximum":1,"minimum":0},"stream":{"type":"boolean","default":false},"messages":{"type":"array","items":{"type":"object","required":["role","content"],"properties":{"role":{"enum":["system","user","assistant","tool"],"type":"string"},"content":{"type":"string"}}},"minItems":1},"max_tokens":{"type":"integer","minimum":1,"description":"Cap on generated tokens. Price scales with this cap."},"temperature":{"type":"number","maximum":2,"minimum":0}}},"responseSchema":null,"example":{"request":{"model":"gpt-3.5-turbo","messages":[{"role":"user","content":"What is artificial intelligence?"}],"max_tokens":150,"temperature":0.7},"response":{"id":"chatcmpl-z2DHhPJl-Iz4LA_T","model":"openai/gpt-3.5-turbo","usage":{"total_tokens":105,"prompt_tokens":12,"completion_tokens":93},"object":"chat.completion","choices":[{"index":0,"message":{"role":"assistant","content":"Artificial intelligence (AI) is a branch of computer science that focuses on creating machines and systems that can perform tasks that typically require human intelligence, such as visual perception, speech recognition, decision-making, and language translation. AI algorithms can analyze data, learn from and adapt to new information, and make decisions or predictions based on that data. AI is used in a wide range of applications, including virtual assistants, self-driving cars, medical diagnosis, and financial trading."},"finish_reason":"stop"}],"created":1780115407}},"exampleRequest":{"model":"gpt-3.5-turbo","messages":[{"role":"user","content":"What is artificial intelligence?"}],"max_tokens":150,"temperature":0.7},"tags":["x402"],"displayCostAmount":"0.001","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"settled","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"down","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.009012","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.009012","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_rZDKGTRmzZ2lfLpvHO1yw","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.009012","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Run LLM chat completions via an OpenAI-compatible API endpoint, paid per-call via x402 micropayment protocol","exampleAgentPrompt":"Ask the LLM 'What are three creative uses for blockchain technology?' using the gpt-3.5-turbo model, with a max of 200 tokens and a temperature of 0.7.","exampleUseCases":[{"title":"Agent reasoning step via LLM","prompt":"Send this reasoning prompt to the gpt-3.5-turbo model and return its reply: 'You are a helpful planning assistant. Given a user wants to plan a trip to Tokyo for 5 days, what are the most important things to arrange first?' Keep the response under 300 tokens."},{"title":"Customer FAQ auto-responder","prompt":"Use the LLM to answer this customer support question: 'How do I reset my password?' — use gpt-3.5-turbo, set temperature to 0.3 for a factual tone, and limit the reply to 150 tokens."},{"title":"Creative writing prompt completion","prompt":"Generate a short story opening using gpt-3.5-turbo: prompt it with 'Write the first paragraph of a mystery novel set in 1920s Paris' at temperature 0.9 and max 200 tokens."}],"resultDescription":"Returns an OpenAI-compatible chat.completion object containing the assistant's generated message text, the model used, token usage breakdown (prompt, completion, total), a unique completion ID, finish reason, and creation timestamp.","failureModes":["Invalid or unsupported model name returns an error response","Exceeding max_tokens silently truncates output with finish_reason 'length'","Malformed messages array causes a 400-level error","Payment failure via x402 protocol blocks the request","Rate limits or upstream OpenAI API errors propagate as 5xx errors","Missing required fields (model, messages) result in validation errors"],"whenToPreferThis":"Choose this endpoint when you need OpenAI-compatible LLM chat completions with pay-per-call micropayment billing via the x402 protocol, avoiding subscription commitments. Ideal for AI agents that need on-demand LLM inference without managing API keys or monthly plans, especially in agentic marketplaces where per-call USDC payments are native.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T18:26:51.115Z","isFirstParty":false}