Prompt is too long 203073 tokens > 200000 maximum
Author: fitchmultzCreated Jan 12, 2025Updated Jan 13, 2025
Description
When making API requests, receiving a 400 error due to prompt length exceeding maximum token limit.
Error Message
Error in _get_completion: Error code: 400
{'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'prompt is too long: 203073 tokens > 200000 maximum'}}Expected Behavior
API requests should process successfully within token limits
Current Behavior
Request fails because prompt length (203,073 tokens) exceeds maximum allowed tokens (200,000)
Steps to Reproduce
- Make API request with prompt
- Receive 400 error due to token limit
Possible Solutions
- Reduce prompt length to stay under 200k token limit
- Break large prompts into smaller chunks
- Implement token counting check before making request
Additional Context
Token limits are a known constraint of the API. Need to implement proper handling.
Labels
- bug
- api
- token-limit
Source: Doriandarko/claude-engineer