AI model API: what it is and how to send your first request

How an AI model API differs from a browser chat, what a key and a base URL are, what you pay for, and how to send your first request in ten minutes.

6 min · · API keys · development

You've used an AI model in a chat window, and now the instructions for a bot, plugin or code editor ask for "an API key and a base URL". Let's look at what an AI model API is, how it differs from a chat app and a subscription, what you pay for, and how to send your first request with curl or Python. Prices in the examples are Zukko prices as of October 7, 2026.

What an AI model API is, in plain words

An API (application programming interface) is how one program talks to another. For an AI model it looks like this: your program sends an HTTP request with text to a server, the server runs it through the model and returns the answer as JSON. No chat window, no buttons — just a request and a response.

Almost every "smart" feature outside the official chat apps works through an API:

  • Telegram bots and support bots;
  • code editor plugins (Cursor, Cline, Kilo Code) and terminal agents like Claude Code;
  • scripts that process spreadsheets, emails and documents;
  • your own services and apps.

How an API differs from a chat app and a subscription

Subscription chatAPI
Paymentfixed monthly feefor the tokens you actually use
Limitsset by the service within the planyour balance and the key limits you set
Interfaceready-made windowyour program or an existing client
Automationmanual, one message at a timethousands of requests from a script
Model choicewhatever the plan includesany model in the catalog, by name
Conversation memorykept by the serviceyou send the history yourself

If you ask a couple of questions a day, a chat app is more convenient. An API is what you need when the model has to work inside a program, process data in batches, or when you want to pay only for actual usage.

The parts of working with an API

Key

A string like fetch_... that tells the server it's you and charges your balance. The key is sent in the header Authorization: Bearer fetch_.... The full key is shown only once, at creation — save it right away. Don't publish it in code on GitHub or in chats. You can create several keys, each with its own daily and monthly dollar limits and a list of allowed models.

Address

The base URL is the address of the server your program calls. For the OpenAI-compatible format it's https://api.zukko.pro/v1, and a model request is POST /v1/chat/completions. For the Anthropic format it's POST https://api.zukko.pro/v1/messages. Programs that append /v1 themselves (Claude Code, the official Anthropic SDK) are configured with https://api.zukko.pro.

Request and response

A request is JSON with the model name (model) and a list of messages (messages), where each message has a role: system for instructions, user for the user, assistant for the model's previous replies. The response is JSON too: the text is in choices[0].message.content, and usage shows how many tokens went to input and output.

Paying for tokens

A token is a piece of text, the unit of billing. The Zukko balance is in dollars, with top-ups from $1: SBP or a Russian card (Mir, Visa, MasterCard) in rubles at the market rate at the time of payment, cryptocurrency, or a foreign card. Each request deducts the cost of its tokens from the balance. How tokens are counted is explained in the article what tokens are in AI models.

First request with curl

  1. Sign up at zukko.pro and top up your balance (or get $0.50 for subscribing to the @zukkopro Telegram channel).
  2. Create a key on the keys page in the dashboard.
  3. Run this in a macOS or Linux terminal:
bash
curl https://api.zukko.pro/v1/chat/completions \
  -H "Authorization: Bearer fetch_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-6.1-sol",
    "messages": [
      {"role": "user", "content": "Explain what an API is in two sentences"}
    ]
  }'

In the response, find choices[0].message.content — the model's text — and usage.prompt_tokens / usage.completion_tokens — the tokens you were charged for. If you're on Windows, it's easier to start with the Python example below: the Windows command line handles quotes differently. The same steps are described in the quick start.

First request in Python

Install the library: pip install openai. It works for any model in Zukko, not just GPT: the gateway converts the request.

bash
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.zukko.pro/v1",
    api_key=os.environ["OPENAI_API_KEY"],  # fetch_...
)

history = [{"role": "system", "content": "Answer briefly and to the point."}]

for question in ["What is an API?", "And how is an API different from an SDK?"]:
    history.append({"role": "user", "content": question})
    resp = client.chat.completions.create(model="gpt-6.1-sol", messages=history)
    answer = resp.choices[0].message.content
    history.append({"role": "assistant", "content": answer})
    print(answer)
    print("tokens:", resp.usage.prompt_tokens, "+", resp.usage.completion_tokens)

Note history: the model doesn't remember previous requests, so the program sends the whole conversation each time. The second request is longer than the first, and costs more. To try another model, change the model string, for example to deepseek-v4.1-flash or claude-sonnet-5. More on working with the SDK in the Python docs.

What a request costs

Formula: cost = (input tokens × input price + output tokens × output price) / 1,000,000, with prices in USD per 1M tokens.

Example: a 500-token question and a 300-token answer. Prices as of October 7, 2026:

ModelInput / output, USD per 1MCalculationOne request1,000 requests
deepseek-v4.1-flash0.013 / 0.038500 × 0.013 + 300 × 0.038 = 17.9$0.0000179$0.0179
gpt-6.1-sol0.27 / 1.32500 × 0.27 + 300 × 1.32 = 531$0.000531$0.531
claude-sonnet-50.4 / 2500 × 0.4 + 300 × 2 = 800$0.0008$0.80

This is an example calculation: take real numbers from the usage of your own responses. Prices change; for the current list and prices, call GET https://api.zukko.pro/v1/models or open the Models page in the dashboard.

Common first-time errors

  • 401 — invalid key: check that you copied all of it and send it as Authorization: Bearer .... More in the authentication docs.
  • 402 — insufficient balance.
  • 404 model_not_found — a typo in the model name; GET /v1/models returns the exact names.
  • 403 model_not_allowed_for_key — the model isn't on this key's allowed list.
  • 429 — the key's daily or monthly limit is used up, or the model provider's rate limit kicked in.

Once the first request works, everything else is the same: in any program that asks for an OpenAI-compatible API, set the base URL to https://api.zukko.pro/v1 and enter your key. You can start by creating a key in the dashboard.

FAQ

Do I need to know how to code to use an API?

Not for existing programs: in a bot, plugin or chat client you just paste the base URL and key into the settings. For your own scripts, basic Python like the example above is enough.

How is an API different from an SDK?

The API is the protocol itself: which addresses, which fields in the request and response. An SDK is a library that wraps those HTTP requests into convenient functions, such as client.chat.completions.create(...).

Can I use one key for different models?

Yes. A fetch_... key works with every model in the catalog; the model is chosen with the model field in each request. If needed, a key can be restricted to a list of allowed models.

Is it safe to put my key into a third-party program?

Create a separate key for it with daily and monthly limits. If the key leaks, spending is capped by the limit, and you can delete the key in the dashboard and issue a new one.

zukko

Pay 25×
less

for Claude Code & ChatGPT

One fetch_* key and base URL api.zukko.pro — for Cursor, Claude Code, Codex, and any SDK.

Get API keyDocumentation

api.zukko.pro · fetch_*

What is an AI API: plain explanation with an example · Zukko