> ## Documentation Index
> Fetch the complete documentation index at: https://apione.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect OpenCode to APIONE

> Connect to APIONE with an OpenAI-compatible provider.

## Setup

### 1. Prepare your APIONE settings

Create an API Key on the [APIONE API Keys page](https://apione.ai/en/app/api-keys) and choose an available group. Look up the actual model IDs your key supports in the [model directory](https://apione.ai/docs/en/models/catalog.md), and confirm the model supports Chat Completions and tool calls.

| Setting | Value |
| - | - |
| Provider ID | `apione` |
| Provider name | `APIONE` |
| Base URL | `https://api.apione.ai/v1` |
| API Key | Your APIONE API Key |
| Model ID | An actual model ID available to your key |

### 2. Check your version and configuration file

In the desktop app, check the version under **Settings → About**. For the CLI, run `opencode --version`. Use the configuration below that matches your version.

Open `.config/opencode/opencode.jsonc` in your user directory, or use `opencode.json` in your project. Back up any existing file before merging the APIONE settings. If the desktop app has no custom provider form, edit the configuration file directly.

### 3. Configure OpenCode 2.x

Add the APIONE provider to the configuration file and replace the model placeholder with an actual ID.

```json theme={null}
{
  "$schema": "https://opencode.ai/config.json",
  "providers": {
    "apione": {
      "name": "APIONE",
      "env": ["APIONE_API_KEY"],
      "package": "@opencode/ai/providers/openai-compatible",
      "settings": {
        "baseURL": "https://api.apione.ai/v1"
      },
      "models": {
        "YOUR_APIONE_MODEL_ID": {"name": "APIONE model"}
      }
    }
  }
}
```

Set `APIONE_API_KEY` in the environment that starts OpenCode. In Windows PowerShell, run the following commands, then start the OpenCode CLI from the same terminal.

```powershell theme={null}
$env:APIONE_API_KEY = "YOUR_APIONE_KEY"
opencode
```

The desktop app's service process must be able to read this variable. On Windows, add `APIONE_API_KEY` under **Environment Variables → User variables**, save, then fully quit and reopen OpenCode.

### 4. Configure OpenCode 1.x

Run `/connect` in OpenCode, select **Other**, enter `apione` as the provider ID, and enter your APIONE API Key. Then merge the following into the configuration file.

```json theme={null}
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "apione": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "APIONE",
      "options": {"baseURL": "https://api.apione.ai/v1"},
      "models": {
        "YOUR_APIONE_MODEL_ID": {"name": "APIONE model"}
      }
    }
  }
}
```

Replace the model placeholder with an actual ID. The provider ID `apione` must match the ID you entered when saving the key.

## Configure providers and models

In the `models` object for your version, add each model using its actual model ID as the key. For multiple models, add one entry per model and save the configuration. Set context, output limits, and image capabilities according to the APIONE model parameters.

## Select a model

Restart OpenCode and open the model picker, or run `/models` where commands are supported. Choose a model under **APIONE** and send "Reply only with OK". Then check the request status, model, and usage in the [APIONE console](https://apione.ai/en/app).

After the text test passes, ask the model to read files in a test project and explain its directory structure to confirm tool calls work.

![OpenCode connected providers list showing apione, marked as connected through an environment variable](https://mintcdn.com/apione/JSBwBgVVuvXGE77Q/images/integrations/screenshots/opencode-apione-connected.png?fit=max\&auto=format\&n=JSBwBgVVuvXGE77Q\&q=85\&s=3cc6a5f2e5e4b4de6c7943e787e7da7f)

The OpenCode providers page shows APIONE connected through an environment variable.

Under **Settings → Providers**, confirm APIONE appears in the connected list. Then select a model, send a message, and check the result in your APIONE request details.

![OpenCode conversation showing the APIONE OpenCode visible success reply](https://mintcdn.com/apione/kQjSwlZGfL2mAyXv/images/integrations/screenshots/opencode-apione-chat-reply-v2.png?fit=max\&auto=format\&n=kQjSwlZGfL2mAyXv\&q=85\&s=b1fbba69b7f912aef530ebc965247c55)

Example of a text reply returned through APIONE in an OpenCode conversation.

After the conversation, check the model and usage in your APIONE request details. Actual charges follow your APIONE bill.

## Troubleshoot

| Problem | Fix |
| - | - |
| APIONE does not appear | Check the configuration file location and version-specific fields, then restart the client or service |
| Model not found | Check the actual model ID in `models` and your key's permissions |
| 401 | Check the credential source, whether the service process reads the variable, and the key status |
| 404 | Check the Base URL and the final request path |
| Chat works but tasks fail | Check the model's tool support, context size, and request parameters |

For configuration fields, see the [current OpenCode docs](https://opencode.ai/docs/providers/) and the [OpenCode 1.x docs](https://opencode.ai/v1/docs/providers/).

***

[Back to integrations](https://apione.ai/docs/en/guides/clients.md) · [Choose a model](https://apione.ai/docs/en/models/catalog.md) · [Troubleshooting](https://apione.ai/docs/en/support/errors.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.