Python
Install theopenai package if you haven’t already:
JavaScript / TypeScript
Install theopenai npm package if you haven’t already:
What changes and what doesn’t
Model names use the
provider/model format in Portrix — for example, openai/gpt-4o, anthropic/claude-3-5-sonnet, or google/gemini-2.0-flash. Pass these directly as the model field in your request.Migrating existing code
1
Install or update the OpenAI SDK
Make sure you are on a recent version of the SDK. Portrix is compatible with
openai >= 1.0.0 for Python and openai >= 4.0.0 for Node.js.2
Set your Portrix API key
Store your key in an environment variable so it never appears in source code:Add this to your
.env file for local development and configure it as a secret in your deployment environment.3
Update the client initialization
Replace your existing client constructor with the Portrix-configured version:Everything else in your codebase — method calls, parameters, response parsing — stays exactly the same.