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

# Kimi Code CLI Integration with Eden AI

> Configure Kimi Code CLI to use Eden AI as a custom model provider for 500+ models with one API key, plus Eden AI expert models as MCP tools.

**Kimi Code CLI Integration with Eden AI**

Configure Kimi Code CLI to use Eden AI as a custom model provider for 500+ models with one API key, plus Eden AI expert models as MCP tools.

[Kimi Code CLI](https://github.com/MoonshotAI/kimi-code) (`kimi`) is Moonshot AI's terminal coding agent. It reads custom providers and models from `~/.kimi-code/config.toml` and supports OpenAI-compatible Chat Completions (`openai`), OpenAI Responses (`openai_responses`), and Anthropic Messages (`anthropic`). Kimi Code sends tool definitions with every request, so choose a model that supports function calling.

## Overview

Pointing Kimi Code at Eden AI gives you:

* **500+ models**: switch between Kimi, Claude, GPT, Gemini, and more from one config file
* **One API key**: unified billing, routing, and monitoring across providers
* **Expert models as MCP tools**: connect Eden AI's [MCP server](https://www.edenai.co/docs/v3/expert-models/mcp-server.md) for OCR, web search, speech, and translation

## Prerequisites

* Kimi Code CLI installed ([install instructions](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/getting-started.html))

* An Eden AI API key from [app.edenai.run](https://app.edenai.run) → **API Keys**

## Setup

### 1. Configure `~/.kimi-code/config.toml`

Kimi Code reads its provider and model definitions from `~/.kimi-code/config.toml` (creating the file on first run if it does not exist). Add an `edenai` provider using `type = "openai"` (the OpenAI Chat Completions protocol) and declare the models you want to use:

```toml ~/.kimi-code/config.toml theme={null}
default_model = "kimi-k2.7-code"

[providers.edenai]
type = "openai"
base_url = "https://api.edenai.run/v3"
api_key_env = "EDENAI_API_KEY"

[models."kimi-k2.7-code"]
provider = "edenai"
model = "kimi-k2.7-code"
max_context_size = 262144
capabilities = ["thinking", "image_in", "tool_use"]

[models."claude-sonnet-5.5"]
provider = "edenai"
model = "claude-sonnet-5.5"
max_context_size = 1000000
capabilities = ["thinking", "image_in", "tool_use"]
```

> [!NOTE]
>
> TOML requires quotes around section keys that contain dots, such as `[models."kimi-k2.7-code"]`. `default_model` must match one of the keys defined under `[models.*]`.

### 2. Launch Kimi Code

```bash theme={null}
export EDENAI_API_KEY="YOUR_EDEN_AI_API_KEY"
kimi
```

To use a separate configuration for a specific project or environment, create a directory and copy the configuration above to `config.toml` in it. Then point `KIMI_CODE_HOME` at that directory:

```bash theme={null}
KIMI_CODE_HOME=/path/to/kimi-home kimi
```

## Model naming and switching

Set `model` to any canonical model name (such as `kimi-k2.7-code`, `kimi-k3.1-pro`, `claude-sonnet-5.5`, or `gpt-5.5`) or a specific `provider/model` ID from `GET https://api.edenai.run/v3/models?view=models` (see [List Models](https://www.edenai.co/docs/v3/llms/listing-models.md)). Use the model's `context_length` from the catalog for `max_context_size`.

Because Kimi Code attaches tool definitions on every turn, only pick models whose catalog entry has `capabilities.supports_function_calling: true`.

To switch models for a single session, pass `--model`:

```bash theme={null}
kimi --model claude-sonnet-5.5
```

### Other provider protocols

`openai` (Chat Completions) is the simplest default because every chat model in the Eden AI catalog supports it. If you prefer another wire protocol under `https://api.edenai.run/v3`:

* `type = "openai_responses"` sends requests to `/v3/responses`.
* `type = "anthropic"` sends requests to `/v3/v1/messages` (use this for Claude models).

## Expert Models as Tools (MCP)

Eden AI hosts an [MCP server](https://www.edenai.co/docs/v3/expert-models/mcp-server.md) that exposes OCR, web search, speech, translation, and more as tools. Run `/mcp-config` inside a Kimi Code session to add it, or edit `~/.kimi-code/mcp.json` directly (`$KIMI_CODE_HOME/mcp.json` when `KIMI_CODE_HOME` is set, or `.kimi-code/mcp.json` for a single project):

```json ~/.kimi-code/mcp.json theme={null}
{
  "mcpServers": {
    "edenai": {
      "url": "https://mcp.edenai.run/mcp",
      "bearerTokenEnvVar": "EDENAI_API_KEY"
    }
  }
}
```

The MCP example reads the same `EDENAI_API_KEY` variable exported above, so no key is stored in the file. Export it in each shell that launches Kimi Code. After editing the file directly, start a new Kimi Code session. Run `/mcp` to check the connected server and its loaded tools. See the [MCP server page](https://www.edenai.co/docs/v3/expert-models/mcp-server.md) for the full tool catalog.

## Troubleshooting

### Authentication errors

Verify that `EDENAI_API_KEY` is exported in the shell launching Kimi Code and that the key has LLM access enabled. You can test the same `/v3/chat/completions` endpoint directly:

```bash theme={null}
curl -X POST https://api.edenai.run/v3/chat/completions \
  -H "Authorization: Bearer YOUR_EDEN_AI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "kimi-k2.7-code", "messages": [{"role": "user", "content": "ping"}]}'
```

### Connection issues

Confirm `base_url` is `https://api.edenai.run/v3` without a trailing `/chat/completions`. With `type = "openai"`, Kimi Code appends `/chat/completions` automatically. Check Eden AI's service status at [app-edenai.instatus.com](https://app-edenai.instatus.com).

### Missing `max_context_size` or model errors

Kimi Code requires `max_context_size` on every `[models.*]` entry. Confirm the model ID exists in `GET https://api.edenai.run/v3/models?view=models` and that its `capabilities.supports_function_calling` field is `true`.

## Next Steps

* [Claude Code](https://www.edenai.co/docs/v3/integrations/claude-code.md): Anthropic's official CLI on Eden AI
* [Codex CLI](https://www.edenai.co/docs/v3/integrations/codex-cli.md): OpenAI's local coding agent on Eden AI
* [OpenCode](https://www.edenai.co/docs/v3/integrations/opencode.md): terminal coding agent with auto-generated config
* [List Models](https://www.edenai.co/docs/v3/llms/listing-models.md): browse the catalog with capabilities and pricing
* [MCP server](https://www.edenai.co/docs/v3/expert-models/mcp-server.md): the full expert model tool catalog


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