Skip to content

Commit 7a711c4

Browse files
committed
Add new section to Portkey Models API documentation for fetching all models at once
- Introduced a new tip and detailed endpoint for retrieving pricing configurations for all models from a specific provider in a single request. - Added example responses and usage instructions to enhance user understanding and accessibility of the API.
1 parent 465b31d commit 7a711c4

1 file changed

Lines changed: 152 additions & 0 deletions

File tree

product/model-catalog/portkey-models.mdx

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ output_cost = pricing['pay_as_you_go']['response_token']['price']
5656

5757
</CodeGroup>
5858

59+
<Tip>
60+
**Need to discover all models for a provider?** Instead of querying each model individually, you can fetch pricing for all models at once:
61+
62+
```bash
63+
curl https://configs.portkey.ai/pricing/{provider}.json
64+
```
65+
66+
[See detailed documentation below ↓](#get-all-models-for-a-provider)
67+
</Tip>
68+
5969
---
6070

6171
## Understanding Pricing Units
@@ -429,6 +439,148 @@ GET https://api.portkey.ai/model-configs/general/{provider}/{model}
429439

430440
---
431441

442+
### Get All Models for a Provider
443+
444+
Returns pricing configuration for all models from a specific provider in a single response.
445+
446+
```
447+
GET https://configs.portkey.ai/pricing/{provider}.json
448+
```
449+
450+
<Info>
451+
Use this endpoint to discover all available models and their pricing for a provider, instead of querying each model individually.
452+
</Info>
453+
454+
#### Path Parameters
455+
456+
<ParamField path="provider" type="string" required>
457+
Provider identifier. Use lowercase with hyphens.
458+
459+
Examples: `openai`, `anthropic`, `google`, `bedrock`, `azure-openai`, `together-ai`, `groq`, `deepseek`, `x-ai`, `mistral-ai`
460+
</ParamField>
461+
462+
#### Response Schema
463+
464+
Returns a JSON object where:
465+
- Keys are model identifiers
466+
- Values contain `pricing_config` objects with the same structure as the individual model pricing endpoint
467+
- A `default` key provides the base pricing template
468+
469+
<ResponseField name="{model-id}" type="object">
470+
Pricing configuration for a specific model.
471+
472+
<Expandable title="properties">
473+
<ResponseField name="pricing_config" type="object">
474+
Contains the same pricing structure as the individual model endpoint: `pay_as_you_go`, `calculate`, `currency`, etc.
475+
</ResponseField>
476+
</Expandable>
477+
</ResponseField>
478+
479+
#### Example Response
480+
481+
<CodeGroup>
482+
483+
```bash cURL
484+
curl --request GET \
485+
--url https://configs.portkey.ai/pricing/bedrock.json
486+
```
487+
488+
```javascript JavaScript
489+
const response = await fetch('https://configs.portkey.ai/pricing/bedrock.json');
490+
const allModels = await response.json();
491+
492+
// Access specific model pricing
493+
const claudePrice = allModels['anthropic.claude-3-5-sonnet-20241022-v2:0'];
494+
console.log(claudePrice.pricing_config.pay_as_you_go);
495+
```
496+
497+
```python Python
498+
import requests
499+
500+
all_models = requests.get(
501+
'https://configs.portkey.ai/pricing/bedrock.json'
502+
).json()
503+
504+
# List all available models
505+
for model_id in all_models.keys():
506+
if model_id != 'default':
507+
print(model_id)
508+
```
509+
510+
</CodeGroup>
511+
512+
<Accordion title="Sample Response (Bedrock)">
513+
514+
```json
515+
{
516+
"default": {
517+
"pricing_config": {
518+
"pay_as_you_go": {
519+
"request_token": { "price": 0 },
520+
"response_token": { "price": 0 }
521+
},
522+
"calculate": {
523+
"request": {
524+
"operation": "multiply",
525+
"operands": [
526+
{ "value": "input_tokens" },
527+
{ "value": "rates.request_token" }
528+
]
529+
},
530+
"response": {
531+
"operation": "multiply",
532+
"operands": [
533+
{ "value": "output_tokens" },
534+
{ "value": "rates.response_token" }
535+
]
536+
}
537+
},
538+
"currency": "USD"
539+
}
540+
},
541+
"anthropic.claude-3-5-sonnet-20241022-v2:0": {
542+
"pricing_config": {
543+
"pay_as_you_go": {
544+
"request_token": { "price": 0.0003 },
545+
"response_token": { "price": 0.0015 },
546+
"cache_write_input_token": { "price": 0.000375 },
547+
"cache_read_input_token": { "price": 0.00003 }
548+
}
549+
}
550+
},
551+
"anthropic.claude-3-haiku-20240307-v1:0": {
552+
"pricing_config": {
553+
"pay_as_you_go": {
554+
"request_token": { "price": 0.000025 },
555+
"response_token": { "price": 0.000125 }
556+
}
557+
}
558+
},
559+
"meta.llama3-1-405b-instruct-v1:0": {
560+
"pricing_config": {
561+
"pay_as_you_go": {
562+
"request_token": { "price": 0.000532 },
563+
"response_token": { "price": 0.0016 }
564+
}
565+
}
566+
},
567+
"amazon.nova-pro-v1:0": {
568+
"pricing_config": {
569+
"pay_as_you_go": {
570+
"request_token": { "price": 0.00008 },
571+
"response_token": { "price": 0.00002 },
572+
"cache_read_input_token": { "price": 0.00004 },
573+
"cache_write_input_token": { "price": 0.00016 }
574+
}
575+
}
576+
}
577+
}
578+
```
579+
580+
</Accordion>
581+
582+
---
583+
432584
## Additional Units Reference
433585

434586
Provider-specific pricing for features beyond standard token costs:

0 commit comments

Comments
 (0)