# Coding tools

Use the AI API in Claude Code, Cursor, Codex, Cline and other tools, with the base addresses, coding models and Coding Plan.

Updated on 17 November 2026

AI coding tools can use the Interweb AI API instead of an account with the model maker: you choose the model, pay with credits or with the Coding Plan, and use the same API key. On this page:

- [Before you start](https://docs.interweb.co.mz/en/coding-tools.md): The key, the base addresses and the environment variable.
- [Recommended models](https://docs.interweb.co.mz/en/coding-tools.md): The catalog models that write code best.
- [Claude Code](https://docs.interweb.co.mz/en/coding-tools.md), [Codex CLI](https://docs.interweb.co.mz/en/coding-tools.md), [Cursor](https://docs.interweb.co.mz/en/coding-tools.md), [Cline](https://docs.interweb.co.mz/en/coding-tools.md), [Roo Code](https://docs.interweb.co.mz/en/coding-tools.md), [OpenCode](https://docs.interweb.co.mz/en/coding-tools.md) and [Kilo Code](https://docs.interweb.co.mz/en/coding-tools.md): The setup of each tool.
- [Plans and credits](https://docs.interweb.co.mz/en/coding-tools.md): The Coding Plan, the points and what happens when they run out.
- [Sandbox](https://docs.interweb.co.mz/en/coding-tools.md): Check the setup without spending anything.
- [Common errors](https://docs.interweb.co.mz/en/coding-tools.md): What each error means and how to fix it.
- [MCP server](https://docs.interweb.co.mz/en/coding-tools.md): Generate images, videos and voice inside the tool.
- [aio command](https://docs.interweb.co.mz/en/coding-tools.md): AI in the terminal, without setting up any tool.

## Before you start

1. Create a key in the [API Center](https://www.meu.interweb.co.mz/api-center.php?language=english&currency=2) with the `ai:read` and `ai:write` permissions. Use a `sandbox_` key to check the setup and a `prod_` key to work. See [Permissions](https://docs.interweb.co.mz/en/permissions.md).
2. Have AI credits or an active Coding Plan in [All in One AI](https://www.meu.interweb.co.mz/all-in-one-ai.php?language=english&currency=2).
3. Give the tool the base address of the format it uses:

| Format | Base address | Tools |
|---|---|---|
| Anthropic (Messages) | `https://api.interweb.co.mz` | Claude Code |
| OpenAI (Responses) | `https://api.interweb.co.mz/v1` | Codex CLI |
| OpenAI (Chat Completions) | `https://api.interweb.co.mz/v1` | Cursor, Cline, Roo Code, OpenCode and Kilo Code |

Claude Code adds `/v1/messages` by itself, so its address has no `/v1`. The other tools only add `/chat/completions` or `/responses`, so their address ends in `/v1`.

In the examples, the key is in the `INTERWEB_API_KEY` environment variable, so it is not written in the configuration files:

```bash
export INTERWEB_API_KEY="prod_..."
```

To have the variable in every new terminal, put this line in `~/.bashrc` or `~/.zshrc`. On Windows, use `setx INTERWEB_API_KEY "prod_..."` and open a new terminal.

## Recommended models

All these models are in the catalog, accept tools (function calling) and are part of the Coding Plan. Use the `id` as it is, with the slash:

| Model | Context | What for |
|---|---|---|
| `moonshotai/kimi-k2.7-code` | 262,144 tokens | Made for coding: the best starting point for everyday work. |
| `deepseek-ai/deepseek-v4-pro` | 1,048,576 tokens | Strong reasoning, for large changes and hard bugs. |
| `zai-org/glm-5.2` | 1,048,576 tokens | Built for agents: uses tools well in long tasks. |
| `qwen/qwen3.8-max` | 1,000,000 tokens | A large model, for reasoning and code across whole projects. |
| `deepseek-ai/deepseek-v4-flash` | 1,048,576 tokens | Fast and cheap, for background tasks and short questions. |
| `minimaxai/minimax-m2.5` | 196,608 tokens | Light and cheap, good for simple edits. |

The context, the maximum output and the price of each model are in [`GET /v1/models`](https://docs.interweb.co.mz/en/ai.md), in the `context_length`, `max_output_tokens` and `pricing` fields. The models that spend your plan points are listed in the Plan tab of All in One AI.

## Claude Code

Claude Code uses the Anthropic format ([`POST /v1/messages`](https://docs.interweb.co.mz/en/ai.md) and [`POST /v1/messages/count_tokens`](https://docs.interweb.co.mz/en/ai.md)). Set these variables before you open it:

```bash
export ANTHROPIC_BASE_URL="https://api.interweb.co.mz"
export ANTHROPIC_AUTH_TOKEN="$INTERWEB_API_KEY"
export ANTHROPIC_MODEL="moonshotai/kimi-k2.7-code"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-ai/deepseek-v4-flash"
export CLAUDE_CODE_MAX_CONTEXT_TOKENS=262144
export CLAUDE_CODE_MAX_OUTPUT_TOKENS=16000
claude
```

| Variable | What it does |
|---|---|
| `ANTHROPIC_BASE_URL` | Our address, without `/v1`. |
| `ANTHROPIC_AUTH_TOKEN` | The key, sent in `Authorization: Bearer`. You can also use `ANTHROPIC_API_KEY`, which sends it in `x-api-key`: we accept both. |
| `ANTHROPIC_MODEL` | The main model. Change it during the session with `/model`, for example `/model zai-org/glm-5.2`. |
| `ANTHROPIC_DEFAULT_HAIKU_MODEL` | The model for background tasks, which should be fast and cheap. Older Claude Code versions use `ANTHROPIC_SMALL_FAST_MODEL`. |
| `CLAUDE_CODE_MAX_CONTEXT_TOKENS` | The context of the model (its `context_length`), so Claude Code summarizes the conversation at the right time. |
| `CLAUDE_CODE_MAX_OUTPUT_TOKENS` | The most tokens of each answer. Without it, Claude Code asks for 32,000 and we reserve credits for all of them: a lower value needs a smaller balance. |

To avoid setting the variables each time, put them in `~/.claude/settings.json`, under the `env` key. Claude Code copies these values as they are, without reading environment variables, so here the key is written in the file: keep this file on your computer only.

```json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.interweb.co.mz",
    "ANTHROPIC_AUTH_TOKEN": "prod_...",
    "ANTHROPIC_MODEL": "moonshotai/kimi-k2.7-code",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-ai/deepseek-v4-flash",
    "CLAUDE_CODE_MAX_CONTEXT_TOKENS": "262144",
    "CLAUDE_CODE_MAX_OUTPUT_TOKENS": "16000",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  }
}
```

- If Claude Code asks for a name that is not in the catalog, such as `claude-sonnet-...`, we use `moonshotai/kimi-k2.7-code` and charge that model. The answer shows the name asked for. To choose the model, always set `ANTHROPIC_MODEL`.
- `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` turns off traffic that is not part of the work, such as telemetry and automatic updates. It is optional.

## Codex CLI

Codex CLI uses the OpenAI Responses format ([`POST /v1/responses`](https://docs.interweb.co.mz/en/ai.md)). Create a provider in `~/.codex/config.toml`:

```toml
model = "moonshotai/kimi-k2.7-code"
model_provider = "api"

[model_providers.api]
name = "Interweb"
base_url = "https://api.interweb.co.mz/v1"
env_key = "INTERWEB_API_KEY"
wire_api = "responses"
```

- `env_key` is the name of the environment variable with the key: Codex reads it at start and sends it in `Authorization: Bearer`.
- `wire_api = "responses"` is required, because Codex talks to the Responses API.
- The provider can only be set in the user file. The `.codex/config.toml` of a project cannot change `model_provider` or `model_providers`.
- The provider id (`api`) can have another name, but not `openai`, `ollama` or `lmstudio`, which are reserved.
- To use another model in one session only: `codex -m zai-org/glm-5.2`.

Each response is kept for 30 days, so Codex can go on with the conversation using `previous_response_id`. You can read it with [`GET /v1/responses/{id}`](https://docs.interweb.co.mz/en/ai.md).

## Cursor

Cursor uses the OpenAI Chat Completions format ([`POST /v1/chat/completions`](https://docs.interweb.co.mz/en/ai.md)):

1. Open **Cursor Settings** > **Models**.
2. Under **API Keys**, turn on **OpenAI API Key** and paste your `prod_` key.
3. Turn on **Override OpenAI Base URL** and type `https://api.interweb.co.mz/v1`.
4. In **Add Custom Model**, add the model `id`, for example `moonshotai/kimi-k2.7-code`, and pick it in the model picker.

- Requests go through the Cursor servers before they reach our API.
- According to the Cursor documentation, your own keys only work with chat models: Tab keeps using Cursor's own models.
- While the address is changed, requests to Cursor's OpenAI models also come to our API. Turn off **Override OpenAI Base URL** to go back to them.

## Cline

1. Open the Cline settings (the gear icon).
2. In **API Provider**, choose **OpenAI Compatible**.
3. In **Base URL**, type `https://api.interweb.co.mz/v1`.
4. In **API Key**, paste your key.
5. In **Model ID**, type the model `id`, for example `moonshotai/kimi-k2.7-code`.
6. In **Model Configuration**, enter the context (`context_length`) and the maximum output of the model.

## Roo Code

1. Open the Roo Code settings.
2. In **API Provider**, choose **OpenAI Compatible**.
3. Fill in **Base URL** with `https://api.interweb.co.mz/v1`, **API Key** with your key and **Model** with the model `id`.
4. In **Model Configuration**, set **Context Window** and **Max Output Tokens** to the values of the model.

Roo Code only works with models that accept tools (function calling). All the recommended models above accept them.

## OpenCode

Add a provider to `~/.config/opencode/opencode.jsonc` (for all projects) or to the `opencode.jsonc` of the project:

```json
{
  "$schema": "https://opencode.ai/config.json",
  "model": "api/kimi-k2.7-code",
  "providers": {
    "api": {
      "name": "Interweb",
      "env": ["INTERWEB_API_KEY"],
      "package": "@opencode/ai/providers/openai-compatible",
      "settings": {
        "baseURL": "https://api.interweb.co.mz/v1"
      },
      "models": {
        "kimi-k2.7-code": { "modelID": "moonshotai/kimi-k2.7-code", "name": "Kimi K2.7 Code" },
        "glm-5.2": { "modelID": "zai-org/glm-5.2", "name": "GLM 5.2" }
      }
    }
  }
}
```

- `env` says which environment variable has the key.
- Each model has a short name (the key inside `models`) and, in `modelID`, the `id` it sends to us.
- Choose the model with `/models` or in `model`, in the `provider/model` format.
- This is the OpenCode 2 format. Earlier versions use `provider`, with `npm` and `options`, like Kilo Code below.

## Kilo Code

In the VS Code extension:

1. Open **Settings** (the gear icon) and the **Providers** tab.
2. At the end of the list, click **Custom provider**.
3. Fill in **Provider ID** (for example `api`), **Display name**, **Provider API** (**OpenAI Compatible**), **Base URL** (`https://api.interweb.co.mz/v1`) and **API key**.
4. In **Models**, choose the models from the list, which Kilo Code reads from [`GET /v1/models`](https://docs.interweb.co.mz/en/ai.md), and click **Submit**.

On the command line, add the provider to `~/.config/kilo/kilo.jsonc`:

```json
{
  "provider": {
    "api": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Interweb",
      "options": {
        "baseURL": "https://api.interweb.co.mz/v1",
        "apiKey": "{env:INTERWEB_API_KEY}"
      },
      "models": {
        "moonshotai/kimi-k2.7-code": { "name": "Kimi K2.7 Code", "limit": { "context": 262144, "output": 16000 } }
      }
    }
  },
  "model": "api/moonshotai/kimi-k2.7-code"
}
```

`{env:INTERWEB_API_KEY}` only works in the global file, in `~/.config/kilo/`: the `kilo.jsonc` of a project does not read environment variables, so a repository cannot read your key.

## Plans and credits

There are two ways to pay for what the tools use, and both work with the same key:

- **Credits**: each request pays for its tokens at the model price in `GET /v1/models`, with a reservation and a final charge, as in [How chat is charged](https://docs.interweb.co.mz/en/ai.md).
- **Coding Plan**: a monthly subscription with points to spend every week on the coding models. Subscribe in the [Plan tab of All in One AI](https://www.meu.interweb.co.mz/all-in-one-ai.php?language=english&currency=2&view=plan), where you also see the price in your currency.

### The plans

| Plan | Points per week | Points per month |
|---|---|---|
| Starter | 16.5 million | 33 million |
| Lite | 33 million | 66 million |
| Plus | 82.5 million | 165 million |
| Max | 165 million | 330 million |
| Ultra | 330 million | 660 million |
| Enterprise | 825 million | 1,650 million |

### How points are counted

- Each request to a model of the plan spends points instead of credits: the input, output and cache tokens, each multiplied by the value of that model. Stronger models spend more points per token.
- A request to a model that is not in the plan is paid with credits, as usual.
- The weekly points come back every Monday at 00:00 UTC and do not carry over to the next week.
- The monthly points count from the start of the subscription period and come back at each renewal.
- Whichever of the two limits runs out first counts, the weekly or the monthly one.

### When the points run out

- By default, the tools keep working and requests are paid with the credits in your balance, at the normal price, until the points come back.
- You can turn this off in the Plan tab of All in One AI, in "Use credits when the plan runs out". When it is off, or without credits, the API answers `429` with `plan_limit_reached` until the reset.
- The error has `details.limit` (`weekly` or `monthly`), `details.resets_at` and the `Retry-After` header, with the seconds left.

### Check what is left

[`GET /v1/ai/balance`](https://docs.interweb.co.mz/en/ai.md) shows the credits and, with a plan, the `subscription` object, with the points left this week and this month and when they come back:

```curl
curl "https://api.interweb.co.mz/v1/ai/balance" \
  -H "Authorization: Bearer $INTERWEB_API_KEY"
```

## Sandbox

With a `sandbox_` key, the tools always get the answer `Resposta de teste (sandbox).`, in the format each one uses, without calling the model and without spending credits or points. Use it to check the address, the key and the model. Then switch to the `prod_` key: with the sandbox one, the tool cannot write code.

## Common errors

| Status | Code | When it happens | What to do |
|---|---|---|---|
| `401` | `unauthorized` | The key is missing or wrong, or the tool did not read the environment variable. | Check the key and open a new terminal after you set the variable. |
| `402` | `insufficient_credits` | The credits are not enough for the reservation of the answer. | Buy credits or lower the maximum output (`CLAUDE_CODE_MAX_OUTPUT_TOKENS`, **Max Output Tokens**). |
| `403` | `insufficient_scope` | The key does not have `ai:write`. | Create a key with `ai:read` and `ai:write`. |
| `403` | `account_suspended` and other `account_*` | The All in One AI account is not active. | Open All in One AI and check the account status. |
| `404` | `model_not_found` | The model `id` is wrong or incomplete. | Use the `id` with the slash, as it comes in `GET /v1/models`. |
| `404` | `not_found` | The base address is wrong, for example with an extra `/v1` in Claude Code or a missing one in the other tools. | Check the address in [Before you start](https://docs.interweb.co.mz/en/coding-tools.md). |
| `429` | `plan_limit_reached` | The plan points ran out and the request cannot be paid with credits. | Wait for `resets_at`, turn on "Use credits when the plan runs out" or buy credits. |
| `429` | `rate_limited` | You went over the 90 requests per minute of the key. Coding agents make many requests in a row. | Wait the seconds in `Retry-After`. The tools usually retry by themselves. |
| `502` | `upstream_error` | The AI service did not respond as expected. | Try again shortly or choose another model. |

In Claude Code, errors come in the Anthropic format: the `type` follows the HTTP status (for example, `rate_limit_error` with `429`) and the message is the same. In Codex CLI they come in the OpenAI format, with the same `code`. The full list is in [Errors](https://docs.interweb.co.mz/en/api-rules.md).

## MCP server

Besides using our models to code, Claude Code, Codex, Cursor, Cline and Windsurf can connect to our MCP server, at `https://api.interweb.co.mz/mcp`, with the same key. This way the agent generates images, videos and voice and asks other models without leaving the chat. The setup of each tool and the skill for Claude Code are in [MCP](https://docs.interweb.co.mz/en/mcp.md).

## aio command

The `aio` command uses the same key to chat with the models in the terminal, generate images, videos and voice and check the balance, without setting up any tool. It also shows the MCP server setup for Claude Code, Codex and Cursor, with `aio mcp install`. It installs in one line: see [CLI](https://docs.interweb.co.mz/en/cli.md).
