This is a community-maintained project! Help us keep the information up-to-date by contributing to the GitHub repository.
Contribute on GitHubThis API provides information about various Large Language Models (LLMs) and their pricing across different providers. The data is maintained by the community to ensure accuracy and timeliness.
https://llmpricing.ai
GET /api/models
Returns a list of all available LLM models and their providers.
Example request:
curl https://llmpricing.ai/api/models
Example response:
{
"OpenAI": [
"gpt-4o",
"gpt-4o-2024-08-06",
...
],
"Anthropic": [
"claude-3-5-sonnet-20240620",
"claude-3-opus-20240229",
...
],
...
}
GET /api/prices
Calculates the price for a given model based on input and output tokens.
Query Parameters:
provider
: The provider of the model (e.g., OpenAI, Anthropic)model
: The name of the modelinput_tokens
: Number of input tokensoutput_tokens
: Number of output tokensExample request:
curl "https://llmpricing.ai/api/prices?provider=OpenAI&model=gpt-4&input_tokens=1000&output_tokens=500"
Example response:
{
"provider": "OpenAI",
"model": "gpt-4",
"input_tokens": 1000,
"output_tokens": 500,
"input_cost": 0.03,
"output_cost": 0.03,
"total_cost": 0.06
}
The API returns appropriate error messages for invalid requests:
Please be aware that this API may be subject to rate limiting. Refer to Cloudflare Workers documentation for more information on usage limits.
As a community-maintained project, we welcome contributions to keep the pricing and model information up-to-date. If you notice any discrepancies or have information about new models, please contribute by submitting a pull request or opening an issue on our GitHub repository.
Contribute on GitHub