AI Models API: user guide
From the gateway team's guide of 6 November 2026. Model capabilities and limits are as of that date.
Use your GenZDealZ AI Models tokens from your own code and tools: Cursor, Cline, Kilo Code, Continue, Zed, Codex CLI, opencode, Aider, n8n, Open WebUI, LibreChat, LangChain, LlamaIndex, and the OpenAI and Vercel AI SDKs.
The API is OpenAI-compatible. Anything that can talk to OpenAI can talk to it with three changes: the base URL, your key and the model name (section 3). Every call is paid from the same token wallets as the AI Models chat on the GenZDealZ website, so tokens you bought or got free work in both. You can use them at the same time.
1. Get a key
- Sign in on the GenZDealZ website and open AI Models, then Manage API keys.
- Choose Create key. Give it a name, and optionally:
- limit it to some models;
- set an expiry;
- set a daily spending cap in rupees.
- Copy the key (
gzdai_live_...) straight away. It is shown only once. Afterwards you will only see its first and last characters.
Keep the key secret. Never put it in a website's browser code or in a public repository. If it leaks, revoke it on the same page: it stops working at once.
How many keys you can have:
- up to 5 once you have bought tokens;
- 1 while you use free tokens only.
2. Make your first call
- Base URL:
<your base URL> - Authentication:
Authorization: Bearer <your key>. Clients built for Azure can sendapi-key: <your key>instead.
curl <your base URL>/chat/completions \
-H "Authorization: Bearer $GZDAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "openai/gpt-6.1-sol", "messages": [{"role": "user", "content": "Say hello"}]}'Python, with the official openai package:
import os
from openai import OpenAI
client = OpenAI(base_url="<your base URL>", api_key=os.environ["GZDAI_API_KEY"])
reply = client.chat.completions.create(
model="openai/gpt-6.1-sol",
messages=[{"role": "user", "content": "Say hello"}],
)
print(reply.choices[0].message.content)
# Streaming, with the token usage at the end
stream = client.chat.completions.create(
model="deepseek/deepseek-v4-flash",
messages=[{"role": "user", "content": "Write a haiku about Mumbai rain"}],
stream=True,
stream_options={"include_usage": True},
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")
if chunk.usage:
print("\n", chunk.usage)JavaScript, with the official openai package:
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "<your base URL>", apiKey: process.env.GZDAI_API_KEY });
const reply = await client.chat.completions.create({
model: "xai/grok-4.7",
messages: [{ role: "user", content: "Say hello" }],
});
console.log(reply.choices[0].message.content);The Responses API works too (client.responses.create(...)). It is stateless: send the whole conversation each time. previous_response_id is not supported. With the Vercel AI SDK's OpenAI provider, set providerOptions.openai.store = false, so that it sends whole items instead of references to stored ones. A reference to an earlier reasoning item is skipped; any other reference is a 400 that says the same.
3. Models
| Model | model | Tools | Images | JSON mode | Reasoning effort | Max input tokens |
|---|---|---|---|---|---|---|
| GPT-6.1 Sol | openai/gpt-6.1-sol | yes | PNG, JPEG, GIF, WebP | yes, and JSON schema | low to xhigh, max | 256,000 |
| GPT-6 Luna | openai/gpt-6-luna | yes | PNG, JPEG, GIF, WebP | yes, and JSON schema | none to xhigh, max | 256,000 |
| GPT-6 Astra | openai/gpt-6-astra | yes | PNG, JPEG, GIF, WebP | yes, and JSON schema | low to xhigh, max | 256,000 |
| DeepSeek V4 Pro | deepseek/deepseek-v4-pro | yes | no | yes | low, high, max; off when not sent | 256,000 |
| DeepSeek V4 Flash | deepseek/deepseek-v4-flash | yes | no | yes | low, high, max; off when not sent | 256,000 |
| GLM 5 | zai/glm-5 | yes | no | yes | none | 180,000 |
| Grok 4.7 | xai/grok-4.7 | yes | PNG, JPEG | yes, and JSON schema | low to xhigh | 160,000 |
| Kimi K3 | moonshotai/kimi-k3 | yes | PNG, JPEG, GIF, WebP, up to 5 MB an image | yes | none to max (minimal becomes low); medium when not sent | 256,000 |
| Llama 4 Maverick | meta/llama-4-maverick | no | PNG, JPEG, GIF, WebP | no | none | 256,000 |
| Qwen3 235B | qwen/qwen3-235b-a22b-2507 | yes | no | yes | none | 240,000 |
| Nova 2 Lite | amazon/nova-2-lite | no | PNG, JPEG, GIF, WebP, up to 5 MB an image | no | none | 256,000 |
| Gemma 4 31B | google/gemma-4-31b | no | PNG, JPEG, up to 2.5 MB of images in a request | no | none | 240,000 |
- Input limits are counted on the safe side. The API counts your input with OpenAI's tokenizer and, for DeepSeek, Grok and Llama, adds 25 %, because their own tokenizers can count more. So for those models only about 80 % of the figure fits, in OpenAI's count: about 200,000 tokens for DeepSeek and Llama and 125,000 for Grok 4.7. Use these numbers as a coding agent's context window. The GPT-6 figures fit whole. The models on Amazon Bedrock are counted as they count text themselves: English as OpenAI's tokenizer does, so the whole figure fits; Hindi about 1.1 to 3 times and Gujarati about 2.4 to 4.75 times as many tokens, depending on the model.
- Every answer is at most 8,192 tokens (
max_tokensormax_completion_tokenslowers it; on the Responses API,max_output_tokens). - Model names are flexible. The name without the vendor works too (
gpt-6.1-sol), with.or-and in any case. - Your list.
GET /v1/modelslists the models your key may use, with those you have tokens for first. - Reasoning effort. A value a model does not take is mapped to the nearest one it does. For example,
noneon GPT-6.1 Sol becomeslow. - Fields a model ignores (such as
temperatureon reasoning models) are dropped instead of failing. TheX-GenZDealZ-Ignored-Paramsheader names them. So are OpenAI's built-in tools, which this API does not run (web and file search, shell, apply_patch, computer use, code interpreter, image generation, MCP, tool search): they are dropped and named in that header, and refused only whentool_choiceforces one. - Requests a model cannot honour are refused with a clear 400: images on DeepSeek, GIF or WebP images on Grok, tools on Llama, JSON mode or a JSON schema where the table does not list it,
logprobs,nabove 1, and custom (freeform) tools on models other than GPT-6. With Codex or Cursor's freeform tools, use a GPT-6 model. Also images on GLM 5 and Qwen3 235B, tools on Nova 2 Lite and Gemma 4 31B, a GIF or WebP image on Gemma 4 31B, and an image larger than the table allows (5 MB on Kimi K3 and Nova 2 Lite, and 2.5 MB of images together on Gemma 4 31B; that is the image's own size, before base64). Kimi K3 and Nova 2 Lite take images as base64 data URLs only, not ashttpslinks, so that their size can be checked. Kimi K3 also needs an image whose width and height can be read from its file: "Kimi K3 could not read the size of an image. Please send it as a PNG or JPEG." - On the models served from Amazon Bedrock,
temperature,top_p, the penalties andstopare dropped (and named in theX-GenZDealZ-Ignored-Paramsheader), and JSON mode isjson_objectonly, without a JSON schema. - Embeddings and the old
/v1/completionsendpoint are not available. Use chat completions or responses. - Llama 4 Maverick retires by 18 Nov 2026. Your Llama 4 Maverick tokens will then move to GPT-6 Luna at the same value.
- Retired models. Grok 4.1 Fast (both versions) retired on 6 Nov 2026, and Llama 4 Maverick retires by 18 Nov 2026. A request naming a retired model answers 404
model_not_found, andGET /v1/modelsno longer lists it. The tokens you held for them are converted at equal value: Grok 4.1 Fast tokens to Grok 4.7 (xai/grok-4.7), about one for ten; Llama 4 Maverick tokens to GPT-6 Luna (openai/gpt-6-luna), about 2.5 for one. A key limited to a retired model keeps its list, so it cannot call the replacement (403model_not_allowed): create a key for the replacement, or for all models, on the AI Models page (Manage API keys).
4. How tokens are charged
- One wallet per model. GPT-6.1 Sol tokens pay only for GPT-6.1 Sol. Buy tokens on the AI Models page; what each model costs today is on the pricing page.
- Free tokens are used first, then bought ones. The chat and the API draw on the same wallet.
- A token is one input token of that model. Each output token counts as the model's output weight: 5 for the GPT-6 models, for example. A model's thinking counts as output.
GET /v1/modelsshows each model'soutput_weight. - Cached input is counted as normal input.
- You pay for what the model actually used, as its provider reports it. Before a request starts, the most it could cost is set aside; when it ends, you are charged the real amount and the rest goes back.
- If your answer cap does not fit your balance, the API lowers it to what you can pay for. The
X-GenZDealZ-Max-Output-TokensandX-GenZDealZ-Output-Cap-Clampedheaders say so. If you set your own cap (max_tokens,max_completion_tokensormax_output_tokens), sendx-genzdealz-strict-max-tokens: trueto get an error instead. Without a cap of your own, the header changes nothing. The error is one of:- a 402
max_tokens_unaffordablewhen your cap cannot fit; - a 429 to retry shortly when it would fit once your other requests in progress finish.
- a 402
- If you disconnect mid-answer (Stop in your tool), the model still finishes and you are charged for the whole answer, because the model's provider charges for it.
- A stopped stream stops counting toward your key's limit of requests at once (section 5), so you can send your next request right away. Stopped and running answers together may reach twice that limit.
- A request that was not streamed keeps counting until the model finishes.
- Every answer reports its charge. Each answer, streamed or not, ends with a
genzdealzobject holdingtokens_charged,balance_afterandbilling.billingis one of:exact: the provider's usage;estimated: the provider reported no usage;none: nothing was charged;pending: the charge is still being recorded, andGET /v1/usage/<request id>shows it shortly.
- Your balance:
GET /v1/credits/balance. - This key's recent requests and what each cost:
GET /v1/usage, orGET /v1/usage/<request id>. The request id is theX-Request-Idheader of every answer. The AI Models page shows the requests of all your keys.
5. Limits
| Free tokens only | After a purchase | |
|---|---|---|
| Keys | 1 | 5 |
| Requests at once, per key | 1 | 4 |
| Requests a minute, per key | 10 | 60 |
| All your keys together | 8 at once, 120 a minute | 8 at once, 120 a minute |
- Requests can be up to 32 MB, with at most 20 images (23 MB together). A model's own image limit is in the Images column of the models table: 5 MB an image on Kimi K3 and Nova 2 Lite, 2.5 MB of images together on Gemma 4 31B (the decoded image's bytes; 5 MB is 5,000,000), and no images on GLM 5 and Qwen3 235B.
- An answer can take at most 10 minutes.
- Reading your models, balance and usage (
GET /v1/models,/v1/credits/balance,/v1/usage): about 120 calls a minute per key. Poll no faster than once a second. - Use streaming for long answers, or set your client's timeout to at least 600 seconds. Reasoning models can think for minutes before the first word. A request your client gives up on is still answered and charged, and an automatic retry by your client is a second request, charged again. The OpenAI SDKs wait 600 seconds by default; some tools wait only 60 (n8n), so raise their timeout.
- Each model also has a daily usage limit across all users. When it is reached, that model pauses until 00:00 UTC (05:30 India time).
6. Errors
Errors use OpenAI's format, so your SDK raises its usual exceptions:
{"error": {"message": "...", "type": "insufficient_quota", "param": null, "code": "insufficient_quota"}}| Status | code | What to do |
|---|---|---|
| 401 | missing_api_keyinvalid_api_key | Check the key; it may be revoked or expired |
| 401 | wrong_product_key | That is a Claude key (sk-gzd-...): create an AI Models key |
| 403 | model_not_allowed | This key is limited to other models |
| 403 | api_disablednot_in_rollout | The API is not available right now, to anyone (api_disabled) or to your account (not_in_rollout). Your keys are kept: try again later |
| 404 | model_not_found | Check the name against GET /v1/models. A retired model answers this too (section 3, "Retired models") |
| 400 | context_length_exceeded | Shorten the conversation |
| 400 | content_filter | The prompt was blocked. Its reading is still charged, as the message says |
| 402 | insufficient_quota | Not enough tokens for this model: top up on the AI Models page |
| 402 | key_daily_limit_reached | This key's daily rupee cap is spent. It resets at 00:00 India time |
| 402 | max_tokens_unaffordable | Only with x-genzdealz-strict-max-tokens: true: lower max_tokens, or drop the header to have it lowered for you |
| 429 | rate_limit_exceededconcurrency_limit_exceededcredits_held_in_flightkey_daily_limit_held | Wait the Retry-After seconds and retry. key_daily_limit_held: this key's other requests in progress are holding the rest of today's cap |
| 429 | model_daily_limit_reached | Use another model, or retry after 00:00 UTC |
| 502 | server_error | The model stopped with an error: retry. One with x-should-retry: false came after the answer began and was charged (below) |
| 503 | server_is_overloadedprovider_unavailable | Busy: retry after Retry-After; you were not charged. A server_is_overloaded without Retry-After came after the answer began and was charged (below) |
Codex CLI gets the three 402s as 429s, with the same code and no Retry-After, because Codex retries a 402 but stops on this 429. Act on the code as the table says.
x-should-retry: false tells your SDK not to retry on its own. It is on the 401s, 402s and 403s and the 429 model_daily_limit_reached: retrying them at once does not help. It is also on an answer that failed after it began and was charged, whatever its status (below). Other 400s, 404s and 413s do not carry it, but sending the same request again fails the same way: change it first.
An answer that fails after it began is charged for what was read and written so far, and its error says so in genzdealz.tokens_charged:
- when it is not streamed, the error also carries
x-should-retry: false, so your SDK does not repeat it, and pay for it again, on its own; - when it is streamed, the error is the stream's last event before
data: [DONE]: a chunk holdingerror, orresponse.failed(or anerrorevent) on the Responses API.
Every answer has an X-Request-Id: quote it when you contact support.
7. Set up your tools
Use the base URL <your base URL> and your key. The settings for each tool:
Cursor
Settings → Models:
- Turn on the OpenAI API key, paste your key, and turn on Override OpenAI Base URL with the base URL.
- Add a custom model named, for example,
openai/gpt-6.1-sol.
Cursor sends requests from its own servers, and about 25,000 tokens of instructions with each one. Tab completion keeps using Cursor's own models.
Cline, Kilo Code, Roo Code
API Provider OpenAI Compatible. Set the base URL, the key and a model id such as openai/gpt-6.1-sol. Set the context window to the input that fits the model (section 3).
Continue
config.yaml:
models:
- name: GPT-6.1 Sol (GenZDealZ)
provider: openai
model: openai/gpt-6.1-sol
apiBase: <your base URL>
apiKey: ${{ secrets.GZDAI_API_KEY }}Codex CLI
~/.codex/config.toml; set GZDAI_API_KEY in your environment:
model = "openai/gpt-6.1-sol"
model_provider = "genzdealz"
model_context_window = 256000
model_auto_compact_token_limit = 220000
[model_providers.genzdealz]
name = "GenZDealZ"
base_url = "<your base URL>"
env_key = "GZDAI_API_KEY"
wire_api = "responses"opencode
opencode.json: a provider with "npm": "@ai-sdk/openai-compatible", "options": {"baseURL": "<your base URL>", "apiKey": "{env:GZDAI_API_KEY}"}, and the models you want under models.
Zed
Under language_models.openai_compatible, add a provider with api_url set to the base URL. List the models with their max_tokens (the input that fits, section 3) and max_output_tokens: 8192.
Aider
OPENAI_API_BASE=<your base URL> OPENAI_API_KEY=$GZDAI_API_KEY aider --model openai/gpt-6.1-soln8n
Create an OpenAI credential with your key and the base URL. In the OpenAI Chat Model node, pick a model from the list. Raise the node's timeout from 60 s to 600 s: otherwise a long answer times out, n8n retries it, and each try is charged.
Open WebUI
Admin Settings → Connections → add an OpenAI connection with the base URL and your key. Its title and tag generation are extra requests, and they use tokens too.
LibreChat
librechat.yaml: a custom endpoint with a name, baseURL set to the base URL, apiKey set to your key, and models with default (at least one model id, such as openai/gpt-6.1-sol) and fetch: true.
LangChain
ChatOpenAI(model="openai/gpt-6.1-sol", base_url="<your base URL>", api_key=...)LlamaIndex
OpenAILike(model="openai/gpt-6.1-sol", api_base="<your base URL>", api_key=...,
is_chat_model=True, is_function_calling_model=True, context_window=256000)Vercel AI SDK
createOpenAICompatible({ name: "genzdealz", baseURL: "<your base URL>",
apiKey: process.env.GZDAI_API_KEY, includeUsage: true })