Authentication
Your services use the same Application API key to call both the Gateway and MCP Gateway. Optiak uses provider credentials to call models on your behalf. Keep these credentials distinct from Connections, which give Optiak access to tools and data sources.
Required role
Applies to
Why use it
Each credential connects a different pair of systems. An Application API key identifies your application to the Gateway. A provider key or supported subscription lets Optiak access model-provider services. Keeping these credentials separate limits what each one can reach.
How it works
Application API keys
Your service sends an Application API key to authenticate with the Gateway. Each key belongs to one application, so requests made with it use that application's available models and settings. The same key can access the application's enabled tools through the MCP Gateway.
Create a key
In the console, open Projects, switch to Applications, select the application, then open Configuration → Credentials and select Create API key. Give the key a name so you can recognize which service uses it. A label and description are optional. Choose how long it should work: no expiration, 7 days, 30 days, 90 days, or 1 year. After it expires, it can no longer authenticate requests.
Copy the full key when it is created. Optiak shows the full value only once; afterward, the list shows only its prefix. Optiak stores only a one-way fingerprint of the key, not the secret itself, so the original key cannot be read back from Optiak.
Use a key
Send the key as a bearer token in the Authorization header. For example:
export OPTIAK_BASE_URL="https://api.optiak.dev/v1"
export OPTIAK_API_KEY="your_application_api_key"
curl "$OPTIAK_BASE_URL/chat/completions" \
-H "Authorization: Bearer $OPTIAK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "codex/gpt-6-luna",
"messages": [{ "role": "user", "content": "Hello" }]
}'
For a guided walkthrough from provider setup to your first request, see the Quickstart.
Use GET /models to check which model IDs the key can access. The same key can call the application's enabled MCP tools; see Tools.
- Never commit an Application API key to a public repository or share it publicly.
- Use one key per integration so you can revoke access to one service without affecting others.
- Set an expiration for temporary tests or short-lived integrations, and rotate long-lived keys regularly.
- Store keys in a secret manager or environment variable, not in application code.
- Revoke a key when its integration is retired or the key may be compromised.
Revoke a key
Open the application's Configuration → Credentials section and revoke the key. Revocation disables it immediately, so any service using it will stop authenticating.
Set it up
- To connect an application to the Gateway, create an Application API key, then send it with API requests.
- Connect Model APIs: prepare provider keys, connect built-in or custom providers, and make their models available to applications.
- To connect tools or data sources to Optiak, see Connections.
Limits and behavior
- Optiak shows the full value of an Application API key only when it is created. Create another key if the value is lost, and revoke keys that should no longer work.
- A provider API key or subscription does not by itself make every model available to every application. The organization enables models, and applications select from those allowed to them.
Related
- Connections: authenticate Optiak to external tools and data sources.
- Models and Routing: choose the models an application can use.
- Using the API: call the Gateway with an Application API key.