Skip to main content

Error codes

StatusMeaningWhat to do
401Invalid API keyCheck your key starts with kyma- or 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

Free tier: 20 requests/minute. Paid tier: 200 req/min. Check your remaining quota:
curl https://kymaapi.com/v1/auth/limits \
  -H "Authorization: Bearer kyma-your-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="kyma-your-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 = ["llama-3.3-70b", "qwen-3-32b", "llama-3.1-8b"]

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