Portkey

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)

  1. Log in to the Portkey dashboard
  2. Go to Model Catalog
  3. Click Add Provider → Self-hosted / Custom
  4. Enter:
    • API Endpoint: https://api.rygen.io/v1
    • API Key: your-rygen-api-key
  5. Add your custom model and define a Model Slug
  6. 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

IssueFix
Request failedCheck custom_host URL formatting
Authentication failedEnsure Authorization header is correctly passed
Model not foundVerify Model Slug matches your configured model

1.3 References