Access and AI keys
AI access uses the same Clients and Profiles as the API Gateway. Nothing is open by default: a client with no AI models granted, or a profile without AI access switched on, cannot call the model API.
On the client
Edit a client and open the AI Gateway section.
| Field | Meaning |
|---|---|
| Allowed models | Tick model names, a tag (Tag: coding grants every model with that tag, including ones added later), or All models. The hint underneath lists the active models the grants currently match. |
| AI budget | An AI Budget whose limits apply to this client. No budget means no AI limits. |
| Default model | Used when a request does not include model. |
On the profile
Edit a profile and use the AI access section.
| Field | Meaning |
|---|---|
| AI access | Lets the profile call the model API. Available once the client has AI models. |
| Limit to these models | An optional subset of the client's models. Leave all unticked to allow every model the client is granted. |
| Token cap | Optional tokens per day, 7 days or 30 days for this profile, on top of the client's budget. |
The AI column on the profiles list shows whether AI is on, the model subset and the AI key prefix.
Authenticating
The model API accepts either:
- An AI key (recommended for SDKs and developer tools):
Authorization: Bearer zk_...orx-api-key: zk_.... - The profile's gateway credentials: the same
X-Client-ID,X-Profile-IDand authentication headers used for the API Gateway. The profile's allowed HTTP methods do not apply to the model API.
Profiles with authentication type None cannot use the AI Gateway, and requests without a profile return 403.
AI keys
On the client's profiles page, select AI key on a profile (modifier role).
- Issue AI key creates a key of the form
zk_<profileId>_<secret>. It is shown once; Zerq stores only a SHA-256 hash. Copy it into the tool's environment asZERQ_KEY. - Rotate issues a new key; the old one stops working immediately.
- Revoke deletes the key.
A key carries the profile's access: its client's model grants, the profile subset, the client's AI budget and the profile's token cap. Disabling the profile or the client, or turning off AI access, stops the key. Issuing and revoking keys is audited; the key is never written to audit or request logs.
The key dialog shows ready-to-paste snippets for Codex, Claude Code, the OpenAI SDK, curl and Cursor. They read the key from ZERQ_KEY and never contain it. See Coding tools.
In the Developer Portal
Developers can manage keys themselves: the portal's AI models page lists the models their client may use, each profile's AI access, token cap and key prefix, and setup snippets. Generate AI key (or Rotate key) issues a key for an AI-enabled profile with authentication, shown once. Portal key issuance is audited as developer_portal / issue_ai_key without the response body. The page also shows the client's AI usage for the last 30 days and its AI budget limits.
From workflows
Workflow LLM and AI Agent nodes with the Zerq AI Gateway provider call the AI Gateway with an AI key stored in an API key credential. Their calls are charged to the key's client and follow the same model grants, budgets and guardrails, and they appear in AI Logs. (With a direct provider, the nodes call the provider themselves and the AI Gateway is not involved.)
Using an OpenAI SDK
import os
from openai import OpenAI
client = OpenAI(base_url="https://<gateway-host>/llm/v1", api_key=os.environ["ZERQ_KEY"])
reply = client.chat.completions.create(model="chat-default", messages=[{"role": "user", "content": "Hello"}])
print(reply.choices[0].message.content)
See the Model API reference for endpoints, headers and errors.