Skip to content
Merged
Show file tree
Hide file tree
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
41 changes: 41 additions & 0 deletions api-reference/inference-api/gateway-for-other-apis.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,47 @@ const response = await portkey.delete('/collections/my-collection');
</Tab>
</Tabs>

## Configs work as usual

Pass an `x-portkey-config` header (or a saved config ID) to apply **fallback**, **loadbalance**, or **conditional** routing—exactly like on `/chat/completions`.

```sh
curl https://api.portkey.ai/v1/rerank \
-H "Content-Type: application/json" \
-H "x-portkey-api-key: $PORTKEY_API_KEY" \
-H 'x-portkey-config: {
"strategy": { "mode": "fallback" },
"targets": [
{ "provider": "@cohere-prod" },
{ "provider": "@cohere-backup" }
]
}' \
-d '{ "model": "rerank-english-v2.0", "query": "...", "documents": ["..."] }'
```

Retries, caching, and guardrails apply the same way.

## Force the proxy on a built-in route

Portkey handles `/chat/completions`, `/embeddings`, and other built-in routes with dedicated logic. To bypass that and send the request through untouched, prefix the path with `/v1/proxy/`:

```sh
curl https://api.portkey.ai/v1/proxy/chat/completions \
-H "Content-Type: application/json" \
-H "x-portkey-api-key: $PORTKEY_API_KEY" \
-H "x-portkey-provider: openai" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{"model":"gpt-4.1-mini","messages":[{"role":"user","content":"Hello"}]}'
```

Use this only when raw passthrough is required.

## Pricing and analytics

- **Token counts** in the response come straight from the provider.
- **Cost tracking** works when Portkey knows the model's pricing. Common provider + model combinations are recognized automatically.
- For **custom models** or unusual endpoints, add the pricing in your Portkey dashboard so cost numbers stay accurate.

## End-to-end Example

<Accordion title="Cohere Rerank Integration">
Expand Down
4 changes: 4 additions & 0 deletions product/ai-gateway.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ description: The world's fastest AI Gateway with advanced routing & integrated G
<Card title="Custom Hosts" href="/product/ai-gateway/custom-hosts">
Route requests to privately hosted or local models using custom host URLs
</Card>

<Card title="Gateway to other APIs" href="/api-reference/inference-api/gateway-for-other-apis">
Call rerank, video, listen, and other provider paths through https://api.portkey.ai/v1/... with the same configs and logging as unified routes
</Card>
</CardGroup>


Expand Down