OpenCode

Configure OpenCode to use BullSequana AI from terminal-first development workflows.

Agentic Friendly

OpenCode should also be connected to BullSequana AI through the CoreAI API.

Even though internal platform components may use LiteLLM behind the scenes, the recommended developer integration path is the stable BullSequana API endpoint.

What To Use

Use:

  • API type: OpenAI (Responses API)
  • base URL: https://llm-backend.<platform-domain>/v1
  • token: JWT or sk-bsq-... API key

Do not configure OpenCode against an internal LiteLLM endpoint as the default developer path.

1. Install OpenCode

Install OpenCode using your preferred installation method.

Examples:

brew install opencode
npm install -g opencode

2. Prepare Authentication

Use either:

  • a JWT bearer token
  • a BullSequana AI API key

For most persistent local tool configurations, API keys are usually more practical.

Requires platform 1.2.1 or later

OpenCode sends the configured key as Authorization: Bearer. On platform versions before 1.2.1 the gateway rejects API keys in that header, so this integration requires 1.2.1 or later.

3. Configure the Provider

Create or edit ~/.config/opencode/opencode.json.

Example configuration:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "bsqai": {
      "name": "BullSequana AI",
      "npm": "@ai-sdk/openai",
      "options": {
        "baseURL": "https://llm-backend.<platform-domain>/v1",
        "apiKey": "sk-bsq-v1-..."
      },
      "models": {
        "<model-name-from-/v1/models>": {
          "name": "<model-name-from-/v1/models>"
        }
      }
    }
  }
}

The "npm": "@ai-sdk/openai" line is required. It makes OpenCode use the official OpenAI SDK provider, which talks to the platform's /v1/responses endpoint (the Responses API). Without it, OpenCode falls back to a generic OpenAI-compatible provider that calls /v1/chat/completions — an endpoint the CoreAI API does not implement — and every request fails with 404 Not Found.

4. Run OpenCode

Example:

opencode --provider bsqai --model <model-name-from-/v1/models>

5. Check Model Availability First

Available models are also visible in the CoreAI Portal.

If you want the API-level source of truth for the current environment, use:

curl "https://llm-backend.<platform-domain>/v1/models" \
  -H "Authorization: Bearer <your-token>"

This gives OpenCode users:

  • a stable API contract
  • consistent authentication
  • environment portability across clusters
  • less coupling to internal platform implementation details

On this page