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 balance or the R$30,00 received when creating the account
- 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 and click Create API Key.
This key will be used by your application to authenticate calls to the https://ai.zenifra.com/v1 endpoint. Store this credential like any other production secret.
Step 2: Define budget and allowed models
When creating the key, define a cost budget and select which models it can access.
This flow is useful to separate usage by environment, team, or integration.
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.6-35b-a3b 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.6-35b-a3b",
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 is billed by tokens. Prices and available models can change over time, so always check the console before shipping integrations to production.
Usage follows the user account renewal cycle. If there is available balance, it will be used first. If there is not enough balance, the pending amount becomes negative balance.
The R$30,00 received when creating the account can also be used with the AI offering.
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, in the AI Models area.
Can I limit the use of a key?
Yes. The key creation flow lets you define a cost budget and select which models it can access.