2026–09–27
Practical guide for picking a model and provider when driving OpenCode through OpenRouter, balancing data-privacy risk against price and performance. Prices are as of 2026–09–27 and are OpenRouter’s listed rates.
Disclosure: I’m not affiliated with any of the model developers or service providers mentioned here.
OpenCode’s /connect connects providers; OpenRouter is one of them. Entries like "DeepSeek" and "DeepSeek (China)" are distinct serving endpoints — the suffix denotes the host's jurisdiction, not a different model. To use OpenRouter as the payment gateway, connect OpenRouter once, then choose models with /models (for example deepseek/deepseek-v4-flash); the upstream host is then selected by OpenRouter's routing, which you can constrain (see §5).
The distinction that matters throughout this note is between the model and the serving provider. An open-weight model (DeepSeek, Qwen, Kimi, GLM) is a set of downloadable files; it carries no inherent data risk. The risk lives in the service that hosts it and the law that governs that service.
A Chinese model is not the same as a Chinese service. The open weights can run anywhere — a non-Chinese host, your own GPU, or a laptop. What changes the privacy calculus is who operates the endpoint.
This is a jurisdiction and compulsion risk, not a claim that any vendor abuses data. It matters most for proprietary code and secrets; for public or open-source work the risk is low.
Assessment checklist per provider: (a) legal jurisdiction of the serving entity; (b) retention policy and whether Zero Data Retention is available; © training-on-inputs policy; (d) whether you can pin or exclude providers; (e) DPA availability; (f) whether self-host or BYOC is possible. In an agentic coding session, what you send is high-sensitivity — source, file contents, and sometimes secrets.
OpenRouter’s listed price is the cheapest endpoint for a model, and endpoints differ in quantization (fp4 vs fp8 weight precision — fewer bits is cheaper but lossy), so treat these as a floor, not a like-for-like quality figure.
Table generated 2026–09–27 from the OpenRouter API. Model prices change frequently — treat this as a snapshot and re-run the scripts in §4 before relying on any number.
Price winners: DeepSeek, with Qwen and GLM close. The open-weight families are far cheaper, especially on output tokens. DeepSeek V4 Pro is frontier-capable at roughly a twentieth of Gemini 3.1 Pro Preview’s and GPT-5.2’s output cost. Kimi is not a price leader — K3 sits at GPT and Claude frontier pricing. OpenAI is the priciest frontier; Gemini sits mid.
List every model’s price, per million tokens, with curl and jq:
curl -s https://openrouter.ai/api/v1/models \ | jq -r '.data[] | [.id, (.pricing.prompt|tonumber*1e6), (.pricing.completion|tonumber*1e6)] | @tsv' \ | sort -t$'\t' -k3 -n | head -30
Print the cheapest models per family with Python:
#!/usr/bin/env python3"""Cheapest OpenRouter models per family, per million tokens."""import jsonimport urllib.requestFAMILIES = { "deepseek": "deepseek", "qwen": "qwen", "moonshotai": "kimi", "google": "gemini", "openai": "openai", "z-ai": "glm",}def per_million(x): try: return float(x) * 1_000_000 except (TypeError, ValueError): return Nonewith urllib.request.urlopen("https://openrouter.ai/api/v1/models") as resp: models = json.load(resp)["data"]for author, label in FAMILIES.items(): rows = [m for m in models if m["id"].startswith(author + "/")] rows.sort(key=lambda m: per_million(m["pricing"].get("completion")) or 9e9) print(f"=== {label} ({author}) — {len(rows)} models ===") for m in rows[:5]: p = m["pricing"] inp = per_million(p.get("prompt")) out = per_million(p.get("completion")) print(f" {m['id']:<52} in ${inp:.3f}/M out ${out:.3f}/M")
Inspect one model’s per-provider endpoints — price, quantization, context — the check that reveals the price floor:
curl -s "https://openrouter.ai/api/v1/models/deepseek/deepseek-v4-flash-0731/endpoints" \ | jq -r '.data.endpoints[] | [.provider_name, .quantization, (.pricing.prompt|tonumber*1e6), (.pricing.completion|tonumber*1e6)] | @tsv'
{ "$schema": "https://opencode.ai/config.json", "model": "openrouter/deepseek/deepseek-v4-pro", "small_model": "openrouter/deepseek/deepseek-v4-flash"}
Controls to set on OpenRouter: enforce Zero Data Retention, opt out of training, and pin or exclude providers by jurisdiction. For agentic tool-calling reliability prefer the :exacto routing variant; avoid :floor, which often routes to fp4 and can degrade tool calls.
btw, i use arch
Choosing a Model for OpenCode via OpenRouter: Privacy, Price, and Performance was originally published in Dev Genius on Medium, where people are continuing the conversation by highlighting and responding to this story.