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

StatusCodeMeaning
401invalid_api_keyThe key is missing, malformed, revoked or disabled.
402insufficient_quotaNot enough credit to cover the request. Top up and retry.
403model_unavailable_in_regionThe model is not available from the requesting region.
404model_not_foundNo such model id. Check /v1/models for the current catalogue.
429rate_limit_exceededToo 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.