{"uid":"cap_4_S42ctiWPHxhO20n99qw","slug":"true402-chat-completions-api-0f403fec","name":"true402 Chat Completions API","description":"The machine-native marketplace. Wallet = identity. Pay per call with HTTP 402.","url":"https://true402.dev/api/v1/chat/completions","method":"POST","headers":{},"bodySchema":{"type":"object","required":["model","messages"],"properties":{"n":{"type":"integer"},"stop":{"type":"string"},"user":{"type":"string"},"model":{"type":"string","description":"Model identifier from /v1/models"},"top_p":{"type":"number"},"stream":{"type":"boolean"},"messages":{"type":"array"},"max_tokens":{"type":"integer"},"temperature":{"type":"number"},"presence_penalty":{"type":"number"},"frequency_penalty":{"type":"number"}}},"responseSchema":{"type":"object","required":["id","object","created","model","choices","usage"],"properties":{"id":{"type":"string"},"model":{"type":"string"},"usage":{"type":"object","required":["prompt_tokens","completion_tokens","total_tokens"],"properties":{"total_tokens":{"type":"integer"},"prompt_tokens":{"type":"integer"},"completion_tokens":{"type":"integer"}}},"object":{"enum":["chat.completion"],"type":"string"},"choices":{"type":"array","items":{"type":"object","required":["index","message","finish_reason"],"properties":{"index":{"type":"integer"},"message":{"type":"object","required":["role","content"],"properties":{"name":{"type":"string"},"role":{"enum":["system","user","assistant","tool"],"type":"string"},"content":{"type":["string","null"]},"tool_call_id":{"type":"string"}}},"finish_reason":{"enum":["stop","length","tool_calls","content_filter",null],"type":["string","null"]}}}},"created":{"type":"integer"}}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002539","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":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.002539/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.0001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.0001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_mBKENAUcKqHc6khTDPrvH","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.0001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Provides OpenAI-compatible chat completions via a machine-native, pay-per-call HTTP 402 marketplace using a crypto wallet as identity.","exampleAgentPrompt":"Use gpt-4o on true402 to answer this question in a single assistant message: 'What are the three most important principles of machine learning?' — keep it under 300 tokens and temperature at 0.7.","exampleUseCases":[{"title":"Autonomous agent reasoning with crypto micropayments","prompt":"Have my agent think through this complex problem using Claude via true402: 'How should a decentralized autonomous organization allocate resources across competing initiatives?' I want it to use temperature 0.8 for creative reasoning and keep the response under 500 tokens — pay with my wallet for just this call."},{"title":"Multi-model comparison without subscriptions","prompt":"Run the same technical question through both GPT-4o and Gemini 2.0 Flash on true402 to compare their answers: 'What are the current limitations of transformer-based language models?' Use my crypto wallet to pay per call, and give me each response separately."},{"title":"Real-time agent response generation with USDC billing","prompt":"When users ask my chatbot questions, have it generate responses using true402's pay-per-call system — route complex queries to Claude 3.5 Sonnet and quick factual questions to Gemini, billing my USDC wallet for each inference without needing traditional API keys or monthly subscriptions."}],"resultDescription":"Returns an OpenAI-compatible chat completion object containing the assistant's generated message, finish reason, and token usage counts (prompt tokens, completion tokens, total tokens). Streaming is optionally supported.","failureModes":["HTTP 402 Payment Required if wallet has insufficient USDC balance or payment is not attached","Invalid model identifier returns 400 with model not found error","Messages array empty or malformed returns 400 validation error","max_tokens exceeds model context window returns 400","Rate limiting or quota exceeded returns 429","Model provider outage returns 503 or upstream error"],"whenToPreferThis":"Choose this endpoint when building autonomous AI agents that need LLM chat completions with per-call crypto micropayments (USDC via HTTP 402), no traditional API key or subscription required, wallet-as-identity authentication, and access to multiple frontier models (GPT-4o, Claude, Gemini) through one OpenAI-compatible interface.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-13T12:46:11.273Z","isFirstParty":false}