Portkey is a production-ready platform that provides the infrastructure and tooling needed to build, deploy, and scale generative AI applications.
1.1 Usage
Method 1: Add Custom Provider via Model Catalog (Recommended)
- Log in to the Portkey dashboard
- Go to Model Catalog
- Click Add Provider → Self-hosted / Custom
- Enter:
- API Endpoint:
https://api.rygen.io/v1 - API Key: your-rygen-api-key
- API Endpoint:
- Add your custom model and define a Model Slug
- Use it like:
@rygen/your-model-name
Method 2: Passthrough Mode
from portkey_ai import Portkey
client = Portkey(
api_key="PORTKEY_API_KEY",
provider="passthrough",
custom_host="https://api.rygen.io/v1",
default_headers={
"authorization": "Bearer YOUR_RYGEN_API_KEY"
}
)
response = client.chat.completions.create(
model="your-model-name",
messages=[{"role": "user", "content": "Hello, How are you?"}]
)Method 3: cURL
curl https://api.portkey.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "x-portkey-api-key: $PORTKEY_API_KEY" \
-H "x-portkey-provider: passthrough" \
-H "x-portkey-custom-host: https://api.rygen.io/v1" \
-H "authorization: Bearer YOUR_RYGEN_API_KEY" \
-d '{
"model": "your-model-name",
"messages": [
{"role": "user", "content": "Hello, How are you?"}
]
}'Method 4: OpenAI SDK Compatibility
from openai import OpenAI
client = OpenAI(
api_key="PORTKEY_API_KEY",
base_url="https://api.portkey.ai/v1"
)
response = client.chat.completions.create(
model="your-model-name",
messages=[{"role": "user", "content": "Hello, How are you doing?"}],
extra_headers={
"x-portkey-provider": "passthrough",
"x-portkey-custom-host": "https://api.rygen.io/v1"
}
)1.2 Troubleshooting
| Issue | Fix |
|---|---|
| Request failed | Check custom_host URL formatting |
| Authentication failed | Ensure Authorization header is correctly passed |
| Model not found | Verify Model Slug matches your configured model |

