milaidy 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +538 -0
  3. package/dist/argv-CfSowvEA.js +63 -0
  4. package/dist/config-B-mboG4v.js +4 -0
  5. package/dist/eliza-CPJjgw-e.js +1491 -0
  6. package/dist/eliza.js +2192 -0
  7. package/dist/entry.js +232 -0
  8. package/dist/index.js +209 -0
  9. package/dist/links-BFKlWqSe.js +15 -0
  10. package/dist/paths-D_yh1DEJ.js +69 -0
  11. package/dist/plugins-cli-B7kSre2c.js +134 -0
  12. package/dist/program-6KwWwKKh.js +510 -0
  13. package/dist/register.agents-CPVmSjMG.js +17 -0
  14. package/dist/register.browser-B2ooXxNx.js +15 -0
  15. package/dist/register.channels-CMYQ6K6Y.js +42 -0
  16. package/dist/register.cron-D91lY1_Y.js +9 -0
  17. package/dist/register.devices-rU5I5L_y.js +13 -0
  18. package/dist/register.gateway-82SLAvw3.js +22 -0
  19. package/dist/register.hooks-B_XTBEkt.js +9 -0
  20. package/dist/register.logs-BgEGcPd8.js +10 -0
  21. package/dist/register.models-BJt9eVgZ.js +26 -0
  22. package/dist/register.nodes-B5xY1s8a.js +9 -0
  23. package/dist/register.skills-SFQqYIhg.js +10 -0
  24. package/dist/register.subclis-uF_AsbWR.js +187 -0
  25. package/dist/run-main-XODklzS-.js +56 -0
  26. package/dist/theme-DBvtuGeq.js +36 -0
  27. package/dist/utils-C1AUpp_V.js +42 -0
  28. package/dist/version-Cpn3yr5D.js +26 -0
  29. package/dist/workspace-Co3Wul2D.js +206 -0
  30. package/dist/workspace-DCA6MNVK.js +350 -0
  31. package/docs/.i18n/README.md +31 -0
  32. package/docs/.i18n/glossary.zh-CN.json +210 -0
  33. package/docs/.i18n/zh-CN.tm.jsonl +1329 -0
  34. package/docs/CNAME +1 -0
  35. package/docs/automation/cron-jobs.md +468 -0
  36. package/docs/automation/cron-vs-heartbeat.md +254 -0
  37. package/docs/automation/gmail-pubsub.md +256 -0
  38. package/docs/automation/poll.md +69 -0
  39. package/docs/automation/webhook.md +163 -0
  40. package/docs/bedrock.md +176 -0
  41. package/docs/brave-search.md +41 -0
  42. package/docs/broadcast-groups.md +442 -0
  43. package/docs/cli/acp.md +170 -0
  44. package/docs/cli/agent.md +24 -0
  45. package/docs/cli/agents.md +75 -0
  46. package/docs/cli/approvals.md +50 -0
  47. package/docs/cli/browser.md +107 -0
  48. package/docs/cli/channels.md +79 -0
  49. package/docs/cli/config.md +50 -0
  50. package/docs/cli/configure.md +33 -0
  51. package/docs/cli/cron.md +42 -0
  52. package/docs/cli/dashboard.md +16 -0
  53. package/docs/cli/devices.md +67 -0
  54. package/docs/cli/directory.md +63 -0
  55. package/docs/cli/dns.md +23 -0
  56. package/docs/cli/docs.md +15 -0
  57. package/docs/cli/doctor.md +41 -0
  58. package/docs/cli/gateway.md +199 -0
  59. package/docs/cli/health.md +21 -0
  60. package/docs/cli/hooks.md +291 -0
  61. package/docs/cli/index.md +1029 -0
  62. package/docs/cli/logs.md +24 -0
  63. package/docs/cli/memory.md +45 -0
  64. package/docs/cli/message.md +239 -0
  65. package/docs/cli/models.md +79 -0
  66. package/docs/cli/node.md +112 -0
  67. package/docs/cli/nodes.md +73 -0
  68. package/docs/cli/onboard.md +29 -0
  69. package/docs/cli/pairing.md +21 -0
  70. package/docs/cli/plugins.md +62 -0
  71. package/docs/cli/reset.md +17 -0
  72. package/docs/cli/sandbox.md +152 -0
  73. package/docs/cli/security.md +26 -0
  74. package/docs/cli/sessions.md +16 -0
  75. package/docs/cli/setup.md +29 -0
  76. package/docs/cli/skills.md +26 -0
  77. package/docs/cli/status.md +26 -0
  78. package/docs/cli/system.md +60 -0
  79. package/docs/cli/tui.md +23 -0
  80. package/docs/cli/uninstall.md +17 -0
  81. package/docs/cli/update.md +98 -0
  82. package/docs/cli/voicecall.md +34 -0
  83. package/docs/cli/webhooks.md +25 -0
  84. package/docs/concepts/agent-loop.md +146 -0
  85. package/docs/concepts/agent-workspace.md +229 -0
  86. package/docs/concepts/agent.md +122 -0
  87. package/docs/concepts/architecture.md +129 -0
  88. package/docs/concepts/channel-routing.md +114 -0
  89. package/docs/concepts/compaction.md +61 -0
  90. package/docs/concepts/context.md +159 -0
  91. package/docs/concepts/features.md +53 -0
  92. package/docs/concepts/group-messages.md +84 -0
  93. package/docs/concepts/groups.md +373 -0
  94. package/docs/concepts/markdown-formatting.md +130 -0
  95. package/docs/concepts/memory.md +546 -0
  96. package/docs/concepts/messages.md +154 -0
  97. package/docs/concepts/model-failover.md +149 -0
  98. package/docs/concepts/model-providers.md +315 -0
  99. package/docs/concepts/models.md +208 -0
  100. package/docs/concepts/multi-agent.md +376 -0
  101. package/docs/concepts/oauth.md +145 -0
  102. package/docs/concepts/plugins.md +454 -0
  103. package/docs/concepts/presence.md +102 -0
  104. package/docs/concepts/queue.md +89 -0
  105. package/docs/concepts/retry.md +69 -0
  106. package/docs/concepts/secrets.md +300 -0
  107. package/docs/concepts/session-pruning.md +122 -0
  108. package/docs/concepts/session-tool.md +193 -0
  109. package/docs/concepts/session.md +188 -0
  110. package/docs/concepts/sessions.md +10 -0
  111. package/docs/concepts/skills.md +392 -0
  112. package/docs/concepts/streaming.md +135 -0
  113. package/docs/concepts/system-prompt.md +114 -0
  114. package/docs/concepts/timezone.md +91 -0
  115. package/docs/concepts/typebox.md +289 -0
  116. package/docs/concepts/typing-indicators.md +68 -0
  117. package/docs/concepts/usage-tracking.md +35 -0
  118. package/docs/custom.css +4 -0
  119. package/docs/date-time.md +128 -0
  120. package/docs/debugging.md +162 -0
  121. package/docs/docs.json +1599 -0
  122. package/docs/environment.md +81 -0
  123. package/docs/hooks.md +876 -0
  124. package/docs/index.md +179 -0
  125. package/docs/install/ansible.md +208 -0
  126. package/docs/install/bun.md +59 -0
  127. package/docs/install/development-channels.md +75 -0
  128. package/docs/install/docker.md +567 -0
  129. package/docs/install/index.md +185 -0
  130. package/docs/install/installer.md +123 -0
  131. package/docs/install/migrating.md +192 -0
  132. package/docs/install/nix.md +96 -0
  133. package/docs/install/node.md +78 -0
  134. package/docs/install/uninstall.md +128 -0
  135. package/docs/install/updating.md +228 -0
  136. package/docs/logging.md +350 -0
  137. package/docs/multi-agent-sandbox-tools.md +395 -0
  138. package/docs/network.md +54 -0
  139. package/docs/nodes/audio.md +114 -0
  140. package/docs/nodes/camera.md +156 -0
  141. package/docs/nodes/images.md +72 -0
  142. package/docs/nodes/index.md +341 -0
  143. package/docs/nodes/location-command.md +113 -0
  144. package/docs/nodes/media-understanding.md +379 -0
  145. package/docs/nodes/talk.md +90 -0
  146. package/docs/nodes/voicewake.md +65 -0
  147. package/docs/northflank.mdx +53 -0
  148. package/docs/perplexity.md +80 -0
  149. package/docs/platforms/android.md +129 -0
  150. package/docs/platforms/digitalocean.md +262 -0
  151. package/docs/platforms/exe-dev.md +125 -0
  152. package/docs/platforms/fly.md +486 -0
  153. package/docs/platforms/gcp.md +503 -0
  154. package/docs/platforms/hetzner.md +330 -0
  155. package/docs/platforms/index.md +53 -0
  156. package/docs/platforms/ios.md +106 -0
  157. package/docs/platforms/linux.md +94 -0
  158. package/docs/platforms/mac/bundled-gateway.md +73 -0
  159. package/docs/platforms/mac/canvas.md +125 -0
  160. package/docs/platforms/mac/child-process.md +69 -0
  161. package/docs/platforms/mac/dev-setup.md +102 -0
  162. package/docs/platforms/mac/health.md +34 -0
  163. package/docs/platforms/mac/icon.md +31 -0
  164. package/docs/platforms/mac/logging.md +57 -0
  165. package/docs/platforms/mac/menu-bar.md +81 -0
  166. package/docs/platforms/mac/peekaboo.md +65 -0
  167. package/docs/platforms/mac/permissions.md +44 -0
  168. package/docs/platforms/mac/release.md +85 -0
  169. package/docs/platforms/mac/remote.md +83 -0
  170. package/docs/platforms/mac/signing.md +47 -0
  171. package/docs/platforms/mac/skills.md +33 -0
  172. package/docs/platforms/mac/voice-overlay.md +60 -0
  173. package/docs/platforms/mac/voicewake.md +67 -0
  174. package/docs/platforms/mac/webchat.md +41 -0
  175. package/docs/platforms/mac/xpc.md +61 -0
  176. package/docs/platforms/macos-vm.md +281 -0
  177. package/docs/platforms/macos.md +203 -0
  178. package/docs/platforms/oracle.md +303 -0
  179. package/docs/platforms/raspberry-pi.md +358 -0
  180. package/docs/platforms/windows.md +159 -0
  181. package/docs/plugin.md +651 -0
  182. package/docs/plugins/agent-tools.md +99 -0
  183. package/docs/plugins/manifest.md +71 -0
  184. package/docs/plugins/voice-call.md +273 -0
  185. package/docs/plugins/zalouser.md +70 -0
  186. package/docs/providers/anthropic.md +152 -0
  187. package/docs/providers/claude-max-api-proxy.md +148 -0
  188. package/docs/providers/cloudflare-ai-gateway.md +71 -0
  189. package/docs/providers/deepgram.md +93 -0
  190. package/docs/providers/glm.md +33 -0
  191. package/docs/providers/index.md +63 -0
  192. package/docs/providers/minimax.md +208 -0
  193. package/docs/providers/models.md +51 -0
  194. package/docs/providers/moonshot.md +142 -0
  195. package/docs/providers/ollama.md +223 -0
  196. package/docs/providers/openai.md +62 -0
  197. package/docs/providers/opencode.md +36 -0
  198. package/docs/providers/openrouter.md +37 -0
  199. package/docs/providers/qwen.md +53 -0
  200. package/docs/providers/synthetic.md +99 -0
  201. package/docs/providers/venice.md +267 -0
  202. package/docs/providers/vercel-ai-gateway.md +50 -0
  203. package/docs/providers/xiaomi.md +64 -0
  204. package/docs/providers/zai.md +36 -0
  205. package/docs/railway.mdx +99 -0
  206. package/docs/reference/templates/AGENTS.md +9 -0
  207. package/docs/reference/templates/BOOTSTRAP.md +3 -0
  208. package/docs/reference/templates/HEARTBEAT.md +3 -0
  209. package/docs/reference/templates/IDENTITY.md +3 -0
  210. package/docs/reference/templates/TOOLS.md +3 -0
  211. package/docs/reference/templates/USER.md +3 -0
  212. package/docs/render.mdx +165 -0
  213. package/docs/start/docs-directory.md +63 -0
  214. package/docs/start/getting-started.md +212 -0
  215. package/docs/start/milaidy.md +247 -0
  216. package/docs/start/onboarding.md +258 -0
  217. package/docs/start/pairing.md +86 -0
  218. package/docs/start/quickstart.md +81 -0
  219. package/docs/start/setup.md +149 -0
  220. package/docs/start/showcase.md +416 -0
  221. package/docs/start/wizard.md +418 -0
  222. package/docs/testing.md +368 -0
  223. package/docs/token-use.md +112 -0
  224. package/docs/tools/agent-send.md +53 -0
  225. package/docs/tools/apply-patch.md +50 -0
  226. package/docs/tools/browser-linux-troubleshooting.md +139 -0
  227. package/docs/tools/browser-login.md +68 -0
  228. package/docs/tools/browser.md +576 -0
  229. package/docs/tools/chrome-extension.md +178 -0
  230. package/docs/tools/clawhub.md +257 -0
  231. package/docs/tools/creating-skills.md +54 -0
  232. package/docs/tools/elevated.md +57 -0
  233. package/docs/tools/exec-approvals.md +246 -0
  234. package/docs/tools/exec.md +179 -0
  235. package/docs/tools/firecrawl.md +61 -0
  236. package/docs/tools/index.md +508 -0
  237. package/docs/tools/llm-task.md +115 -0
  238. package/docs/tools/reactions.md +22 -0
  239. package/docs/tools/skills-config.md +76 -0
  240. package/docs/tools/skills.md +300 -0
  241. package/docs/tools/slash-commands.md +196 -0
  242. package/docs/tools/subagents.md +151 -0
  243. package/docs/tools/thinking.md +73 -0
  244. package/docs/tools/web.md +261 -0
  245. package/docs/tui.md +159 -0
  246. package/docs/vps.md +43 -0
  247. package/docs/web/control-ui.md +221 -0
  248. package/docs/web/dashboard.md +46 -0
  249. package/docs/web/index.md +116 -0
  250. package/docs/web/webchat.md +49 -0
  251. package/milaidy.mjs +14 -0
  252. package/package.json +271 -0
  253. package/skills/.cache/catalog.json +88519 -0
