Kearnix developer guide ยท English

Connect your OpenAI-compatible client to Kearnix

Connect an OpenAI-compatible client to Kearnix, choose a live model ID, and send a chat completion using a server-side API key.

The three settings to change

Set the base URL to https://kearnix.com/v1, provide your Kearnix API key, and use an exact model ID from the Kearnix catalog. A key from another provider will not authenticate a Kearnix request. Model IDs are case-sensitive identifiers; copy the full value, including any provider prefix or variant suffix.

OpenAI-compatible describes the request format for supported endpoints. It does not mean that every model implements every OpenAI endpoint, parameter or tool feature. Check the model's endpoint and capability information before adapting an existing integration.

Send a small cURL request

Set KEARNIX_API_KEY and KEARNIX_MODEL in your server environment. Keep credentials out of browser code, screenshots and source control. Replace the model variable with a current catalog ID before running this example.

curl https://kearnix.com/v1/chat/completions \
  -H "Authorization: Bearer $KEARNIX_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"model\":\"$KEARNIX_MODEL\",\"messages\":[{\"role\":\"user\",\"content\":\"Say hello in one sentence.\"}],\"max_tokens\":64}"

Configure an SDK or compatible tool

In a client with a custom OpenAI-compatible provider setting, enter https://kearnix.com/v1 as the base URL. If a tool asks for the full chat-completions URL instead, use https://kearnix.com/v1/chat/completions. Avoid adding /v1 twice or putting the API key in a URL query parameter.

For an SDK, configure its base URL and API key explicitly rather than changing global credentials used by unrelated applications. Use a separate key for each application when possible, and restrict available models to what that application needs.

Troubleshoot the first response

If authentication fails, confirm that the key belongs to this account and reaches the server in the Authorization header. If a model is unavailable, confirm the exact ID, account access, key restrictions and current catalog availability. Check prepaid credit before retrying a request that was rejected for insufficient balance.

Retry transient rate-limit or provider errors with bounded backoff, following any Retry-After response. Do not retry invalid credentials or malformed input indefinitely. For streaming, use a client that correctly reads server-sent events and handles an interrupted stream. The API reference documents supported request and response shapes.

From choosing a model to your first request