What
Adds an optional fallback flag to AI chat requests. When set to false, a request that fails on the first provider tried returns that error instead of being retried on another provider that serves the same model. With provider also set, the request is answered by that provider or fails, and a provider that does not serve the model returns a 400.
Accepted from puter.ai.chat(), /drivers/call, the /openai/v1/* routes, and /anthropic/v1/messages. Unset defaults to true.
Also: three two-line prettier fixes in PuterAIController.ts (as UsageDetails | undefined reflow) that eslint flagged on main; the file now lints clean.
Why
Fallback picks the provider for you and bills you for the attempt that responds. However, some providers are more expensive than others. openrouter:anthropic/claude-haiku-5-5 can be exponentially more expensive than claude:anthropic/claude-haiku-5-5, and sometimes a failure is preferred over 600 credits lost. (can you tell I'm speaking from experience?)
Testing
Driver routing tests on deepseek-v4-pro (four routes) cover one attempt with fallback: false, the pinned provider only, a 400 for a pinned provider with no route, the failed route still marked unhealthy, and three attempts when unset. Controller, Anthropic wire, puter.js unit and API suite tests cover the passthrough. Typecheck, puter.js type check, and eslint pass on the touched files.