Skip to main content
Kaer APIv1

OpenAI SDKsStart


Chat completions and the model list speak the OpenAI wire format, so you can keep the OpenAI SDK you already use. Point it at https://api.kaer.ai/v1 and give it your Kaer key.

# Tools built on the OpenAI SDKs read these variables.
export OPENAI_BASE_URL="https://api.kaer.ai/v1"
export OPENAI_API_KEY="$KAER_API_KEY"

Check what is supported

SDK callStatus
chat.completions.createSupported, including stream and function tools
models.listSupported. No key needed, but the SDKs want one set.
models.retrieveNot available (404 unknown_endpoint). Use the list.
Embeddings, image generation, audio, files, responses, assistantsNot available (404 unknown_endpoint)

Know which parameters are forwarded

The gateway forwards model, messages, max_tokens (or max_completion_tokens), temperature, top_p, tools and stream. Other fields, such as stop, tool_choice, response_format, n, seed, logprobs, presence_penalty, frequency_penalty, user and stream_options, are accepted and ignored. Usage is always reported, so stream_options is not needed.

Message content must be text: a string, or an array of text parts. Image, audio and file parts are refused with 400.

Read the cost and handle errors

The cost comes back in a kaer object. In Python it is a plain dict (response.kaer["cost_usd"]); in Node, response.kaer.cost_usd.

Errors are OpenAI-shaped, so the SDKs raise their usual exceptions: AuthenticationError (401), PermissionDeniedError (403), NotFoundError (404) and RateLimitError (429); a 402 is a generic status error (APIStatusError in Python, APIError in Node).

© 2026 Kaer Labs Ltd. All rights reserved.