ChatOpenAI and OpenAI classes accept a custom openai_api_base (Python) or configuration.baseURL (JavaScript), which means you can point them at Portrix without any custom integrations or provider plugins. Your LangChain chains, agents, and pipelines gain access to every model on the platform — swapping providers becomes a one-line change.
Python (LangChain)
Installation
Basic chat model
ConfigureChatOpenAI with Portrix’s base URL and your Portrix API key. Use the model_name parameter to specify any model available on Portrix:
Simple chain
Build a prompt-model-parser chain using LangChain’s pipe syntax:JavaScript (LangChain.js)
Installation
Basic chat model
Using different models
Because changing models is a single property update, you can use different providers at different steps of a pipeline — for example, a fast cheap model for classification and a more powerful model for generation:LangChain agents with Portrix
UseChatOpenAI pointed at Portrix as the backbone for a LangChain tool-calling agent. Portrix normalises function/tool call responses across providers:
The
model_name parameter (Python) and model parameter (JavaScript) must use Portrix’s provider/model format — for example, "openai/gpt-4o" or "anthropic/claude-3-5-sonnet". Passing OpenAI’s native format (e.g. "gpt-4o") will result in a model-not-found error.