惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

有赞技术团队
有赞技术团队
Stack Overflow Blog
Stack Overflow Blog
爱范儿
爱范儿
B
Blog
博客园 - 三生石上(FineUI控件)
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
A
About on SuperTechFans
C
Check Point Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
Y
Y Combinator Blog
WordPress大学
WordPress大学
小众软件
小众软件
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
Recent Announcements
Recent Announcements
L
LangChain Blog
大猫的无限游戏
大猫的无限游戏
阮一峰的网络日志
阮一峰的网络日志
D
DataBreaches.Net
博客园 - 聂微东
Microsoft Security Blog
Microsoft Security Blog
美团技术团队

OpenRouter Blog

Using OpenRouter With LangChain (ChatOpenRouter) — OpenRouter Blog How to Evaluate LLM Provider Performance — OpenRouter Blog Image Generation API on OpenRouter: Generate + Read Images — OpenRouter Blog Classifiers: Track What Your Agents Do and What It Costs — OpenRouter Blog Transcription on OpenRouter: Whisper & More STT Models — OpenRouter Blog OpenRouter Prompt Caching: What Cached Tokens Cost — OpenRouter Blog One API for Image, Video, Audio, Embeddings & Transcription — OpenRouter Blog A New Look for OpenRouter — OpenRouter Blog Why Use OpenRouter for DeepSeek — OpenRouter Blog Choosing the Optimal Image Input Detail Level in LLMs — OpenRouter Blog DeepSeek V4 Is Earning Agentic Token Share — OpenRouter Blog The Open Weight Models that Matter: June 2026 — OpenRouter Blog The OpenRouter MCP Server — OpenRouter Blog Introducing the Unified Image API — OpenRouter Blog The AI Governance Checklist That Maps to Your Stack — OpenRouter Blog Enforce AI Data Residency at the Routing Layer — OpenRouter Blog OpenRouter vs Portkey: Routing Network vs Control Plane — OpenRouter Blog OpenRouter vs LiteLLM: Managed vs Self-Hosted Gateway — OpenRouter Blog Connect OpenClaw to OpenRouter: One Key, Failover, Free Models — OpenRouter Blog Connect SillyTavern to OpenRouter: Setup, Models, Fixes — OpenRouter Blog A Robot is Sprinting Towards You: Do You Want it Running on Claude or Grok? Codex CLI with OpenRouter: config.toml Setup and Models — OpenRouter Blog Claude Code with OpenRouter: Setup, Models, and Costs — OpenRouter Blog How to Use OpenRouter With Any Coding Agent or AI Tool — OpenRouter Blog Subagent: Let Your Model Delegate the Busywork — OpenRouter Blog Free LLM API in 2026: 13 Options Ranked and Compared — OpenRouter Blog How to Enforce Agentic AI Governance at the API Layer — OpenRouter Blog Keep Your Agent Running When Models Disappear — OpenRouter Blog Hermes Agent + OpenRouter: Setup, Model Choice & Routing Config — OpenRouter Blog Lowest-Cost LLM Inference: The Complete OpenRouter Guide — OpenRouter Blog
Kilo Code + OpenRouter: Setup, Routing, and Free Models —...
OpenRouter · 2026-06-18 · via OpenRouter Blog

Kilo Code runs the coding session: chat, edits, context, modes, and the model picker inside your editor or terminal. It doesn’t ship its own models. It expects you to bring a provider.

OpenRouter is that provider layer. Add it and Kilo gets one API key for 300+ models across 70+ providers, plus routing rules, failover, and billing in one place. Kilo also offers Kilo Gateway, its own managed-billing path, which we compare below. The whole setup is three steps, and the routing controls live in one config file.

Add OpenRouter to Kilo Code in three steps

First, create a key on your API Keys page. Sign in with Google or GitHub. Load credits on the pricing page unless you’re sticking to free models. There’s no minimum spend on pay-as-you-go.

Second, open Settings in Kilo Code from the gear icon, go to the Providers tab, click Connect on OpenRouter, paste the key, and save.

Third, open the model picker and type a name or slug to switch models. Browse the live list at openrouter.ai/models, since the catalog changes as providers ship new models.

