Connect OpenCode to Apertis

Use OpenCode with one Apertis key and the OpenAI-compatible endpoint. Keep the provider configuration explicit, select a current model from the live catalog, and verify both the response and its usage record before expanding the workflow.

Before you configure OpenCode

  1. Create an Apertis account.
  2. Choose a current Coding Plan or add PAYG balance in Credits.
  3. Create a scoped key in API Keys. Keep the full key out of source control and logs.

No card is required to create an account. Choose a Coding Plan or add PAYG balance before your first API request.

Configure the OpenAI-compatible provider

In OpenCode, add an “Other” credential with /connect, then define the same provider ID in opencode.json with the OpenAI-compatible AI SDK package and the Apertis base URL. Follow the current official OpenCode custom-provider guide if the installed version differs.

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "apertis": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Apertis",
      "options": { "baseURL": "https://api.apertis.ai/v1" },
      "models": {
        "YOUR_MODEL_ID": { "name": "YOUR_MODEL_ID" }
      }
    }
  }
}

Select a current model

Model IDs, availability, capabilities, and pricing change faster than this guide. Copy the exact ID from the live model catalog and replace YOUR_MODEL_ID.

Verify the first successful API call

Send one small request through OpenCode. A completed setup is a model response followed by a matching request record in Activity—not account creation alone.

curl -sS https://api.apertis.ai/v1/chat/completions \
  -H "Authorization: Bearer $APERTIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"YOUR_MODEL_ID","messages":[{"role":"user","content":"Reply with OK"}]}'

Common setup failures

Error What it usually means Next step
401 Unauthorized The key is missing, expired, or entered incorrectly Create or replace the key without exposing it in logs
404 Model Not Found The selected model is unavailable for the current access path Copy a current ID from the live catalog
429 Too Many Requests The request reached a rate or quota boundary Review the current plan, PAYG balance, and key quota
Tool call failed The model or endpoint may not support the tool pattern Choose a model with the needed capability

Start with one workload

Create your Apertis account, then validate one response and its Activity record before moving more repositories.