Connect Model APIs
Connect a model provider so Optiak can call its models on your organization's behalf. Your services keep using an Application API key; they do not send provider keys with Gateway requests.
Required role
Applies to
How provider keys work
A provider key authenticates Optiak to a model provider, using the access available through that provider account. A key can be available to the organization or limited to selected projects or applications. Optiak stores provider keys encrypted and does not show their values again after saving.
Connecting a key does not enable every model for every application. The organization enables models, and applications select from those allowed to them. Provider permissions, billing, quotas, and model availability still apply.
The table below shows which credentials to prepare for each provider.
| Provider | Authentication | Account or identity used | Before you connect |
|---|---|---|---|
| OpenAI | Provider key | OpenAI provider account | Key permissions for the intended models |
| Anthropic | Provider key | Anthropic provider account | Active account with billing enabled |
| AWS Bedrock | Amazon Bedrock API key | AWS identity associated with the key | Model access, IAM permissions, and a compatible key type and region |
| Azure | Provider key and resource name | Azure OpenAI resource | Models deployed in the resource |
| Gemini provider key | Google Cloud project selected in AI Studio | Billing, quota, and regional availability | |
| Vertex AI | Service-account JSON key | Google Cloud service account | Vertex AI API, IAM role, billing, and quotas |
| Mistral | Provider key | Mistral provider account | Access to the intended models |
| CompactifAI | Provider key | CompactifAI account | Billing details and payment method |
| Custom provider | Provider key and endpoint base URL | Account accepted by the endpoint | An OpenAI-compatible endpoint and its model IDs |
Scope and credential order
Scope determines which applications can use a credential. Organization scope includes all current and future applications. Project scope includes applications in the selected projects. Application scope includes only the selected applications. You can combine selected projects and applications.
When several active credentials match a request, Optiak tries application-scoped credentials first, then project-scoped credentials, then organization-wide credentials. Within the same matching scope level, lower Order values are tried first. If the values are equal, the older credential comes first. These rules also apply to subscription connections.
For example, an application-scoped key with Order 10 is tried before a project-scoped key with Order 0. Between two application-scoped keys, 0 is tried before 10.
If authentication fails or a rate limit is reached, Optiak tries the next eligible credential. Other retryable provider failures can move the request to another model deployment; see Fallback models. Invalid requests and timeouts stop retries, as does a streamed response that has already started.
When a request names a model without a provider prefix, scope and order also prioritize credentials across providers offering that model. Naming a provider explicitly keeps the request on that provider's selected deployments before configured fallback models.
Before you connect
- Use an Organization Admin account to manage providers.
- Choose the provider account or service account whose models and billing your applications should use. Prepare a key with permission to call the intended models.
- Confirm the provider's billing, quotas, and any model-access prerequisites.
- Have the provider-specific details ready, such as an Azure resource name, a service-account JSON key, or a custom endpoint base URL.
In Company setup → Providers, select Add provider, choose the provider, give the connection a Name, enter its credentials, and choose the organization, projects, or applications that can use them. See Supported providers for preparation steps and provider-specific fields. For subscription-backed models such as Codex, see Connections instead.
After you connect
- In Company setup → Models, enable the models your organization wants applications to use. Custom provider models appear separately and do not require a built-in provider key.
- Select the application's models by following Models and Routing. Applications can use only models enabled by the organization and available to them.
- Use the application's key to call
GET /modelsand check its available model IDs, then send a request using one of those IDs. See Using the API for request examples.
If you rotate or revoke a provider key, update the saved credentials in Optiak. Requests using an expired or revoked key fail even if the application's own key is still valid.
Supported providers
Use an OpenAI provider key with permission to call the models you want to enable.
- Open OpenAI's API keys page.
- Select Create new secret key.
- Name the key and choose its permissions.
- Copy it; OpenAI shows the full value only once.
Choose OpenAI in Optiak and enter the key.
Use an Anthropic provider key from an active account with billing enabled.
- Open Anthropic Console.
- Select Create Key and copy the key; Anthropic shows the full value only once.
Choose Anthropic in Optiak and enter the key.
Use an Amazon Bedrock API key. Many models in commercial AWS Regions are available by default; for third-party models that require an AWS Marketplace subscription, Bedrock can initiate the subscription automatically on first use. This requires the right Bedrock and Marketplace permissions, a valid payment method, and any provider-specific prerequisites. For example, Anthropic models require first-time-use details. Some models may need additional account-level access. See AWS's current model access guidance.
The recommended IAM policy includes these actions:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream",
"bedrock:GetInferenceProfile",
"bedrock:ListInferenceProfiles",
"aws-marketplace:Subscribe",
"aws-marketplace:Unsubscribe",
"aws-marketplace:ViewSubscriptions"
],
"Resource": "*"
}
]
}
Generate a key by following AWS's key-generation instructions. Choose AWS Bedrock in Optiak, enter the key in API Key, and give it a Name. The form does not accept an AWS access-key/secret-key pair or ask for an AWS Region.
Optiak uses the saved key for its EU and US Bedrock deployments. AWS short-term keys work only in the region where they were generated and expire within 12 hours, so check the key type and region against the models you plan to use.
Connect an Azure OpenAI resource using its provider key and resource name.
- In the Azure Portal, open the resource, then Resource Management → Keys and Endpoint.
- Copy KEY 1 or KEY 2. The resource name is the first part of its endpoint; for
https://my-openai-resource.openai.azure.com/, it ismy-openai-resource. - Deploy the models you want to use in Azure AI Foundry. A key alone does not grant access to an undeployed model.
Choose Azure in Optiak. Enter the key in API Key and the resource name in Resource name. The resource name must be 2–64 characters, use only letters, numbers, and hyphens, and start and end with a letter or number.
Use a Gemini provider key created in Google AI Studio.
- Select or create a Google Cloud project in AI Studio and create the key.
- Check that billing, quota, and regional availability meet your production needs.
Choose Google in Optiak and enter the key.
Use Vertex AI when you want Gemini models billed and governed through Google Cloud Vertex AI. Optiak authenticates with a Google Cloud service account.
- In the Google Cloud Console, open IAM & Admin → Service Accounts and create a service account with the Vertex AI user role (
roles/aiplatform.user). - Under the service account, select Keys → Add Key → Create new key (JSON) and download the JSON file.
- Enable the Vertex AI API in the project:
gcloud services enable aiplatform.googleapis.com
Choose Vertex AI in Optiak and paste the full JSON file contents into Service account JSON key. Confirm billing and quotas are active in the Google Cloud project.
Use a Mistral provider key with access to the models you want to enable.
- Open Mistral Console.
- Select Create new key, name it, and choose its permissions.
- Copy the key.
Choose Mistral in Optiak and enter the key.
CompactifAI is Multiverse Computing's API for its compressed models.
- Sign up or sign in at the CompactifAI Dashboard.
- In Manage API Keys, add your billing details, accept the billing terms, and add a payment method.
- Copy the API key from Manage API Keys.
Choose CompactifAI in Optiak and enter the key. CompactifAI issues one key per account. If you rotate it in the dashboard, update the key in Optiak, or requests that use it will fail.
Use a custom provider for an OpenAI-compatible endpoint that is not in the built-in provider list. Have the endpoint base URL, provider key, and model IDs ready.
Choose Custom provider in Optiak, then add a name, slug, endpoint base URL, and provider key. The slug is part of each model's public ID and cannot be changed after creation.
After creating the provider, add its models and optional input, output, cache read and cache write pricing. You can edit provider or model details later. If the organization or an application still allows a model from a custom provider, Optiak asks you to confirm before deleting the provider or model. The confirmation lists what will lose access.
Each model can also declare Token limits (optional): Context window and Max output tokens. Leave a field empty when you don't know it; Optiak only enforces the limits you set. Max output must be lower than the context window. If the provider publishes only a context length, set just the context window. See Token limits for where to find the values and what they change.
Before calling a model, follow Custom provider models to enable it for the organization and application, including when the provider has a limited scope.
Troubleshooting
- Authentication fails: Send a valid Application API key, not a provider key, to the Gateway. If the provider rejects authentication, replace its expired or revoked key in Company setup → Providers.
- Model is missing: Check the credential's scope, organization enablement, and application model selection. For custom providers, add the model first. Use an ID returned by
GET /models; see Models and Routing. - Requests fail after key rotation: Update the saved provider key in Company setup → Providers. Rotating it at the provider does not update Optiak.
- Billing, quota, or access error: Check billing, remaining quota, and model permissions in the connected provider account. Enabling a model in Optiak does not grant provider access or increase quota.
- AWS Bedrock fails: Use an Amazon Bedrock API key, not an AWS access-key/secret-key pair. Check expiry, region, IAM permissions, and model access.
- Azure fails: Use a key and Resource name from the same resource, with the model deployed there. Enter the name, not the endpoint URL; see Azure.
- Vertex AI fails: Paste the full service-account JSON key, not a Gemini key. Check the API is enabled and the account has the required role.
- Custom provider fails: Check the OpenAI-compatible Base URL, key, and upstream model ID. Gateway requests use the Optiak public model ID.
Never include Application API keys or provider keys in support messages or logs.
Related
- Authentication: create and manage the Application API keys your services send to Optiak.
- Models and Routing: choose the models an application can use.
- Connections: connect subscription-backed models, tools, and data sources.