Token-based LLM API

Open-weight language models behind an OpenAI-compatible API, billed per token consumed, in Brazilian reais. Change the base_url in your code and start using it.

You pay per token, in reais, and only for what you use. No subscription, no monthly fee and no committed spend: every call is charged against the same balance that already pays for your GPU instances. Billing in reais via Pix or card, with no currency conversion and no Brazilian international purchase tax (IOF), and support in Portuguese.

Pricing by model

Price per million tokens, in Brazilian reais. Input tokens (what you send: instructions, history and context) and output tokens (what the model generates) are counted separately, because they cost differently.

Model Context Input (R$/1M) Output (R$/1M)
DeepSeek V4 Flash gpub-fast 1,000,000 tokens R$ 0.49 R$ 1.09
Qwen 3.6 35B gpub-mini 200,000 tokens R$ 0.59 R$ 3.49
Qwen 3.8 27B gpub-plus 1,000,000 tokens R$ 0.69 R$ 3.99
GLM 5.3 Flash gpub-pro 250,000 tokens R$ 1.89 R$ 5.90
GLM 5.2 gpub-base 250,000 tokens R$ 7.90 R$ 17.90
Kimi K3 gpub-max 1,000,000 tokens R$ 17.90 R$ 84.90

Price per million tokens, in Brazilian reais.

There is no minimum token purchase. You do not buy bundles, packs or token credits: you are charged in proportion to what the call actually consumed. A short question can cost fractions of a cent. The only minimums are deposit minimums, which already apply to GPUs: R$100 on the first deposit (with a R$12 bonus, or R$25 from R$300 up) and R$5 on later top-ups.

Use gpub-max, gpub-base, gpub-pro, gpub-plus, gpub-mini or gpub-fast in the model field. These are stable identifiers: when the model behind one of them is updated to a newer generation, your code keeps working unchanged. For convenience the model name is also accepted on input (kimi-k3, qwen3.8), and the response always echoes back the identifier you sent.

Cost simulator

Estimate what a call would cost before writing the first line of code. For reference, a short question (500 input tokens and 300 output tokens) lands in the fractions-of-a-cent range on the cheaper models.

≈ R$ 0.00

Estimated with the same public prices shown in the table above. The exact cost of each call comes back in the usage.cost_brl field of the API response itself.

Base URL and authentication

All endpoints live under the base URL below and follow the OpenAI API format:

https://gpubrasil.com.br/v1

Authenticate with the same API key you already use to provision GPUs, in the Authorization header. Treat it like a password.

Authorization: Bearer gpub_live_suachaveaqui

Generate your API key in the dashboard

For security, API keys are generated and managed inside your account, in the API Keys section of the dashboard. The plaintext key is shown only once, in the authenticated area.

Open dashboard → API Keys

Code examples

cURL

curl https://gpubrasil.com.br/v1/chat/completions \
  -H "Authorization: Bearer gpub_live_suachaveaqui" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpub-plus",
    "messages": [
      { "role": "user", "content": "Explain what an LLM token is in two sentences." }
    ]
  }'

Response (abridged):
{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "model": "gpub-plus",
  "choices": [
    { "index": 0, "message": { "role": "assistant", "content": "..." }, "finish_reason": "stop" }
  ],
  "usage": {
    "prompt_tokens": 22,
    "completion_tokens": 64,
    "total_tokens": 86,
    "cost_brl": 0.0012
  }
}

The usage.cost_brl field is the cost of that call in Brazilian reais, already computed by the server. It is the same amount charged against your balance.

If you do not send max_tokens, we apply a default cap of 4,096 output tokens (32,768 maximum per call, and always bounded by what is left of the context window). It is the guard that keeps a single call from costing tens of reais — pass max_tokens explicitly when you need longer answers, otherwise the response comes back with finish_reason: "length".

Python (official OpenAI SDK)

Install with pip install openai. Only the base_url and the key change:

from openai import OpenAI

client = OpenAI(
    api_key="gpub_live_suachaveaqui",
    base_url="https://gpubrasil.com.br/v1",
)

response = client.chat.completions.create(
    model="gpub-plus",
    messages=[{"role": "user", "content": "Summarize this text in 3 bullets: ..."}],
)

print(response.choices[0].message.content)
print("Cost in R$:", response.usage.model_dump().get("cost_brl"))

Node.js (openai package)

Install with npm i openai:

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "gpub_live_suachaveaqui",
  baseURL: "https://gpubrasil.com.br/v1",
});

const response = await client.chat.completions.create({
  model: "gpub-mini",
  messages: [{ role: "user", content: "Classify this comment as positive or negative: ..." }],
});

console.log(response.choices[0].message.content);
console.log("Cost in R$:", response.usage.cost_brl);

Streaming

With stream: true tokens arrive as they are generated. Ask for stream_options.include_usage to receive the usage block, with the cost in reais, in the final event of the stream:

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "gpub_live_suachaveaqui",
  baseURL: "https://gpubrasil.com.br/v1",
});

const stream = await client.chat.completions.create({
  model: "gpub-max",
  messages: [{ role: "user", content: "Write a short script about..." }],
  stream: true,
  stream_options: { include_usage: true },
});

