Documentation
Quickstart
The API is OpenAI-compatible, so any OpenAI SDK works by changing the base URL. Nothing else in your code has to move.
1. Authenticate
Create a key in the dashboard. It is shown once and stored only as a hash, so if you lose it you rotate rather than recover it.
Authorization: Bearer vk_live_...
2. Send a request
curl https://api.vatan.one/v1/chat/completions \
-H "Authorization: Bearer $VATAN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-5",
"messages": [{"role": "user", "content": "Hello"}]
}'3. Stream
Server-sent events, in OpenAI's chunk format, whichever provider is behind the model. A cancelled stream is still billed for what was generated, because the provider bills us for it.
from openai import OpenAI
client = OpenAI(
base_url="https://api.vatan.one/v1",
api_key=os.environ["VATAN_API_KEY"],
)
stream = client.chat.completions.create(
model="openai/gpt-4o",
messages=[{"role": "user", "content": "Hello"}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")Errors
| Status | Code | Meaning |
|---|---|---|
| 401 | invalid_api_key | The key is missing, malformed, revoked or disabled. |
| 402 | insufficient_quota | Not enough credit to cover the request. Top up and retry. |
| 403 | model_unavailable_in_region | The model is not available from the requesting region. |
| 404 | model_not_found | No such model id. Check /v1/models for the current catalogue. |
| 429 | rate_limit_exceeded | Too many requests in flight on this key at once. Retry after a moment. |
Errors use OpenAI's envelope, so an SDK parses them with the same code path it already uses. A different shape would turn a clean 402 into an unhandled exception.