
Kosha Model Discovery
io.github.sriinnu由 GitHub 帳號 sriinnu 發布v1.13.0更新於 Nov 4, 2026
Tells your agent which model to use and what it costs, across 46 providers and local runtimes.
概覽
透過 MCP 提供模型目錄,讓助理比較 46 家供應商與本機執行環境的模型、價格、上下文上限與路由。
- 可以做什麼
- 依供應商、模式與能力查詢並篩選模型目錄
- 依價格排序,或找出符合能力與上下文需求的最便宜模型
- 檢視單一模型的定價、上限與生命週期狀態,並列出所有提供該模型的路由或區域
- 將簡短別名解析為標準模型 ID,並檢查供應商健康狀態
- 為指定模型提供上下文策略建議
- 適用情境
- 適合助理需要在多個模型之間做選擇、比較價格與上下文視窗,或確認某個固定模型是否已棄用、是否仍有供應商提供時使用。在全新機器上也有用,因為不需任何 API 金鑰即可從公開目錄作答。
- 執行需求
- 以 npm 套件 @sriinnu/kosha-discovery(kosha-mcp)在本機透過 stdio 執行,需要 Node.js 22+。所有供應商 API 金鑰皆為選用,缺少時會回退到公開目錄與內建清單。選用變數包括 ANTHROPIC_API_KEY、OPENAI_API_KEY、GOOGLE_API_KEY、OPENROUTER_API_KEY、XAI_API_KEY、TYPESAFE_API_KEY 與 KOSHA_CACHE_TTL_HOURS。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Kosha Model Discovery,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
kosha-discovery
Tells your agent — or your code — which model to use and what it costs.
Website: kosha.srinivas.dev
kosha discovers models across 46 providers and local runtimes, finds your API keys wherever they already live (env vars, Claude CLI, Codex, gcloud ADC, AWS SSO), fills in pricing and context limits, and answers questions like the cheapest model with tool use and 128k context that I actually hold a key for. It ships as a TypeScript library, a CLI, an HTTP API, an OpenAI-compatible proxy with a spend ledger, and an MCP server.
It works with no API keys at all — discovery falls back to the public models.dev and
LiteLLM catalogs, so kosha list is useful on a fresh machine.
Install
Requires Node.js 22+.
Quick start
Library
CLI
Every command takes --json. kosha --help lists the rest.
After each discovery, a stable v1 manifest lands at ~/.kosha/registry.json:
GitHub Action
Fail a build when a model your code pins is deprecated, about to be retired, or listed by no provider any more:
Pin it to a commit SHA rather than a moving tag, as you would any action. The
action runs the kosha version it was released with, not latest, so a new npm
publish does not change what your CI runs until you move the pin.
It runs kosha doctor --ci --model … against the public catalogs (no provider
keys needed), writes a table to the job summary, and annotates each failing
model. A reseller retiring one of its routes is reported but does not fail the
build while the model's own provider still serves it; deprecation-window
(default 30 days) sets how far ahead a sunset counts.
Public snapshot
A weekly discovery run publishes a full snapshot — every provider, model, price and limit kosha can see without your keys — at a stable URL:
It is a release asset rather than a file in the repository: at ~2.8 MB growing
with every provider added, committing it weekly would put roughly 150 MB of
already-stale data a year into a repo people are meant to clone. Dated
snapshot-YYYY-MM-DD pre-releases keep a short trail for diffing, pruned to the
two most recent, and an older one is only removed once a newer one exists.
Each snapshot's release notes list what changed since the previous one — new
models, repricings, new deprecations, removals. The same diff runs locally with
pnpm snapshot:diff old.json new.json.
HTTP API
Parameters and response shapes: docs/api.md.
Proxy
kosha serve also exposes an OpenAI-compatible endpoint at /proxy/v1. Point any OpenAI SDK at it; the proxy resolves the model or alias, picks a provider you hold credentials for, injects the upstream key, forwards the request, and writes a row to the spend ledger.
kosha:cheapest filter syntax (comma-separated, combinable):
kosha:fastest, kosha:reliable, and kosha:balanced take the same filters and rank on observed latency and circuit-breaker state instead of price.
Every response carries x-kosha-model, x-kosha-provider, x-kosha-requested, x-kosha-attempt-chain, and x-kosha-estimated-cost-usd; non-streaming responses add x-kosha-actual-cost-usd when the upstream returned a usage block.
What the proxy can forward:
Defaults that matter before you expose it: the server binds 127.0.0.1. Pass --host 0.0.0.0 (or KOSHA_HOST) to listen on a network interface, and set KOSHA_PROXY_TOKEN so /proxy/* and POST /api/refresh require Authorization: Bearer <token> or x-kosha-token. KOSHA_MONTHLY_BUDGET_USD caps spend per calendar month. Reference: docs/api.md, docs/operations.md.
MCP server
kosha-mcp serves the registry over the Model Context Protocol on stdio, so an agent can call kosha_query_models, kosha_cheapest_model, kosha_ranked_routes, kosha_model_detail, kosha_model_routes, kosha_resolve_alias, kosha_provider_health, and kosha_context_strategy without an HTTP server.
It is published to the MCP registry
as io.github.sriinnu/kosha-discovery, so clients that read the registry can
install it without a manual command. The manifest is server.json.
Every provider key is optional. With no credentials at all the server still answers from the public models.dev and LiteLLM catalogs plus a curated offline list, so it is useful on a fresh machine.
Tools and protocol details: docs/mcp.md.
Supported providers
46 providers. Each has a descriptor in src/provider-catalog.ts; most OpenAI-compatible
ones are driven from GENERIC_OPENAI_PROVIDERS in src/discovery/generic-openai.ts
rather than a hand-written class.
Regional pairs
Several providers run separate hosts for international and mainland-China traffic, with separate keys and separate price sheets — Qwen 2.5 72B is $1.40/M input internationally against $0.574/M in China. Merging them would make a model's price depend on which host answered last, so each region is its own provider:
kosha routes <model> lists every region a model is served from, so you can
compare prices across them directly.
Without a key, providers fall back to the public models.dev + LiteLLM catalog, then to kosha's own weekly snapshot if those are unreachable, then to a curated static list, so kosha list works on a fresh machine. The same fallback applies when a key is present but rejected: the provider stays listed from the public catalog, shows as unauthenticated, and the error is kept for kosha doctor. Exact env var names: docs/credentials.md.
To take models.dev and LiteLLM out of the loop, set KOSHA_CATALOG_SOURCE=pinned (kosha's snapshot only) or local (a file from kosha registry export, no network). See Catalog Source.
Non-chat modes
Most models are chat, but mode also covers embedding, image, video,
audio, moderation, rerank, and judgment. A judgment model — TypeSafe's
System One family — answers a question with a typed value (a choice and its
probability distribution, a probability, or a score on described levels) instead
of generating text. It carries no chat capability on purpose: routing a prompt
to one would be a category error.
How it works
- Discovery — one discoverer per provider runs concurrently (
Promise.allSettled); each returns normalizedModelCards. A failing provider is recorded indiscoveryErrors()and doesn't block the others. - Enrichment — pricing, context window, and output cap are filled from models.dev and LiteLLM where the provider API doesn't publish them;
pricingSourceon each card says which. Cards also carryreleaseDateand a lifecyclestatuswhere a catalog publishes them. - Resilience — a per-provider circuit breaker with exponential cooldown, plus stale-cache fallback, so a provider outage degrades to cached data rather than an error.
- Cache and manifest — results are cached under
~/.kosha/cache/(24 h TTL) and exported as a versioned snapshot at~/.kosha/registry.jsonfor other tools to read. - Proxy — resolves the requested model or
kosha:<strategy>[filters]selector against the registry, ranks candidate routes, forwards with failover, and records estimated and reconciled cost in~/.kosha/ledger-YYYY-MM.jsonl.
Details: docs/architecture.md, docs/resilience.md.
Development
The alias table in src/aliases.ts is the one part of the catalog written by
hand. aliases:check compares it against a snapshot, and the weekly snapshot
run annotates itself with the result, so a bare alias like opus falling behind
shows up there rather than in a bug report.
Project layout
Adding a provider
For an OpenAI-compatible provider — most of them — it is two table entries:
- Add a descriptor to
PROVIDER_CATALOGinsrc/provider-catalog.ts(id, base URL, transport, credential env vars). - Add a spec to
GENERIC_OPENAI_PROVIDERSinsrc/discovery/generic-openai.ts. It registers its own discoverer, resolves credentials from the descriptor'scredentialEnvVars, and falls back to the public catalog when there is no key. - Map the provider to its models.dev / LiteLLM slug in
src/discovery/modelsdev-seed.tsandlitellm-seed.tsso keyless discovery works. Check the slug — GLM is published aszhipuai, and a missing mapping means no keyless models at all. - Add a case to
test/discovery/generic-openai.test.tsand document the env vars indocs/credentials.md.
Write a discoverer class only when classification genuinely needs code — per-route pricing (OpenRouter), a non-OpenAI response envelope (TypeSafe), or origin remapping (Vercel):
- Create
src/discovery/<provider>.tsextendingBaseDiscovererorOpenAICompatibleDiscoverer;fetchJSONandmakeCardare provided. - Export it from
src/discovery/index.tsand add a factory entry toDISCOVERER_REGISTRY. - Add a resolver branch in
src/credentials/resolver.tsonly for a bespoke search order (CLI files, OAuth, ADC, SSO). A plain API key in env vars needs no branch — the descriptor covers it. - Add
test/discovery/<provider>.test.ts(mockfetch; seetypesafe.test.ts).
Docs
The same pages are mirrored to the wiki, alongside guides that only live there (troubleshooting, the release runbook). docs/ is the source: the mirror is regenerated on every push to main, so edit here, not there.
Release
- Bump
versioninpackage.jsonandserver.json(both places), and date the[Unreleased]section inCHANGELOG.md; merge that as a PR. - Tag and push:
The workflow checks that the tag matches package.json, runs lint / build / test, stages the package on npm with provenance, and creates the GitHub Release. Staging authenticates through npm trusted publishing (OIDC); there is no npm token. The version goes live only after a maintainer approves it with 2FA:
Support
kosha is free and open source. If it helps you pick cheaper models, consider sponsoring its upkeep:
License
MIT
來源:README.md,提交 14c7454
工具
0版本歷史
8- v1.13.0最新Nov 4, 2026
- v1.12.1Nov 4, 2026
- v1.12.0Nov 3, 2026
- v1.11.0Nov 1, 2026
- v1.9.1Oct 29, 2026
- v1.8.1Oct 6, 2026
- v1.7.0Oct 5, 2026
- v1.6.2Sep 19, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
其他 Model 整合

model.tools — Zero-Auth Agent Utilities
tools.model官方發布者
零認證遠端工具伺服器,讓代理程式讀取一次性信箱驗證碼、保存檢查點、接收 Webhook、排定喚醒、取得任務回執,並把網頁轉成 Markdown。
NLP.COM.AI Open Model Catalog
ai.com.nlp官方發布者
搜尋精選的開放權重AI模型發布、授權條款、架構和原始來源。AI 翻譯

Hologram Model Hub
foundation.uor.hub官方發布者
一個遠端 MCP 伺服器,讓助理搜尋開放模型索引,並取得附有 SHA-256 校驗值的下載連結。

ModelLens
由 GitHub 帳號 Greatbeing 發布
探測相容於 OpenAI 的模型閘道,依實測延遲與成功率為模型排名,並推薦該用哪個模型。

Bedrock Multi-Model
由 GitHub 帳號 Sagargupta16 發布
本機 MCP 伺服器,把 AWS Bedrock 的文字、影像、影片與嵌入模型包裝成九個工具,讓助理可以提問、比較與評審模型。