Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

retry-after header missing from response #357

Open
aleclarson opened this issue Mar 26, 2024 · 1 comment · May be fixed by #358
Open

retry-after header missing from response #357

aleclarson opened this issue Mar 26, 2024 · 1 comment · May be fixed by #358

Comments

@aleclarson
Copy link

aleclarson commented Mar 26, 2024

If there's no retry-after or retry-after-ms response header, the library should create one from the greater value of the anthropic-ratelimit-requests-reset and anthropic-ratelimit-tokens-reset headers (if both anthropic-ratelimit-requests-remaining and anthropic-ratelimit-tokens-remaining are zero). If only one of those headers is zero, use the reset time for that one.

{
    'anthropic-ratelimit-requests-limit': '5',
    'anthropic-ratelimit-requests-remaining': '0',
    'anthropic-ratelimit-requests-reset': '2024-03-26T20:00:00Z',
    'anthropic-ratelimit-tokens-limit': '25000',
    'anthropic-ratelimit-tokens-remaining': '16000',
    'anthropic-ratelimit-tokens-reset': '2024-03-26T20:00:00Z',
    'cf-cache-status': 'DYNAMIC',
    'cf-ray': '86a9b96cdac90359-MIA',
    connection: 'keep-alive',
    'content-length': '305',
    'content-type': 'application/json',
    date: 'Tue, 26 Mar 2024 19:59:59 GMT',
    'request-id': 'req_01T5fCVnYdf9X5ZW6KayReBK',
    server: 'cloudflare',
    via: '1.1 google',
    'x-cloud-trace-context': 'ae6af598607da922ea75fbb21d9c3bd6',
    'x-should-retry': 'true'
  }
@aleclarson aleclarson linked a pull request Mar 26, 2024 that will close this issue
@rattrayalex
Copy link
Collaborator

Hey, thanks for raising this. I've pinged the relevant folks on the API team to see if we can't just get retry-after-ms sent on every 429.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants