Skip to content

Add support for proxying models from kilocode CLI #213

@benzntech

Description

@benzntech

Summary

Add support for Kilo API (https://api.kilo.ai) which provides access to multiple free models including z-ai/glm-4.7:free.

Background

Kilo API is an OpenRouter-compatible API that can be used directly without the CLI. It provides free access to multiple models.

Quick Test

# List models
curl https://api.kilo.ai/api/openrouter/models

# Chat completion with free model
curl -X POST https://api.kilo.ai/api/openrouter/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer anonymous" \
  -H "User-Agent: kilo/1.0.14" \
  -d '{
    "model": "z-ai/glm-4.7:free",
    "messages": [{"role": "user", "content": "Hello"}],
    "max_tokens": 100
  }'

Available Free Models

  • minimax/minimax-m2.1:free
  • z-ai/glm-4.7:free
  • arcee-ai/trinity-large-preview:free
  • openrouter/free
  • stepfun/step-3.5-flash:free

API Details

  • Base URL: https://api.kilo.ai/api/openrouter
  • Format: OpenAI/OpenRouter compatible
  • Authentication: Authorization: Bearer anonymous (for free access) or valid token
  • Headers Required:
    • User-Agent: kilo/1.0.14 (or similar)
    • Content-Type: application/json

Feature Request

1. Add Kilo Provider to CLIProxyAPI

provider: kilo
baseURL: https://api.kilo.ai/api/openrouter
apiKey: anonymous
format: openai-compatible

2. Model Discovery

  • GET /v1/models → Proxy to https://api.kilo.ai/api/openrouter/models

3. Chat Completions

  • POST /v1/chat/completions → Proxy to Kilo API
  • Add required headers

Implementation Example

// In CLIProxyAPI provider registry
type KiloProvider struct {
    baseURL string
    apiKey  string
}

func (k *KiloProvider) ListModels() ([]Model, error) {
    resp, err := http.Get(k.baseURL + "/models")
    // ...
}

func (k *KiloProvider) ChatCompletion(req ChatRequest) (*ChatResponse, error) {
    headers := map[string]string{
        "Authorization": "Bearer " + k.apiKey,
        "User-Agent":    "cli-proxy-api/1.0",
        "Content-Type":  "application/json",
    }
    // ...
}

Priority

High - Direct API access confirmed working with free models

Additional Resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions