{"uid":"cap_1bDbLjcM9w0q0mkSYqyb1","slug":"openrelay-chat-completions-2c5016b0","name":"OpenRelay Chat Completions","description":"OpenAI-compatible chat completion. $0.10/1M tokens (input+max_tokens). USDC on Solana or Base — no signup, no keys, pay-per-request via x402.","url":"https://openrelay.hggfffdfy687.workers.dev/v1/chat/completions","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"model":{"enum":["deepseek-ai/DeepSeek-V4-Flash-0731","moonshotai/Kimi-K2.6","MiniMaxAI/MiniMax-M2.7"],"type":"string","default":"deepseek-ai/DeepSeek-V4-Flash-0731","description":"Model id. Available: DeepSeek V4 Flash (400k ctx), Kimi K2.6 (240k ctx), MiniMax M2.7 (180k ctx). See GET /v1/models. Default: DeepSeek V4 Flash."},"stream":{"type":"boolean","default":false},"messages":{"type":"array","items":{"type":"object","required":["role","content"],"properties":{"role":{"enum":["system","user","assistant"]},"content":{"type":"string"}}}},"max_tokens":{"type":"integer","default":512,"maximum":16384,"minimum":1},"temperature":{"type":"number","default":1,"maximum":2,"minimum":0}}},"responseSchema":{"type":"json","example":{"id":"chatcmpl-openrelay-abc123","model":"deepseek-ai/DeepSeek-V4-Flash-0731","usage":{"total_tokens":15,"prompt_tokens":12,"completion_tokens":3},"object":"chat.completion","choices":[{"index":0,"message":{"role":"assistant","content":"Hello!"},"finish_reason":"stop"}],"created":1787532386}},"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_wWfIayAvcStYDSKsQ6bjg","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Pay-per-request OpenAI-compatible chat completion via a Cloudflare Worker relay, defaulting to DeepSeek-V4-Flash at $0.10/1M tokens with a $0.01 minimum per request.","exampleAgentPrompt":"Using OpenRelay, send these messages to DeepSeek-V4-Flash-0731 and get a response: system prompt 'You are a helpful assistant', user message 'Summarize the key differences between REST and GraphQL in 3 bullet points' — keep it under 300 tokens and temperature at 0.7.","exampleUseCases":[{"title":"Agentic reasoning step on a budget","prompt":"I need you to call OpenRelay's DeepSeek model with the system message 'You are a reasoning agent' and user message 'Given this list of tasks, which should I prioritize: write report, fix bug, answer emails?' — limit the response to 200 tokens and use temperature 0.5."},{"title":"Customer support draft generation","prompt":"Use OpenRelay to draft a polite reply for a customer who complained their order arrived late — system prompt: 'You are a customer support agent for an e-commerce brand', user message: 'My order was 5 days late and I'm very unhappy', max 150 tokens."},{"title":"Code explanation for developer tool","prompt":"Ask OpenRelay's chat completion endpoint with model deepseek-ai/DeepSeek-V4-Flash-0731 to explain what this Python snippet does: 'for i in range(10): print(i**2)' — use a system prompt of 'You are a senior Python developer' and cap the output at 256 tokens."}],"resultDescription":"Returns a JSON object matching the OpenAI chat.completion format, including the assistant's reply text under choices[0].message.content, token usage breakdown (prompt_tokens, completion_tokens, total_tokens), the model used, finish_reason, and a unique completion ID.","failureModes":["Payment not attached or insufficient (402 Payment Required)","Invalid or unsupported model ID returns an error","messages array missing or malformed (400 Bad Request)","max_tokens exceeds 16384 limit","Temperature outside 0–2 range rejected","Worker timeout for very large completions","Model unavailable or rate-limited upstream from DeepSeek"],"whenToPreferThis":"Choose this endpoint when you need cheap, pay-per-request LLM inference without a subscription, especially in agentic workflows that use the x402 crypto payment protocol and want OpenAI API compatibility. Prefer it over direct OpenAI when cost per token matters most or when USDC micropayments are required. The DeepSeek default model is well-suited for reasoning and instruction-following tasks at a fraction of GPT-4 costs.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T18:37:14.525Z","isFirstParty":false}