Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.kymaapi.com/llms.txt

Use this file to discover all available pages before exploring further.

Error codes

StatusMeaningWhat to do
401Invalid API keyCheck your key starts with ky-
404Model not foundCheck model ID with GET /v1/models
429Rate limit exceededWait until midnight UTC or reduce requests
500Provider errorRetry or try a different model

Rate limits

Rate limits are tier-based: Tier 0 = 30 RPM, Tier 1 = 60 RPM, up to Tier 4 = 300 RPM. See Rate Limits for details. Check your remaining quota:
curl https://kymaapi.com/v1/auth/limits \
  -H "Authorization: Bearer ky-your-api-key"
Response:
{
  "rpm_limit": 200,
  "used_today": 15,
  "remaining": 85,
  "resets_at": "2026-04-06T00:00:00.000Z"
}

Python error handling

from openai import OpenAI, APIError, RateLimitError, AuthenticationError

client = OpenAI(base_url="https://kymaapi.com/v1", api_key="ky-your-api-key")

try:
    response = client.chat.completions.create(
        model="llama-3.3-70b",
        messages=[{"role": "user", "content": "Hello"}]
    )
except AuthenticationError:
    print("Invalid API key")
except RateLimitError:
    print("Daily limit reached. Try again tomorrow.")
except APIError as e:
    print(f"API error: {e.message}")

Retry with fallback model

models = ["qwen-3.6-plus", "qwen-3-32b", "llama-3.3-70b"]

for model in models:
    try:
        response = client.chat.completions.create(
            model=model,
            messages=[{"role": "user", "content": "Hello"}]
        )
        print(f"Success with {model}")
        break
    except Exception:
        continue