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 key
SDK base_url
https://api.keyvia.cc/v1

Include /v1

Chat Completions
POST https://api.keyvia.cc/v1/chat/completions
Responses
POST https://api.keyvia.cc/v1/responses
Model list
GET https://api.keyvia.cc/v1/models

Use 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
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" }]
  }'
Python · pip install openai
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)
Node.js · npm install openai
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
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" }'
Python
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.

Python
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.

KeyVia Logo
KeyVia

One API for full-power Claude, GPT, Gemini and other leading AI models at ultra-low prices.

© 2026 KeyVia. All rights reserved.