Kilo writes that provider setup to kilo.json (or ~/.config/kilo/kilo.json), so the VS Code extension and the CLI share one config. The Providers tab edits the file for you; CLI users can edit it directly. A saved key with no credits still fails on the first paid request, so load credits before testing a paid model.

Control routing and long prompts from kilo.json

Kilo forwards anything under a model’s options straight to OpenRouter as providerOptions.openrouter, without validating it. That pass-through is what gives you OpenRouter’s provider routing inside Kilo. Put the provider block under models.{modelId}.options:

{
  "provider": {
    "openrouter": {
      "models": {
        "anthropic/claude-sonnet-4.5": {
          "options": {
            "provider": {
              "sort": "price",
              "order": ["Anthropic", "Google"],
              "only": ["Anthropic"],
              "data_collection": "deny",
              "zdr": true
            }
          }
        }
      }
    }
  }
}

Each field maps to an OpenRouter routing parameter: sort by price, throughput, or latency; order to set provider preference; only to fail rather than leave an approved list; data_collection and zdr for data policy. The nesting has to be exact. A provider block at the root provider.openrouter level does nothing, and because Kilo passes fields through unvalidated, a misspelled field is ignored with no error. Match the path above exactly.

For prompts that run past a model’s context window, OpenRouter’s middle-out transform drops content from the middle, where models pay the least attention, instead of rejecting the request. Turn it on in the same options block:

{ "options": { "transforms": ["middle-out"] } }

Run free models inside Kilo

OpenRouter has 20+ free models. Filter for them by typing free in Kilo’s model picker. With no credits loaded, free models run at 50 requests per day and 20 per minute. Add $10 or more in credits and that daily cap rises to 1,000.

Keep the two free paths straight. OpenRouter free models use your OpenRouter account and rate limits. Kilo’s kilo-auto/free, served through Kilo Gateway, doesn’t touch your OpenRouter credits or routing rules.

One caveat for private code: free endpoints can log prompts, so they’re a poor fit for proprietary source unless the data policy works for you. Add data_collection: "deny" to narrow eligible providers.

Choose OpenRouter or Kilo Gateway

Both put models in front of Kilo Code, so the choice comes down to what your team already runs.

Reach for OpenRouter when you already use it across tools, want provider routing controls, or want one account and one bill spanning every AI tool you run. It charges 5.5% on credit purchases with no provider markup, and BYOK lets you route through your own provider key for 5% of what the provider would bill, waived for the first 1M requests each month.

Kilo Gateway is the native path: Kilo markets it as zero-markup, billing lands in your Kilo account, and routing is Kilo-managed. If Kilo Code is your only AI surface and it carries the exact model you need, compare that model in Kilo Gateway before taking on the OpenRouter fee. It mostly comes down to account gravity. If OpenRouter already sits in your stack, add it to Kilo and keep one routing policy.

Frequently asked questions

Is OpenRouter free with Kilo Code?

Partly. OpenRouter has 20+ free models you can use inside Kilo Code, capped at 50 requests per day and 20 per minute with no credits loaded. Add $10 or more in credits and the free-model cap rises to 1,000 requests per day. Kilo’s own kilo-auto/free option is separate and runs through Kilo Gateway.

What is the difference between Kilo Code and OpenRouter?

Kilo Code is the coding agent that runs in your editor or terminal. OpenRouter is a provider you add inside Kilo Code to reach 300+ models from 70+ providers through one API key. You use them together.

How do I set the OpenRouter provider order in Kilo Code?

Add an order array under models.{modelId}.options.provider in kilo.json, listing provider names in preference order such as ["Anthropic", "Google"]. Add only to restrict requests to an approved list. Kilo forwards these fields to OpenRouter without validating them.

Does OpenRouter cost more than Kilo’s own gateway?

OpenRouter charges a 5.5% fee on credit purchases and doesn’t mark up provider prices. Kilo markets Kilo Gateway as zero-markup. OpenRouter is often the better operational choice when you already use it across tools or need provider routing controls.

Can I use OpenRouter with the Kilo CLI?

Yes. The CLI reads the same kilo.json config, so you can add the OpenRouter provider block and routing options directly. The VS Code Providers tab writes to the same file.