Skip to content

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.

Terminal window
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"
}'
{
"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 }
}

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 ?? '');
}
  • reasoning_effort accepts none|minimal|low|medium|high|xhigh — see Effort levels.
  • Tool calls (tools/tool_calls) are passed through and preserved across streaming.
  • On /hf, use any org/model[:policy] id; on /oss, use a curated alias.