[BUG] claude with model sonnet[1m] doesn't accept single messages > 200.000 tokens

Status Closed — not planned
Maintainer reply ✓ Yes — dicksontsai
Activity 9 comments · opened Sep 12, 2025 · closed Jan 13, 2026
💡 Likely answer: A maintainer (dicksontsai, collaborator) responded on this thread — see the highlighted reply below.

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When I try to send a message to claude with model sonnet[1m] in batch mode, I get an api error 400 with the error message, that this execeeds context limit (see below).

What Should Happen?

claude should accept and process the message

Error Messages/Logs

$ cat mylongprompt.md | claude --model=sonnet[1m] -p
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"input length and `max_tokens` exceed context limit: 199139 + 21333 > 200000, decrease input length or `max_tokens` and try again"},"request_id":"req_xxx"}

Steps to Reproduce

take a long text file and pipe it to "claude --model=sonnet[1m] -p

Claude Model

Sonnet (default)

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

1.0.112

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Non-interactive/CI environment

Additional Information

_No response_

View original on GitHub ↗

9 Comments

github-actions[bot] · 1 year ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/4869
  2. https://github.com/anthropics/claude-code/issues/6632
  3. https://github.com/anthropics/claude-code/issues/6559

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

dicksontsai collaborator · 1 year ago

Which type of account do you have? sonnet[1m] is not available to every user. Omitting the request ID makes this report unactionable.

jkaster · 11 months ago
Which type of account do you have? sonnet[1m] is not available to every user. Omitting the request ID makes this report unactionable.

I have a premier license with my company.

ariccio · 11 months ago
Which type of account do you have? sonnet[1m] is not available to every user. Omitting the request ID makes this report unactionable.

Quick question for @dicksontsai I started using sonnet[1m] yesterday with an API key - it seemed to work fine, and I was very glad to see that, even though pricey!

It clearly appears to be sonnet[1m]:

<img width="761" height="264" alt="Image" src="https://github.com/user-attachments/assets/7b73178c-46ee-40fe-9acf-e35649374cb2" />

But it's actually not letting me use more than about ~205k tokens.

I'm happy to pay out the wazoo for sonnet[1m] for a few specific workloads, and apparently have spent around ~$100 on it already? But is something else going on?

ariccio · 11 months ago

Okay, something is different now?!

<img width="715" height="555" alt="Image" src="https://github.com/user-attachments/assets/e844a178-ab4e-44ca-a375-637cbffb3acc" />

hats off if someone at anthropic _just_ fixed it 🤣👌

github-actions[bot] · 10 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

jkaster · 10 months ago

Now that Opus 4.5 is greatly improved and is the default model I've switched to that. I would definitely be interested in a 1m token Opus 4.5 because I still see frequent auto-compacts but compacting is also slightly faster now, so it's not as painful.

github-actions[bot] · 9 months ago

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

github-actions[bot] · 8 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.