English
Documentation
Console
Console API
Providers API

Providers API

Call the providers connected to your workspace through the Console gateway with a Console key.

Every provider connected to your workspace is served through the Console gateway at its own URL. OpenCode uses it automatically after /connect; call it directly to use the same providers from your own tools. Console adds the provider credential before forwarding, so the provider secret never leaves the workspace.

curl -X POST "https://opencode.ai/inference/custom/conn_.../chat/completions" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4.1-flash",
    "messages": [{ "role": "user", "content": "Say hi" }]
  }'

Provider URL

Copy the Console API URL from the provider's page under Providers.

https://opencode.ai/inference/custom/<connection_id>

Authentication

Replace <token> with a service account key created in Console. Console swaps it for the connection's credential before forwarding.

Authorization: Bearer <token>

Console also reads the key from x-api-key, api-key, or x-goog-api-key, so provider SDKs work when pointed at the Console API URL.

Endpoints

Append the provider's API path to the Console API URL. Console forwards the request to the connection's base URL and returns the provider response unchanged.

FormatPath
Chat Completions/chat/completions
Responses API/responses
Anthropic Compatible/messages
Google Generative AI/models/<model>:generateContent
Embeddings/embeddings

Send the model ID as it appears on the provider page. When a model has a different API ID upstream, Console rewrites it. Requests for models that are not enabled on the connection are rejected.

Chat Completions

curl -X POST "https://opencode.ai/inference/custom/conn_.../chat/completions" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4.1-flash",
    "messages": [{ "role": "user", "content": "Say hi" }]
  }'

Responses API

curl -X POST "https://opencode.ai/inference/custom/conn_.../responses" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-6.1-sol",
    "input": "Say hi"
  }'

Anthropic Compatible

max_tokens is required.

curl -X POST "https://opencode.ai/inference/custom/conn_.../messages" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5-5",
    "max_tokens": 1024,
    "messages": [{ "role": "user", "content": "Say hi" }]
  }'

Google Generative AI

The model and method are part of the path. Replace :generateContent with :streamGenerateContent to stream the response.

curl -X POST "https://opencode.ai/inference/custom/conn_.../models/gemini-4-argon:generateContent" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{ "parts": [{ "text": "Say hi" }] }]
  }'

Usage

Requests count toward budgets using the pricing set on each model. The provider bills you for the tokens.