@@ -0,0 +1,149 @@
1
+ ---
2
+ summary: "How Milaidy rotates auth profiles and falls back across models"
3
+ read_when:
4
+ - Diagnosing auth profile rotation, cooldowns, or model fallback behavior
5
+ - Updating failover rules for auth profiles or models
6
+ title: "Model Failover"
7
+ ---
8
+
9
+ # Model failover
10
+
11
+ Milaidy handles failures in two stages:
12
+
13
+ 1. **Auth profile rotation** within the current provider.
14
+ 2. **Model fallback** to the next model in `agents.defaults.model.fallbacks`.
15
+
16
+ This doc explains the runtime rules and the data that backs them.
17
+
18
+ ## Auth storage (keys + OAuth)
19
+
20
+ Milaidy uses **auth profiles** for both API keys and OAuth tokens.
21
+
22
+ - Secrets live in `~/.milaidy/agents/<agentId>/agent/auth-profiles.json` (legacy: `~/.milaidy/agent/auth-profiles.json`).
23
+ - Config `auth.profiles` / `auth.order` are **metadata + routing only** (no secrets).
24
+ - Legacy import-only OAuth file: `~/.milaidy/credentials/oauth.json` (imported into `auth-profiles.json` on first use).
25
+
26
+ More detail: [/concepts/oauth](/concepts/oauth)
27
+
28
+ Credential types:
29
+
30
+ - `type: "api_key"` → `{ provider, key }`
31
+ - `type: "oauth"` → `{ provider, access, refresh, expires, email? }` (+ `projectId`/`enterpriseUrl` for some providers)
32
+
33
+ ## Profile IDs
34
+
35
+ OAuth logins create distinct profiles so multiple accounts can coexist.
36
+
37
+ - Default: `provider:default` when no email is available.
38
+ - OAuth with email: `provider:<email>` (for example `google-antigravity:user@gmail.com`).
39
+
40
+ Profiles live in `~/.milaidy/agents/<agentId>/agent/auth-profiles.json` under `profiles`.
41
+
42
+ ## Rotation order
43
+
44
+ When a provider has multiple profiles, Milaidy chooses an order like this:
45
+
46
+ 1. **Explicit config**: `auth.order[provider]` (if set).
47
+ 2. **Configured profiles**: `auth.profiles` filtered by provider.
48
+ 3. **Stored profiles**: entries in `auth-profiles.json` for the provider.
49
+
50
+ If no explicit order is configured, Milaidy uses a round‑robin order:
51
+
52
+ - **Primary key:** profile type (**OAuth before API keys**).
53
+ - **Secondary key:** `usageStats.lastUsed` (oldest first, within each type).
54
+ - **Cooldown/disabled profiles** are moved to the end, ordered by soonest expiry.
55
+
56
+ ### Session stickiness (cache-friendly)
57
+
58
+ Milaidy **pins the chosen auth profile per session** to keep provider caches warm.
59
+ It does **not** rotate on every request. The pinned profile is reused until:
60
+
61
+ - the session is reset (`/new` / `/reset`)
62
+ - a compaction completes (compaction count increments)
63
+ - the profile is in cooldown/disabled
64
+
65
+ Manual selection via `/model …@<profileId>` sets a **user override** for that session
66
+ and is not auto‑rotated until a new session starts.
67
+
68
+ Auto‑pinned profiles (selected by the session router) are treated as a **preference**:
69
+ they are tried first, but Milaidy may rotate to another profile on rate limits/timeouts.
70
+ User‑pinned profiles stay locked to that profile; if it fails and model fallbacks
71
+ are configured, Milaidy moves to the next model instead of switching profiles.
72
+
73
+ ### Why OAuth can “look lost”
74
+
75
+ If you have both an OAuth profile and an API key profile for the same provider, round‑robin can switch between them across messages unless pinned. To force a single profile:
76
+
77
+ - Pin with `auth.order[provider] = ["provider:profileId"]`, or
78
+ - Use a per-session override via `/model …` with a profile override (when supported by your UI/chat surface).
79
+
80
+ ## Cooldowns
81
+
82
+ When a profile fails due to auth/rate‑limit errors (or a timeout that looks
83
+ like rate limiting), Milaidy marks it in cooldown and moves to the next profile.
84
+ Format/invalid‑request errors (for example Cloud Code Assist tool call ID
85
+ validation failures) are treated as failover‑worthy and use the same cooldowns.
86
+
87
+ Cooldowns use exponential backoff:
88
+
89
+ - 1 minute
90
+ - 5 minutes
91
+ - 25 minutes
92
+ - 1 hour (cap)
93
+
94
+ State is stored in `auth-profiles.json` under `usageStats`:
95
+
96
+ ```json
97
+ {
98
+ "usageStats": {
99
+ "provider:profile": {
100
+ "lastUsed": 1736160000000,
101
+ "cooldownUntil": 1736160600000,
102
+ "errorCount": 2
103
+ }
104
+ }
105
+ }
106
+ ```
107
+
108
+ ## Billing disables
109
+
110
+ Billing/credit failures (for example “insufficient credits” / “credit balance too low”) are treated as failover‑worthy, but they’re usually not transient. Instead of a short cooldown, Milaidy marks the profile as **disabled** (with a longer backoff) and rotates to the next profile/provider.
111
+
112
+ State is stored in `auth-profiles.json`:
113
+
114
+ ```json
115
+ {
116
+ "usageStats": {
117
+ "provider:profile": {
118
+ "disabledUntil": 1736178000000,
119
+ "disabledReason": "billing"
120
+ }
121
+ }
122
+ }
123
+ ```
124
+
125
+ Defaults:
126
+
127
+ - Billing backoff starts at **5 hours**, doubles per billing failure, and caps at **24 hours**.
128
+ - Backoff counters reset if the profile hasn’t failed for **24 hours** (configurable).
129
+
130
+ ## Model fallback
131
+
132
+ If all profiles for a provider fail, Milaidy moves to the next model in
133
+ `agents.defaults.model.fallbacks`. This applies to auth failures, rate limits, and
134
+ timeouts that exhausted profile rotation (other errors do not advance fallback).
135
+
136
+ When a run starts with a model override (hooks or CLI), fallbacks still end at
137
+ `agents.defaults.model.primary` after trying any configured fallbacks.
138
+
139
+ ## Related config
140
+
141
+ See [Gateway configuration](/gateway/configuration) for:
142
+
143
+ - `auth.profiles` / `auth.order`
144
+ - `auth.cooldowns.billingBackoffHours` / `auth.cooldowns.billingBackoffHoursByProvider`
145
+ - `auth.cooldowns.billingMaxHours` / `auth.cooldowns.failureWindowHours`
146
+ - `agents.defaults.model.primary` / `agents.defaults.model.fallbacks`
147
+ - `agents.defaults.imageModel` routing
148
+
149
+ See [Models](/concepts/models) for the broader model selection and fallback overview.
@@ -0,0 +1,315 @@
1
+ ---
2
+ summary: "Model provider overview with example configs + CLI flows"
3
+ read_when:
4
+ - You need a provider-by-provider model setup reference
5
+ - You want example configs or CLI onboarding commands for model providers
6
+ title: "Model Providers"
7
+ ---
8
+
9
+ # Model providers
10
+
11
+ This page covers **LLM/model providers** (not chat channels like WhatsApp/Telegram).
12
+ For model selection rules, see [/concepts/models](/concepts/models).
13
+
14
+ ## Quick rules
15
+
16
+ - Model refs use `provider/model` (example: `opencode/claude-opus-4-5`).
17
+ - If you set `agents.defaults.models`, it becomes the allowlist.
18
+ - CLI helpers: `milaidy onboard`, `milaidy models list`, `milaidy models set <provider/model>`.
19
+
20
+ ## Built-in providers (pi-ai catalog)
21
+
22
+ Milaidy ships with the pi‑ai catalog. These providers require **no**
23
+ `models.providers` config; just set auth + pick a model.
24
+
25
+ ### OpenAI
26
+
27
+ - Provider: `openai`
28
+ - Auth: `OPENAI_API_KEY`
29
+ - Example model: `openai/gpt-5.2`
30
+ - CLI: `milaidy onboard --auth-choice openai-api-key`
31
+
32
+ ```json5
33
+ {
34
+ agents: { defaults: { model: { primary: "openai/gpt-5.2" } } },
35
+ }
36
+ ```
37
+
38
+ ### Anthropic
39
+
40
+ - Provider: `anthropic`
41
+ - Auth: `ANTHROPIC_API_KEY` or `claude setup-token`
42
+ - Example model: `anthropic/claude-opus-4-5`
43
+ - CLI: `milaidy onboard --auth-choice token` (paste setup-token) or `milaidy models auth paste-token --provider anthropic`
44
+
45
+ ```json5
46
+ {
47
+ agents: { defaults: { model: { primary: "anthropic/claude-opus-4-5" } } },
48
+ }
49
+ ```
50
+
51
+ ### OpenAI Code (Codex)
52
+
53
+ - Provider: `openai-codex`
54
+ - Auth: OAuth (ChatGPT)
55
+ - Example model: `openai-codex/gpt-5.2`
56
+ - CLI: `milaidy onboard --auth-choice openai-codex` or `milaidy models auth login --provider openai-codex`
57
+
58
+ ```json5
59
+ {
60
+ agents: { defaults: { model: { primary: "openai-codex/gpt-5.2" } } },
61
+ }
62
+ ```
63
+
64
+ ### OpenCode Zen
65
+
66
+ - Provider: `opencode`
67
+ - Auth: `OPENCODE_API_KEY` (or `OPENCODE_ZEN_API_KEY`)
68
+ - Example model: `opencode/claude-opus-4-5`
69
+ - CLI: `milaidy onboard --auth-choice opencode-zen`
70
+
71
+ ```json5
72
+ {
73
+ agents: { defaults: { model: { primary: "opencode/claude-opus-4-5" } } },
74
+ }
75
+ ```
76
+
77
+ ### Google Gemini (API key)
78
+
79
+ - Provider: `google`
80
+ - Auth: `GEMINI_API_KEY`
81
+ - Example model: `google/gemini-3-pro-preview`
82
+ - CLI: `milaidy onboard --auth-choice gemini-api-key`
83
+
84
+ ### Google Vertex, Antigravity, and Gemini CLI
85
+
86
+ - Providers: `google-vertex`, `google-antigravity`, `google-gemini-cli`
87
+ - Auth: Vertex uses gcloud ADC; Antigravity/Gemini CLI use their respective auth flows
88
+ - Antigravity OAuth is shipped as a bundled plugin (`google-antigravity-auth`, disabled by default).
89
+ - Enable: `milaidy plugins enable google-antigravity-auth`
90
+ - Login: `milaidy models auth login --provider google-antigravity --set-default`
91
+ - Gemini CLI OAuth is shipped as a bundled plugin (`google-gemini-cli-auth`, disabled by default).
92
+ - Enable: `milaidy plugins enable google-gemini-cli-auth`
93
+ - Login: `milaidy models auth login --provider google-gemini-cli --set-default`
94
+ - Note: you do **not** paste a client id or secret into `milaidy.json`. The CLI login flow stores
95
+ tokens in auth profiles on the gateway host.
96
+
97
+ ### Z.AI (GLM)
98
+
99
+ - Provider: `zai`
100
+ - Auth: `ZAI_API_KEY`
101
+ - Example model: `zai/glm-4.7`
102
+ - CLI: `milaidy onboard --auth-choice zai-api-key`
103
+ - Aliases: `z.ai/*` and `z-ai/*` normalize to `zai/*`
104
+
105
+ ### Vercel AI Gateway
106
+
107
+ - Provider: `vercel-ai-gateway`
108
+ - Auth: `AI_GATEWAY_API_KEY`
109
+ - Example model: `vercel-ai-gateway/anthropic/claude-opus-4.5`
110
+ - CLI: `milaidy onboard --auth-choice ai-gateway-api-key`
111
+
112
+ ### Other built-in providers
113
+
114
+ - OpenRouter: `openrouter` (`OPENROUTER_API_KEY`)
115
+ - Example model: `openrouter/anthropic/claude-sonnet-4-5`
116
+ - xAI: `xai` (`XAI_API_KEY`)
117
+ - Groq: `groq` (`GROQ_API_KEY`)
118
+ - Cerebras: `cerebras` (`CEREBRAS_API_KEY`)
119
+ - GLM models on Cerebras use ids `zai-glm-4.7` and `zai-glm-4.6`.
120
+ - OpenAI-compatible base URL: `https://api.cerebras.ai/v1`.
121
+ - Mistral: `mistral` (`MISTRAL_API_KEY`)
122
+
123
+ ## Providers via `models.providers` (custom/base URL)
124
+
125
+ Use `models.providers` (or `models.json`) to add **custom** providers or
126
+ OpenAI/Anthropic‑compatible proxies.
127
+
128
+ ### Moonshot AI (Kimi)
129
+
130
+ Moonshot uses OpenAI-compatible endpoints, so configure it as a custom provider:
131
+
132
+ - Provider: `moonshot`
133
+ - Auth: `MOONSHOT_API_KEY`
134
+ - Example model: `moonshot/kimi-k2.5`
135
+
136
+ Kimi K2 model IDs:
137
+
138
+ {/_ moonshot-kimi-k2-model-refs:start _/ && null}
139
+
140
+ - `moonshot/kimi-k2.5`
141
+ - `moonshot/kimi-k2-0905-preview`
142
+ - `moonshot/kimi-k2-turbo-preview`
143
+ - `moonshot/kimi-k2-thinking`
144
+ - `moonshot/kimi-k2-thinking-turbo`
145
+ {/_ moonshot-kimi-k2-model-refs:end _/ && null}
146
+
147
+ ```json5
148
+ {
149
+ agents: {
150
+ defaults: { model: { primary: "moonshot/kimi-k2.5" } },
151
+ },
152
+ models: {
153
+ mode: "merge",
154
+ providers: {
155
+ moonshot: {
156
+ baseUrl: "https://api.moonshot.ai/v1",
157
+ apiKey: "${MOONSHOT_API_KEY}",
158
+ api: "openai-completions",
159
+ models: [{ id: "kimi-k2.5", name: "Kimi K2.5" }],
160
+ },
161
+ },
162
+ },
163
+ }
164
+ ```
165
+
166
+ ### Kimi Coding
167
+
168
+ Kimi Coding uses Moonshot AI's Anthropic-compatible endpoint:
169
+
170
+ - Provider: `kimi-coding`
171
+ - Auth: `KIMI_API_KEY`
172
+ - Example model: `kimi-coding/k2p5`
173
+
174
+ ```json5
175
+ {
176
+ env: { KIMI_API_KEY: "sk-..." },
177
+ agents: {
178
+ defaults: { model: { primary: "kimi-coding/k2p5" } },
179
+ },
180
+ }
181
+ ```
182
+
183
+ ### Qwen OAuth (free tier)
184
+
185
+ Qwen provides OAuth access to Qwen Coder + Vision via a device-code flow.
186
+ Enable the bundled plugin, then log in:
187
+
188
+ ```bash
189
+ milaidy plugins enable qwen-portal-auth
190
+ milaidy models auth login --provider qwen-portal --set-default
191
+ ```
192
+
193
+ Model refs:
194
+
195
+ - `qwen-portal/coder-model`
196
+ - `qwen-portal/vision-model`
197
+
198
+ See [/providers/qwen](/providers/qwen) for setup details and notes.
199
+
200
+ ### Synthetic
201
+
202
+ Synthetic provides Anthropic-compatible models behind the `synthetic` provider:
203
+
204
+ - Provider: `synthetic`
205
+ - Auth: `SYNTHETIC_API_KEY`
206
+ - Example model: `synthetic/hf:MiniMaxAI/MiniMax-M2.1`
207
+ - CLI: `milaidy onboard --auth-choice synthetic-api-key`
208
+
209
+ ```json5
210
+ {
211
+ agents: {
212
+ defaults: { model: { primary: "synthetic/hf:MiniMaxAI/MiniMax-M2.1" } },
213
+ },
214
+ models: {
215
+ mode: "merge",
216
+ providers: {
217
+ synthetic: {
218
+ baseUrl: "https://api.synthetic.new/anthropic",
219
+ apiKey: "${SYNTHETIC_API_KEY}",
220
+ api: "anthropic-messages",
221
+ models: [{ id: "hf:MiniMaxAI/MiniMax-M2.1", name: "MiniMax M2.1" }],
222
+ },
223
+ },
224
+ },
225
+ }
226
+ ```
227
+
228
+ ### MiniMax
229
+
230
+ MiniMax is configured via `models.providers` because it uses custom endpoints:
231
+
232
+ - MiniMax (Anthropic‑compatible): `--auth-choice minimax-api`
233
+ - Auth: `MINIMAX_API_KEY`
234
+
235
+ See [/providers/minimax](/providers/minimax) for setup details, model options, and config snippets.
236
+
237
+ ### Ollama
238
+
239
+ Ollama is a local LLM runtime that provides an OpenAI-compatible API:
240
+
241
+ - Provider: `ollama`
242
+ - Auth: None required (local server)
243
+ - Example model: `ollama/llama3.3`
244
+ - Installation: https://ollama.ai
245
+
246
+ ```bash
247
+ # Install Ollama, then pull a model:
248
+ ollama pull llama3.3
249
+ ```
250
+
251
+ ```json5
252
+ {
253
+ agents: {
254
+ defaults: { model: { primary: "ollama/llama3.3" } },
255
+ },
256
+ }
257
+ ```
258
+
259
+ Ollama is automatically detected when running locally at `http://127.0.0.1:11434/v1`. See [/providers/ollama](/providers/ollama) for model recommendations and custom configuration.
260
+
261
+ ### Local proxies (LM Studio, vLLM, LiteLLM, etc.)
262
+
263
+ Example (OpenAI‑compatible):
264
+
265
+ ```json5
266
+ {
267
+ agents: {
268
+ defaults: {
269
+ model: { primary: "lmstudio/minimax-m2.1-gs32" },
270
+ models: { "lmstudio/minimax-m2.1-gs32": { alias: "Minimax" } },
271
+ },
272
+ },
273
+ models: {
274
+ providers: {
275
+ lmstudio: {
276
+ baseUrl: "http://localhost:1234/v1",
277
+ apiKey: "LMSTUDIO_KEY",
278
+ api: "openai-completions",
279
+ models: [
280
+ {
281
+ id: "minimax-m2.1-gs32",
282
+ name: "MiniMax M2.1",
283
+ reasoning: false,
284
+ input: ["text"],
285
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
286
+ contextWindow: 200000,
287
+ maxTokens: 8192,
288
+ },
289
+ ],
290
+ },
291
+ },
292
+ },
293
+ }
294
+ ```
295
+
296
+ Notes:
297
+
298
+ - For custom providers, `reasoning`, `input`, `cost`, `contextWindow`, and `maxTokens` are optional.
299
+ When omitted, Milaidy defaults to:
300
+ - `reasoning: false`
301
+ - `input: ["text"]`
302
+ - `cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }`
303
+ - `contextWindow: 200000`
304
+ - `maxTokens: 8192`
305
+ - Recommended: set explicit values that match your proxy/model limits.
306
+
307
+ ## CLI examples
308
+
309
+ ```bash
310
+ milaidy onboard --auth-choice opencode-zen
311
+ milaidy models set opencode/claude-opus-4-5
312
+ milaidy models list
313
+ ```
314
+
315
+ See also: [/gateway/configuration](/gateway/configuration) for full configuration examples.
@@ -0,0 +1,208 @@
1
+ ---
2
+ summary: "Models CLI: list, set, aliases, fallbacks, scan, status"
3
+ read_when:
4
+ - Adding or modifying models CLI (models list/set/scan/aliases/fallbacks)
5
+ - Changing model fallback behavior or selection UX
6
+ - Updating model scan probes (tools/images)
7
+ title: "Models CLI"
8
+ ---
9
+
10
+ # Models CLI
11
+
12
+ See [/concepts/model-failover](/concepts/model-failover) for auth profile
13
+ rotation, cooldowns, and how that interacts with fallbacks.
14
+ Quick provider overview + examples: [/concepts/model-providers](/concepts/model-providers).
15
+
16
+ ## How model selection works
17
+
18
+ Milaidy selects models in this order:
19
+
20
+ 1. **Primary** model (`agents.defaults.model.primary` or `agents.defaults.model`).
21
+ 2. **Fallbacks** in `agents.defaults.model.fallbacks` (in order).
22
+ 3. **Provider auth failover** happens inside a provider before moving to the
23
+ next model.
24
+
25
+ Related:
26
+
27
+ - `agents.defaults.models` is the allowlist/catalog of models Milaidy can use (plus aliases).
28
+ - `agents.defaults.imageModel` is used **only when** the primary model can’t accept images.
29
+ - Per-agent defaults can override `agents.defaults.model` via `agents.list[].model` plus bindings (see [/concepts/multi-agent](/concepts/multi-agent)).
30
+
31
+ ## Quick model picks (anecdotal)
32
+
33
+ - **GLM**: a bit better for coding/tool calling.
34
+ - **MiniMax**: better for writing and vibes.
35
+
36
+ ## Setup wizard (recommended)
37
+
38
+ If you don’t want to hand-edit config, run the onboarding wizard:
39
+
40
+ ```bash
41
+ milaidy onboard
42
+ ```
43
+
44
+ It can set up model + auth for common providers, including **OpenAI Code (Codex)
45
+ subscription** (OAuth) and **Anthropic** (API key recommended; `claude
46
+ setup-token` also supported).
47
+
48
+ ## Config keys (overview)
49
+
50
+ - `agents.defaults.model.primary` and `agents.defaults.model.fallbacks`
51
+ - `agents.defaults.imageModel.primary` and `agents.defaults.imageModel.fallbacks`
52
+ - `agents.defaults.models` (allowlist + aliases + provider params)
53
+ - `models.providers` (custom providers written into `models.json`)
54
+
55
+ Model refs are normalized to lowercase. Provider aliases like `z.ai/*` normalize
56
+ to `zai/*`.
57
+
58
+ Provider configuration examples (including OpenCode Zen) live in
59
+ [/gateway/configuration](/gateway/configuration#opencode-zen-multi-model-proxy).
60
+
61
+ ## “Model is not allowed” (and why replies stop)
62
+
63
+ If `agents.defaults.models` is set, it becomes the **allowlist** for `/model` and for
64
+ session overrides. When a user selects a model that isn’t in that allowlist,
65
+ Milaidy returns:
66
+
67
+ ```
68
+ Model "provider/model" is not allowed. Use /model to list available models.
69
+ ```
70
+
71
+ This happens **before** a normal reply is generated, so the message can feel
72
+ like it “didn’t respond.” The fix is to either:
73
+
74
+ - Add the model to `agents.defaults.models`, or
75
+ - Clear the allowlist (remove `agents.defaults.models`), or
76
+ - Pick a model from `/model list`.
77
+
78
+ Example allowlist config:
79
+
80
+ ```json5
81
+ {
82
+ agent: {
83
+ model: { primary: "anthropic/claude-sonnet-4-5" },
84
+ models: {
85
+ "anthropic/claude-sonnet-4-5": { alias: "Sonnet" },
86
+ "anthropic/claude-opus-4-5": { alias: "Opus" },
87
+ },
88
+ },
89
+ }
90
+ ```
91
+
92
+ ## Switching models in chat (`/model`)
93
+
94
+ You can switch models for the current session without restarting:
95
+
96
+ ```
97
+ /model
98
+ /model list
99
+ /model 3
100
+ /model openai/gpt-5.2
101
+ /model status
102
+ ```
103
+
104
+ Notes:
105
+
106
+ - `/model` (and `/model list`) is a compact, numbered picker (model family + available providers).
107
+ - `/model <#>` selects from that picker.
108
+ - `/model status` is the detailed view (auth candidates and, when configured, provider endpoint `baseUrl` + `api` mode).
109
+ - Model refs are parsed by splitting on the **first** `/`. Use `provider/model` when typing `/model <ref>`.
110
+ - If the model ID itself contains `/` (OpenRouter-style), you must include the provider prefix (example: `/model openrouter/moonshotai/kimi-k2`).
111
+ - If you omit the provider, Milaidy treats the input as an alias or a model for the **default provider** (only works when there is no `/` in the model ID).
112
+
113
+ Full command behavior/config: [Slash commands](/tools/slash-commands).
114
+
115
+ ## CLI commands
116
+
117
+ ```bash
118
+ milaidy models list
119
+ milaidy models status
120
+ milaidy models set <provider/model>
121
+ milaidy models set-image <provider/model>
122
+
123
+ milaidy models aliases list
124
+ milaidy models aliases add <alias> <provider/model>
125
+ milaidy models aliases remove <alias>
126
+
127
+ milaidy models fallbacks list
128
+ milaidy models fallbacks add <provider/model>
129
+ milaidy models fallbacks remove <provider/model>
130
+ milaidy models fallbacks clear
131
+
132
+ milaidy models image-fallbacks list
133
+ milaidy models image-fallbacks add <provider/model>
134
+ milaidy models image-fallbacks remove <provider/model>
135
+ milaidy models image-fallbacks clear
136
+ ```
137
+
138
+ `milaidy models` (no subcommand) is a shortcut for `models status`.
139
+
140
+ ### `models list`
141
+
142
+ Shows configured models by default. Useful flags:
143
+
144
+ - `--all`: full catalog
145
+ - `--local`: local providers only
146
+ - `--provider <name>`: filter by provider
147
+ - `--plain`: one model per line
148
+ - `--json`: machine‑readable output
149
+
150
+ ### `models status`
151
+
152
+ Shows the resolved primary model, fallbacks, image model, and an auth overview
153
+ of configured providers. It also surfaces OAuth expiry status for profiles found
154
+ in the auth store (warns within 24h by default). `--plain` prints only the
155
+ resolved primary model.
156
+ OAuth status is always shown (and included in `--json` output). If a configured
157
+ provider has no credentials, `models status` prints a **Missing auth** section.
158
+ JSON includes `auth.oauth` (warn window + profiles) and `auth.providers`
159
+ (effective auth per provider).
160
+ Use `--check` for automation (exit `1` when missing/expired, `2` when expiring).
161
+
162
+ Preferred Anthropic auth is the Claude Code CLI setup-token (run anywhere; paste on the gateway host if needed):
163
+
164
+ ```bash
165
+ claude setup-token
166
+ milaidy models status
167
+ ```
168
+
169
+ ## Scanning (OpenRouter free models)
170
+
171
+ `milaidy models scan` inspects OpenRouter’s **free model catalog** and can
172
+ optionally probe models for tool and image support.
173
+
174
+ Key flags:
175
+
176
+ - `--no-probe`: skip live probes (metadata only)
177
+ - `--min-params <b>`: minimum parameter size (billions)
178
+ - `--max-age-days <days>`: skip older models
179
+ - `--provider <name>`: provider prefix filter
180
+ - `--max-candidates <n>`: fallback list size
181
+ - `--set-default`: set `agents.defaults.model.primary` to the first selection
182
+ - `--set-image`: set `agents.defaults.imageModel.primary` to the first image selection
183
+
184
+ Probing requires an OpenRouter API key (from auth profiles or
185
+ `OPENROUTER_API_KEY`). Without a key, use `--no-probe` to list candidates only.
186
+
187
+ Scan results are ranked by:
188
+
189
+ 1. Image support
190
+ 2. Tool latency
191
+ 3. Context size
192
+ 4. Parameter count
193
+
194
+ Input
195
+
196
+ - OpenRouter `/models` list (filter `:free`)
197
+ - Requires OpenRouter API key from auth profiles or `OPENROUTER_API_KEY` (see [/environment](/environment))
198
+ - Optional filters: `--max-age-days`, `--min-params`, `--provider`, `--max-candidates`
199
+ - Probe controls: `--timeout`, `--concurrency`
200
+
201
+ When run in a TTY, you can select fallbacks interactively. In non‑interactive
202
+ mode, pass `--yes` to accept defaults.
203
+
204
+ ## Models registry (`models.json`)
205
+
206
+ Custom providers in `models.providers` are written into `models.json` under the
207
+ agent directory (default `~/.milaidy/agents/<agentId>/models.json`). This file
208
+ is merged by default unless `models.mode` is set to `replace`.