SDK Examples
ShareKiteRouter works with OpenAI-compatible SDKs and HTTP clients. Point the client at KiteRouter's base URL and use a KiteRouter API key.
OpenAI SDK
1import os
2from openai import OpenAI
3
4client = OpenAI(
5 base_url="https://kiterouter.com/api/v1",
6 api_key=os.environ["KITEROUTER_API_KEY"],
7)
8
9response = client.chat.completions.create(
10 model="gpt-4o-mini",
11 messages=[{"role": "user", "content": "Explain routing in one sentence."}],
12)
13
14print(response.choices[0].message.content)Fetch / HTTP
1curl https://kiterouter.com/api/v1/chat/completions \ 2 -H "Authorization: Bearer kr-your-api-key" \ 3 -H "Content-Type: application/json" \ 4 -d '{ 5 "model": "gpt-4o-mini", 6 "messages": [{"role": "user", "content": "Hello from cURL."}] 7 }'
Compatible clients
Any client that supports a custom OpenAI-compatible base URL works with KiteRouter:
| Client | Setting |
|---|---|
| OpenAI JavaScript SDK | baseURL: "https://kiterouter.com/api/v1" |
| OpenAI Python SDK | base_url="https://kiterouter.com/api/v1" |
| go-openai | config.BaseURL = "https://kiterouter.com/api/v1" |
| Raw HTTP / cURL | POST https://kiterouter.com/api/v1/chat/completions |
Info: Use KiteRouter model IDs from the Models page. KiteRouter maps them to upstream provider model names.