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

# Coding tools

> Use Aesoteric models in Claude Code, Codex, Pi, OpenCode, Cursor and other tools.

Any tool that lets you set an OpenAI or Anthropic base URL and key can use Aesoteric. The [API keys](https://app.aesoteric.ai/keys#coding-agents) page in the console shows the Claude Code and Pi setups filled in with current model ids and context sizes.

In the examples, replace `<model-id>` with a model id and `<context-length>` with that model's `context_length` from the [Models](https://docs.aesoteric.ai/models.md) page.

Use one key per tool, so you can see each tool's spend and revoke it on its own.

## Any OpenAI-compatible tool

| Setting | Value |
| - | - |
| Base URL | `https://api.aesoteric.ai/v1` |
| API key | One of your keys |
| Model | A model id from the [Models](https://docs.aesoteric.ai/models.md) page |

Tools that speak the Anthropic format use `https://api.aesoteric.ai` as the base URL, without `/v1`.

## Claude Code

Set these in your shell, then start `claude`:

```bash theme={null}
export ANTHROPIC_BASE_URL=https://api.aesoteric.ai
export ANTHROPIC_AUTH_TOKEN=sk-...
export ANTHROPIC_MODEL=<model-id>
export ANTHROPIC_DEFAULT_HAIKU_MODEL=<model-id>
export CLAUDE_CODE_MAX_CONTEXT_TOKENS=<context-length>
```

* `ANTHROPIC_DEFAULT_HAIKU_MODEL` covers the background tasks Claude Code would otherwise send to a Claude model.
* `CLAUDE_CODE_MAX_CONTEXT_TOKENS` tells Claude Code the real context size of the model you chose. Without it, Claude Code can send prompts longer than that model accepts, and those are answered `400`.
* Claude Code's WebSearch tool is refused, because there is no web search. To keep it from being tried, deny it in `.claude/settings.json`:

```json theme={null}
{"permissions": {"deny": ["WebSearch"]}}
```

Anthropic does not support Claude Code with other providers' models, so expect rough edges. See the [Claude Code docs](https://code.claude.com/docs).

## Codex

Codex uses the [Responses](https://docs.aesoteric.ai/api-formats.md#responses) format. Add a provider to `~/.codex/config.toml`:

```toml ~/.codex/config.toml theme={null}
model = "<model-id>"
model_provider = "aesoteric"
model_context_window = <context-length>

[model_providers.aesoteric]
name = "Aesoteric"
base_url = "https://api.aesoteric.ai/v1"
env_key = "AESOTERIC_API_KEY"
wire_api = "responses"
```

Then set your key and run Codex:

```bash theme={null}
export AESOTERIC_API_KEY=sk-...
codex
```

* Codex's web search tool is removed from each request, so you don't need to turn it off.
* Codex offers its `apply_patch` tool only when its model metadata asks for it. Without that, it edits files with shell commands. Both work.

OpenAI does not support Codex with other providers' models, so expect rough edges.

## Pi

1. Add an `aesoteric` provider to `~/.pi/agent/models.json`, merging it into `providers` if the file exists. The **Pi** tab on the [API keys](https://app.aesoteric.ai/keys#coding-agents) page has this file filled in for every model. To write it yourself, add one entry to `models` per model, and in `thinkingLevelMap` map each Pi level to an effort from that model's `reasoning.supported_efforts`, or to `null` if it isn't listed. Set `reasoning` to `false` if that model lists no efforts:

```json ~/.pi/agent/models.json theme={null}
{
  "providers": {
    "aesoteric": {
      "name": "Aesoteric",
      "baseUrl": "https://api.aesoteric.ai/v1",
      "api": "openai-completions",
      "apiKey": "$AESOTERIC_API_KEY",
      "compat": {
        "supportsDeveloperRole": false,
        "supportsReasoningEffort": false,
        "maxTokensField": "max_tokens",
        "thinkingFormat": "chat-template",
        "chatTemplateKwargs": { "reasoning_effort": { "$var": "thinking.effort" } }
      },
      "models": [
        {
          "id": "<model-id>",
          "reasoning": true,
          "thinkingLevelMap": {
            "off": "none",
            "minimal": null,
            "low": "low",
            "medium": "medium",
            "high": "high",
            "xhigh": null,
            "max": null
          },
          "input": ["text"],
          "contextWindow": <context-length>,
          "maxTokens": 65536
        }
      ]
    }
  }
}
```

`input` is that model's `architecture.input_modalities`. `maxTokens` is Pi's own cap on one answer, not a model limit.

2. Set your key in the shell that starts Pi:

```bash theme={null}
export AESOTERIC_API_KEY=sk-...
```

3. Start `pi`, run `/model` and choose a model.

See [pi.dev](https://pi.dev).

## OpenCode

Add a custom provider to `opencode.json` in your project, or to `~/.config/opencode/opencode.json`:

```json opencode.json theme={null}
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "aesoteric": {
      "name": "Aesoteric",
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://api.aesoteric.ai/v1",
        "apiKey": "{env:AESOTERIC_API_KEY}"
      },
      "models": {
        "<model-id>": {}
      }
    }
  }
}
```

Set your key in the shell that starts OpenCode, then start `opencode` and choose `aesoteric/<model-id>` with `/models`:

```bash theme={null}
export AESOTERIC_API_KEY=sk-...
opencode
```

opencode.ai's docs show a newer config format (`providers`, `package`, `settings`) that OpenCode 1.19.6, the latest release as of November 2026, doesn't read, so use the format above. See [opencode.ai](https://opencode.ai).

## Cursor

1. Open **Cursor Settings** > **Models**.
2. Turn on **OpenAI API Key** and paste your Aesoteric key.
3. Turn on **Override OpenAI Base URL** and enter `https://api.aesoteric.ai/v1`.
4. Add `<model-id>` as a custom model and choose it.

Cursor sends these requests from its own servers, and custom keys work only for chat. The base URL override applies to every OpenAI model in Cursor, so turn it off to use Cursor's own OpenAI models. See Cursor's [API keys docs](https://cursor.com/docs/settings/api-keys).


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