OpenAI setup
Connect Port to OpenAI's API to use models like gpt-5. This guide walks you through storing your API key and registering OpenAI as an LLM provider in Port.
Prerequisites
- An active OpenAI account with API access.
- An OpenAI API key. You can generate one in your OpenAI API keys page.
Step 1: Store your API key in Port secrets
Before configuring the provider, store your OpenAI API key in Port's secrets system.
- In your Port application, click on your profile picture
.
- Click on Credentials.
- Click on the
Secretstab. - Click on
+ Secretand add your secret(s).
For provider-specific secret requirements and examples, see Step 2: Store API Keys in Secrets.
You can choose any names for your secrets. The examples are suggestions. Use names that make sense for your organization, and reference the exact names in your provider configuration.
For more details on managing secrets, see the Port Secrets documentation.
Step 2: Register OpenAI with the Port API
Call the Create or connect an LLM provider API with validate_connection=true to test your configuration. Set provider to "openai" and reference the secret name you created in Step 1.
{
"provider": "openai",
"enabled": true,
"config": {
"apiKeySecretName": "openai-api-key"
}
}
When you register OpenAI without specifying model overrides, Port validates all supported OpenAI models by default. If you only have access to specific models or want to limit which models are enabled, use the overrides field. See Model overrides for details.
Step 3: Validate the configuration
The validate_connection=true parameter tests your configuration by making a request to your provider. If validation succeeds, your provider configuration is saved. If it fails, check the error message for details.
For more troubleshooting steps, see the Setup & Configuration guide.
Common validation failures:
- Invalid API key: Verify your API key is correct and active in your OpenAI account.
- Insufficient quota: Ensure your OpenAI account has sufficient usage quota or credits.
- Rate limit exceeded: Wait and retry if you've exceeded OpenAI's rate limits.
After registration
Once your provider is configured:
- Set as default: Go to Builder → Organization Settings → AI tab in the UI, or use the Change default LLM provider and model API to set your provider as the organization's default.
- Use in API calls: Pass the provider name and a supported model name in individual general-purpose AI interactions or invoke a specific agent requests.
For more information on provider selection and validation flow, see Setup & Configuration.