Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
292 changes: 292 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ x-server-groups:
- url: SELF_HOSTED_GATEWAY_URL
description: Self-Hosted Gateway URL

PublicServers: &PublicServers
- url: https://api.portkey.ai
description: Portkey Public API (no auth required)

x-mint:
mcp:
enabled: true
Expand Down Expand Up @@ -110,6 +114,8 @@ tags:
description: Manage usage limits policies to control total usage over time
- name: Rate Limits Policies
description: Manage rate limits policies to control request or token rates
- name: Model Pricing
description: Model pricing configurations for 2300+ LLMs across 40+ providers


paths:
Expand Down Expand Up @@ -19425,6 +19431,165 @@ paths:
- object
- data

/model-configs/pricing/{provider}/{model}:
servers: *PublicServers
get:
summary: Get Model Pricing
security: []
description: |
Returns pricing configuration for a specific model.

**Note:** Prices are in USD cents per token.

## Supported Providers

openai, anthropic, google, azure-openai, bedrock, mistral-ai, cohere,
together-ai, groq, deepseek, fireworks-ai, perplexity-ai, anyscale,
deepinfra, cerebras, x-ai, and 25+ more.

## Example Response Fields

| Field | Description | Unit |
|-------|-------------|------|
| `request_token.price` | Input token cost | cents/token |
| `response_token.price` | Output token cost | cents/token |
| `cache_write_input_token.price` | Cache write cost | cents/token |
| `cache_read_input_token.price` | Cache read cost | cents/token |
| `additional_units.*` | Provider-specific features | cents/unit |

operationId: getModelPricing
tags:
- Model Pricing
parameters:
- name: provider
in: path
required: true
description: |
Provider identifier. Use lowercase with hyphens.

Examples: `openai`, `anthropic`, `google`, `azure-openai`, `bedrock`, `x-ai`
schema:
type: string
example: openai
- name: model
in: path
required: true
description: |
Model identifier. Use the exact model name as specified by the provider.

Examples: `gpt-5`, `gpt-5.2`, `claude-opus-4-5-20251101`, `gemini-3.0-pro`
schema:
type: string
example: gpt-5
responses:
'200':
description: Pricing configuration for the specified model
content:
application/json:
schema:
$ref: '#/components/schemas/ModelPricingConfig'
examples:
openai-gpt4:
summary: OpenAI GPT-4
value:
pay_as_you_go:
request_token:
price: 0.003
response_token:
price: 0.006
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
openai-gpt4o-with-tools:
summary: OpenAI GPT-4o (with additional units)
value:
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
response:
operation: multiply
operands:
- value: output_tokens
- value: rates.response_token
currency: USD
anthropic-claude:
summary: Anthropic Claude 3.5 Sonnet
value:
pay_as_you_go:
request_token:
price: 0.0003
response_token:
price: 0.0015
cache_read_input_token:
price: 0.00003
cache_write_input_token:
price: 0.000375
currency: USD
google-gemini:
summary: Google Gemini 2.5 Pro (with thinking tokens)
value:
pay_as_you_go:
request_token:
price: 0.000125
response_token:
price: 0.001
additional_units:
thinking_token:
price: 0.001
web_search:
price: 3.5
search:
price: 3.5
currency: USD
'404':
description: Model or provider not found
content:
application/json:
schema:
type: object
properties:
error:
type: string
example: Model not found


components:
securitySchemes:
Expand Down Expand Up @@ -19711,6 +19876,133 @@ components:
type: string

schemas:
ModelPricingConfig:
type: object
description: Complete pricing configuration for a model
properties:
pay_as_you_go:
$ref: '#/components/schemas/ModelPayAsYouGo'
calculate:
$ref: '#/components/schemas/ModelCalculateConfig'
currency:
type: string
enum: [USD]
description: Currency code (always USD)
finetune_config:
$ref: '#/components/schemas/ModelFinetuneConfig'

ModelPayAsYouGo:
type: object
description: Token-based pricing (all prices in USD cents)
properties:
request_token:
$ref: '#/components/schemas/ModelTokenPrice'
response_token:
$ref: '#/components/schemas/ModelTokenPrice'
cache_write_input_token:
$ref: '#/components/schemas/ModelTokenPrice'
cache_read_input_token:
$ref: '#/components/schemas/ModelTokenPrice'
request_audio_token:
$ref: '#/components/schemas/ModelTokenPrice'
response_audio_token:
$ref: '#/components/schemas/ModelTokenPrice'
cache_read_audio_input_token:
$ref: '#/components/schemas/ModelTokenPrice'
additional_units:
type: object
description: |
Provider-specific additional pricing units.

Common additional units:
- `web_search`: Web search tool usage
- `file_search`: File search tool usage
- `thinking_token`: Chain-of-thought reasoning tokens (Google)
- `image_token`: Image generation tokens
- `video_duration_seconds_*`: Video generation (OpenAI Sora)
additionalProperties:
$ref: '#/components/schemas/ModelTokenPrice'
image:
$ref: '#/components/schemas/ModelImagePricing'

ModelTokenPrice:
type: object
description: Price object (value is in USD cents)
properties:
price:
type: number
description: |
Price in USD cents per token/unit.

Example: `0.003` = 0.003 cents/token = $0.03 per 1K tokens

ModelImagePricing:
type: object
description: Image generation pricing by quality and size
additionalProperties:
type: object
additionalProperties:
$ref: '#/components/schemas/ModelTokenPrice'
example:
standard:
1024x1024:
price: 4
1024x1792:
price: 8
hd:
1024x1024:
price: 8
1024x1792:
price: 12

ModelCalculateConfig:
type: object
description: Cost calculation formulas
properties:
request:
$ref: '#/components/schemas/ModelCalculateOperation'
response:
$ref: '#/components/schemas/ModelCalculateOperation'

ModelCalculateOperation:
type: object
description: Mathematical operation for cost calculation
properties:
operation:
type: string
enum: [sum, multiply]
description: Operation type
operands:
type: array
description: Operands for the operation
items:
oneOf:
- $ref: '#/components/schemas/ModelCalculateOperation'
- $ref: '#/components/schemas/ModelValueReference'

ModelValueReference:
type: object
properties:
value:
type: string
description: |
Reference to a value or rate.

Examples:
- `input_tokens`: Number of input tokens
- `output_tokens`: Number of output tokens
- `rates.request_token`: Request token rate
- `rates.response_token`: Response token rate

ModelFinetuneConfig:
type: object
description: Fine-tuning pricing configuration
properties:
pay_per_token:
$ref: '#/components/schemas/ModelTokenPrice'
pay_per_hour:
$ref: '#/components/schemas/ModelTokenPrice'

Error:
type: object
properties:
Expand Down
Loading