Guides

SDKs & examples

KeyC speaks the OpenAI Chat Completions API (and Anthropic Messages). Keep your existing SDKs — only the base URL and key change.

openai (Python)
from openai import OpenAI

client = OpenAI(
    api_key="kc-your-virtual-key",
    base_url="https://api.keyc.ai/v1",
)

resp = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Hello"}],
)

Streaming

Pass stream: true exactly as you would with the provider. Tokens are metered from the stream; you do not need a separate usage endpoint for basic billing.

Base URLs

Provider styleBase URL
OpenAI-compatiblehttps://api.keyc.ai/v1
Anthropic SDKhttps://api.keyc.ai

Authorization

Send the virtual key as Authorization: Bearer kc-… (OpenAI SDK) or the SDK's api_key field — same as a normal provider key.