Use API keys with AI tools
Point Claude Code, the OpenAI and Anthropic SDKs and other compatible tools at your deployment with an API key, and how model names, allowed models and budgets apply.
Your deployment answers the OpenAI and Anthropic APIs, so tools written for those services can use the models you have configured under Model providers. Each call is authenticated with an API key, checked against the key's allowed models and budget, and metered and attributed to the key's owner (see how cost is calculated). Provider keys are never shared with the tool.
Create a key first, as described in API keys. A personal key works for your own tools; a Coworker or App key attributes the usage to that Coworker or App.
Turn the endpoints on or off#
Compatible tool endpoints are on by default. An administrator can switch them off or on again under Settings, Administration, Features, Compatible tool endpoints. The same card shows the two base URLs below, each with a copy button. While the setting is off, every call to these addresses fails with a server error (500) reading "Compatible tool endpoints are not enabled by your administrator." and nothing is sent to a model or billed. A call with an invalid key still gets the authentication error (401). Turning the setting back on restores service immediately; keys, budgets and usage history are untouched.
These addresses also follow the Coworkers switch under Settings, then Features. While Coworkers is off, a call with a valid key gets a not-found error (404) in the same error format, whatever the setting above says, and nothing is sent to a model or billed.
Addresses#
Replace <host> with your deployment's address.
| Tool family | Base URL |
|---|---|
| OpenAI SDKs and OpenAI-compatible tools | https://<host>/api/openai/v1 |
| Anthropic SDKs, Claude Code and Anthropic-compatible tools | https://<host>/api/anthropic |
Both addresses also work with the /v1 segment added or removed (https://<host>/api/openai,
https://<host>/api/anthropic/v1), so a tool that appends its own /v1 still reaches the right
place. Send the key as Authorization: Bearer wi_sk_... or, for Anthropic-style clients, as an
x-api-key header.
The OpenAI address serves chat completions and the model list. The Anthropic address serves messages (streaming and non-streaming, including tool use and images), token counting and the model list.
Claude Code#
Set these environment variables before you start Claude Code:
export ANTHROPIC_BASE_URL=https://<host>/api/anthropic
export ANTHROPIC_API_KEY=wi_sk_... # or ANTHROPIC_AUTH_TOKEN
Claude Code then sends its requests to your deployment. To pick a model, use one of the names in
the next section, for example ANTHROPIC_MODEL=default.
OpenAI SDK#
from openai import OpenAI
client = OpenAI(base_url="https://<host>/api/openai/v1", api_key="wi_sk_...")
reply = client.chat.completions.create(
model="auto", messages=[{"role": "user", "content": "Hello"}]
)
The Anthropic SDK works the same way with base_url="https://<host>/api/anthropic".
Model names#
Tools often send model names such as gpt-4o or claude-sonnet-... that your providers do not
serve, so the platform resolves the name for you:
| Name sent | Model used |
|---|---|
auto or default |
The company default model |
small |
The company default model |
<provider>/<model>, for example anthropic/claude-sonnet-5-5 |
That model on that provider |
| A bare model id that exactly one active provider serves | That model |
| Anything else (other than a Coworker id, below) | The company default model |
Set the company default under Settings, Administration, Model providers; see
Default models. The response echoes the model name the
client sent. The model list a tool fetches shows the models the key may use, followed by
auto, default and small.
Use a Coworker as the model#
Instead of a model name, a tool can send a Coworker's id as the model. The tool then talks to that
Coworker: it answers with the Coworker's own instructions and knowledge, followed by whatever system
prompt the tool sends. Read the id from the model list (each
Coworker you can chat with appears there under its name). Send it as model: "<coworker id>"; the
coworker:<id> form works too. An id that does not match a Coworker in your company is rejected with a
"model not found" error (404) and never falls back to the default model.
Only a personal key, or a connected tool's key that acts for a person, can do this, and it can chat with
exactly the Coworkers that person could open in the app (a Coworker in Interview, retired, or limited to
a Team the person is not in is refused with a permission error). Company App and Coworker keys cannot,
because they are not tied to a person. If the key has a list of allowed models, the Coworker is allowed
when the list names its id (or coworker:<id>) or allows the model the Coworker runs on.
The tool sees only the Coworker's replies. When the Coworker needs one of its own tools (searching its knowledge, running a script) it does so in the background and the tool never sees those steps. If the Coworker needs one of the tool's own tools, that request is returned to the tool as usual, and the tool sends the result back in its next call; when both kinds are requested at once, the tool's request is returned first. If the tool defines a tool with the same name as one of the Coworker's, the tool's version is used. A reply that involves background steps arrives all at once at the end rather than word by word. Everything is billed to the key, with each step counted, and nothing is saved as a conversation in the app. Sharing files, publishing artifacts and requesting secrets are not available this way.
Allowed models#
A key can carry a list of allowed models, set when the key is created through the API's
model_allowlist field. Entries are <provider>/<model>, a bare model id, or <provider>/* for
every model of a provider. A key with no list, or with an empty list, may use every model. The check applies to the model
the name resolves to, so an alias cannot reach a model the key does not allow. A call that
resolves to a model the key may not use is rejected with a permission error.
Budgets#
A key's Monthly budget counts everything the key spends since the start of the month. Once the budget is reached, further calls with that key are rejected with a rate-limit error ("This API key has reached its monthly budget.") and nothing is sent to the model. A streamed reply that the client abandons part-way is still billed for what was generated. Raise the budget by issuing a replacement key; see API keys.
Errors#
| Situation | What the tool sees |
|---|---|
| Missing, wrong, revoked or disabled key | Authentication error (401) |
| Compatible tool endpoints switched off by an administrator | Server error (500) with the message "Compatible tool endpoints are not enabled by your administrator." |
| Model not allowed for the key | Permission error (403) |
| Coworker id that does not exist in your company | Model-not-found error (404) |
| Coworker the key's person cannot chat with, or a key that is not tied to a person | Permission error (403) |
| Monthly budget reached | Rate-limit error (429) |
| Malformed request | Invalid-request error (400) |
| No default model configured, or the selected model is unavailable | Error (404 or 503); an administrator checks the model configuration |
| Provider outage or overload | The provider-appropriate error, without provider details |
A key never signs a person in to the web app, and the web session is never accepted on these addresses.