Personal API keys
Create and manage a personal API key for coding tools and your own projects.
A personal API key lets you reach your workspace's models from outside ajan, so you can use them in coding tools like Claude Code, GitHub Copilot, or Codex, or in a project of your own. The key authenticates as you, which means it spends your usage budget and reaches the completion endpoints only.
Create a personal API key
Open API keys
Go to Settings > Account > API keys.
Enter the key details
Click Create API key. Give the key a name that tells you where it's used, so you know which tool to update later, and choose when it expires.
Create and copy the key
Click Create API key, then copy the key and store it somewhere safe. ajan shows it once and never again.
The page also tracks how much of your budget you have used and when it resets. If your individual limit has nothing left, personal API requests return an error instead of using a fallback model. You can request a higher limit when usage requests are enabled, or ask your workspace admin. If the workspace has reached its spend limit, increasing your individual limit does not restore API access. Your workspace admin must raise the workspace limit or set it to Unlimited, or you must wait for the current billing period to reset.
Connect a tool
Connect your tools walks you through the setup for Claude Code, Claude Desktop, OpenCode, Codex, GitHub Copilot, and direct API calls with cURL. You can also connect Cursor with the same key. Pick an available model and the examples update to match, then follow the steps for your tool.
The guides below match that setup. See the ajan Completion APIs for an overview of the available APIs. Replace YOUR_API_KEY with your key and your-model-id with an ID from Available models. Use eu or us to match your workspace's model region. For an OpenAI compatible model in the global region, use /openai/global/v1 and list models at /openai/global/v1/models. On dedicated deployments the base URL starts with your deployment origin instead of https://api.ajan.io.
Claude Code uses the Anthropic Messages API through ajan.
Check available Claude models
curl https://api.ajan.io/anthropic/eu/v1/models \
-H "Authorization: Bearer YOUR_API_KEY"Add your settings
Add this to ~/.claude/settings.json (on Windows: %USERPROFILE%\.claude\settings.json), and create the file if it does not exist. Replace the model IDs with ones from the previous step, and make sure ANTHROPIC_API_KEY is not set:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.ajan.io/anthropic/eu",
"ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
"ANTHROPIC_MODEL": "your-model-id",
"ANTHROPIC_SMALL_FAST_MODEL": "your-model-id"
}
}Start Claude Code
claudeClaude Code speaks the Anthropic Messages API, which ajan serves at the base URL above. All requests are now routed through your workspace.
Claude Desktop can run chats on ajan models through third-party inference.
Enable Developer Mode
In Claude Desktop, open Help → Troubleshooting → Enable Developer Mode.
Configure the gateway
Open Developer → Configure third-party inference. Set Inference provider to Gateway. Under Gateway credentials, enter:
Gateway base URL: https://api.ajan.io/anthropic/eu
Gateway API key: YOUR_API_KEY
Gateway auth scheme: bearer
Credential kind: Static API keyTest and apply
Keep Model discovery enabled, then click Test connection and Test model discovery. Claude discovers the Anthropic models available in your workspace. Click Save Changes, then Apply Changes. Claude relaunches; select Continue with Gateway if prompted.
Cursor has no built-in card under Connect your tools yet. Point its OpenAI provider at ajan:
Open model settings
In Cursor, open Cursor Settings > Models.
Add your key and base URL
Paste your personal API key into the OpenAI provider field and click Save. Turn on Override OpenAI Base URL and enter this URL with /v1 and no trailing slash:
https://api.ajan.io/openai/eu/v1Add a workspace model
Enter the exact ID of a model from Available models, then click Add Custom Model. Select that model for chat.
Custom API keys in Cursor cover chat models only. Tab completion keeps using Cursor's built-in models. Agent mode fails with an HTTP 400 error, because ajan's Chat Completions endpoint accepts only tools of type function. For agentic coding, use Claude Code, Codex, GitHub Copilot, or OpenCode instead.
Codex uses ajan's OpenAI Responses endpoint (wire_api = "responses").
Add your config
Add this to ~/.codex/config.toml (on Windows: %USERPROFILE%\.codex\config.toml), and create the file if it does not exist:
model = "your-model-id"
model_provider = "workspace"
[model_providers.workspace]
name = "ajan"
base_url = "https://api.ajan.io/openai/eu/v1"
wire_api = "responses"
experimental_bearer_token = "YOUR_API_KEY"Start Codex
codexOr open the Codex / ChatGPT desktop app. This file stores your key on this computer. If you share the machine, revoke the key in ajan and create a new one.
GitHub Copilot uses ajan's OpenAI Chat Completions endpoint. Copilot Chat in VS Code, agent mode, and Copilot CLI need an OpenAI-compatible model that supports tools.
Add a custom endpoint in VS Code
In VS Code, open the Command Palette and run Chat: Manage Language Models. Choose Add Models → Custom Endpoint. Use ajan as the group name, paste your API key, and select Chat Completions.
Add the provider
VS Code opens chatLanguageModels.json. Add this provider, or merge it with providers you already have, save, then pick the model in the Chat picker:
[
{
"name": "ajan",
"vendor": "customendpoint",
"apiKey": "YOUR_API_KEY",
"apiType": "chat-completions",
"models": [
{
"id": "your-model-id",
"name": "Your model",
"url": "https://api.ajan.io/openai/eu/v1/chat/completions",
"toolCalling": true,
"streaming": true
}
]
}
]Or use Copilot CLI
Run this in your terminal. Add the exports to your shell profile if you want them to persist. On Windows, set the same values with $env::
export COPILOT_PROVIDER_BASE_URL="https://api.ajan.io/openai/eu/v1"
export COPILOT_PROVIDER_API_KEY="YOUR_API_KEY"
export COPILOT_MODEL="your-model-id"
copilotWhat this connection covers
This routes Copilot Chat, agent mode, and Copilot CLI through your workspace. Inline ghost-text completions still use GitHub. Copilot Business or Enterprise organizations may need an admin to enable the Bring Your Own Language Model Key policy.
OpenCode uses the Anthropic-compatible endpoint through ajan.
Add your config
Add this to opencode.json in your project, or to ~/.config/opencode/opencode.json (on Windows: %USERPROFILE%\.config\opencode\opencode.json). You can list more workspace models under models:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"workspace": {
"npm": "@ai-sdk/anthropic",
"name": "ajan",
"options": {
"baseURL": "https://api.ajan.io/anthropic/eu/v1"
},
"models": {
"your-model-id": { "name": "Your model" }
}
}
}
}Start OpenCode and connect
opencodeRun /connect, select Other, enter workspace as the provider ID, then paste your API key.
Choose the model
Choose the model with /models, or start OpenCode with it directly:
opencode --model workspace/your-model-idCall the completion APIs directly from your own projects.
List available models
curl https://api.ajan.io/openai/eu/v1/models \
-H "Authorization: Bearer YOUR_API_KEY"Send a Chat Completions request
curl https://api.ajan.io/openai/eu/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "your-model-id", "messages": [{"role": "user", "content": "Hello"}]}'Or use the Anthropic-compatible API
curl https://api.ajan.io/anthropic/eu/v1/messages \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "your-model-id", "max_tokens": 1024, "messages": [{"role": "user", "content": "Hello"}]}'Use any OpenAI- or Anthropic-compatible SDK by pointing its base URL at the URLs above. See the Chat Completions, Responses, and Anthropic Messages API docs for full request shapes.
Your key works with the OpenAI compatible Chat Completions and Responses APIs, the Anthropic Messages API, the Google Completion API, and the Mistral Completion API. Which of them you can call depends on the models configured for your workspace. Available models shows what you can pick for the built-in OpenAI and Anthropic guides, and for Google and Mistral you follow the API documentation instead.
Personal API keys work only with the completion endpoints. The Agent, Embedding, Knowledge Folder, Integrations, Skills, Prompts, Usage Export, User Management, and Audit Logs APIs need a workspace API key with the matching scope.
Rotate or revoke a key
Open the menu next to a key under Your API keys:
- Rotate key replaces the secret and shows the new one once. The old one stops working immediately, so update every connected tool right away.
- Revoke key switches the key off for good.
Your workspace admin can revoke your keys as well. They also stop working if your admin takes away your access to personal API keys or deactivates your workspace membership.