Skip to main content
This guide helps you diagnose and fix the most common issues you might encounter when using the Portrix API. Work through the relevant section for your error, and if you’re still stuck, contact support with your request ID.
Every Portrix response includes an x-portrix-request-id header. Copy this value and include it whenever you contact support — it allows the team to locate your specific request in the logs and resolve issues significantly faster.
Symptom: The API returns 401 Unauthorized for every request.Cause: Your API key is missing, malformed, or has been revoked.Fix:
  1. Confirm you’re including the Authorization header in your request with the exact format:
  2. Check that you’re using a Portrix API key (starting with the Portrix key prefix), not an OpenAI or other provider key.
  3. Verify the key is active in the dashboard under Settings > API Keys. Revoked or expired keys are shown with a status of “Inactive”.
  4. Make sure there are no extra spaces, newline characters, or quotes wrapping the key value.
Symptom: The API returns 403 Forbidden, even though your API key is valid and active.Cause: Your API key exists but lacks the permissions required for the operation you’re attempting. API keys can be scoped to specific models, endpoints, or usage types.Fix:
  1. Go to Settings > API Keys in the dashboard.
  2. Click on the key you’re using and review its Scopes and Restrictions.
  3. If the key is restricted to specific models, ensure the model you’re requesting is on the allowed list.
  4. If you need broader access, either update the key’s scopes or create a new unrestricted key.
A 403 can also occur if you’re on the Free plan and attempting to access a feature or model that requires a paid plan. Check the Billing page for plan-level restrictions.
Symptom: The API returns 404 with a message like model not found or unknown model.Cause: The model ID you specified is incorrect, misspelled, or not yet available on your account.Fix:
  1. Verify you’re using the full {provider}/{model} format. For example:
    • openai/gpt-4o
    • anthropic/claude-3-5-sonnet
    • gpt-4o (missing provider prefix)
    • claude-3.5-sonnet (wrong separator and missing prefix)
  2. Fetch the complete list of models available to your account to find the exact ID:
  1. Check the Supported Models page for a curated list of popular model IDs.
  2. If a model you expect to see is missing from the list, contact support — it may require enablement on your account.
Symptom: The API returns 429 Too Many Requests intermittently or consistently under load.Cause: You’ve exceeded your requests-per-minute (RPM), tokens-per-minute (TPM), or daily token quota.Fix:
  1. Read the Retry-After response header — it tells you exactly how many seconds to wait before retrying.
  2. Implement exponential backoff with jitter in your application (see code examples on the Rate Limits page).
  3. Review your current usage on the Usage page in the dashboard to understand what’s driving the spike.
  4. If you’re consistently hitting limits, upgrade your plan or contact support for a custom quota.
Configure Portrix fallback routing to automatically try a different model when you hit a rate limit. This keeps your application responsive without requiring manual retry logic.
Symptom: The API returns a 500 Internal Server Error, 502 Bad Gateway, or 503 Service Unavailable.Cause: The upstream provider (OpenAI, Anthropic, Google, etc.) is experiencing an outage, degraded performance, or the request exceeded the provider’s internal limits.Fix:
  1. Check the Portrix status page for any active incidents.
  2. Check the affected provider’s status page directly (e.g., status.openai.com, status.anthropic.com).
  3. Configure fallback routing in your Portrix request to automatically retry with a different model or provider when a 5xx error occurs:
  1. For transient errors, implement a retry with backoff — 5xx errors from providers are often short-lived.
Symptom: When using stream: true, the connection closes before the response is complete. You receive a partial response or a connection reset error.Cause: Network timeouts, intermediate proxy configurations, or client-side read timeouts that are too short for the length of the response.Fix:
  1. Increase your HTTP client’s read timeout. For long completions, a timeout of 120–300 seconds is recommended.
  2. Ensure any proxies or load balancers between your client and Portrix are configured to support long-lived HTTP connections (disable aggressive idle timeouts).
  3. Handle stream interruptions in your code and reconnect if needed:
  1. If the issue persists, try without streaming to determine whether it’s a streaming-specific problem.
Symptom: Requests succeed but return OpenAI branding in errors, or you see 401 errors even with a valid Portrix key. Alternatively, your code silently continues using the OpenAI API and you’re being billed by OpenAI.Cause: Your base URL is still set to https://api.openai.com/v1 instead of https://api.portrix.ai/v1.Fix: Explicitly set the base URL in your client configuration. Do not rely on defaults:
Use the PORTRIX_BASE_URL environment variable to manage this across environments. See Environment Variables for details.
Symptom: The model’s responses seem off — wrong tone, missing capabilities, or behavior inconsistent with what you expect.Cause: Several factors can cause this:
  • You may be targeting the wrong model (e.g., gpt-4o-mini instead of gpt-4o)
  • A missing or incomplete system prompt that the original model relied upon
  • Provider-specific behavior differences — models from different providers respond differently to the same prompts
Fix:
  1. Double-check the model field in your request. Log it explicitly if you’re setting it dynamically.
  2. Inspect the model field in the API response — it reflects the model that actually served the request.
  3. When switching from one provider’s model to another, expect to adjust your system prompt. Instructions that work perfectly for GPT-4o may need tuning for Claude or Gemini.
  4. If you have fallbacks configured, confirm which model in your fallback chain actually fulfilled the request by checking the x-portrix-model response header.

Getting help

If these steps don’t resolve your issue, the Portrix support team is here to help: When filing a support request, include:
  1. The x-portrix-request-id from the response headers of the failing request
  2. The full request you’re sending (redact your API key)
  3. The complete error response body
  4. The SDK or HTTP client you’re using and its version