AgentsOpen Source 🇷🇺 31.07.2026 10:02

One Interface, Nine LLM Providers: How We Brought Kimi K3, GLM-5.2, Claude, and Ollama into One Terminal Agent

Moonshot AIMoonshot AI AnthropicAnthropic OpenAIOpenAI
execai, a terminal AI agent written in Go, now supports nine LLM providers behind a single interface, allowing users to switch between sources like Kimi Code, GLM Coding Plan, and local Ollama in one chat with shared history. The architecture handles two incompatible API dialects (Anthropic-compat and OpenAI-compat), SSE streaming with tool call accumulation, dynamic model catalogs, and automatic subscription tier detection. The project is open source on GitHub.
The author built execai, a terminal AI agent in Go, to support multiple LLM providers in one chat with shared history and seamless switching. The core is a five-line interface, StreamingLLM, which abstracts the tool-use loop over nine providers: execai gateway, Z.ai, Kimi Code, Moonshot Platform, Anthropic API, OpenAI API, Ollama cloud, Ollama local, and local CLIs like Claude Code and Codex CLI. All providers reduce to two API dialects: OpenAI-compatible (chat/completions with delta.tool_calls) and Anthropic-compatible (messages API with thinking_delta). Up to four implementations of StreamingLLM suffice: a custom gateway client, generic OpenAI-compat, generic Anthropic-compat, and wrappers over local CLIs. The author highlights pitfalls: Z.ai and Kimi subscription keys work only on Anthropic-compatible endpoints, with separate billing from pay-per-token APIs; tool calls must be accumulated by index; dynamic model catalogs fetch /v1/models for OpenAI-compat sources; and Kimi Code's /coding/v1/models endpoint reveals the subscription tier by listing only available models (k3, kimi-for-coding, kimi-for-coding-highspeed), while usage quotas come from /coding/v1/usages. Claude Code Pro and Codex CLI are delegated to local binaries via stream-json output, but agent tools are not available this way. Switching sources requires careful invariants: find models only in the new catalog, restore the default catalog snapshot, and always recreate the client to avoid mixing incompatible dialects. The author praises Kimi K3 and GLM-5.2 (MoE 753B/40B with dual thinking) as capable and affordable, and notes that both subscriptions are purchasable without a Western bank card. The code is open source on GitHub.
Сокращения
API = Application Programming Interface — программный интерфейс приложения
CLI = Command Line Interface — интерфейс командной строки
JSON = JavaScript Object Notation — формат обмена данными
JSONL = JSON Lines — формат JSON Lines
SSE = Server-Sent Events — события, отправляемые сервером
MoE = Mixture of Experts — смесь экспертов
Source: Habr — хаб ИИ — original
Our earlier posts on this topic ↓
Fresh news