Providers as data; add Ollama and Custom endpoints
Every gateway provider is now an entry in providers.json - endpoint and auth template, how its model list is read, how it is probed before a switch, what setup asks, which doctor checks apply, and its title, colour and logo - installed next to the presets and read by all three consumers: the bash CLI (through cm-json.py), the Windows script, and the bar widget (through health.json). anthropic stays built in; it is the native login, not a gateway. Behaviour that differs in kind stays in code, chosen by name from the entry: catalogue parsers (openrouter, lmstudio, ollama, openai, static), probe rules (always, lenient, local), and named doctor checks. A provider that reuses them is an entry and a default preset, with no code. The widget draws providers from health.json, so a new one needs no QML change and no shell restart. The existing three are unchanged in behaviour: their blank presets come out byte-identical from the file, and setup, doctor, models and the picker run the same checks through the generic paths. Ollama: local server on :11434, placeholder token, one model for every tier, models from /api/tags. doctor reads the context each loaded model actually runs with (/api/ps) and its maximum (/api/show), because Ollama defaults to 4096 tokens unless OLLAMA_CONTEXT_LENGTH is set and silently truncates past it. A bare model name matches its :latest tag. Custom: any Anthropic-compatible endpoint. Ships with no address and is refused until it has one; key optional; models from /v1/models when the endpoint has a list, and a lenient probe so a proxy without one is not blocked. Also: preflight (and Set-ClaudeMode on Windows) refuses a preset with no server address; the server form, setup and set-auth use each provider's own default URL, key name and placeholder token instead of LM Studio's; the Windows build gains the no-models and no-address guards it never had. Tested on Linux against fake Ollama/Custom servers, and on Windows 5.1 in a USERPROFILE sandbox on winbox. 1.12.0. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+240
@@ -0,0 +1,240 @@
|
||||
{
|
||||
"_comment": [
|
||||
"Every gateway provider claude-mode can switch to. anthropic is not here: it is the native login.",
|
||||
"Read by linux/cm-json.py (CLI + bar widget, via health.json) and claude-mode.ps1 (Windows).",
|
||||
"Behaviour that differs in kind is chosen by name: catalogue.kind (openrouter | lmstudio | ollama | openai | static),",
|
||||
"server.probe (always | lenient | local), setup.key (required | optional), setup.models (per-tier | one-for-all),",
|
||||
"and the doctor checks. A new provider that reuses those is an entry here and a preset in presets/.",
|
||||
"Logos are single-path 24x24 SVG marks; logoScale corrects apparent size (see Modes.js)."
|
||||
],
|
||||
"providers": [
|
||||
{
|
||||
"id": "openrouter",
|
||||
"aliases": [],
|
||||
"title": "OpenRouter",
|
||||
"label": "OpenRouter - remote, pay-per-token, any vendor",
|
||||
"blurb": "Remote gateway, pay per token, any vendor.",
|
||||
"color": "cyan",
|
||||
"defaultPreset": "default",
|
||||
"preset": {
|
||||
"baseUrl": "https://openrouter.ai/api",
|
||||
"auth": {
|
||||
"mode": "vault",
|
||||
"keyRef": "openrouter"
|
||||
},
|
||||
"contextTokens": 1000000,
|
||||
"gatewayModelDiscovery": true
|
||||
},
|
||||
"server": {
|
||||
"editable": false,
|
||||
"probe": "local"
|
||||
},
|
||||
"catalogue": {
|
||||
"kind": "openrouter",
|
||||
"url": "https://openrouter.ai/api/v1/models"
|
||||
},
|
||||
"setup": {
|
||||
"key": "required",
|
||||
"models": "per-tier",
|
||||
"keyUrl": "https://openrouter.ai/settings/keys"
|
||||
},
|
||||
"guardrail": true,
|
||||
"doctor": [
|
||||
"openrouter-key",
|
||||
"guardrail",
|
||||
"catalogue-models"
|
||||
],
|
||||
"logo": "M16.778 1.844v1.919q-.569-.026-1.138-.032-.708-.008-1.415.037c-1.93.126-4.023.728-6.149 2.237-2.911 2.066-2.731 1.95-4.14 2.75-.396.223-1.342.574-2.185.798-.841.225-1.753.333-1.751.333v4.229s.768.108 1.61.333c.842.224 1.789.575 2.185.799 1.41.798 1.228.683 4.14 2.75 2.126 1.509 4.22 2.11 6.148 2.236.88.058 1.716.041 2.555.005v1.918l7.222-4.168-7.222-4.17v2.176c-.86.038-1.611.065-2.278.021-1.364-.09-2.417-.357-3.979-1.465-2.244-1.593-2.866-2.027-3.68-2.508.889-.518 1.449-.906 3.822-2.59 1.56-1.109 2.614-1.377 3.978-1.466.667-.044 1.418-.017 2.278.02v2.176L24 6.014Z",
|
||||
"logoScale": 1.12,
|
||||
"glyph": "F0469"
|
||||
},
|
||||
{
|
||||
"id": "zai",
|
||||
"aliases": [
|
||||
"z.ai",
|
||||
"z-ai"
|
||||
],
|
||||
"title": "Z.AI",
|
||||
"label": "Z.AI - GLM coding plan",
|
||||
"blurb": "GLM coding plan on Z.AI's Anthropic endpoint.",
|
||||
"color": "green",
|
||||
"defaultPreset": "zai",
|
||||
"preset": {
|
||||
"baseUrl": "https://api.z.ai/api/anthropic",
|
||||
"auth": {
|
||||
"mode": "vault",
|
||||
"keyRef": "zai"
|
||||
},
|
||||
"contextTokens": 1000000,
|
||||
"gatewayModelDiscovery": false,
|
||||
"extraEnv": {
|
||||
"API_TIMEOUT_MS": "3000000",
|
||||
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
|
||||
}
|
||||
},
|
||||
"server": {
|
||||
"editable": false,
|
||||
"probe": "local"
|
||||
},
|
||||
"catalogue": {
|
||||
"kind": "static",
|
||||
"docs": "https://docs.z.ai/devpack/tool/claude",
|
||||
"static": [
|
||||
{
|
||||
"id": "glm-5.3",
|
||||
"note": "flagship coding model - opus/sonnet tier"
|
||||
},
|
||||
{
|
||||
"id": "glm-4.7",
|
||||
"note": "fast/cheap tier - haiku"
|
||||
}
|
||||
]
|
||||
},
|
||||
"setup": {
|
||||
"key": "required",
|
||||
"models": "per-tier",
|
||||
"keyUrl": "https://z.ai/manage-apikey/apikey-list"
|
||||
},
|
||||
"doctor": [
|
||||
"message-check"
|
||||
],
|
||||
"logo": "M12.105 2L9.927 4.953H.653L2.83 2h9.276zM23.254 19.048L21.078 22h-9.242l2.174-2.952h9.244zM24 2L9.264 22H0L14.736 2H24z",
|
||||
"logoScale": 1.07,
|
||||
"glyph": "F015F"
|
||||
},
|
||||
{
|
||||
"id": "lmstudio",
|
||||
"aliases": [
|
||||
"lm-studio"
|
||||
],
|
||||
"title": "LM Studio",
|
||||
"label": "LM Studio - local server, offline, free",
|
||||
"blurb": "Local LM Studio server. Offline and free.",
|
||||
"color": "yellow",
|
||||
"defaultPreset": "lmstudio",
|
||||
"preset": {
|
||||
"baseUrl": "http://127.0.0.1:1234",
|
||||
"auth": {
|
||||
"mode": "literal",
|
||||
"token": "lmstudio"
|
||||
},
|
||||
"contextTokens": 262144,
|
||||
"gatewayModelDiscovery": false,
|
||||
"extraEnv": {
|
||||
"CLAUDE_CODE_ATTRIBUTION_HEADER": "0"
|
||||
}
|
||||
},
|
||||
"server": {
|
||||
"editable": true,
|
||||
"probe": "always",
|
||||
"paths": [
|
||||
"/api/v0/models",
|
||||
"/v1/models"
|
||||
],
|
||||
"hint": "LM Studio does not have to be on this machine. Point this at a LAN address, or anything reachable through a tunnel or proxy.",
|
||||
"start": "start the server (Developer > Start Server)"
|
||||
},
|
||||
"catalogue": {
|
||||
"kind": "lmstudio",
|
||||
"perServer": true
|
||||
},
|
||||
"setup": {
|
||||
"key": "optional",
|
||||
"models": "one-for-all"
|
||||
},
|
||||
"doctor": [
|
||||
"catalogue-models",
|
||||
"lmstudio-templates"
|
||||
],
|
||||
"logo": "M14.025 0c3.492 0 5.237 0 6.571.68a6.24 6.24 0 0 1 2.725 2.724C24 4.738 24 6.484 24 9.975v4.05c0 3.492 0 5.237-.68 6.571a6.24 6.24 0 0 1-2.724 2.725c-1.334.679-3.08.679-6.571.679h-4.05c-3.492 0-5.237 0-6.571-.68A6.24 6.24 0 0 1 .68 20.597C0 19.262 0 17.516 0 14.025v-4.05c0-3.492 0-5.237.68-6.571A6.23 6.23 0 0 1 3.404.68C4.738 0 6.484 0 9.975 0zM7.688 16.313a1.313 1.313 0 0 0 0 2.625h11.625a1.313 1.313 0 0 0 0-2.625zm-3-3.75a1.313 1.313 0 0 0 0 2.624h11.625a1.313 1.313 0 0 0 0-2.624zm3-3.75a1.313 1.313 0 0 0 0 2.624h11.625a1.313 1.313 0 0 0 0-2.624zm-3-3.75a1.313 1.313 0 0 0 0 2.625h11.625a1.313 1.313 0 0 0 0-2.625z",
|
||||
"logoScale": 0.86,
|
||||
"glyph": "F048B"
|
||||
},
|
||||
{
|
||||
"id": "ollama",
|
||||
"aliases": [],
|
||||
"title": "Ollama",
|
||||
"label": "Ollama - local server, offline, free",
|
||||
"blurb": "Local Ollama server. Offline and free.",
|
||||
"color": "white",
|
||||
"defaultPreset": "ollama",
|
||||
"preset": {
|
||||
"baseUrl": "http://127.0.0.1:11434",
|
||||
"auth": {
|
||||
"mode": "literal",
|
||||
"token": "ollama"
|
||||
},
|
||||
"contextTokens": 65536,
|
||||
"gatewayModelDiscovery": false,
|
||||
"extraEnv": {
|
||||
"CLAUDE_CODE_ATTRIBUTION_HEADER": "0"
|
||||
}
|
||||
},
|
||||
"server": {
|
||||
"editable": true,
|
||||
"probe": "always",
|
||||
"paths": [
|
||||
"/api/tags"
|
||||
],
|
||||
"hint": "Ollama does not have to be on this machine. Serve it with OLLAMA_HOST=0.0.0.0 to reach it over the LAN.",
|
||||
"start": "start it with: ollama serve"
|
||||
},
|
||||
"catalogue": {
|
||||
"kind": "ollama",
|
||||
"perServer": true
|
||||
},
|
||||
"setup": {
|
||||
"key": "optional",
|
||||
"models": "one-for-all"
|
||||
},
|
||||
"doctor": [
|
||||
"catalogue-models",
|
||||
"ollama-context"
|
||||
],
|
||||
"logo": "M16.361 10.26a.894.894 0 0 0-.558.47l-.072.148.001.207c0 .193.004.217.059.353.076.193.152.312.291.448.24.238.51.3.872.205a.86.86 0 0 0 .517-.436.752.752 0 0 0 .08-.498c-.064-.453-.33-.782-.724-.897a1.06 1.06 0 0 0-.466 0zm-9.203.005c-.305.096-.533.32-.65.639a1.187 1.187 0 0 0-.06.52c.057.309.31.59.598.667.362.095.632.033.872-.205.14-.136.215-.255.291-.448.055-.136.059-.16.059-.353l.001-.207-.072-.148a.894.894 0 0 0-.565-.472 1.02 1.02 0 0 0-.474.007Zm4.184 2c-.131.071-.223.25-.195.383.031.143.157.288.353.407.105.063.112.072.117.136.004.038-.01.146-.029.243-.02.094-.036.194-.036.222.002.074.07.195.143.253.064.052.076.054.255.059.164.005.198.001.264-.03.169-.082.212-.234.15-.525-.052-.243-.042-.28.087-.355.137-.08.281-.219.324-.314a.365.365 0 0 0-.175-.48.394.394 0 0 0-.181-.033c-.126 0-.207.03-.355.124l-.085.053-.053-.032c-.219-.13-.259-.145-.391-.143a.396.396 0 0 0-.193.032zm.39-2.195c-.373.036-.475.05-.654.086-.291.06-.68.195-.951.328-.94.46-1.589 1.226-1.787 2.114-.04.176-.045.234-.045.53 0 .294.005.357.043.524.264 1.16 1.332 2.017 2.714 2.173.3.033 1.596.033 1.896 0 1.11-.125 2.064-.727 2.493-1.571.114-.226.169-.372.22-.602.039-.167.044-.23.044-.523 0-.297-.005-.355-.045-.531-.288-1.29-1.539-2.304-3.072-2.497a6.873 6.873 0 0 0-.855-.031zm.645.937a3.283 3.283 0 0 1 1.44.514c.223.148.537.458.671.662.166.251.26.508.303.82.02.143.01.251-.043.482-.08.345-.332.705-.672.957a3.115 3.115 0 0 1-.689.348c-.382.122-.632.144-1.525.138-.582-.006-.686-.01-.853-.042-.57-.107-1.022-.334-1.35-.68-.264-.28-.385-.535-.45-.946-.03-.192.025-.509.137-.776.136-.326.488-.73.836-.963.403-.269.934-.46 1.422-.512.187-.02.586-.02.773-.002zm-5.503-11a1.653 1.653 0 0 0-.683.298C5.617.74 5.173 1.666 4.985 2.819c-.07.436-.119 1.04-.119 1.503 0 .544.064 1.24.155 1.721.02.107.031.202.023.208a8.12 8.12 0 0 1-.187.152 5.324 5.324 0 0 0-.949 1.02 5.49 5.49 0 0 0-.94 2.339 6.625 6.625 0 0 0-.023 1.357c.091.78.325 1.438.727 2.04l.13.195-.037.064c-.269.452-.498 1.105-.605 1.732-.084.496-.095.629-.095 1.294 0 .67.009.803.088 1.266.095.555.288 1.143.503 1.534.071.128.243.393.264.407.007.003-.014.067-.046.141a7.405 7.405 0 0 0-.548 1.873c-.062.417-.071.552-.071.991 0 .56.031.832.148 1.279L3.42 24h1.478l-.05-.091c-.297-.552-.325-1.575-.068-2.597.117-.472.25-.819.498-1.296l.148-.29v-.177c0-.165-.003-.184-.057-.293a.915.915 0 0 0-.194-.25 1.74 1.74 0 0 1-.385-.543c-.424-.92-.506-2.286-.208-3.451.124-.486.329-.918.544-1.154a.787.787 0 0 0 .223-.531c0-.195-.07-.355-.224-.522a3.136 3.136 0 0 1-.817-1.729c-.14-.96.114-2.005.69-2.834.563-.814 1.353-1.336 2.237-1.475.199-.033.57-.028.776.01.226.04.367.028.512-.041.179-.085.268-.19.374-.431.093-.215.165-.333.36-.576.234-.29.46-.489.822-.729.413-.27.884-.467 1.352-.561.17-.035.25-.04.569-.04.319 0 .398.005.569.04a4.07 4.07 0 0 1 1.914.997c.117.109.398.457.488.602.034.057.095.177.132.267.105.241.195.346.374.43.14.068.286.082.503.045.343-.058.607-.053.943.016 1.144.23 2.14 1.173 2.581 2.437.385 1.108.276 2.267-.296 3.153-.097.15-.193.27-.333.419-.301.322-.301.722-.001 1.053.493.539.801 1.866.708 3.036-.062.772-.26 1.463-.533 1.854a2.096 2.096 0 0 1-.224.258.916.916 0 0 0-.194.25c-.054.109-.057.128-.057.293v.178l.148.29c.248.476.38.823.498 1.295.253 1.008.231 2.01-.059 2.581a.845.845 0 0 0-.044.098c0 .006.329.009.732.009h.73l.02-.074.036-.134c.019-.076.057-.3.088-.516.029-.217.029-1.016 0-1.258-.11-.875-.295-1.57-.597-2.226-.032-.074-.053-.138-.046-.141.008-.005.057-.074.108-.152.376-.569.607-1.284.724-2.228.031-.26.031-1.378 0-1.628-.083-.645-.182-1.082-.348-1.525a6.083 6.083 0 0 0-.329-.7l-.038-.064.131-.194c.402-.604.636-1.262.727-2.04a6.625 6.625 0 0 0-.024-1.358 5.512 5.512 0 0 0-.939-2.339 5.325 5.325 0 0 0-.95-1.02 8.097 8.097 0 0 1-.186-.152.692.692 0 0 1 .023-.208c.208-1.087.201-2.443-.017-3.503-.19-.924-.535-1.658-.98-2.082-.354-.338-.716-.482-1.15-.455-.996.059-1.8 1.205-2.116 3.01a6.805 6.805 0 0 0-.097.726c0 .036-.007.066-.015.066a.96.96 0 0 1-.149-.078A4.857 4.857 0 0 0 12 3.03c-.832 0-1.687.243-2.456.698a.958.958 0 0 1-.148.078c-.008 0-.015-.03-.015-.066a6.71 6.71 0 0 0-.097-.725C8.997 1.392 8.337.319 7.46.048a2.096 2.096 0 0 0-.585-.041Zm.293 1.402c.248.197.523.759.682 1.388.03.113.06.244.069.292.007.047.026.152.041.233.067.365.098.76.102 1.24l.002.475-.12.175-.118.178h-.278c-.324 0-.646.041-.954.124l-.238.06c-.033.007-.038-.003-.057-.144a8.438 8.438 0 0 1 .016-2.323c.124-.788.413-1.501.696-1.711.067-.05.079-.049.157.013zm9.825-.012c.17.126.358.46.498.888.28.854.36 2.028.212 3.145-.019.14-.024.151-.057.144l-.238-.06a3.693 3.693 0 0 0-.954-.124h-.278l-.119-.178-.119-.175.002-.474c.004-.669.066-1.19.214-1.772.157-.623.434-1.185.68-1.382.078-.062.09-.063.159-.012z",
|
||||
"logoScale": 1.0,
|
||||
"glyph": ""
|
||||
},
|
||||
{
|
||||
"id": "custom",
|
||||
"aliases": [],
|
||||
"title": "Custom",
|
||||
"label": "Custom - any Anthropic-compatible endpoint",
|
||||
"blurb": "Your own endpoint: a proxy, gateway or self-hosted server.",
|
||||
"color": "gray",
|
||||
"defaultPreset": "custom",
|
||||
"preset": {
|
||||
"baseUrl": "",
|
||||
"auth": {
|
||||
"mode": "vault",
|
||||
"keyRef": "custom"
|
||||
},
|
||||
"contextTokens": 200000,
|
||||
"gatewayModelDiscovery": false
|
||||
},
|
||||
"server": {
|
||||
"editable": true,
|
||||
"probe": "lenient",
|
||||
"paths": [
|
||||
"/v1/models"
|
||||
],
|
||||
"hint": "Any server that speaks Anthropic's Messages API: a LiteLLM or Vercel gateway, vLLM, llama.cpp, a company proxy.",
|
||||
"start": ""
|
||||
},
|
||||
"catalogue": {
|
||||
"kind": "openai",
|
||||
"perServer": true
|
||||
},
|
||||
"setup": {
|
||||
"key": "optional",
|
||||
"models": "per-tier"
|
||||
},
|
||||
"doctor": [
|
||||
"catalogue-models"
|
||||
],
|
||||
"logo": "M9 3.5 1 12l8 8.5 2-2L4.8 12 11 5.5zm6 0-2 2 6.2 6.5-6.2 6.5 2 2 8-8.5z",
|
||||
"logoScale": 1.09,
|
||||
"glyph": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user