Chat completions
POST /<lane>/v1/chat/completions — the OpenAI Chat Completions wire protocol.
Used by Cursor, Cline/Roo, OpenCode (openai-compatible), and the OpenAI SDK.
Request
Section titled “Request”curl "https://api.opengateway.one/oss/v1/chat/completions" \ -H "Authorization: Bearer $OPENGATEWAY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-turbo-hub-qwen3-coder", "messages": [ { "role": "system", "content": "You are a precise coding assistant." }, { "role": "user", "content": "Write a TypeScript debounce helper." } ], "reasoning_effort": "medium" }'Response
Section titled “Response”{ "id": "chatcmpl-...", "object": "chat.completion", "model": "claude-turbo-hub-qwen3-coder", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "export function debounce..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 24, "completion_tokens": 88, "total_tokens": 112 }}Streaming
Section titled “Streaming”Set stream: true to receive chat.completion.chunk SSE events.
const stream = await client.chat.completions.create({ model: 'claude-turbo-hub-qwen3-coder', messages: [{ role: 'user', content: 'Stream a haiku about the edge.' }], stream: true,});for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? '');}stream = client.chat.completions.create( model="claude-turbo-hub-qwen3-coder", messages=[{"role": "user", "content": "Stream a haiku about the edge."}], stream=True,)for chunk in stream: print(chunk.choices[0].delta.content or "", end="")reasoning_effortacceptsnone|minimal|low|medium|high|xhigh— see Effort levels.- Tool calls (
tools/tool_calls) are passed through and preserved across streaming. - On
/hf, use anyorg/model[:policy]id; on/oss, use a curated alias.
OpenGateway Guide
Ask about configuring OpenGateway — lanes, base URLs, client setup, model choice, or an error you hit. Answers are grounded in the docs.