Skip to main content
The Portrix API is a REST API that follows the OpenAI API specification. Any tool, SDK, or code that works with OpenAI works with Portrix with minimal changes — simply swap the base URL and your API key to gain access to 400+ models from every major provider through a single, unified endpoint.

Base URL

All API endpoints are relative to the following base URL:
Every request you make should target a path under this base URL. For example, to call the chat completions endpoint you send a request to https://api.portrix.ai/v1/chat/completions.

Authentication

Portrix authenticates requests using Bearer tokens in the Authorization header. You can generate an API key from your dashboard at app.portrix.ai.
See the Authentication guide for detailed setup instructions, SDK examples, and security best practices.

Endpoints

Chat Completions

POST /v1/chat/completionsGenerate chat responses from any model using a conversation history. The primary endpoint for most use cases.

Text Completions

POST /v1/completionsLegacy prompt-based text completion for workflows that require a raw continuation rather than a chat turn.

Embeddings

POST /v1/embeddingsConvert text into numeric vector representations for semantic search, clustering, and retrieval-augmented generation.

Models

GET /v1/modelsRetrieve the full list of AI models available through Portrix, including provider metadata and capability flags.

Request Format

All requests must use a JSON body with the Content-Type: application/json header set. All responses are also returned as JSON. For streaming endpoints, responses use text/event-stream (Server-Sent Events).

Model IDs

Portrix uses a {provider}/{model} naming convention for all model IDs. This tells the gateway which upstream provider to route your request to. For example: Pass the full provider/model string in the model field of any request body.

Portrix-Specific Headers

In addition to the standard OpenAI-compatible headers, Portrix supports several request headers that control routing, fallback, and search behavior. You can attach these to any request.

Rate Limits

Portrix enforces rate limits on a per-key basis. When you exceed a limit, the API returns a 429 Too Many Requests response with a Retry-After header indicating when you can retry. See the Rate Limits guide for information on default limits, how to check your current usage, and how to request an increase.

SDKs

You can use Portrix with any OpenAI-compatible SDK by setting the base_url and api_key. No custom SDK required.

Python SDK

Use the official openai Python package pointed at the Portrix base URL.

TypeScript / Node.js SDK

Use the openai npm package with a custom baseURL option.

REST / cURL

Call the API directly with any HTTP client — no SDK required.

LangChain & LlamaIndex

Drop Portrix in as the LLM provider in popular orchestration frameworks.