Getting started with AI on Zenifra
This guide shows how to generate your credential, limit usage with a budget, and make the first call using an OpenAI-compatible client.
Prerequisites
- a Zenifra account
- access to the Zenifra console
- available credit, including promotional credits when granted
- a Python project with the
openaipackage installed - an environment variable to store the key
Step 1: Create the API key

In the Zenifra console, open AI models, click Create API Key, and enter a name that identifies the environment, application, or team that will use the key. The name accepts 4 to 24 characters and may contain only unaccented letters, numbers, and hyphens, with no spaces, such as production-api-01.
Required permissions
For AI operations through a user session, an owner has full access; assistant and member need the organization grants. For automation, organization API Keys use the AI key ID:
| Action | Minimum scope |
|---|---|
| Create an AI key | ai_key.create on organization:* |
| Read a key | ai_key.read on ai_key:<key-id> |
| Change the budget | ai_key.update on ai_key:<key-id> |
| Remove/deactivate a key | ai_key.delete on ai_key:<key-id> |
| Read usage and costs | ai_usage.read on ai_key:<key-id>; use * only for all permitted keys |
The scopes above are independent: creating a key must not be treated as authorization to read usage for other keys. The key used by the client for ai.zenifra.com is an inference credential separate from the organization API Key.
Keys belong to the organization but retain their creator link. Removing a member from the organization automatically deactivates the AI keys created by that member.
This key will be used by your application to authenticate calls to the https://ai.zenifra.com/v1 endpoint. The secret is shown only once after creation; copy it and store it securely like any other production secret.
Step 2: Define budget and allowed models
When creating the key, you select the Allowed Models and set the Daily quota (BRL) and Monthly quota (BRL). You can also adjust the Key RPM and Key TPM, which can be lower than the organization limits but never higher. Quotas never increase the organization's available credit.
This flow is useful to separate usage by environment, team, or integration.
Allowed models accept all-team-models (every model available to the organization, the default) or 1 to 50 unique catalog IDs, such as zenifra/qwen3.8-flash. IDs outside the catalog are rejected.
Manage keys through the API
The same console operations are available at https://api.zenifra.com/v1, with the x-organization-id header and the scopes from the previous section.
| Method | Endpoint | Description |
|---|---|---|
GET | /ai/models | Catalog of models that can be enabled for a key |
POST | /ai/keys | Creates a key; the secret (api_key) appears only in the 201 response |
GET | /ai/keys | Lists the organization's keys, always paginated |
GET | /ai/keys/:id | Reads a key |
PATCH | /ai/keys/:id/budget | Changes the key's daily and monthly quotas |
DELETE | /ai/keys/:id | Revokes the key |
GET | /ai/rate-limits | Reads the organization's RPM and TPM limits (requires ai_key.create) |
The list accepts page (starting at 1, default 1), limit (1 to 50, default 50), and user_email to filter the keys of an active member; a member can only filter by their own email. The response includes a pagination field:
{
"status": "success",
"data": [
{
"id": "6650f1c2a9b8c7d6e5f40312",
"name": "production-api-01",
"models": ["zenifra/qwen3.8-flash"],
"quota_limits": { "daily": 10, "monthly": 200 },
"rpm": 60,
"tpm": 100000,
"is_active": true,
"status": "active",
"created_at": "2026-10-01T12:00:00.000Z",
"expires_at": null
}
],
"pagination": { "page": 1, "limit": 50, "total": 1, "pages": 1 }
}A revoked key, or one past its expiration, appears with status: "inactive". A revoked key never becomes active again.
When changing quotas, send quota_limits with positive daily and monthly values; monthly must be greater than or equal to daily.
Key limits and errors
Each organization can have up to 100 active AI keys at the same time. Revoked or expired keys do not count.
| Status | Code or message | When it happens | How to act |
|---|---|---|---|
400 | One or more models are not available | an ID in models is not in the catalog | use IDs from GET /v1/ai/models or all-team-models |
400 | AI key rate limits must be within the organization limits | rpm or tpm above the organization limit | check GET /v1/ai/rate-limits |
400 | validation message | invalid key id, name outside the pattern, or invalid quotas | fix the request |
404 | API key not found | the key does not exist or does not belong to the organization | check the id |
409 | AI_KEY_LIMIT_REACHED | the organization already has 100 active keys | revoke keys you no longer use before creating another |
409 | AI_KEY_REVOKED | attempt to change the quota of a revoked key | create a new key |
503 | AI models are temporarily unavailable | the catalog is temporarily unavailable | try again shortly |
Step 3: Make the first request
Install the OpenAI SDK in your Python project:
pip install openaiThen use the example below. For this documentation, we will use the zenifra/qwen3.8-flash model, if it is enabled for your key in the console:
import os
from openai import OpenAI
client = OpenAI(
base_url="https://ai.zenifra.com/v1",
api_key=os.environ["ZENIFRA_AI_API_KEY"],
)
response = client.chat.completions.create(
model="zenifra/qwen3.8-flash",
messages=[
{
"role": "user",
"content": "What is the average temperature in southern Brazil?",
}
],
)
print(response.choices[0].message.content)Step 4: Track usage and costs

In the console, you can view:
- daily costs
- total costs
- usage by model
- current models
- created keys
How billing works
AI usage can be billed by tokens, images, or another unit identified by the catalog. Token-based models can have a standard (peak) price, an off-peak price, and context tiers selected by the input-token count. Review AI model pricing and the Console before shipping integrations to production.
AI usage is prepaid and uses the organization's shared credit. When no usable credit remains, new calls are blocked. A saved card does not enable additional AI usage.
FAQ
Do I need to use the OpenAI SDK?
Not necessarily. The important part is to use a client compatible with the OpenAI API and configure base_url and api_key correctly.
Where can I track current models and prices?
In the console, on the AI Models page, Available Models tab. The public list is also available at GET https://ai.zenifra.com/v1/models.
Can I limit the use of a key?
Yes. When creating the key, you set daily and monthly quotas in BRL, the RPM and TPM limits, and which models it can access. Quotas can be changed later in Edit quota.
How many AI keys can I create?
Up to 100 active keys per organization. Revoke keys you no longer use to free up room.
Next steps
Last updated on
Use Zenifra AI in OpenCode
Use Zenifra AI in OpenCode with the official plugin: install it, connect your plan or on-demand key, pick a model and learn how the key usage limits work.
AI model pricing
How Zenifra prices AI models: standard and off-peak rates, input-token context tiers, cache reads, per-image units and how to estimate cost from the catalog.