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

# Use Kilo Code CLI with A2Agent for Lower-Cost Models

> Kilo Code CLI loads custom providers from kilo.json. Add A2Agent there, then pick any A2Agent model from the Kilo picker and code from your terminal.

Kilo Code CLI supports custom providers through its `kilo.json` configuration file. After adding A2Agent, you can select a model using the Kilo model picker and run coding tasks directly from your terminal.

## Prerequisites

* Kilo Code CLI installed — follow the [official Kilo CLI guide](https://kilo.ai/docs/code-with-ai/platforms/cli)
* An A2Agent API key — [sign up at a2agent.me/register](https://a2agent.me/register) to get one
* A model ID listed on the [A2Agent Models page](https://a2agent.me/models)

## Setup

<Steps>
  <Step title="Install Kilo Code CLI">
    Create the configuration directory:

    ```bash theme={null}
    mkdir -p ~/.config/kilo
    ```

    Create or edit the global configuration file:

    ```bash theme={null}
    nano ~/.config/kilo/kilo.json
    ```
  </Step>

  <Step title="Add A2Agent as a custom provider">
    Add the following configuration:

    ```bash theme={null}
    {
      "$schema": "https://app.kilo.ai/config.json",
      "provider": {
        "a2agent": {
          "npm": "@ai-sdk/openai-compatible",
          "models": {
            "deepseek-v4-flash": {
              "name": "DeepSeek V4 Flash"
            },
            "deepseek-v4-pro": {
              "name": "DeepSeek V4 Pro"
            }
            "minimax-m2.5": {
              "name": "MiniMax M2.5"
            }
          },
          "options": {
            "apiKey": "YOUR_A2AGENT_KEY",
            "baseURL": "https://api.a2agent.me/v1"
          }
        }
      },
      "model": "a2agent/deepseek-v4-flash"
    }
    ```

    Replace YOUR\_A2AGENT\_KEY with your A2Agent API key.

    The API key is written directly into the local Kilo configuration. You do not need to set `OPENAI_API_KEY`, `OPENAI_BASE_URL`, or complete a separate login flow.

    Use the exact model IDs currently shown on the [A2Agent Models page](https://a2agent.me/models). The model IDs above are examples and may change.

    If your file already contains other providers, add `a2agent` inside the existing `provider` object instead of replacing the entire file.
  </Step>

  <Step title="Start Kilo Code CLI">
    Go to the project you want to work on:

    ```bash theme={null}
    cd /path/to/your/project
    ```

    Start Kilo:

    ```bash theme={null}
    kilo
    ```
  </Step>

  <Step title="Select or switch models">
    Open the model picker:

    ```bash theme={null}
    /models
    ```

    Select the `a2agent` provider, then choose a configured model.

    For example:

    ```text theme={null}
    a2agent/deepseek-v4-flash
    a2agent/deepseek-v4-pro
    ```
  </Step>

  <Step title="Run a task and verify the connection">
    Enter a task in the Kilo session:

    ```text theme={null}
    Summarize this repository and explain how to run its tests.
    ```

    You can also run a one-shot task:

    ```text theme={null}
    kilo run "Review this repository and suggest improvements."
    ```

    If Kilo returns a response, the A2Agent connection is working.
  </Step>
</Steps>

## Troubleshooting

<AccordionGroup>
  <Accordion title="401 Unauthorized">
    Kilo reached A2Agent, but the API key was rejected.

    * Confirm that the key is a valid A2Agent API key.
    * Make sure the complete key was copied.
    * Check for extra spaces or line breaks.
    * Do not use an OpenAI API key.
    * Confirm that `apiKey` is inside the `a2agent` provider’s `options` object.
  </Accordion>

  <Accordion title="Connection error">
    Confirm that the base URL is exactly:

    ```text theme={null}
    https://api.a2agent.me/v1
    ```
  </Accordion>

  <Accordion title="A2Agent models do not appear">
    Check that:

    * the file is located at `~/.config/kilo/kilo.json`;
    * the JSON syntax is valid;
    * the Provider ID is `a2agent`;
    * the provider uses `@ai-sdk/openai-compatible`;
    * at least one model is listed;
    * `apiKey` is inside `options`; and
    * the model ID is spelled correctly.

    After editing the file, close and restart Kilo.
  </Accordion>

  <Accordion title="Model not found">
    The model ID must match an available A2Agent model exactly.

    Check the current list at:[https://a2agent.me/models](https://a2agent.me/models)

    Then update the corresponding entry under `models` and, if necessary, the default `model` value.
  </Accordion>
</AccordionGroup>
