Claude claude-v1-100k showing 10k token limit
Problem
I have API access and am testing `claude-v1-100k`. I call API passing in `text` to the prompt, which is a large doc. [code block] I see max token count ~10k: [code block] Is it possible that some users do not have access to `claude-v1-100k`? I also tried with a second API key.
Error Output
Exception: Prompt tokens (62386) + max-sampled tokens (200) exceeds max (9216)
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Verify Access to claude-v1-100k and Adjust Token Usage
The error indicates that the API is enforcing a token limit of 9216, which suggests that the user may not have access to the claude-v1-100k model. This could be due to account limitations or incorrect API endpoint usage. Additionally, the prompt size exceeds the maximum allowed tokens, leading to the exception.
Awaiting Verification
Be the first to verify this fix
- 1
Check API Access Level
Confirm that your API key has access to the claude-v1-100k model. This can be done by reviewing your account settings or contacting the vendor's support.
- 2
Use Correct API Endpoint
Ensure that you are using the correct endpoint for the claude-v1-100k model. Refer to the API documentation for the specific endpoint to use for this model.
javascriptconst response = await fetch('https://api.anthropic.com/v1/claude-v1-100k', { method: 'POST', body: JSON.stringify({ prompt: text }) }); - 3
Reduce Prompt Size
Since the prompt tokens exceed the allowed limit, consider breaking down the document into smaller chunks or summarizing it before sending it to the API. This will help in staying within the token limits.
javascriptconst chunkedText = text.match(/(.|\n){1,8192}/g); // Splits text into chunks of 8192 characters - 4
Test with Smaller Inputs
Before testing with the full document, try sending a smaller input to verify that the API responds correctly without exceeding token limits.
javascriptconst smallPrompt = 'This is a test input.'; // Use a small prompt to test the API - 5
Monitor API Response
After making the necessary adjustments, monitor the API response for any errors or warnings. This will help ensure that the changes made are effective.
javascriptif (response.ok) { console.log('API call successful'); } else { console.error('API error:', response.statusText); }
Validation
Confirm that the API call returns a successful response without exceeding token limits. Additionally, verify that the model used is indeed claude-v1-100k by checking the response metadata.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep