{"uid":"cap_ms2cazCJbX78g8qU72-JQ","slug":"openai-compatible-flat-rate-chat-completions-a992f912","name":"OpenAI-Compatible Flat-Rate Chat Completions","description":"Chat completions with the exact request and response shape of the OpenAI API: point your existing client at this URL and it works, no code change. One flat price per call whatever the size of the prompt or the answer — no token metering, no API key, no account, no rate limit. Automatic failover across several large models, so a model being down is not your problem. You are only charged if the completion is delivered.","url":"https://flat-rate-llm.kikoribera03.workers.dev/v1/chat/completions?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":[],"properties":{"model":{"type":"string","description":"Ignored on purpose: the service picks the model and fails over between several. Accepted so an OpenAI client can send it unchanged."},"prompt":{"type":"string","description":"Shortcut for a single user message, if you do not want to build the array."},"messages":{"type":"string","description":"The conversation, as in the OpenAI API: [{\"role\":\"system|user|assistant\",\"content\":\"...\"}]. In a POST, send it as a real JSON array, exactly as an OpenAI client does; in a GET, pass that same JSON as text in the query string. Both are accepted."},"max_tokens":{"type":"number","description":"Output token cap, up to 4000. Does not change the price."},"temperature":{"type":"number","description":"Passed through to the model when given."}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object"}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.005","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.005/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_LIFxa0P7gVnlyTRvHPBul","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.005","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Delivers LLM chat completions using the OpenAI API request/response format at a fixed per-call price with no token metering, no API key, and automatic model failover.","exampleAgentPrompt":"Can you ask an LLM to write a short cover letter for a software engineering role? Use a flat-rate call — one fixed price, no token counting — and set max_tokens to 300 with a temperature of 0.7.","exampleUseCases":[{"title":"Automated customer support draft generation","prompt":"For this incoming support ticket — 'My order hasn't arrived after two weeks, what should I do?' — generate a polite, helpful draft reply an agent can send, keeping it under 150 words. Use the flat-rate chat endpoint so we pay the same regardless of how long the response is."},{"title":"Coding assistant inside a dev workflow","prompt":"I'm building a script and I'm stuck — can you ask the LLM to explain what's wrong with this Python function and suggest a fix? Here's the code: `def add(a, b): return a - b`. Cap the response at 200 tokens."},{"title":"Multi-turn conversation with budget predictability","prompt":"I need to run a 3-turn conversation with an AI tutor explaining the basics of photosynthesis for a middle schooler — use the flat-rate LLM so I know exactly what each call costs, and keep temperature at 0.5 for consistent answers."}],"resultDescription":"Returns an OpenAI-format chat completion object containing the assistant's message, finish reason, and model metadata — identical in shape to an OpenAI /v1/chat/completions response, so existing OpenAI SDK clients can consume it without modification.","failureModes":["Model backend unavailable despite failover (returns error after all models exhausted)","Payment not confirmed — completion not delivered, charge not incurred","Malformed messages JSON in query string (parse error returned)","max_tokens exceeds 4000 cap (clamped or rejected)","Network timeout on the Cloudflare Worker side"],"whenToPreferThis":"Choose this endpoint when you need OpenAI-compatible chat completions with perfectly predictable per-call pricing — ideal for agents that make many short or variable-length calls and want to avoid token-metering surprises. Also ideal when you have an existing OpenAI client and want zero code changes, or when uptime matters and you want automatic multi-model failover without managing it yourself. Less suitable for very high-volume batch workloads where per-token pricing would be cheaper than per-call.","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":"openai-compatible-flat-rate-chat-completions-a992f912"}