for await (const part of stream) {
  const text = part.choices?.[0]?.delta?.content;
  if (text) process.stdout.write(text);
  // The final event carries no text: it carries the usage and the cost in reais.
  if (part.usage) console.log("\nCost in R$:", part.usage.cost_brl);
}

Errors use the same OpenAI envelope: {"error":{"message","type","param","code"}}. The common ones: 402 insufficient balance (add funds and retry), 403 the programmatic API unlocks after your first confirmed deposit — until then, try the models in the dashboard playground, 429 rate limit (wait and retry) and 503 service temporarily unavailable.

When to use the token API and when to use a dedicated GPU

Token API

To get started in minutes, with nothing to provision or keep running. It fits when:

  • usage is intermittent or unpredictable;
  • you do not want to pay for an idle machine between calls;
  • you want to try several models by changing one line of code;
  • demand spikes are short and you do not want to size infrastructure for them;
  • your integration already uses the OpenAI SDK and you only want to swap the base_url.

We do not use your prompts or the responses to train models.

Dedicated GPU

A GPU instance that is yours alone, billed by the hour. It fits when:

  • volume is high and steady, and the GPU hour comes out cheaper than the token;
  • you need your own model, fine-tuned or outside our catalog;
  • you need control: the weights run inside your instance and you decide what is written to logs, for how long and who has access, without depending on anyone's API. It is that control, not the geography of the server, that backs a governance and LGPD policy;
  • you want to run training, RAG, image generation or any workload beyond text.
Open the console and launch a dedicated GPU

Internet access

In the dashboard playground, internet lookup is automatic. An ordinary conversation queries nothing and pays for tokens only; when your question needs current information — recent news, a number that moves during the day — the data is fetched before the question reaches the model, and the answer cites the value and the time of the lookup.

A R$ 0.05 access fee applies to those messages only, on top of the token cost. A badge on the reply marks when a lookup happened and where the data came from.

On the API, you are in control. Calls to /v1/chat/completions do not query the internet: you build whatever context you want. The standard path is to declare a search tool in tools — the model requests the call, your code runs the search and returns the result. That already works through our API today.

Tool support varies by model. gpub-max, gpub-pro and gpub-plus request tools and use the result correctly. gpub-fast requests tools but does not always make good use of the result. gpub-mini does not support tools — it ignores the request even when forced. For tool-using agents, pick gpub-max, gpub-pro or gpub-plus.

About max_tokens on reasoning models. Five of the six models — gpub-max, gpub-base, gpub-pro, gpub-plus and gpub-mini — think before they answer, and that text arrives in reasoning_content, separate from content. Those tokens are billed as output, whether or not they show up in the answer: they were generated. With a low ceiling the reasoning eats the whole budget, the answer comes back empty and the call ends with finish_reason: "length" — we measured gpub-max burning a full 1,024 tokens thinking without writing a single line. For a real question on these models, use at least 4,096 output tokens. Only gpub-fast answers straight through, with no reasoning phase.

Frequently asked questions

Is there a minimum token purchase?

No. There are no bundles, packs or token minimums: you are charged in proportion to what the call actually consumed, counting input and output separately. The only minimums are deposit minimums, which already apply to GPUs: R$100 on the first deposit (with a R$12 bonus, or R$25 from R$300 up) and R$5 on later top-ups.

Do I need a monthly plan?

No. There is no subscription, monthly fee or committed spend. You add balance in reais and API usage is charged against that same balance, the one that already pays for your GPU instances. A month with no calls is a month with no charge.

Is the API compatible with OpenAI's?

Yes. The /v1/chat/completions, /v1/completions and /v1/models endpoints follow the OpenAI format, including streamed responses with stream: true. In practice you keep the official SDK and change only the base_url and the key.

How do I know what each call cost?

Every response carries usage.cost_brl, the cost in reais of that call, already computed by the server. When streaming, send stream_options: {"include_usage": true} to receive the usage block in the final event. You can also track aggregate usage at /api/inference/usage and in your dashboard statement.

Do you train models on my prompts?

No. Your prompts and the responses are not used to train models. If your requirement is full control over weights, logs and retention, the path is a dedicated GPU: the model runs inside an instance that is yours alone and you decide what gets logged.

When is a dedicated GPU better than the token API?

When volume is high and steady, when you need your own or fine-tuned model, or when you need direct control over weights, logs and retention. The token API wins when usage is intermittent, when you do not want a machine sitting idle, and when the goal is to start in minutes.

Which currency is the API billed in?

Brazilian reais. Prices are published in R$ per million tokens, balance is added in reais via Pix or card, and usage is charged from that same balance. There is no currency conversion and no Brazilian international purchase tax (IOF).

Are the prices on this page the same ones you charge?

Yes. The table above is loaded at runtime from the same catalog the server uses to compute usage.cost_brl. The values written into the HTML exist only so the page stays readable if your network fails to load the table.

Can I use the same balance as my GPUs?

Yes, and that is exactly how it works: a single balance, in reais, paying both hourly instances and per-token API calls. Top up by Pix or card, with no currency conversion and no Brazilian international purchase tax (IOF).