Access any custom provider endpoint through Portkey API
This feature is available on all Portkey plans.
Portkey API has first-class support for monitoring and routing your requests to 10+ provider endpoints, like /chat/completions, /audio, /embeddings, etc. We also make these endpoints work across 250+ different LLMs.
However, there are still many endpoints like Cohere’s /rerank or Deepgram’s /listen that are uncommon or have niche use cases.
With the Gateway to Other APIs feature, you can route to any custom provider endpoint using Portkey (including the ones hosted on your private setups) and get complete logging & monitoring for all your requests.
Portkey integrates with 40+ LLM providers. Add your provider credentials (such as API key) to Portkey, and get a virtual key that you can use to authenticate and send your requests.
Portkey Gateway base URL remains same: https://api.portkey.ai/v1
Append your custom endpoint at the end of the URL: https://api.portkey.ai/v1/{provider-endpoint}
Copy
Ask AI
curl --request POST \ --url https://api.portkey.ai/v1/rerank \ --header 'Content-Type: application/json' \ --header 'x-portkey-api-key: $PORTKEY_API_KEY' \ --header 'x-portkey-virtual-key: $COHERE_VIRTUAL_KEY' \ --data '{ "model": "rerank-english-v2.0", "query": "What is machine learning?", "documents": [ "Machine learning is a branch of AI focused on building systems that learn from data.", "Data science involves analyzing and interpreting complex data sets." ] }'
A complete example showing document reranking with Cohere:
Copy
Ask AI
from portkey_ai import Portkeyportkey = Portkey( api_key="PORTKEY_API_KEY", provider="@COHERE_VIRTUAL_KEY")response = portkey.post( '/rerank', return_documents=False, max_chunks_per_doc=10, model="rerank-english-v2.0", query="What is the capital of the United States?", documents=[ "Carson City is the capital city of the American state of Nevada.", "Washington, D.C. is the capital of the United States.", "Capital punishment has existed in the United States since before its founding." ])