Skip to main content
POST
Add a OpenCode connection: an OpenCode auth file

Authorizations

Authorization
string
header
required

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

Body

application/json
contents
string
required
Minimum string length: 1
name
string
required

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

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

Response

Created

id
string<uuid>
required
kind
enum<string>
required

Which of the provider's credentials the connection holds: plan, a Claude plan's setup token or a ChatGPT plan's tokens; api_key, an Anthropic or OpenAI API key; host_plan, the ChatGPT login your agent did on its own host; auth_file, an OpenCode auth file; tokens, a Cursor token pair.

Available options:
plan,
api_key,
host_plan,
auth_file,
tokens
name
string
required

The name you gave the connection, unique among your connections of its provider and kind.

Minimum string length: 1
needs_reauth
boolean
required
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