anthropics / anthropic-sdk-python

MIT License
1.11k stars 144 forks source link

Please add a `/models` endpoint that returns information about available models. #506

Closed p-i- closed 1 month ago

p-i- commented 1 month ago

Please add a /models endpoint that returns information about available models.

So I can do, e.g.:

(AFAIK the last 2 are returned in response headers, but we shouldn't need a dummy request to get at this info; the info doesn't depend on the request!).

This way a developer can create a product that:

I'm using the HTTP API directly and currently I have to maintain my own table:

HEADERS = {
    'x-api-key': API_KEY,
    'anthropic-version': '2023-06-01',
    'anthropic-beta': 'tools-2024-04-04',
    'content-type': 'application/json',
}
MODELS = {
    'HAIKU': 'claude-3-haiku-20240307',
    'SONNET': 'claude-3-sonnet-20240229',
    'OPUS': 'claude-3-opus-20240229',
}

And a quick search shows you are doing the same thing! https://github.com/search?q=repo%3Aanthropics%2Fanthropic-sdk-python%20claude-3-haiku-20240307&type=code

In fact you're having to break "single-source-of-truth" as this information exists in 2 places in the repo.

This works for now, as you only have one generation of models. But think a year down the line!

jenan-anthropic commented 1 month ago

Hi @p-i-, and thanks for the request! Closing as duplicate of #361