Skip to main content
GET
https://api.portkey.ai
/
model-configs
/
pricing
/
{provider}
/
{model}
Portkey Models
curl --request GET \
  --url https://api.portkey.ai/model-configs/pricing/{provider}/{model}
{
  "pay_as_you_go": {
    "request_token": {
      "price": 123
    },
    "response_token": {
      "price": 123
    },
    "cache_read_input_token": {
      "price": 123
    },
    "cache_write_input_token": {
      "price": 123
    },
    "request_audio_token": {
      "price": 123
    },
    "response_audio_token": {
      "price": 123
    },
    "additional_units": {},
    "image": {}
  },
  "calculate": {
    "request": {},
    "response": {}
  },
  "currency": "<string>",
  "finetune_config": {
    "pay_per_token": {},
    "pay_per_hour": {}
  },
  "params": [
    {
      "key": "<string>",
      "defaultValue": "<any>",
      "minValue": 123,
      "maxValue": 123,
      "type": "<string>",
      "options": [
        {}
      ]
    }
  ],
  "type": {
    "primary": "<string>",
    "supported": [
      {}
    ]
  },
  "messages": {
    "options": [
      {}
    ]
  },
  "disablePlayground": true,
  "isDefault": true,
  "{model-id}": {
    "pricing_config": {}
  }
}
Portkey Models is a free, open-source pricing database for LLMs. No API key required — just query any model’s pricing directly.

Quick Start

Get pricing for any model with a single API call:
curl https://api.portkey.ai/model-configs/pricing/openai/gpt-4o
Need to discover all models for a provider? Instead of querying each model individually, you can fetch pricing for all models at once:
curl https://configs.portkey.ai/pricing/{provider}.json
See detailed documentation below ↓

Understanding Pricing Units

Prices are in cents per token, not dollars.
API ResponsePer 1K TokensPer 1M Tokens
0.003$0.03$30
0.00025$0.0025$2.50
0.0001$0.001$1.00
Calculate cost in dollars:
const costInDollars = (tokens * priceFromAPI) / 100;

API Reference

Get Model Pricing

Returns pricing configuration for a specific model.
GET https://api.portkey.ai/model-configs/pricing/{provider}/{model}

Path Parameters

provider
string
required
Provider identifier. Use lowercase with hyphens.Examples: openai, anthropic, google, azure-openai, bedrock, together-ai, groq, deepseek, x-ai, mistral-ai, cohere, fireworks-ai, perplexity-ai, anyscale, deepinfra, cerebras
model
string
required
Model identifier. Use the exact model name as specified by the provider.Examples: gpt-4o, gpt-4-turbo, claude-3-5-sonnet-20241022, claude-3-opus-20240229, gemini-2.0-flash-001, gemini-1.5-pro

Response Schema

pay_as_you_go
object
Token-based pricing. All prices in USD cents per token.
calculate
object
Cost calculation formulas for complex pricing scenarios.
currency
string
Currency code. Always USD.
finetune_config
object
Fine-tuning pricing (when available).

Example Responses

{
  "pay_as_you_go": {
    "request_token": { "price": 0.00025 },
    "response_token": { "price": 0.001 },
    "cache_write_input_token": { "price": 0 },
    "cache_read_input_token": { "price": 0.000125 },
    "additional_units": {
      "web_search": { "price": 1 },
      "file_search": { "price": 0.25 }
    }
  },
  "calculate": {
    "request": {
      "operation": "sum",
      "operands": [
        { "operation": "multiply", "operands": [{ "value": "input_tokens" }, { "value": "rates.request_token" }] },
        { "operation": "multiply", "operands": [{ "value": "cache_write_tokens" }, { "value": "rates.cache_write_input_token" }] },
        { "operation": "multiply", "operands": [{ "value": "cache_read_tokens" }, { "value": "rates.cache_read_input_token" }] }
      ]
    },
    "response": {
      "operation": "multiply",
      "operands": [{ "value": "output_tokens" }, { "value": "rates.response_token" }]
    }
  },
  "currency": "USD"
}

Get Model Configuration

Returns general configuration and capabilities for a specific model.
GET https://api.portkey.ai/model-configs/general/{provider}/{model}

Path Parameters

provider
string
required
Provider identifier (e.g., openai, anthropic, google)
model
string
required
Model identifier (e.g., gpt-4o, claude-3-opus)

Response Schema

params
array
Model parameters with their constraints.
type
object
Model type classification.
messages
object
Message configuration.
disablePlayground
boolean
If true, model is not available in Portkey playground.
isDefault
boolean
If true, this is the default model for the provider.

Example Responses

{
  "params": [
    {
      "key": "max_tokens",
      "maxValue": 16384
    },
    {
      "key": "response_format",
      "defaultValue": null,
      "options": [
        { "value": null, "name": "Text" },
        { "value": "json_object", "name": "JSON Object" },
        { "value": "json_schema", "name": "JSON Schema" }
      ],
      "type": "string"
    },
    {
      "key": "temperature",
      "minValue": 0,
      "maxValue": 2,
      "defaultValue": 1
    }
  ],
  "type": {
    "primary": "chat",
    "supported": ["tools", "image"]
  }
}

