Skip to content

API access

With an API key, programs use the AI models of your workspace: coding tools, automations or your own scripts. An admin creates it under Settings → API access; the key is shown only once, when it is created. If the section is missing from your settings, API access is not yet enabled for your workspace; get in touch with us to enable it.

Tool Base URL
OpenCode, Continue, Cline and every other OpenAI-compatible program https://chat.9brains.de/api/v1/openai
Claude Code https://chat.9brains.de/api/v1/anthropic

As the model name you enter the model ID, for example gpt-6-luna or claude-haiku-5-5-bedrock. Only models enabled in your workspace work; 9brains refuses any other name with an error message.

In opencode.json in the project folder, with the key in the environment variable NINEBRAINS_API_KEY:

{
"$schema": "https://opencode.ai/config.json",
"provider": {
"9brains": {
"npm": "@ai-sdk/openai-compatible",
"name": "9brains",
"options": {
"baseURL": "https://chat.9brains.de/api/v1/openai",
"apiKey": "{env:NINEBRAINS_API_KEY}"
},
"models": {
"gpt-6-luna": { "name": "GPT-6 Luna" }
}
}
},
"model": "9brains/gpt-6-luna"
}

Claude Code is set up with environment variables:

Terminal window
export ANTHROPIC_BASE_URL=https://chat.9brains.de/api/v1/anthropic
export ANTHROPIC_AUTH_TOKEN=9b_…
export ANTHROPIC_MODEL=claude-sonnet-5-5-bedrock
export ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-5-5-bedrock

ANTHROPIC_MODEL is the model Claude Code works with. It uses ANTHROPIC_DEFAULT_HAIKU_MODEL for small side tasks; without this variable the main model handles them too, which costs more.

Web search and other tools that run at the AI provider are not available through API access. The WebSearch tool in Claude Code therefore reports an error; everything else works as usual.

In VS Code there are four ways to 9brains. All of them need only the key and a model ID.

The Continue extension reads ~/.continue/config.yaml. In VS Code you open the file with the gear at the top of the Continue sidebar, then Configs and the gear next to Main Config:

name: 9brains
version: 1.0.0
schema: v1
models:
- name: GPT-6 Luna
provider: openai
model: gpt-6-luna
apiBase: https://chat.9brains.de/api/v1/openai
apiKey: 9b_…
useResponsesApi: false

The line useResponsesApi: false belongs to every model. Without it, Continue sends GPT models to an interface 9brains does not offer and reports an error. Continue only creates files in Agent mode, which you pick on the left below the input field.

When Cline starts for the first time, choose Bring my own API key; later you find the same fields through the gear at the top of the Cline sidebar:

  • API Provider: OpenAI Compatible
  • Base URL: https://chat.9brains.de/api/v1/openai
  • OpenAI Compatible API Key: your key
  • Model ID: for example gpt-6-luna

Under Model Configuration, Cline sets a context window of 128,000 tokens; if the model is larger, enter its size, otherwise Cline shortens conversations earlier than necessary. Turn off Supports Images for models that do not understand images. The cost Cline shows stays at $0 because it does not know the prices; billing works as described under Billing.

The Claude Code extension only sees variables from your terminal if you start VS Code from that terminal. So enter the values from Claude Code in ~/.claude/settings.json; then they apply in the extension and in the terminal:

{
"env": {
"ANTHROPIC_BASE_URL": "https://chat.9brains.de/api/v1/anthropic",
"ANTHROPIC_AUTH_TOKEN": "9b_…",
"ANTHROPIC_MODEL": "claude-sonnet-5-5-bedrock",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-5-5-bedrock"
}
}

The extension then no longer asks you to sign in to Anthropic.

The chat built into VS Code takes 9brains models as a provider of its own, even without a GitHub account and without a Copilot plan:

  1. Command palette, Chat: Manage Language Models, then Add Models and Custom Endpoint.
  2. Enter a name such as 9brains and the key, and choose Chat Completions as the API type.
  3. In the file chatLanguageModels.json that VS Code opens next, enter the model. Here url holds the full address with /chat/completions at the end:
"id": "gpt-6-luna",
"name": "GPT-6 Luna",
"url": "https://chat.9brains.de/api/v1/openai/chat/completions",
  1. Reload VS Code (Developer: Reload Window); the model then appears in the chat’s model picker.

Without a GitHub sign-in, the chat’s requests go only to 9brains. If you are signed in to GitHub Copilot, inline suggestions, semantic search and side tasks such as titles and summaries still run through GitHub. You redirect the side tasks to a 9brains model with the settings chat.utilityModel and chat.utilitySmallModel. In Copilot Business and Enterprise, the organisation can turn off your own models.

Any program that lets you set its own base URL for OpenAI talks to 9brains through the OpenAI-compatible base URL. In Python, for example, with the openai library:

from openai import OpenAI
client = OpenAI(base_url="https://chat.9brains.de/api/v1/openai", api_key="9b_…")
answer = client.chat.completions.create(
model="gpt-6-luna",
messages=[{"role": "user", "content": "Summarise this text in three sentences: …"}],
)
print(answer.choices[0].message.content)

The API offers text and image input with text answers, tool calls included. Embeddings, image generation and speech recognition are not part of API access.

How thoroughly a model thinks is set in the tool; 9brains translates the setting into the right form for each model. If the tool sends none, the model’s default in 9brains applies.

  • OpenCode: on the model, "options": { "reasoningEffort": "low" }, for example low or high.
  • Claude Code: with /effort or the environment variable CLAUDE_CODE_EFFORT_LEVEL, for example low or high.

API calls are billed exclusively to your workspace’s credit. If a tool cancels an answer, it is still billed, because the model writes it to the end.

Once the credit is used up, 9brains refuses every call until there is credit again. If a key has a weekly limit, 9brains refuses its calls once it is reached, until Monday at 0:00 (Berlin time) or until an admin raises the limit. In both cases the tool shows an error message with the reason.