---
title: "Use Autohand models in Kilo Code"
source: https://docs.autohand.ai/integrations/coding-agents/kilo-code
---

# Use Autohand models in Kilo Code

Add Autohand as a custom provider in Kilo Code, choose Fantail or Moa for each agent, and send subagent work to Fantail.

Quick answer

## How do I use Autohand models in Kilo Code?

Kilo Code accepts any OpenAI Chat Completions endpoint as a custom provider. Add a provider that points to `https://api.autohand.ai/v1`, authenticate with your Autohand API key, and select `autohand/fantail` or `autohand/moa`. The same `kilo.jsonc` file configures the VS Code extension and the Kilo CLI.

Status

Available through the OpenAI Compatible provider type

Requires

An Autohand account, an Autohand API key, and Kilo Code for VS Code or the Kilo CLI.

Configure with

A custom provider in **Settings** > **Providers**, or the `provider` section of `kilo.jsonc`.

Best for

Using Moa for architecture and planning while code and subagent work runs on Fantail.

**Know before you start:** Set the context and output limits for each model. Kilo treats a missing limit as `0`, which limits context management.

## Prerequisites

-   An Autohand account. [Sign up or sign in to Console](https://console.autohand.ai/). The Free plan includes Fantail. Moa requires the Pro plan or above.
-   An Autohand API key. The first step shows how to create one.
-   Kilo Code for VS Code, or the Kilo CLI. Install the CLI with `npm install -g @kilocode/cli`.

## Step 1: Create an Autohand API key

1.  Sign in to [Autohand Console](https://console.autohand.ai/).
2.  Open [API Keys](https://console.autohand.ai/api-keys) and select **Create API Key**.
3.  Enter a name that identifies the agent and machine, for example `kilo-laptop`.
4.  Select **Create Key** and copy the value. Console shows the key only once.

## Step 2: Store the key in an environment variable

Store the key in an environment variable so it stays out of configuration files and source control.

```bash
# macOS and Linux (add the line to ~/.zshrc or ~/.bashrc to keep it)
export AUTOHAND_API_KEY="your-api-key"
```

```powershell
# Windows PowerShell (current session)
$env:AUTOHAND_API_KEY = "your-api-key"

# Windows (persist for new sessions)
setx AUTOHAND_API_KEY "your-api-key"
```

Confirm that the key works and that your plan can see the models:

```bash
curl https://api.autohand.ai/v1/models \
  -H "Authorization: Bearer $AUTOHAND_API_KEY"
```

The response lists `fantail`, and `moa` when your plan includes it. A `401` response means the key is missing or not recognised.

Restart VS Code or open a new terminal after you set the variable so Kilo can read it.

## Step 3: Add Autohand as a custom provider

Use the VS Code settings, or edit `kilo.jsonc` directly. Both methods write the same configuration.

### In VS Code

1.  Open Kilo Code **Settings** (gear icon) and select the **Providers** tab.
2.  Scroll to the end of the provider list and select **Custom provider**.
3.  Enter the following values:
    -   **Provider ID**: `autohand`
    -   **Display name**: `Autohand`
    -   **Provider API**: **OpenAI Compatible**
    -   **Base URL**: `https://api.autohand.ai/v1`
    -   **API key**: your Autohand API key
    -   **Models**: select `fantail`, and `moa` if your plan includes it, from the list that Kilo loads from `/v1/models`. You can also add the IDs manually.
4.  Select **Submit**.

The dialog does not set token limits. Add them in `kilo.jsonc` as shown in the next section.

### In kilo.jsonc

Kilo reads a global file at `~/.config/kilo/kilo.jsonc` (on Windows, `C:\Users\<username>\.config\kilo\kilo.jsonc`) and a project file at `kilo.jsonc` or `.kilo/kilo.jsonc`. Add the provider to the global file so every project can use it:

```json
{
  "$schema": "https://app.kilo.ai/config.json",
  "model": "autohand/fantail",
  "provider": {
    "autohand": {
      "npm": "@ai-sdk/openai-compatible",
      "env": ["AUTOHAND_API_KEY"],
      "options": {
        "baseURL": "https://api.autohand.ai/v1"
      },
      "models": {
        "fantail": {
          "name": "Autohand Fantail",
          "tool_call": true,
          "limit": { "context": 262144, "output": 16000 }
        },
        "moa": {
          "name": "Autohand Moa",
          "tool_call": true,
          "limit": { "context": 1048576, "output": 262144 }
        }
      }
    }
  }
}
```

The `env` field tells Kilo to read the key from `AUTOHAND_API_KEY`, so the file contains no secret. The `model` key uses the `provider_id/model_id` format.

## Step 4: Choose Fantail or Moa

| Model ID | Use it for | Context | Max output | Plans |
|---|---|---|---|---|
| fantail | Main coding loops, quick fixes, reviews, and sub-agents | 262,144 tokens | 16,000 tokens | Free and above |
| moa | Planning, large refactors, and multi-file reasoning | 1,048,576 tokens | 262,144 tokens | Pro and above |

In VS Code, pick the model in the model selector, or set per-agent defaults in **Settings** > **Models**. In the CLI, list the models Kilo can see:

```bash
kilo models
```

Confirm that `autohand/fantail` appears in the list.

## Step 5: Run a test prompt

```bash
kilo run --model autohand/fantail "Summarize what this repository does in three sentences."
```

A text answer confirms that Kilo reaches Autohand with your key. In VS Code, start a new task with the Autohand model selected and send the same prompt.

## Run subagents on Fantail

Kilo agents such as Code, Architect, and Debug can each use a different model, and the `task` tool launches subagents. By default, a subagent inherits the model of the agent that launched it. Set `subagent_model` to send all subagent work to Fantail, and use the `agent` section for per-agent defaults:

```json
{
  "model": "autohand/moa",
  "subagent_model": "autohand/fantail",
  "small_model": "autohand/fantail",
  "agent": {
    "code": { "model": "autohand/fantail" },
    "architect": { "model": "autohand/moa" },
    "explore": { "model": "autohand/fantail" }
  }
}
```

-   `subagent_model` sets the default model for subagents that the `task` tool starts.
-   `small_model` handles session titles, commit messages, and prompt enhancement.
-   `agent.<name>.model` sets a default for one agent, such as `explore`.

You can also define a custom subagent as a Markdown file in `.kilo/agents/` for a project or `~/.config/kilo/agents/` for all projects:

```markdown
---
description: Reviews a diff for correctness, missing tests, and risky changes
mode: subagent
model: autohand/fantail
---

Review the changes you are given. List concrete problems with file paths.
Do not edit files.
```

Kilo starts the subagent through the `task` tool when its description matches the work, or when you mention it with `@` and its file name.

## Troubleshooting

| Symptom | Cause | Resolution |
|---|---|---|
| 401 with Credential not recognised. or Missing Autohand credential. | The agent sent no key, a mistyped key, or a revoked key. | Confirm that AUTOHAND_API_KEY is set in the environment that starts the agent. Create a new key in Console if needed. |
| 404 or Not found | The base URL or the API format is wrong. | Use https://api.autohand.ai/v1 with the OpenAI Chat Completions format. Autohand does not serve /v1/responses or /v1/messages. |
| Model not found or not available | The model ID is misspelled, or your plan does not include it. | Use the exact IDs fantail or moa. Moa requires the Pro plan or above. |
| Context length or output errors | The agent uses default limits for an unknown model. | Set the limits for Fantail (262,144 context, 16,000 output) or Moa (1,048,576 context, 262,144 output). |
| Autohand models do not appear in the picker | Kilo cached the project config when the session started. | Reload the VS Code window or start a new CLI session, then run kilo models. |

## Next steps

-   [Use Autohand models in other coding agents](https://docs.autohand.ai/integrations/coding-agents/)
-   [Compare Autohand models](https://docs.autohand.ai/models/)
-   [Fantail model reference](https://docs.autohand.ai/models/fantail/)
-   [Moa model reference](https://docs.autohand.ai/models/moa/)
-   [Create and protect an API key](https://docs.autohand.ai/agent-sdk/api-key-setup)

Common questions

## Kilo Code and Autohand FAQ

### Which provider type does Autohand use in Kilo Code?

Choose **OpenAI Compatible**. Autohand serves the OpenAI Chat Completions format at `https://api.autohand.ai/v1`.

### How do I make Kilo subagents use Fantail?

Set `subagent_model` to `autohand/fantail` in `kilo.jsonc`, or set `model: autohand/fantail` in a custom subagent definition.

### Do I need a paid Autohand plan?

Fantail is available on the Free plan and above. Moa requires the Pro plan or above.