Skip to main content
Use an API key to connect your application to OverControl. Give each application its own key, limit its permissions to the endpoints it needs, and choose which models it can use. This page covers API-key authentication for Chat Completions, Messages, models, and Files.

Create a key

You create a key in the API dashboard. It starts with oc_sk_. Copy it when it appears, and keep it on your server.
Treat the key like a password. It belongs on your server, not in client-side code, a repository, or a screenshot.

Where the key goes

You can pass the key in either of these headers. One of them is enough.
Send one authentication header per request. If both Authorization and x-api-key contain a value, the API rejects the request with HTTP 401 and Ambiguous credentials. On Chat Completions, models, and Files, the error code is invalid_credential. This also applies when both headers contain the same key. Try the key with the models endpoint. This example needs the models:read scope and does not spend inference usage.
A successful response has object: "list" and a data array of model objects. The key’s model allowlist determines which models appear.

Scopes

Each key carries a set of scopes. A request goes through when the key includes the scope for that operation. When you create a key, enable the scopes needed by your application. A key used for both inference APIs needs both chat:completions and messages:create. Server-side web search and web fetch use the scope of the inference endpoint; they do not need an extra web-tool scope. To upload a PDF, ask a model about it by file ID, and delete it afterward, enable files:write, files:read, and files:delete, plus the relevant inference scope. Referring to an existing file ID needs files:read, even when you do not download the file yourself. If a required scope is missing, you’ll get HTTP 403 and the message Forbidden. Chat Completions, the models list, and Files return this body. The response includes X-Request-Id.
Messages describes the same refusal in its own shape. You’ll also see request-id, and the same identifier inside the JSON as request_id.

Model allowlist

Some keys are limited to a list of model IDs. A key with no list can call every model on the models page, and GET /v1/models returns that full list. A key with a list only sees the models on it. Changing the model field in a request does not add that model to the key’s permissions. If you call Chat Completions with a model the key is not allowed to use, you’ll get HTTP 403:
On Messages, an unknown model and a model outside the allowlist look the same. Both come back as HTTP 404:

When the key is not accepted

You’ll get HTTP 401 and the message Invalid API key if the key is missing, the Authorization value is malformed, or the key is not recognized or is no longer valid. On Chat Completions, the models list, and Files:
On Messages:
If you write to support about a failed call, include the X-Request-Id header. On Messages, request-id and request_id are that same value.