Docs

Integration guide

OpenAI-compatible. Point your existing code at a new base URL and API key and you are done.

Overview

hinnflowAI is an AI model gateway: one API key reaches models from many providers, with unified billing and usage tracking. The API follows the OpenAI API format, so any OpenAI-compatible SDK, framework or client works as is.

ItemValue
Base URLhttps://api.hinnflow.com/v1
AuthenticationAuthorization: Bearer <API key>
FormatJSON requests and responses, Content-Type: application/json
StreamingServer-Sent Events (stream: true)

Quick start

  1. Sign up and log in.
  2. Open Console → API keys, create a key and save it (it starts with sk-).
  3. Add credit in the Wallet, or redeem a top-up code.
  4. Set the base URL to https://api.hinnflow.com/v1 and the API key to your new key, then make your first call:
curl https://api.hinnflow.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4-flash",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Introduce yourself in one sentence."}
    ]
  }'
Replace deepseek-v4-flash with any model name from the model list.

Authentication

Send your API key in the request header on every call:

HTTP
Authorization: Bearer sk-xxxxxxxxxxxxxxxxxxxxxxxx
  • A key spends your balance. Use it on the server only; never ship it in frontend code, app bundles or public repositories.
  • Create separate keys per project, each with its own spend limit, expiry, allowed models and IP allowlist.
  • If a key leaks, disable or delete it in the console and it stops working immediately.

Chat completions

POST/v1/chat/completions

Generates a reply from the conversation so far. The most common endpoint. Key parameters:

ParameterTypeRequiredDescription
modelstringYesModel name, see the model list
messagesarrayYesConversation messages, each with a role (system / user / assistant) and content
streambooleanNoStream the response, default false
temperaturenumberNoSampling temperature, 0–2; higher is more random
max_tokensintegerNoMaximum tokens to generate in the reply
top_pnumberNoNucleus sampling; usually tune this or temperature, not both
toolsarrayNoTool definitions for function calling, if the model supports it

Other parameters match the official OpenAI API and are passed through to the upstream model. Example response:

JSON
{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "created": 1792560000,
  "model": "deepseek-v4-flash",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "..." },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 24,
    "completion_tokens": 86,
    "total_tokens": 110
  }
}
The token counts in usage are what you are billed for. Every request is itemised in Console → Usage logs.

Streaming

Add "stream": true and the response arrives as a stream of SSE events, ideal for chat UIs that render as they go. The stream ends with data: [DONE].

stream = client.chat.completions.create(
    model="deepseek-v4-flash",
    messages=[{"role": "user", "content": "Write a short poem about the sea."}],
    stream=True,
)
for chunk in stream:
    delta = chunk.choices[0].delta.content if chunk.choices else None
    if delta:
        print(delta, end="", flush=True)

The raw event stream looks like this:

SSE
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant","content":""}}]}

data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"Waves"}}]}

data: [DONE]
If you relay streams through a reverse proxy such as Nginx, turn buffering off (proxy_buffering off;), or the output will arrive all at once at the end.

List models

GET/v1/models

Returns every model the key can call. If the key restricts models, only the allowed ones are listed. See the model list for pricing and availability.

curl https://api.hinnflow.com/v1/models \
  -H "Authorization: Bearer $API_KEY"

Other endpoints

The gateway runs on new-api and also supports these OpenAI-format endpoints. Which endpoints a given model supports is shown in its details on the model list.

APIMethod and pathPurpose
ResponsesPOST /v1/responsesOpenAI’s newer responses API
EmbeddingsPOST /v1/embeddingsText embeddings
ImagesPOST /v1/images/generationsImage generation
AudioPOST /v1/audio/transcriptions, /v1/audio/speechSpeech to text and text to speech

For full parameter details, see the new-api API reference.

Errors

Errors return a non-2xx status with an OpenAI-style body:

JSON
{
  "error": {
    "message": "Invalid token (request id: 2026102110...)",
    "type": "new_api_error",
    "code": ""
  }
}
StatusCommon causeWhat to do
400Invalid parameters or unknown model nameCheck the request body and the model field
401API key invalid, disabled or expiredCheck the key in the console
403Insufficient balance or key limit, model not allowed, IP not allowlistedTop up or adjust the key settings
429Too many requests, or upstream rate limitReduce concurrency and retry with exponential backoff
500 / 502 / 503Upstream error or temporarily unavailableRetry later; contact us if it persists
The request id in the error message helps us trace the problem quickly; please include it when you contact us.

Billing

  • Most models are billed per token, with separate input and output prices listed per million tokens on the model list.
  • Some models are billed per request, or tiered by time of day or context length (shown as “Dynamic pricing”).
  • Requests that fail with an upstream error are not charged; any pre-held amount is returned.
  • Your balance and per-request spend are in the console.

FAQ

QuestionAnswer
Should the base URL include /v1?The official OpenAI SDKs need it: https://api.hinnflow.com/v1. Some clients take https://api.hinnflow.com and add /v1 themselves; follow the client’s own instructions.
Which tools can I use?Any tool that accepts a custom OpenAI base URL, such as Cherry Studio, LobeChat, Dify, LangChain or Cursor.
I get a 401.Make sure the header is Authorization: Bearer sk-... and the key is active in the console.
Streaming does not work.Make sure you send "stream": true; behind a reverse proxy, turn proxy buffering off.