Skip to content

Correct max output tokens for Claude Opus 4.6, 4.7, 4.8 and Sonnet 4.6 - #7129

Merged
tim-smart merged 1 commit into
Effect-TS:mainfrom
mkdynamic:fix/anthropic-stale-max-output-tokens
Aug 8, 2026
Merged

Correct max output tokens for Claude Opus 4.6, 4.7, 4.8 and Sonnet 4.6#7129
tim-smart merged 1 commit into
Effect-TS:mainfrom
mkdynamic:fix/anthropic-stale-max-output-tokens

Conversation

@mkdynamic

Copy link
Copy Markdown
Contributor

Type

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

These models share the 4.5 family's 64000 token entry in getModelCapabilities, but each allows 128000, so requests default to half the model's real limit.

Anthropic's models overview lists "Max output: 128k tokens" for Opus 4.6, 4.7, 4.8 and Sonnet 4.6, against 64k for Sonnet 4.5 and Opus 4.5. The API says the same when a request exceeds it:

max_tokens: 9999999 > 128000, which is the maximum allowed number of output tokens for claude-opus-4-8

The 4.5 models keep their existing 64000 entry, which is correct for them.

Related

  • Related Issue #
  • Closes #

These models shared the 4.5 family's 64000 token entry, but the API allows
128000 for each -- confirmed by the limit the API itself reports when the
request exceeds it. The 4.5 models keep 64000, which matches theirs.
@changeset-bot

changeset-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d55805a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
Name Type
@effect/ai-anthropic Patch
effect Patch
@effect/ai-openai Patch
@effect/ai-openai-compat Patch
@effect/ai-openrouter Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/docgen Patch
@effect/doctest Patch
@effect/openapi-generator Patch
@effect/opentelemetry Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-deno Patch
@effect/platform-node Patch
@effect/platform-node-shared Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/vitest Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This PR updates the internal getModelCapabilities mapping in @effect/ai-anthropic so that Claude Opus 4.6, 4.7, 4.8, and Sonnet 4.6 use maxOutputTokens: 128000 instead of being grouped with the 4.5 family at 64000. The 4.5 models (Opus 4.5, Sonnet 4.5, Haiku 4.5) correctly keep 64000, and the structured-output flags are unchanged.

  • .changeset/anthropic-stale-max-output-tokens.md — concise patch changeset for @effect/ai-anthropic.
  • packages/ai/anthropic/src/AnthropicLanguageModel.ts — splits the 128k-capable 4.6/4.7/4.8 models into their own branch ahead of the 4.5 branch.

I cross-checked the limits against Anthropic's published models overview: the legacy models table lists 128k max output for Opus 4.6/4.7/4.8 and Sonnet 4.6, and 64k for Opus 4.5 and Sonnet 4.5. The targeted test run for AnthropicLanguageModel.test.ts in @effect/ai-anthropic passed.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File Name Current Size Previous Size Difference
basic.ts 6.92 KB 6.92 KB 0.00 KB (0.00%)
batching.ts 9.72 KB 9.72 KB 0.00 KB (0.00%)
brand.ts 6.60 KB 6.60 KB 0.00 KB (0.00%)
cache.ts 10.59 KB 10.59 KB 0.00 KB (0.00%)
config.ts 20.83 KB 20.83 KB 0.00 KB (0.00%)
differ.ts 19.67 KB 19.67 KB 0.00 KB (0.00%)
http-client.ts 21.50 KB 21.50 KB 0.00 KB (0.00%)
logger.ts 10.81 KB 10.81 KB 0.00 KB (0.00%)
metric.ts 8.86 KB 8.86 KB 0.00 KB (0.00%)
optic.ts 6.68 KB 6.68 KB 0.00 KB (0.00%)
pubsub.ts 14.86 KB 14.86 KB 0.00 KB (0.00%)
queue.ts 11.54 KB 11.54 KB 0.00 KB (0.00%)
schedule.ts 10.71 KB 10.71 KB 0.00 KB (0.00%)
schema-class.ts 19.38 KB 19.38 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 29.24 KB 29.24 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 25.51 KB 25.51 KB 0.00 KB (0.00%)
schema-string-transformation.ts 13.49 KB 13.49 KB 0.00 KB (0.00%)
schema-string.ts 11.03 KB 11.03 KB 0.00 KB (0.00%)
schema-template-literal.ts 15.30 KB 15.30 KB 0.00 KB (0.00%)
schema-toArbitraryLazy.ts 21.43 KB 21.43 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 23.87 KB 23.87 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 18.64 KB 18.64 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 18.47 KB 18.47 KB 0.00 KB (0.00%)
schema-toFormatter.ts 18.32 KB 18.32 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 22.09 KB 22.09 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 19.01 KB 19.01 KB 0.00 KB (0.00%)
schema.ts 18.62 KB 18.62 KB 0.00 KB (0.00%)
stm.ts 12.59 KB 12.59 KB 0.00 KB (0.00%)
stream.ts 9.67 KB 9.67 KB 0.00 KB (0.00%)

@tim-smart
tim-smart merged commit d0baed9 into Effect-TS:main Aug 8, 2026
15 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants