Skip to content

One API for AI models, behind a single key.

Hazeloft AI Gateway is one API for AI models: send chat requests in the OpenAI Chat Completions format with an hzx_ key. Usage is drawn from your plan's quota and shows up in the console, request by request.

Mode
const url = `${process.env.HAZELOFT_BASE_URL}/chat/completions`;
const response = await fetch(url, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.HAZELOFT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "auto",
    stream: true,
    messages: [{ role: "user", content: "How does a streamed reply arrive?" }],
  }),
});
// Frames arrive one by one: data: {…"delta":{"content":"…"}…}
const stream = response.body.pipeThrough(new TextDecoderStream());
for await (const frames of stream) process.stdout.write(frames);
import os, requests

response = requests.post(
    f"{os.environ['HAZELOFT_BASE_URL']}/chat/completions",
    headers={"Authorization": f"Bearer {os.environ['HAZELOFT_API_KEY']}"},
    json={
        "model": "auto",
        "stream": True,
        "messages": [{"role": "user", "content": "How does a streamed reply arrive?"}],
    },
    stream=True,
)

# Frames arrive one by one: data: {…"delta":{"content":"…"}…}
for line in response.iter_lines():
    print(line.decode())
# Frames arrive one by one: data: {…"delta":{"content":"…"}…}
curl -N "$HAZELOFT_BASE_URL/chat/completions" \
  -H "Authorization: Bearer $HAZELOFT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto",
    "stream": true,
    "messages": [
      { "role": "user", "content": "How does a streamed reply arrive?" }
    ]
  }'

Response200 text/event-stream

In pieces, as it is being generated.

Diagram: the request leaves the code, passes through the gateway at /v1 and is sent down the route of the chosen mode: Auto, Fast or Extended. The reply comes back along the same route, piece by piece.

In-page demo: it sends no request, and the reply is a preset text. $HAZELOFT_BASE_URL stands in for the gateway address and ends in /v1.

AI Gateway has four endpoints, all under /v1.

Each one expects an Authorization: Bearer header with an hzx_ key and answers in JSON. Only chat can also answer as a stream.

  • POST /v1/chat/completions

    A conversation with a model, in the OpenAI Chat Completions format, with or without streaming.

    Takes
    model, messages, stream, stream_options, max_tokens, max_completion_tokens, temperature, tools, tool_choice, reasoning_effort
    Returns
    a chat.completion object or, with stream: true, chat.completion.chunk frames ending in [DONE]
    Response 200 · text/event-stream
    data: {"id":"chatcmpl-…","object":"chat.completion.chunk","created":…,"model":"…",
           "choices":[{"index":0,"delta":{"role":"assistant","content":"In"},
                       "finish_reason":null}]}
    data: {…,"choices":[{"index":0,"delta":{"content":" pieces,"},"finish_reason":null}]}
    data: {…,"choices":[{"index":0,"delta":{"content":" as"},"finish_reason":null}]}
    …
    data: {…,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
    data: [DONE]
    Response 200 · application/json
    {
      "id": "chatcmpl-…",
      "object": "chat.completion",
      "created": …,
      "model": "…",
      "choices": [{
        "index": 0,
        "message": { "role": "assistant", "content": "In pieces, as it is being generated." },
        "finish_reason": "stop"
      }],
      "usage": { "prompt_tokens": …, "completion_tokens": …, "total_tokens": … }
    }
  • GET /v1/models

    The models and modes your account can use.

    Takes
    nothing
    Returns
    data: one row per model, with id, hazeloft_label, hazeloft_default, hazeloft_allowed and, where they apply, hazeloft_min_plan and hazeloft_reasoning_efforts; plus hazeloft_chat_tiers
    Response 200 · application/json
    {
      "object": "list",
      "data": [{
        "id": "…",
        "object": "model",
        "owned_by": "hazeloft",
        "hazeloft_label": "…",
        "hazeloft_default": true,
        "hazeloft_allowed": true,
        "hazeloft_reasoning_efforts": ["low", "medium", "high"]
      }],
      "hazeloft_chat_tiers": [
        { "tier": "auto", "label": "Auto", "allowed": true, "minPlan": "…" }
      ]
    }
  • POST /v1/search

    Web search. Built for the Hazeloft apps; it accepts the same key. Its own format.

    Takes
    query, a text of at most 400 characters
    Returns
    results: at most 6 entries, each with title, url and snippet
    Response 200 · application/json
    {
      "results": [
        { "title": "…", "url": "https://…", "snippet": "…" }
      ]
    }
  • POST /v1/transcribe

    Audio to text. Built for the Hazeloft apps; it accepts the same key. Its own format.

    Takes
    audio, base64-encoded, at most 20 MiB decoded; mediaType, shaped like audio/webm
    Returns
    text, language and durationInSeconds
    Response 200 · application/json
    {
      "text": "…",
      "language": "…",
      "durationInSeconds": …
    }

The response shapes use the API's field names. “…” stands in for values that differ from one request to the next.

From account to first request, in four steps.

The order is real: without the right plan you cannot create a key, and without a key no request gets through.

  1. Move to the Pro plan

    AI Gateway keys require the Pro plan or higher. Below it, the platform shows “Ai nevoie de planul Pro” (you need the Pro plan).

    You get: access to the AI Gateway section

  2. Create an API key

    Under “Chei API”, press “Creează cheie API” and give the key a name. The secret is shown once, in the “Salvează-ți cheia” dialog.

    You get: a key that starts with hzx_

  3. Send your first request

    Put the key in the Authorization: Bearer header and POST to /v1/chat/completions. GET /v1/models tells you what you can write in the model field.

    You get: the model's reply, whole or streamed

  4. Follow your usage

    The “Utilizare” page shows requests, tokens, cost and response times, broken down by model or by key.

    You get: every request, in the “Jurnal” view

What the chat endpoint reads.

A subset of the OpenAI Chat Completions format. The fields below are the ones the gateway applies.

  • stream

    Streamed replies

    With stream: true, the reply arrives as server-sent events: chat.completion.chunk frames, then [DONE]. With stream_options.include_usage, the last frame before [DONE] carries the token counts.

  • tools

    Tool calls

    Declare functions in tools, steer with tool_choice and send results back as messages with the tool role. When the model asks for a tool, finish_reason is tool_calls.

  • image_url

    Image input

    A user message can hold text and image_url parts. The image travels in the request, as a base64 data: URL; http addresses are not accepted.

  • reasoning_effort

    Reasoning effort

    Choose how much the model thinks: none, minimal, low, medium, high, xhigh or max. The thinking, when the model emits it, comes in the reasoning_content field.

  • model

    Modes: auto, fast, extended

    In model you write the id of a model from /v1/models or a mode; the ones open to your account come in hazeloft_chat_tiers. On a mode, the server picks the model and the reasoning effort, and a reasoning_effort you send is not applied.

  • error

    Errors with stable codes

    Every error has the shape { error: { message, type, code } }. An invalid request gets a 400 that names the offending fields; an invalid key, 401; an insufficient plan, 403; an exhausted quota, 429.

Keys and usage, in the same place.

The AI Gateway section of the platform has one page for keys and one for usage. Its labels are in Romanian, quoted here as they appear.

  • Chei API

    Create, rename and delete keys

    Each key has a name and shows when it was created and when it was last used. Deletion cannot be undone: requests sent with that key get a 401.

  • Secret

    The key is shown once

    After creation the secret is never displayed again. The platform keeps only its hash and the last four characters.

  • Utilizare

    Cost, requests, tokens and timings

    Charts for cost, requests, P50 TTFT and tokens by type: input, output, cache read and cache write. Pick one of ten ranges, from the last 5 minutes to the last 30 days.

  • Breakdown

    By model or by key

    The requests table groups by “Modele” (models) or “Chei API” (keys), in the “Sumar” or “Jurnal” view. You can filter the whole page down to a single key.

The limits of a request.

120

requests per minute, on each key.

The rate limit has a second measure: 120 requests per minute from one IP address.

Authentication
the Authorization: Bearer header, with an hzx_… key
Request body
at most 2 MiB
Messages per request
at most 1,024 messages
Text per message
at most 256,000 characters
Inline image
at most 700,000 base64 characters; a user message holds at most 8 parts
Tools per request
at most 128 tools
Maximum output
32,768 tokensLowered to the model's own limit when that is smaller.
temperature
between 0 and 2
Active keys per account
at most 5 keys
The “Utilizare” page
covers the most recent 5,000 requests in the chosen range
Minimum plan
ProBelow this plan, requests made with a key get a 403.

What it does not do.

Four things you are better off learning before you write code.

  • No images, video, voice or embeddings

    The gateway has four endpoints: chat, models, web search and transcription. It does not generate images, video or speech, and it has no embeddings endpoint.

  • Unknown fields are ignored, not rejected

    The chat endpoint reads only the fields on its list. response_format, top_p and anything else outside it pass without an error and without effect, so do not rely on structured output.

  • One key means full access

    There are no per-key permissions, per-key budgets or model restrictions. Whoever holds the key spends your quota.

  • No pay-as-you-go

    There is no per-token price and no usage to buy on top of the plan. Requests draw from the plan's quota; once it runs out you get a 429 until it refreshes.

Included in the subscription, from the Pro plan.

AI Gateway is not billed separately and has no per-token rate. Requests draw from the plan's quota.

Pro
500 RON / month
API keys and console, with an extended usage rate
Ultra
1000 RON / month
API keys and console, with the highest usage rate

The amount shown is the amount charged, per month. The quota has two windows, of 5 hours and of 7 days, which refresh on their own.

Compare plans

Frequently asked questions.

Can I use an OpenAI SDK with AI Gateway?

The /v1/chat/completions endpoint takes the request and returns the response in the OpenAI Chat Completions format, including streaming and tool calls. A client that speaks this format and lets you change the base address and the key can be pointed at the gateway. It is a subset of the format, and we do not publish a list of tested SDKs.

Which models can I call?

The list belongs to your account and comes from GET /v1/models: each model's id, its label, which one is the default, whether your plan allows it and which reasoning levels it accepts. This page names no models, because the list changes with the platform's configuration.

How much does a request cost?

It has no price of its own. There is no per-token rate and no separate billing for the gateway: each request draws from your plan's quota. If the quota is used up, the gateway answers with a 429 and the code usage_limit_exceeded, without calling the model.

Where do I find the gateway's base address?

This page does not print it: the examples use the HAZELOFT_BASE_URL variable in its place, and the address ends in /v1. You create the key yourself, under “Chei API”. If you do not have the address yet, write to us through the contact page.

Can I see a key again after creating it?

No. The secret is shown once, at creation. The platform keeps only the hash and the last four characters, so a lost key is replaced with a new one.

What happens to my keys if I leave the Pro plan?

They stop working. The gateway checks the plan on every request and refuses keys from accounts below the Pro plan.

Can I send images or files?

Images, yes: as image_url parts in a user message, with the image included in the request as a base64 data: URL. Http addresses are not accepted, and other file types have no field of their own.

Create your first API key.

You need an account on the Pro plan. If you would rather we handle the integration, write to us.

This site uses measurement and advertising technologies. You can accept or decline them.

How we handle your data: Privacy policy · Cookie policy