Other Clients & Protocols
OpenAI compatible
Chat Completions and Responses endpoints, for the OpenAI SDK and any OpenAI-compatible client.
For the official OpenAI SDK and OpenAI-compatible clients. The key’s group must support OpenAI. Other vendors’ models, including Claude, can use this protocol where supported.
Endpoint and authentication
YOUR_API_KEY in the examples is a placeholder and will not work as copied. Sign in to pick one of your keys and fill it into every example on this page.
Sign in to fill in keyhttps://api.keyvia.cc/v1Include /v1
POST https://api.keyvia.cc/v1/chat/completionsPOST https://api.keyvia.cc/v1/responsesGET https://api.keyvia.cc/v1/modelsUse the authentication header Authorization: Bearer YOUR_API_KEY. The example model comes from the catalog; replace it with another available model if needed.
Chat Completions
Send messages. The reply is in choices[0].message.content.
curl https://api.keyvia.cc/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5",
"messages": [{ "role": "user", "content": "Reply only: Hello" }]
}'from openai import OpenAI
client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.keyvia.cc/v1")
resp = client.chat.completions.create(
model="gpt-5",
messages=[{"role": "user", "content": "Reply only: Hello"}],
)
print(resp.choices[0].message.content)import OpenAI from 'openai'
const client = new OpenAI({ apiKey: 'YOUR_API_KEY', baseURL: 'https://api.keyvia.cc/v1' })
const resp = await client.chat.completions.create({
model: 'gpt-5',
messages: [{ role: 'user', content: 'Reply only: Hello' }],
})
console.log(resp.choices[0].message.content)Responses
This is the protocol used by Codex. Send input. The reply is in output entries with type output_text. The SDK provides output_text convenience property.
curl https://api.keyvia.cc/v1/responses \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "model": "gpt-5", "input": "Reply only: Hello" }'from openai import OpenAI
client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.keyvia.cc/v1")
resp = client.responses.create(model="gpt-5", input="Reply only: Hello")
print(resp.output_text)Streaming
Add this to the request body: "stream": true to receive SSE events in the upstream format. In the SDK, set stream=True and iterate over the chunks.
from openai import OpenAI
client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.keyvia.cc/v1")
stream = client.chat.completions.create(
model="gpt-5",
messages=[{"role": "user", "content": "Introduce yourself in one sentence"}],
stream=True,
)
for chunk in stream:
delta = chunk.choices[0].delta.content
if delta:
print(delta, end="", flush=True)See available models in the Model catalog. Models and parameters depend on the gateway’s supported routes. For failures, see Error codes.