CostScope API
Access real-time pricing data programmatically. Compare prices across ... providers including OpenAI, Anthropic, Google, Mistral, and more.
Rate Limits
API requests are tracked per user account. Limits reset daily at midnight UTC.
Response Headers: Every response includes X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset
Base URL
https://api.costscope.appAuthentication
Most endpoints are public and don't require authentication. Some endpoints require a JWT token.
How to get your API Token
- Create an account or sign in at costscope.app/auth
- Go to your Dashboard Settings
- Copy your API token from the API Access section
- Include it in your requests as a Bearer token
Public Endpoints (No Auth Required)
curl "https://api.costscope.app/api/prices"Authenticated Endpoints
# Set your token
export TOKEN="your_jwt_token_here"
# Make authenticated request
curl -H "Authorization: Bearer $TOKEN" \
"https://api.costscope.app/api/usage"Prices
/api/pricesGet all current prices for all providers and models. Data is grouped by provider.
Request Examples
curl "https://api.costscope.app/api/prices"Response
{
"data": {
"openai": {
"provider_name": "OpenAI",
"provider_slug": "openai",
"services": {
"gpt-4o": {
"id": "uuid",
"name": "GPT-4o",
"slug": "gpt-4o",
"unit_type": "tokens",
"prices": [
{ "type": "input", "value": 2.5, "currency": "USD" },
{ "type": "output", "value": 10.0, "currency": "USD" }
]
}
}
}
},
"total_prices": 494
}/api/prices/changesGet recent price changes across all providers.
Request Examples
curl "https://api.costscope.app/api/prices/changes?limit=10"Response
{
"data": [
{
"service_name": "GPT-4o",
"provider_name": "OpenAI",
"price_type": "input",
"old_value": 3.0,
"new_value": 2.5,
"diff_percent": -16.67,
"detected_at": "2026-02-01T12:00:00Z"
}
],
"count": 10
}/api/prices/compareCompare prices across providers, sorted by price. Great for finding the cheapest option.
Request Examples
curl "https://api.costscope.app/api/prices/compare?type=input"/api/prices/history/:serviceIdGet historical price data for a specific service.
Request Examples
curl "https://api.costscope.app/api/prices/history/abc123?days=30"Full Code Examples
Complete examples in different programming languages
// Fetch all prices and find the cheapest model
const response = await fetch('https://api.costscope.app/api/prices');
const { data } = await response.json();
// Get all providers
const providers = Object.keys(data);
console.log('Available providers:', providers.join(', '));
// Find cheapest input price
let cheapest = { provider: '', model: '', price: Infinity };
for (const [provider, info] of Object.entries(data)) {
for (const [model, service] of Object.entries(info.services)) {
const inputPrice = service.prices.find(p => p.type === 'input');
if (inputPrice && inputPrice.value < cheapest.price && inputPrice.value > 0) {
cheapest = { provider, model, price: inputPrice.value };
}
}
}
console.log('Cheapest:', cheapest.provider, '-', cheapest.model, 'at $' + cheapest.price + '/1M tokens');