Skip to content
Console docs

Providers API

Contents

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.

Terminal
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" }]
  }'

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

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

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.

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

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.

Terminal
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" }]
  }'

Terminal
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"
  }'

max_tokens is required.

Terminal
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" }]
  }'

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

Terminal
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" }] }]
  }'

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