---
title: "OpenCode setup: provider in opencode.jsonc — AI Creator API"
description: "How to connect OpenCode to AI Creator API: a provider in opencode.jsonc, the base URL, the key from the environment and models."
url: https://llm.aicreator.app/en/docs/opencode/
lang: en
updated: 2026-11-10
---

# OpenCode

OpenCode talks to us over OpenAI Chat Completions. The provider is described in the config, and the key comes from an environment variable.

> **What is verified.** We have not yet verified this setup with a live run of OpenCode against our API. From [the OpenCode documentation](https://opencode.ai/docs/providers/) (read on November 9, 2026) we took: `@opencode/ai/providers/openai-compatible`, `settings.baseURL`, `models`. Not checked against the documentation: the other lines of the example ($schema, model, providers, env) and the name of the config file. If something does not match, [tell support](https://t.me/let_support).

## Setup

Add a provider to the OpenCode config:

```jsonc title="opencode.jsonc"
// The key comes from the environment: export AIC_API_KEY=sk-aic-…
{
  "$schema": "https://opencode.ai/config.json",
  "model": "aic/gpt-6-astra",
  "providers": {
    "aic": {
      "name": "AI Creator",
      "package": "@opencode/ai/providers/openai-compatible",
      "env": ["AIC_API_KEY"],
      "settings": { "baseURL": "https://api.aicreator.app/v1" },
      "models": {
        "gpt-6-astra": { "name": "GPT-6 Astra" }
      }
    }
  }
}
```

Set the key in the environment before you start OpenCode:

```bash
export AIC_API_KEY=sk-aic-…
```

- `settings.baseURL` — `https://api.aicreator.app/v1`, with `/v1` at the end.
- `env` — the environment variable that holds the key. Keep the key itself out of the config: a project file is committed to the repository.
- `models` — the models of this provider. Add the ones you need by their full id.
- `model` — the default model as `provider/model`; the provider here is `aic`.

## Models

Any model on the Chat protocol will do; they are listed in [Models and prices](https://llm.aicreator.app/en/docs/models/). A key of the `models` block is the model’s id on our list, letter for letter. The API itself gives the list for your key:

```bash
curl "https://api.aicreator.app/v1/models?surface=chat" \
  -H "Authorization: Bearer $AIC_API_KEY"
```

An id that is not on the list returns 400 `model_not_available`.

## Things to know

- One key runs up to 4 requests at a time; the next one gets 429 `concurrent_requests` with a `retry-after` header.
- A Chat Completions stream of ours always ends with a chunk that has an empty `choices: []` and the token usage; that is how we charge by actual tokens.
- From Russia, if `https://api.aicreator.app` is unreachable, set `settings.baseURL` to `https://api-ru.aicreator.app/v1`: the key and the balance are the same.

If a request fails, see [Troubleshooting](https://llm.aicreator.app/en/docs/troubleshooting/).
