|
| 1 | +--- |
| 2 | +title: ZenMux |
| 3 | +--- |
| 4 | + |
| 5 | +import Codicon from "@site/src/components/Codicon"; |
| 6 | + |
| 7 | +# Using ZenMux With Kilo Code |
| 8 | + |
| 9 | +[ZenMux](https://zenmux.ai) 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. |
| 10 | + |
| 11 | +## Getting Started |
| 12 | + |
| 13 | +1. **Sign up for ZenMux:** Visit [zenmux.ai](https://zenmux.ai) to create an account. |
| 14 | +2. **Get your API key:** After signing up, navigate to your dashboard to generate an API key. |
| 15 | +3. **Configure in Kilo Code:** Add your API key to Kilo Code settings. |
| 16 | + |
| 17 | +## Configuration in Kilo Code |
| 18 | + |
| 19 | +1. **Open Kilo Code Settings:** Click the gear icon (<Codicon name="gear" />) in the Kilo Code panel. |
| 20 | +2. **Select Provider:** Choose "ZenMux" from the "API Provider" dropdown. |
| 21 | +3. **Enter API Key:** Paste your ZenMux API key into the "ZenMux API Key" field. |
| 22 | +4. **Select Model:** Choose your desired model from the "Model" dropdown. |
| 23 | +5. **(Optional) Custom Base URL:** If you need to use a custom base URL for the ZenMux API, check "Use custom base URL" and enter the URL. Leave this blank for most users. |
| 24 | + |
| 25 | +## Supported Models |
| 26 | + |
| 27 | +ZenMux supports a wide range of models from various providers: |
| 28 | + |
| 29 | +Visi [zenmux.ai/models](https://zenmux.ai/models) to see the complete list of available models. |
| 30 | + |
| 31 | +### Other Providers |
| 32 | + |
| 33 | +ZenMux also supports models from Meta, Mistral, and many other providers. Check your ZenMux dashboard for the complete list of available models. |
| 34 | + |
| 35 | +## API Compatibility |
| 36 | + |
| 37 | +ZenMux provides multiple API endpoints for different protocols: |
| 38 | + |
| 39 | +### OpenAI Compatible API |
| 40 | + |
| 41 | +Use the standard OpenAI SDK with ZenMux's base URL: |
| 42 | + |
| 43 | +```javascript |
| 44 | +import OpenAI from "openai" |
| 45 | + |
| 46 | +const openai = new OpenAI({ |
| 47 | + baseURL: "https://zenmux.ai/api/v1", |
| 48 | + apiKey: "<ZENMUX_API_KEY>", |
| 49 | +}) |
| 50 | + |
| 51 | +async function main() { |
| 52 | + const completion = await openai.chat.completions.create({ |
| 53 | + model: "openai/gpt-5", |
| 54 | + messages: [ |
| 55 | + { |
| 56 | + role: "user", |
| 57 | + content: "What is the meaning of life?", |
| 58 | + }, |
| 59 | + ], |
| 60 | + }) |
| 61 | + |
| 62 | + console.log(completion.choices[0].message) |
| 63 | +} |
| 64 | + |
| 65 | +main() |
| 66 | +``` |
| 67 | + |
| 68 | +### Anthropic API |
| 69 | + |
| 70 | +For Anthropic models, use the dedicated endpoint: |
| 71 | + |
| 72 | +```typescript |
| 73 | +import Anthropic from "@anthropic-ai/sdk" |
| 74 | + |
| 75 | +// 1. Initialize the Anthropic client |
| 76 | +const anthropic = new Anthropic({ |
| 77 | + // 2. Replace with the API key from your ZenMux console |
| 78 | + apiKey: "<YOUR ZENMUX_API_KEY>", |
| 79 | + // 3. Point the base URL to the ZenMux endpoint |
| 80 | + baseURL: "https://zenmux.ai/api/anthropic", |
| 81 | +}) |
| 82 | + |
| 83 | +async function main() { |
| 84 | + const msg = await anthropic.messages.create({ |
| 85 | + model: "anthropic/claude-sonnet-4.5", |
| 86 | + max_tokens: 1024, |
| 87 | + messages: [{ role: "user", content: "Hello, Claude" }], |
| 88 | + }) |
| 89 | + console.log(msg) |
| 90 | +} |
| 91 | + |
| 92 | +main() |
| 93 | +``` |
| 94 | + |
| 95 | +### Platform API |
| 96 | + |
| 97 | +The Get generation interface is used to query generation information, such as usage and costs. |
| 98 | + |
| 99 | +```bash |
| 100 | +curl https://zenmux.ai/api/v1/generation?id=<generation_id> \ |
| 101 | + -H "Authorization: Bearer $ZENMUX_API_KEY" |
| 102 | +``` |
| 103 | + |
| 104 | +### Google Vertex AI API |
| 105 | + |
| 106 | +For Google models: |
| 107 | + |
| 108 | +```typescript |
| 109 | +const genai = require("@google/genai") |
| 110 | + |
| 111 | +const client = new genai.GoogleGenAI({ |
| 112 | + apiKey: "$ZENMUX_API_KEY", |
| 113 | + vertexai: true, |
| 114 | + httpOptions: { |
| 115 | + baseUrl: "https://zenmux.ai/api/vertex-ai", |
| 116 | + apiVersion: "v1", |
| 117 | + }, |
| 118 | +}) |
| 119 | + |
| 120 | +const response = await client.models.generateContent({ |
| 121 | + model: "google/gemini-2.5-pro", |
| 122 | + contents: "How does AI work?", |
| 123 | +}) |
| 124 | +console.log(response) |
| 125 | +``` |
| 126 | + |
| 127 | +## Features |
| 128 | + |
| 129 | +### Automatic Routing |
| 130 | + |
| 131 | +ZenMux automatically routes your requests to the best available provider based on: |
| 132 | + |
| 133 | +- Model availability |
| 134 | +- Response time |
| 135 | +- Cost optimization |
| 136 | +- Provider health status |
| 137 | + |
| 138 | +### Fallback Support |
| 139 | + |
| 140 | +If a provider is unavailable, ZenMux automatically falls back to alternative providers that support the same model capabilities. |
| 141 | + |
| 142 | +### Cost Optimization |
| 143 | + |
| 144 | +ZenMux can be configured to optimize for cost, routing requests to the most cost-effective provider while maintaining quality. |
| 145 | + |
| 146 | +### Zero Data Retention (ZDR) |
| 147 | + |
| 148 | +Enable ZDR mode to ensure that no request or response data is stored by ZenMux, providing maximum privacy for sensitive applications. |
| 149 | + |
| 150 | +## Advanced Configuration |
| 151 | + |
| 152 | +### Provider Routing |
| 153 | + |
| 154 | +You can specify routing preferences: |
| 155 | + |
| 156 | +- **Price**: Route to the lowest cost provider |
| 157 | +- **Throughput**: Route to the provider with highest tokens/second |
| 158 | +- **Latency**: Route to the provider with fastest response time |
| 159 | + |
| 160 | +### Data Collection Settings |
| 161 | + |
| 162 | +Control how ZenMux handles your data: |
| 163 | + |
| 164 | +- **Allow**: Allow data collection for service improvement |
| 165 | +- **Deny**: Disable all data collection |
| 166 | + |
| 167 | +### Middle-Out Transform |
| 168 | + |
| 169 | +Enable the middle-out transform feature to optimize prompts that exceed model context limits. |
| 170 | + |
| 171 | +## Troubleshooting |
| 172 | + |
| 173 | +### API Key Issues |
| 174 | + |
| 175 | +- Ensure your API key is correctly copied without any extra spaces |
| 176 | +- Check that your ZenMux account is active and has available credits |
| 177 | +- Verify the API key has the necessary permissions |
| 178 | + |
| 179 | +### Model Availability |
| 180 | + |
| 181 | +- Some models may have regional restrictions |
| 182 | +- Check the ZenMux dashboard for current model availability |
| 183 | +- Ensure your account tier has access to the desired models |
| 184 | + |
| 185 | +### Connection Issues |
| 186 | + |
| 187 | +- Verify your internet connection |
| 188 | +- Check if you're behind a firewall that might block API requests |
| 189 | +- Try using a custom base URL if the default endpoint is blocked |
| 190 | + |
| 191 | +## Support |
| 192 | + |
| 193 | +For additional support: |
| 194 | + |
| 195 | +- Visit the [ZenMux documentation](https://zenmux.ai/docs) |
| 196 | +- Contact ZenMux support through their dashboard |
| 197 | +- Check the [Kilo Code GitHub repository](https://github.com/kilocode/kilocode) for integration-specific issues |
0 commit comments