packages/kilo-docs/pages/ai-providers/zenmux.md
ZenMux provides a unified API gateway to access multiple AI models from different providers through a single endpoint. It supports OpenAI, Anthropic, Google, and other major AI providers, automatically handling routing, fallbacks, and cost optimization.
{% tabs %} {% tab label="VSCode (Legacy)" %}
{% /tab %} {% tab label="VSCode" %}
Open Settings (gear icon) and go to the Providers tab to add ZenMux and enter your API key.
The extension stores this in your kilo.json config file. You can also edit the config file directly — see the CLI tab for the file format.
{% /tab %} {% tab label="CLI" %}
Set the API key as an environment variable or configure it in your kilo.json config file:
Environment variable:
export ZENMUX_API_KEY="your-api-key"
Config file (~/.config/kilo/kilo.json or ./kilo.json):
{
"provider": {
"zenmux": {
"env": ["ZENMUX_API_KEY"],
},
},
}
Then set your default model:
{
"model": "zenmux/openai/gpt-5",
}
{% /tab %} {% /tabs %}
ZenMux supports a wide range of models from various providers:
Visit zenmux.ai/models to see the complete list of available models.
ZenMux also supports models from Meta, Mistral, and many other providers. Check your ZenMux dashboard for the complete list of available models.
ZenMux provides multiple API endpoints for different protocols:
Use the standard OpenAI SDK with ZenMux's base URL:
import OpenAI from "openai"
const openai = new OpenAI({
baseURL: "https://zenmux.ai/api/v1",
apiKey: "<ZENMUX_API_KEY>",
})
async function main() {
const completion = await openai.chat.completions.create({
model: "openai/gpt-5",
messages: [
{
role: "user",
content: "What is the meaning of life?",
},
],
})
console.log(completion.choices[0].message)
}
main()
For Anthropic models, use the dedicated endpoint:
import Anthropic from "@anthropic-ai/sdk"
// 1. Initialize the Anthropic client
const anthropic = new Anthropic({
// 2. Replace with the API key from your ZenMux console
apiKey: "<YOUR ZENMUX_API_KEY>",
// 3. Point the base URL to the ZenMux endpoint
baseURL: "https://zenmux.ai/api/anthropic",
})
async function main() {
const msg = await anthropic.messages.create({
model: "anthropic/claude-sonnet-4.5",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello, Claude" }],
})
console.log(msg)
}
main()
The Get generation interface is used to query generation information, such as usage and costs.
curl https://zenmux.ai/api/v1/generation?id=<generation_id> \
-H "Authorization: Bearer $ZENMUX_API_KEY"
For Google models:
const genai = require("@google/genai")
const client = new genai.GoogleGenAI({
apiKey: "$ZENMUX_API_KEY",
vertexai: true,
httpOptions: {
baseUrl: "https://zenmux.ai/api/vertex-ai",
apiVersion: "v1",
},
})
const response = await client.models.generateContent({
model: "google/gemini-2.5-pro",
contents: "How does AI work?",
})
console.log(response)
ZenMux automatically routes your requests to the best available provider based on:
If a provider is unavailable, ZenMux automatically falls back to alternative providers that support the same model capabilities.
ZenMux can be configured to optimize for cost, routing requests to the most cost-effective provider while maintaining quality.
Enable ZDR mode to ensure that no request or response data is stored by ZenMux, providing maximum privacy for sensitive applications.
You can specify routing preferences:
Control how ZenMux handles your data:
Enable the middle-out transform feature to optimize prompts that exceed model context limits.
For additional support: