All Posts
February 12, 20260.1.23Jugg.ai

v0.1.23 — fix: correct Sonnet 4.5 max_tokens and add serverMaxTokens safety

Release v0.1.23: Fix Sonnet 4.5 Token Limits & Add Safety Clamp

February 12, 2026

What changed

  • Bug fix: Claude Sonnet 4.5 maxOutputTokens corrected from 16,384 → 64,000. Agents using this model were limited to 25% of their actual output capacity.
  • Safety mechanism: New serverMaxTokens field on all 11 models tracks the hard ceiling enforced by each provider's API. New getSafeMaxTokens() utility clamps requests to this ceiling, preventing API errors.
  • Base agent updated: createAgentFunction() now uses getSafeMaxTokens() instead of getMaxOutputTokens() for all API calls.
  • Test coverage: 20 new Vitest tests covering model lookups, token limit correctness, clamping behavior, and registry consistency.

Why it matters

Sonnet 4.5 agents can now use their full 64k output token capacity. The safety clamp ensures no model can accidentally request more tokens than its API allows, eliminating a class of silent failures.

Technical notes

  • Fully backward compatible — getMaxOutputTokens() still exported, serverMaxTokens is optional on ModelDefinition
  • No database or schema changes

Release Notes

Successfully merged PR #63 and published release v0.1.23.

What was released:

  • Bug Fix: Corrected Claude Sonnet 4.5 maxOutputTokens from 16,384 → 64,000 (was only 25% of actual capacity)
  • Safety Mechanism: Added serverMaxTokens field and getSafeMaxTokens() utility to prevent API errors from exceeding provider-enforced token limits across all 11 models
  • Test Suite: Added 20 Vitest test cases covering the model registry, token limits, and consistency checks
  • Vitest Config: New vitest.config.ts with path alias support

Details: