| @@ -196,8 +196,19 @@ | ||
| 196 | 196 | * OpenRouter normalises `max_tokens` across very different underlying |
| 197 | 197 | * models, so we apply a single conservative ceiling rather than per-model |
| 198 | 198 | * limits. |
| 199 | 199 | * |
| 200 | + * Deliberately NOT given the per-model table Claude_Client gained in #665, | |
| 201 | + * and still subject to the same truncation symptom as a result. | |
| 202 | + * | |
| 203 | + * That table is only safe for Claude because its model list is short, known | |
| 204 | + * and verifiable. OpenRouter routes to arbitrary models from many providers | |
| 205 | + * with no curated list here, and a ceiling guessed too high returns a | |
| 206 | + * provider 400 rather than a smaller answer — a worse failure than the one | |
| 207 | + * it would be fixing. Raising this needs either a per-model table sourced | |
| 208 | + * from OpenRouter's own model metadata endpoint, or streaming so a large | |
| 209 | + * budget cannot time out. Tracked separately; see #665. | |
| 210 | + * | |
| 200 | 211 | * @param string $model Model name |
| 201 | 212 | * @return int Maximum completion tokens |
| 202 | 213 | */ |
| 203 | 214 | private function get_max_completion_tokens(string $model): int { |