Get All Models for a Provider

Returns pricing configuration for all models from a specific provider in a single response.
GET https://configs.portkey.ai/pricing/{provider}.json
Use this endpoint to discover all available models and their pricing for a provider, instead of querying each model individually.

Path Parameters

provider
string
required
Provider identifier. Use lowercase with hyphens.Examples: openai, anthropic, google, bedrock, azure-openai, together-ai, groq, deepseek, x-ai, mistral-ai

Response Schema

Returns a JSON object where:
  • Keys are model identifiers
  • Values contain pricing_config objects with the same structure as the individual model pricing endpoint
  • A default key provides the base pricing template
{model-id}
object
Pricing configuration for a specific model.

Example Response

curl --request GET \
  --url https://configs.portkey.ai/pricing/bedrock.json
{
  "default": {
    "pricing_config": {
      "pay_as_you_go": {
        "request_token": { "price": 0 },
        "response_token": { "price": 0 }
      },
      "calculate": {
        "request": {
          "operation": "multiply",
          "operands": [
            { "value": "input_tokens" },
            { "value": "rates.request_token" }
          ]
        },
        "response": {
          "operation": "multiply",
          "operands": [
            { "value": "output_tokens" },
            { "value": "rates.response_token" }
          ]
        }
      },
      "currency": "USD"
    }
  },
  "anthropic.claude-3-5-sonnet-20241022-v2:0": {
    "pricing_config": {
      "pay_as_you_go": {
        "request_token": { "price": 0.0003 },
        "response_token": { "price": 0.0015 },
        "cache_write_input_token": { "price": 0.000375 },
        "cache_read_input_token": { "price": 0.00003 }
      }
    }
  },
  "anthropic.claude-3-haiku-20240307-v1:0": {
    "pricing_config": {
      "pay_as_you_go": {
        "request_token": { "price": 0.000025 },
        "response_token": { "price": 0.000125 }
      }
    }
  },
  "meta.llama3-1-405b-instruct-v1:0": {
    "pricing_config": {
      "pay_as_you_go": {
        "request_token": { "price": 0.000532 },
        "response_token": { "price": 0.0016 }
      }
    }
  },
  "amazon.nova-pro-v1:0": {
    "pricing_config": {
      "pay_as_you_go": {
        "request_token": { "price": 0.00008 },
        "response_token": { "price": 0.00002 },
        "cache_read_input_token": { "price": 0.00004 },
        "cache_write_input_token": { "price": 0.00016 }
      }
    }
  }
}

Additional Units Reference

Provider-specific pricing for features beyond standard token costs:
UnitDescriptionProvidersPrice Range (¢)
web_searchWeb search tool usageOpenAI, Azure, Google, Vertex AI, Perplexity0.5 - 3.5
file_searchFile search tool usageOpenAI, Azure0.25
searchGoogle search groundingGoogle, Vertex AI1.4 - 3.5
thinking_tokenChain-of-thought reasoningGoogle, Vertex AI0.00004 - 0.0012
image_tokenImage processing tokensGoogle, Vertex AI0.003
image_1kImage generation (1K units)Google3.9
megapixelsImage generation by megapixelTogether AI0.0027 - 0.08
video_secondsVideo generationVertex AI10 - 50
video_duration_seconds_720_1280Video (720p)OpenAI Sora10 - 30
video_duration_seconds_1080_1920Video (1080p)OpenAI Sora50
routing_unitsAzure OpenAI routingAzure OpenAI0.000014
input_imageImage inputVertex AI0.01
input_video_essentialVideo input (essential)Vertex AI0.05
input_video_standardVideo input (standard)Vertex AI0.1
input_video_plusVideo input (plus)Vertex AI0.2
Perplexity has context-dependent web search pricing:
UnitPrice (¢)
web_search_low_context0.5 - 0.6
web_search_medium_context0.8 - 1.0
web_search_high_context1.2 - 1.4

Supported Providers

AI21, Anthropic, Anyscale, Azure AI, Azure OpenAI, AWS Bedrock, Cerebras, Cohere, Dashscope, Deepbricks, DeepInfra, DeepSeek, Fireworks AI, GitHub, Google, Groq, Inference.net, Jina, Lambda, Lemonfox AI, Mistral AI, MonsterAPI, Nebius, Nomic, Novita AI, OpenAI, OpenRouter, Oracle, PaLM, Perplexity AI, Predibase, Reka AI, Sagemaker, Segmind, Stability AI, Together AI, Vertex AI, Workers AI, X.AI, Zhipu

Use with Portkey

Portkey Models powers automatic cost tracking for all requests through the Portkey Gateway. When you make requests via Portkey, costs are calculated automatically using this pricing data. If you have negotiated enterprise rates, you can override the default pricing:

Custom Pricing

Set custom input/output costs to match your contracts