{"repo": "benewende-dev/outio-ai", "files": {"packages/kilo-docs/pages/gateway/models-and-providers.md": {"a264355dd88a5a1aeffd451cc2117adad8c627cb": {"t": 1785596046.3939607, "n": 7366, "h": "332328ae020075af", "c": "---\ntitle: \"Models & Providers\"\ndescription: \"Learn about the AI models and providers available through the Kilo AI Gateway, including model IDs, routing behavior, and provider-specific features.\"\n---\n\n# Models & Providers\n\nThe Kilo AI Gateway provides access to hundreds of AI models from multiple providers through a single unified API. You can switch between models by changing the model ID string -- no code changes required.\n\n## Specifying a model\n\nModels are identified using the format `provider/model-name`. Pass this as the `model` parameter in your request:\n\n```typescript\nconst result = streamText({\n model: kilo.chat(\"anthropic/claude-sonnet-4.6\"),\n prompt: \"Hello!\",\n})\n```\n\nOr in a raw API request:\n\n```json\n{\n \"model\": \"anthropic/claude-sonnet-4.6\",\n \"messages\": [{ \"role\": \"user\", \"content\": \"Hello!\" }]\n}\n```\n\n## Available models\n\nYou can browse the full list of available models via the models endpoint:\n\n```\nGET https://api.kilo.ai/api/gateway/models\n```\n\nThis returns model information including pricing, context window, and supported features. No authentication is required.\n\n### Popular models\n\n| Model ID | Provider | Description |\n| ------------------------------- | --------- | ----------------------------------------------- |\n| `anthropic/claude-opus-4.6` | Anthropic | Most capable Claude model for complex reasoning |\n| `anthropic/claude-sonnet-4.6` | Anthropic | Balanced performance and cost |\n| `anthropic/claude-haiku-4.5` | Anthropic | Fast and cost-effective |\n| `openai/gpt-5.2` | OpenAI | Latest GPT model |\n| `google/gemini-3-pro-preview` | Google | Advanced reasoning with 1M context |\n| `google/gemini-3-flash-preview` | Google | Fast and efficient |\n| `x-ai/grok-code-fast-1` | xAI | Optimized for code tasks |\n| `moonshotai/kimi-k2.5` | Moonshot | Strong multilingual model |\n\n### Free models\n\nSeveral models are available at no cost, subject to rate limits:\n\n| Model ID | Description |\n| ------------------------------------- | ------------------------- |\n| `minimax/minimax-m2.1:free` | MiniMax M2.1 |\n| `z-ai/glm-5:free` | Z.AI GLM-5 |\n| `giga-potato` | Community model |\n| `corethink:free` | CoreThink reasoning model |\n| `arcee-ai/trinity-large-preview:free` | Arcee Trinity |\n\nFree models are available to both authenticated and anonymous users. Anonymous users are rate-limited to 200 requests per hour per IP address.\n\n## Auto models\n\nKilo Auto virtual models automatically select the best underlying model based on the task type. The selection is controlled by the `x-kilocode-mode` request header.\n\n### `kilo-auto/frontier`\n\nRoutes to the most capable paid models optimizing for cost, performance, and capabilities.\n\n| Mode | Resolved Model |\n| -------------------------------------------------------------- | ----------------------------- |\n| `plan`, `general`, `architect`, `orchestrator`, `ask`, `debug` | `anthropic/claude-opus-4.6` |\n| `build`, `explore`, `code` | `anthropic/claude-sonnet-4.6` |\n| Default (no mode specified) | `anthropic/claude-sonnet-4.6` |\n\n### `kilo-auto/balanced`\n\nFollows the same mode-based routing as Frontier but uses more cost-effective models.\n\n| Mode | Resolved Model |\n| -------------------------------------------------------------- | ---------------------- |\n| `plan`, `general`, `architect`, `orchestrator`, `ask`, `debug` | `moonshotai/kimi-k2.5` |\n| `build`, `explore`, `code` | `minimax/minimax-m2.7` |\n| Default (no mode specified) | `minimax/minimax-m2.7` |\n\n### `kilo-auto/free`\n\nThe best available free model for each mode.\n\n| Mode | Resolved Model |\n| --------------------------- | --------------------------- |\n| All modes | `minimax/minimax-m2.5:free` |\n| Default (no mode specified) | `minimax/minimax-m2.5:free` |\n\n### Example usage\n\n```json\n{\n \"model\": \"kilo-auto/frontier\",\n \"messages\": [{ \"role\": \"user\", \"content\": \"Help me design a database schema\" }]\n}\n```\n\nWith the mode header:\n\n```bash\ncurl -X POST \"https://api.kilo.ai/api/gateway/chat/completions\" \\\n -H \"Authorization: Bearer $KILO_API_KEY\" \\\n -H \"x-kilocode-mode: plan\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"model\": \"kilo-auto/balanced\", \"messages\": [{\"role\": \"user\", \"content\": \"Design a database schema\"}]}'\n```\n\n## Providers\n\nThe gateway routes requests to the appropriate provider based on the model and your configuration:\n\n| Provider | Slug | Description |\n| ----------------- | ------------ | ----------------------------------- |\n| OpenRouter | `openrouter` | Primary gateway for most models |\n| Vercel AI Gateway | `vercel` | BYOK routing and select A/B testing |\n| Mistral | `mistral` | FIM completions (Codestral) |\n| xAI | `x-ai` | Grok models (direct) |\n| MiniMax | `minimax` | MiniMax models (direct) |\n| CoreThink | `corethink` | CoreThink reasoning model |\n| Inception | `inception` | InceptionLabs models |\n| Martian | `martian` | Optimized xAI models |\n| StreamLake | `streamlake` | KAT-Coder models |\n\n## Provider routing\n\nThe gateway uses the following priority for routing requests:\n\n1. **BYOK check**: If you have a BYOK key for the model's provider, the request is routed through Vercel AI Gateway using your key\n2. **Free model routing**: If the model is a Kilo-hosted free model, it's routed to its designated provider\n3. **Default routing**: All other requests go through OpenRouter\n\n### Preferred inference providers\n\nFor models available through multiple providers, the gateway may use a preferred provider for better performance:\n\n| Model Family | Preferred Provider |\n| ---------------- | -------------------- |\n| Anthropic models | Amazon Bedrock |\n| MiniMax models | MiniMax (direct) |\n| Mistral models | Mistral (direct) |\n| Moonshot models | Moonshot AI (direct) |\n\nThese preferences are sent as hints to OpenRouter, which may override them based on availability and load.\n\n## Listing models\n\n### Models endpoint\n\n```\nGET https://api.kilo.ai/api/gateway/models\n```\n\nReturns an OpenAI-compatible list of all available models with metadata including pricing, context window, and capabilities.\n\n### Providers endpoint\n\n```\nGET https://api.kilo.ai/api/gateway/providers\n```\n\nReturns a list of all available inference providers.\n\n### Models by provider\n\n```\nGET https://api.kilo.ai/api/gateway/models-by-provider\n```\n\nReturns models grouped by their provider, useful for building model selection interfaces.\n"}}, "packages/opencode/test/preload.ts": {"a264355dd88a5a1aeffd451cc2117adad8c627cb": {"t": 1786068277.1311867, "n": 3264, "h": "a0690adeb060c027", "c": "// IMPORTANT: Set env vars BEFORE any imports from src/ directory\n// xdg-basedir reads env vars at import time, so we must set these first\nimport os from \"os\"\nimport path from \"path\"\nimport fs from \"fs/promises\"\nimport { setTimeout as sleep } from \"node:timers/promises\"\nimport { afterAll } from \"bun:test\"\n\n// Set XDG env vars FIRST, before any src/ imports\nconst dir = path.join(os.tmpdir(), \"opencode-test-data-\" + process.pid)\nawait fs.mkdir(dir, { recursive: true })\nafterAll(async () => {\n const { Database } = await import(\"../src/storage/db\")\n Database.close()\n const busy = (error: unknown) =>\n typeof error === \"object\" && error !== null && \"code\" in error && error.code === \"EBUSY\"\n const rm = async (left: number): Promise => {\n Bun.gc(true)\n await sleep(100)\n return fs.rm(dir, { recursive: true, force: true }).catch((error) => {\n if (!busy(error)) throw error\n if (left <= 1) throw error\n return rm(left - 1)\n })\n }\n\n // Windows can keep SQLite WAL handles alive until GC finalizers run, so we\n // force GC and retry teardown to avoid flaky EBUSY in test cleanup.\n await rm(30)\n})\n\nprocess.env[\"XDG_DATA_HOME\"] = path.join(dir, \"share\")\nprocess.env[\"XDG_CACHE_HOME\"] = path.join(dir, \"cache\")\nprocess.env[\"XDG_CONFIG_HOME\"] = path.join(dir, \"config\")\nprocess.env[\"XDG_STATE_HOME\"] = path.join(dir, \"state\")\nprocess.env[\"OPENCODE_MODELS_PATH\"] = path.join(import.meta.dir, \"tool\", \"fixtures\", \"models-api.json\")\n\n// Set test home directory to isolate tests from user's actual home directory\n// This prevents tests from picking up real user configs/skills from ~/.claude/skills\nconst testHome = path.join(dir, \"home\")\nawait fs.mkdir(testHome, { recursive: true })\nprocess.env[\"KILO_TEST_HOME\"] = testHome\n\n// Set test managed config directory to isolate tests from system managed settings\nconst testManagedConfigDir = path.join(dir, \"managed\")\nprocess.env[\"KILO_TEST_MANAGED_CONFIG_DIR\"] = testManagedConfigDir\n\n// Write the cache version file to prevent global/index.ts from clearing the cache\nconst cacheDir = path.join(dir, \"cache\", \"opencode\")\nawait fs.mkdir(cacheDir, { recursive: true })\nawait fs.writeFile(path.join(cacheDir, \"version\"), \"14\")\n\n// Clear provider and server auth env vars to ensure clean test state\ndelete process.env[\"ANTHROPIC_API_KEY\"]\ndelete process.env[\"OPENAI_API_KEY\"]\ndelete process.env[\"GOOGLE_API_KEY\"]\ndelete process.env[\"GOOGLE_GENERATIVE_AI_API_KEY\"]\ndelete process.env[\"AZURE_OPENAI_API_KEY\"]\ndelete process.env[\"AWS_ACCESS_KEY_ID\"]\ndelete process.env[\"AWS_PROFILE\"]\ndelete process.env[\"AWS_REGION\"]\ndelete process.env[\"AWS_BEARER_TOKEN_BEDROCK\"]\ndelete process.env[\"OPENROUTER_API_KEY\"]\ndelete process.env[\"GROQ_API_KEY\"]\ndelete process.env[\"MISTRAL_API_KEY\"]\ndelete process.env[\"PERPLEXITY_API_KEY\"]\ndelete process.env[\"TOGETHER_API_KEY\"]\ndelete process.env[\"XAI_API_KEY\"]\ndelete process.env[\"DEEPSEEK_API_KEY\"]\ndelete process.env[\"FIREWORKS_API_KEY\"]\ndelete process.env[\"CEREBRAS_API_KEY\"]\ndelete process.env[\"SAMBANOVA_API_KEY\"]\ndelete process.env[\"OPENCODE_SERVER_PASSWORD\"]\ndelete process.env[\"OPENCODE_SERVER_USERNAME\"]\n\n// Now safe to import from src/\nconst { Log } = await import(\"../src/util/log\")\n\nLog.init({\n print: false,\n dev: true,\n level: \"DEBUG\",\n})\n"}}}}