Skip to main content
POST
Add a connection: OpenAI API key

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
api_key
string
required
Minimum string length: 4
Pattern: ^\s*sk-\S+\s*$
name
string
required

The connection's name: unique among your connections of its option, without leading or trailing spaces.

Required string length: 1 - 100
Pattern: ^\S(.*\S)?$

Response

Created

id
string<uuid>
required
name
string
required

The name you gave the connection, unique among your connections of its option.

Minimum string length: 1
needs_reauth
boolean
required
option
enum<string>
required

Which credential the connection holds, qualified by its vendor: claude_plan, a Claude plan's setup token; anthropic_api_key, an Anthropic API key; chatgpt_plan, a ChatGPT plan's tokens; chatgpt_host_plan, the ChatGPT login your agent did on its own host; openai_api_key, an OpenAI API key; openrouter_api_key, an OpenRouter API key; opencode_auth_file, an OpenCode auth file.

Available options:
claude_plan,
anthropic_api_key,
chatgpt_plan,
chatgpt_host_plan,
openai_api_key,
openrouter_api_key,
opencode_auth_file
works_with
enum<string>[]
required

The harnesses that run on the connection, which its option decides.

Minimum array length: 1
Available options:
claude-code,
codex,
opencode
email
string

A ChatGPT plan's account email, when its token names one.

Minimum string length: 1
key_suffix
string

An API key's last four characters, for a key of at least eight.

Minimum string length: 1
providers
string[] | null

The model providers an OpenCode auth file signs in to.

reauth_reason
string