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

Internal server error with certain API keys when model identifier contains space characters #691

Open
dandv opened this issue Feb 24, 2025 · 0 comments

Comments

@dandv
Copy link
Contributor

dandv commented Feb 24, 2025

Using the problematic key from #690, the code therein returns not_found_error if the model is invalid-model. But if the invalid model name contains a space, the code returns error: { type: 'api_error', message: 'Internal server error' }:

const response = await fetch('https://api.anthropic.com/v1/messages', {
  method: 'POST',
  headers: {
    'x-api-key': 'sk-ant-api03-1WH_3...-ONyGHQAA',
    'anthropic-version': '2023-06-01',  // required by the Messages API
  },
  body: JSON.stringify({
    messages: [{ role: 'user', content: 'Hello' }],
    max_tokens: 4096,  // required, maximum
    model: 'invalid model',  // instead of `invalid-model`
  }),
});
console.log(await response.json());
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

No branches or pull requests

1 participant