Kilo CLI Integration

AVELIN API works with Kilo CLI — the command-line client for Kilo Code. Kilo CLI connects directly to AVELIN and provides terminal-based AI coding assistance with file operations, command execution, and multi-step task automation.

Why AVELIN + Kilo CLI? Get access to frontier coding models through Kilo's terminal interface with 1M-token context windows, automatic failover, and competitive pricing.


Quick Setup

Step 1: Get your AVELIN API key

Sign up at avelin.ai and generate an API key. It will look like sk-ave...xxxx.

Step 2: Install Kilo CLI

Prerequisites: Install Node.js (v18.0 or later).

npm install -g @kilocode/cli
kilo --version

If a version number displays, the installation was successful.

Step 3: Configure Kilo CLI

Create the configuration file at ~/.config/kilo/config.json:

{
  "$schema": "https://kilo.ai/config.json",
  "provider": {
    "avelin": {
      "npm": "@ai-sdk/anthropic",
      "name": "AVELIN AI",
      "options": {
        "baseURL": "https://api.avelin.ai",
        "apiKey": "sk-a...
      },
      "models": {
        "avelin-coding-pro": {
          "name": "Avelin Coding Plus",
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 32768
            }
          }
        },
        "avelin-coding-fast": {
          "name": "Avelin Coding",
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 32768
            }
          }
        },
        "avelin-coding-ultra": {
          "name": "Avelin Coding Architect",
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 32768
            }
          }
        },
        "avelin-fast": {
          "name": "Avelin Fast"
        }
      }
    }
  }
}

Step 4: Start Kilo CLI

kilo

Kilo CLI will automatically use AVELIN as the backend.


Primary Recommendation: avelin-coding-pro

For everyday coding tasks:

Featureavelin-coding-proWhy it matters for Kilo CLI
Context window1M tokensLarge codebases and multi-file refactors without context loss
Max output65K tokensGenerate large code files and comprehensive tests
Throughput~100 tokens/sec2× faster than standard tiers — faster feedback loops
ReasoningDeep step-by-step thinkingCatches subtle bugs, understands architectural impact
Tool callingFirst-class supportReliable file operations and command execution

Alternative Models

ModelWhen to use
avelin-coding-fastLighter coding tasks, quick questions — saves cost on simple work
avelin-coding-ultraSystem design, architecture reviews, security-sensitive refactors
avelin-fastQuick lookups and simple extractions — lowest cost, fastest response

Why AVELIN for Kilo CLI?

1. Cost Optimization

Kilo CLI sessions can be long with large context windows. AVELIN delivers frontier-tier coding quality at sustainable economics:

  • Prompt caching: ~80% cost reduction on repeated system prompts
  • Competitive pricing: Lower per-token costs than direct provider APIs
  • Pay-per-token: No subscription lock-in

2. Model Diversity

Access multiple frontier coding models through one API. AVELIN routes your requests to a diverse set of frontier models across multiple cloud providers, ensuring high availability and consistent quality. If one provider is slow or unavailable, your request automatically routes to the next best option.

3. Reliability

  • Automatic failover: If one provider is slow or down, AVELIN switches to another
  • Retry logic: Transient errors are handled automatically
  • 99.9% uptime: Enterprise-grade infrastructure

4. 1M Context Windows

Kilo CLI works best with large context. AVELIN's coding models support 1M tokens — load entire repositories without chunking.


Example Session

$ kilo

╭─ Kilo CLI ──────────────────────────────────╮
│ Model: avelin-coding-pro                   │
│ Provider: AVELIN (api.avelin.ai)           │
╰─────────────────────────────────────────────╯

You> Refactor the database layer to use the repository pattern.

Kilo: I'll refactor your database layer to use the repository pattern.
      Let me examine the current implementation...

[Reads database files, service layer]

Current state:
- Direct database calls in service files
- No abstraction layer
- Difficult to test and maintain

Here's my plan:
1. Create repository interfaces for each entity
2. Implement repositories with database operations
3. Update services to use repositories instead of direct DB calls
4. Add dependency injection for testability
5. Write tests for repositories and updated services

Shall I proceed?

You> yes

Kilo: [Creates repositories/user.repository.ts]
      [Creates repositories/product.repository.ts]
      [Updates services/user.service.ts]
      [Updates services/product.service.ts]
      [Creates tests/repositories/user.repository.test.ts]
      [Runs tests — all passing]

Done! I've refactored the database layer:
- Created repository interfaces and implementations
- Updated all services to use repositories
- Added dependency injection
- Wrote 15 passing tests

The codebase is now more testable and maintainable.

Advanced Configuration

Multiple Providers

You can configure multiple providers in ~/.config/kilo/config.json:

{
  "$schema": "https://kilo.ai/config.json",
  "provider": {
    "avelin": {
      "npm": "@ai-sdk/anthropic",
      "name": "AVELIN AI",
      "options": {
        "baseURL": "https://api.avelin.ai",
        "apiKey": "sk-a...
      },
      "models": {
        "avelin-coding-pro": {
          "name": "Avelin Coding Plus",
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 32768
            }
          }
        }
      }
    },
    "avelin-anthropic": {
      "npm": "@ai-sdk/anthropic",
      "name": "AVELIN AI (Anthropic)",
      "options": {
        "baseURL": "https://api.avelin.ai",
        "apiKey": "sk-a...
      },
      "models": {
        "avelin-coding-pro": {
          "name": "Avelin Coding Plus",
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 32768
            }
          }
        }
      }
    }
  }
}

Thinking Budget

The configuration includes budgetTokens: 32768 for thinking. This allocates tokens for the model's reasoning process:

  • Higher budget (32K+): Better for complex refactors, architecture decisions
  • Lower budget (8K): Faster responses for simple edits
  • Disabled: For quick questions where speed matters most
{
  "avelin-fast": {
    "name": "Avelin Fast",
    "options": {
      "thinking": {
        "type": "disabled"
      }
    }
  }
}

Model Switching

You can switch models on-the-fly in Kilo CLI:

kilo --model avelin-coding-ultra

Or set different models for different tasks in your config.


Troubleshooting

IssueSolution
"Provider not found"Ensure @ai-sdk/anthropic is specified in the npm field
"Model not available"Use a valid AVELIN model name from the Model Catalog
Slow first responseNormal — model thinks before responding. Streaming starts after reasoning completes.
Context too long errorsSet context_length: 1000000 in your configuration
API key errorsVerify your AVELIN API key is correct and active