Using Aegis With Agents

Configure OpenCode, Cline, and Claude Code Router with one Aegis key, and understand the current Codex limitation.

OpenCode

OpenCode can talk to Aegis through the `@ai-sdk/openai-compatible` adapter. Add Aegis as a custom provider and point it at the proxy base URL.

After saving the config, launch `opencode` and switch models from the built-in model picker when needed.

~/.config/opencode/opencode.json

{
  "$schema": "https://opencode.ai/config.json",
  "model": "aegis/glm-5.2",
  "provider": {
    "aegis": {
      "name": "Aegis",
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://proxy.aegis.dev/v1",
        "apiKey": "{env:AEGIS_API_KEY}"
      },
      "models": {
        "glm-5.2": {
          "name": "GLM-5.2",
          "limit": { "context": 1048560 }
        },
        "qwen3.5-397b": {
          "name": "Qwen3.5 397B",
          "limit": { "context": 262128 }
        },
        "kimi-k2.7-code": {
          "name": "Kimi K2.7 Code",
          "limit": { "context": 262128 }
        }
      }
    }
  }
}

Cline

Cline supports OpenAI-compatible providers directly from its settings panel.

  • Open the Cline settings panel.
  • Set `API Provider` to `OpenAI Compatible`.
  • Set `Base URL` to `https://proxy.aegis.dev/v1`.
  • Paste your `aegis_...` key into the API key field.
  • Enter a model ID from the Aegis Models page, such as `glm-5.2` or `qwen3.6-35b`.
If Cline asks for optional model metadata such as context window, pricing, or image support, use the values listed on the Aegis Models page.

Claude Code

Claude Code does not speak the OpenAI format directly. Route it through `claude-code-router`, then send that router to Aegis's chat completions endpoint.

Shell

npm install -g @anthropic-ai/claude-code
npm install -g @musistudio/claude-code-router

export AEGIS_API_KEY="aegis_..."

~/.claude-code-router/config.json

{
  "Providers": [
    {
      "name": "aegis",
      "api_base_url": "https://proxy.aegis.dev/v1/chat/completions",
      "api_key": "$AEGIS_API_KEY",
      "models": ["glm-5.2", "qwen3.5-397b", "kimi-k2.7-code"]
    }
  ],
  "Router": {
    "default": "aegis,glm-5.2",
    "background": "aegis,glm-5.2"
  }
}

Codex CLI

Codex CLI currently expects the OpenAI Responses API. Aegis currently documents and supports the OpenAI-compatible chat completions shape, not a direct Responses API integration.

That means you should not point Codex CLI at Aegis yet and expect full support. Use OpenCode, Cline, or Claude Code Router today for coding-agent workflows over the Aegis endpoint.

When Aegis adds a supported Responses API surface, this page should be expanded with a `~/.codex/config.toml` example.