Bineric APIdocumentation

One OpenAI-compatible API for Lynx and models from OpenAI, Anthropic, Google and more, and Zuse for decisions. Change the base URL in your OpenAI SDK and keep your code.

Get an API key

For agents and LLM tools: docs.md · llms.txt

Chat, images, speech and research

OpenAI-compatible. Keep your OpenAI SDK and change the base URL.

POST /v1/chat/completions

Quickstart →

Decisions with Zuse

Its own endpoint and format, Jev's rather than OpenAI's. Answers with how sure it is.

POST /v1/zuse

How it differs →Zuse quickstart →

Base URL
https://api.bineric.com/v1
Auth
Authorization: Bearer
Format
OpenAI-compatible, Zuse
Models
42 chat, image and audio
On this page

Getting started

Quickstart

The Bineric API is OpenAI-compatible. Point an OpenAI SDK at the Bineric base URL, use a Bineric API key, and call any model in the list below.

Base URL

Chat completions and the model list live under /v1, where OpenAI SDKs expect them. Account endpoints (file conversion, usage and balance) live under /api/v1. The older /api/v1/ai/chat/completions still works for chat completions.

bash
https://api.bineric.com/v1

First request

To switch models, change model to any id from Models. Everything else stays the same.

from openai import OpenAI
client = OpenAI(
base_url="https://api.bineric.com/v1",
api_key="YOUR_API_KEY",
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)

Getting started

Authentication

Every request except the model list (GET /v1/models and GET /v1/models/{model}) needs an API key.

Send the key as a Bearer token in the Authorization header (what the OpenAI SDKs do), or in an api-key header. If both are sent, the Bearer token is used.

bash
-H "Authorization: Bearer YOUR_API_KEY"
# or
-H "api-key: YOUR_API_KEY"

Get a key

  1. Create an account at platform.bineric.com.
  2. Create an API key in the dashboard and copy it.
  3. Buy credits under Billing. A call needs a completed purchase and a balance of at least $0.10; a saved card on its own is not enough.

Getting started

Models

Pass the id in the first column as model. Prices are in USD, at the provider's list price.

To keep every request in the EU, switch on EU-hosted models only under Settings → Privacy in the dashboard. Requests to a model that can run outside the EU are then refused with 403 eu_only before anything is sent.

Language models · 37

modelProviderContextIn / out per 1MSupports
lynx-30bLynx · Stays in the EUBineric AI262K$3 / $15
gpt-4oGPT-4o · Stays in the EUOpenAI128K$2.75 / $11ToolsVision
gpt-5GPT-5-Reasoning · Stays in the EUOpenAI272K$1.38 / $11ToolsVision
gpt-5-miniGPT-5-Mini · Stays in the EUOpenAI272K$0.28 / $2.20ToolsVision
gpt-5.1GPT 5.1 · Stays in the EUOpenAI272K$1.38 / $11ToolsVision
gpt-5.2GPT 5.2 · Leaves the EUOpenAI272K$1.75 / $14ToolsVision
gpt-5.4GPT 5.4 · Stays in the EUOpenAI272K$2.75 / $16.50ToolsVision
gpt-5.5GPT-5.5 · Stays in the EUOpenAI272K$5.50 / $33ToolsVision
gpt-5.6-lunaGPT-5.6-Luna · Stays in the EUOpenAI272K$0.22 / $1.32ToolsVision
gpt-5.6-solGPT 5.6 Sol · Stays in the EUOpenAI272K$4.40 / $22ToolsVision
gpt-5.6-terraGPT 5.6 Terra · Stays in the EUOpenAI272K$2.20 / $13.20ToolsVision
gpt-oss-20bgpt-oss-20b · Leaves the EUOpenAI128K$0.07 / $0.30
gpt-oss-120bgpt-oss-120b · Leaves the EUOpenAI128K$0.15 / $0.60
o1O1 · Stays in the EUOpenAI200K$16.50 / $66ToolsVision
o3-miniO3-Mini · Stays in the EUOpenAI200K$1.21 / $4.84ToolsVision
claude-haiku-4-5Claude Haiku 4.5 · Stays in the EUAnthropic200K$1.10 / $5.50ToolsVision
claude-haiku-5.5Claude Haiku 5.5 · Stays in the EUAnthropic100K$0.11 / $0.55ToolsVision
claude-opus-4-5Claude Opus 4.5 · Stays in the EUAnthropic200K$5.50 / $27.50ToolsVision
claude-opus-4-6Claude Opus 4.6 · Stays in the EUAnthropic1M$5.50 / $27.50ToolsVision
claude-opus-4-7Claude Opus 4.7 · Stays in the EUAnthropic1M$5.50 / $27.50ToolsVision
claude-opus-4.8Claude Opus 4.8 · Stays in the EUAnthropic1M$5.50 / $27.50ToolsVision
claude-opus-5Claude Opus 5 · Stays in the EUAnthropic1M$5.50 / $27.50ToolsVision
claude-opus-5.5Claude Opus 5.5 · Stays in the EUAnthropic1M$4.40 / $22ToolsVision
claude-sonnet-4-6Claude Sonnet 4.6 · Stays in the EUAnthropic1M$3.30 / $16.50ToolsVision
claude-sonnet-5Claude Sonnet 5 · Stays in the EUAnthropic1M$2.20 / $11ToolsVision
claude-sonnet-5.5Claude Sonnet 5.5 · Stays in the EUAnthropic1M$2.20 / $11ToolsVision
gemini-3.1-flash-liteGemini 3.1 Flash-Lite · Stays in the EUGoogle1M$0.28 / $1.65ToolsVision
gemini-3.1-proGemini 3.1 Pro · Leaves the EUGoogle200K$2 / $12ToolsVision
gemini-3.5-flashGemini 3.5 Flash · Stays in the EUGoogle1M$1.65 / $9.90ToolsVision
gemini-3.5-flash-liteGemini 3.5 Flash-Lite · Stays in the EUGoogle1M$0.33 / $2.75ToolsVision
gemini-4-carbonGemini 4 Carbon · Stays in the EUGoogle1M$4.40 / $22ToolsVision
gemini-4-neonGemini 4 Neon · Stays in the EUGoogle1M$3.30 / $16.50ToolsVision
borealis-2Borealis 2 · Stays in the EUNasjonalbiblioteket16K$2 / $10Tools
meta-llama-3.3-70bLlama 3.3-70B · Leaves the EUMeta128K$0.72 / $0.72
mistral_large_24_02Mistral Large 24.02 · Stays in the EUMistral AI32K$4.30 / $13
qwen-3-235bQwen 3 235B · Stays in the EUQwen262K$0.22 / $0.88
qwen-3-coder-480bQwen 3 Coder 480B · Stays in the EUQwen262K$0.45 / $1.80

Image models · 2

modelProviderContextPriceSupports
gpt-image-1gpt-image-1 · Leaves the EUOpenAI128K$10 / $40Vision
stability-aiStable Diffusion 3.5 Large · Leaves the EUStability AI–$0.08 per image

Speech, search and research models · 3

modelProviderContextPriceSupports
deep-researchDeep Research · Stays in the EUBineric AI128K$0.25 per call
sonar-web-searchsonar-web-search · Stays in the EUBineric AI128K$1 / $1
speech-to-textSpeech to Text · Stays in the EUMicrosoft4K$0.18 per hour

Retired ids still work and are answered by their replacement: claude-sonnet-4 → claude-sonnet-4-6, gpt-5.3 → gpt-5.5.

Decision models (Zuse) answer fixed-choice questions through their own endpoint; see the Zuse API. The model library compares every model side by side.

GET /v1/models

GET/v1/models

Every model the API serves, chat and decision models together, with live prices. No key is needed, and client.models.list() works. Per-token prices are per million tokens; per_request is a fixed price per call (0 when there is none), and decision models show per_decision instead. For speech-to-text, per_request is the price per hour of speech. The text-to-speech model works but is not in this list. models repeats the decision models with their name and description.

owned_by is the provider the model runs on. euHosted is true when your requests to the model stay in the EU, and false when they may leave it; check it rather than hosting. hosting is where the model runs: EU, US, or Global when the provider may process requests in any region worldwide. Both is a legacy value that does not guarantee the EU; treat it as leaving the EU. context_length is the model's context window in tokens.

bash
curl https://api.bineric.com/v1/models
json
{
"object": "list",
"data": [
{
"id": "claude-sonnet-4-6",
"object": "model",
"created": 1735689600,
"owned_by": "bedrock-anthropic",
"name": "Claude Sonnet 4.6",
"description": "Claude Sonnet 4.6 delivers frontier intelligence at scale, built for coding, agents, and enterprise workflows.",
"category": "General",
"hosting": "EU",
"euHosted": true,
"tier": "premium",
"context_length": 1000000,
"pricing": {
"input_per_million_tokens": 3.3,
"output_per_million_tokens": 16.5,
"per_request": 0,
"currency": "USD"
}
}
],
"models": []
}

GET /v1/models/{model}

GET/v1/models/{model}

One model by id, with the same fields as its entry in the list. No key is needed, and client.models.retrieve("zuse-27b") works. An unknown id returns 404 model_not_found.

bash
curl https://api.bineric.com/v1/models/zuse-27b
json
{
"id": "zuse-27b",
"object": "model",
"created": 1793025018,
"owned_by": "bineric",
"name": "Zuse 27B",
"description": "Typed decisions with calibrated probabilities in 27 European languages and many more, hosted in the EU.",
"category": "Decision",
"hosting": "EU",
"euHosted": true,
"tier": "premium",
"context_length": 65536,
"pricing": {
"input_per_million_tokens": 0.75,
"output_per_million_tokens": 0,
"per_decision": 0,
"currency": "USD"
}
}

Zuse API

How Zuse differs

Zuse uses the same API key, base URL and credit as the rest of the API, but not the OpenAI format. It has its own endpoint, request and answer: Jev's format, not chat.

Endpoint
ChatPOST /v1/chat/completionsZusePOST /v1/zuse
You send
ChatmessagesZuseA document (state) and your questions
You get back
ChatGenerated textZuseA choice, a yes or no, or a score, with how sure it is
Client
ChatThe OpenAI SDK, pointed at our base URLZuseAny HTTP client, or TypeSafe's Jev SDKs
Models
ChatThe model listZusezuse-27b and zuse-9b (Decision models)
List models
ChatGET /v1/modelsZuseThe same GET /v1/models: one list for both, where Zuse models have category: "Decision"
You pay for
ChatInput and output tokensZuseInput tokens only
Rate limit
Chat500 requests a minute per IP address, and up to 50 running at once per accountZuse1,200 requests a minute per key and 2,400 per IP address, with no limit on how many run at once (Errors and limits)

Sending a decision model to chat completions, or a chat model to /v1/zuse, returns 400 model_not_supported. New to Zuse? Start with the Zuse quickstart, or try it without a key in the playground.

Zuse API

Zuse quickstart

Zuse reads a document and answers your questions with a choice, a yes or no, or a score, and says how sure it is. Hosted in the EU.

POST/v1/zuse

The examples read your key from an environment variable, so set it first: export BINERIC_API_KEY=your_key. The Python example needs pip install requests. Save the JavaScript example as a .mjs file, because it uses top-level await.

Send the document as state and your questions as questions, keyed by ids you choose. Every question about one document is answered in a single pass, and the answers come back under the same ids.

curl https://api.bineric.com/v1/zuse \
-H "Authorization: Bearer $BINERIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "zuse-27b",
"state": "Hi, I was charged twice for my monthly pass last week. I want my money back as soon as possible, this is the second time it has happened!",
"questions": {
"team": {
"type": "choice",
"instructions": "Which team should handle it?",
"criteria": {
"billing": "Payments and refunds",
"technical": "The app or website is not working",
"travel": "Questions about routes and departures",
"other": "Other"
}
},
"refund": {
"type": "noul",
"instructions": "Is the customer asking for a refund?"
},
"urgency": {
"type": "score",
"instructions": "How urgent is it?",
"criteria": [
"Not urgent",
"Normal",
"Urgent",
"Critical"
]
}
}
}'

Request body

FieldTypeDescription
modelstringOptional. A decision model id; see Decision models. Only that model answers, unless you set fallback.
fallbackstringOptional. The model that may answer instead when yours is busy: zuse-9b for a zuse-27b request, zuse-27b for a zuse-9b request. See Fallback.
statestring, object or arrayThe document or record to decide about. JSON is passed as is; you do not need to flatten it.
questionsobjectAt least one question, keyed by an id you choose. See Question types.
json
{
"model": "zuse-27b",
"state": "Hi, I was charged twice for my monthly pass last week. I want my money back as soon as possible, this is the second time it has happened!",
"questions": {
"team": {
"type": "choice",
"instructions": "Which team should handle it?",
"criteria": {
"billing": "Payments and refunds",
"technical": "The app or website is not working",
"travel": "Questions about routes and departures",
"other": "Other"
}
},
"refund": {
"type": "noul",
"instructions": "Is the customer asking for a refund?"
},
"urgency": {
"type": "score",
"instructions": "How urgent is it?",
"criteria": [
"Not urgent",
"Normal",
"Urgent",
"Critical"
]
}
}
}

Zuse API

Decision models

Pass the id as model, or leave it out and the request goes to zuse-27b. Only the model you name answers, unless you set `fallback`.

modelUse it forContextPrice
zuse-27bZuse 27B · Stays in the EUHighest accuracy, for the decisions you automate.66K$0.75 per 1M input tokens
zuse-9bZuse 9B · Stays in the EUFast and low cost, for routing at volume.66K$0.12 per 1M input tokens

zuse-27b is the most accurate. zuse-9b is several times faster and costs a sixth as much, so it suits short texts, high volume and real-time use such as live calls and chat. On our European suite it scores 84.1% against 87.5% for the 27B, and in some languages, Latvian and Finnish among them, the two are within half a point. Both take the same request and the same key, so you switch by changing model. Both also run in your own cloud account from AWS Marketplace: Zuse 27B and Zuse 9B. Azure is coming soon.

You pay per input token. Zuse writes no text, so there are no output tokens to pay for. Decision models are also listed by GET /v1/models, with category set to Decision. Chat models sent to /v1/zuse return 400 model_not_supported.

Zuse API

Fallback

Each model id is answered only by that model. Set fallback if you would rather have an answer from the other model now than retry later.

A request for zuse-27b is answered by zuse-27b, never quietly by another model. The response's model field and the x-bineric-served-by header name the model that answered; x-bineric-model is the id you asked for.

With fallback set, a request whose model is busy or failing may be answered by the fallback model instead of returning an error. model and x-bineric-served-by then name the fallback model, and the call is billed at the price of the model that answered.

modelfallbackMoves when
zuse-27bzuse-9bThe 27B is busy or failing, and the document fits the 9B.
zuse-9bzuse-27bThe 9B is busy or failing, and the document is up to about 12,000 tokens. Billed at the 27B price.
# -i prints the response headers, so you can see x-bineric-served-by.
curl -i https://api.bineric.com/v1/zuse \
-H "Authorization: Bearer $BINERIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "zuse-27b", "fallback": "zuse-9b",
"state": "Hi, I was charged twice for my monthly pass ...",
"questions": {"refund": {"type": "noul", "instructions": "Is the customer asking for a refund?"}}}'
  • Those are the only two pairs. Any other value, such as something that is not a model id, the same model as model, or a model that is not its partner, returns 400 invalid_request.
  • A document too long for the fallback model is not moved. It stays with its own model, as it would without fallback.
  • Leave fallback out and a busy model returns 503 server_busy; see Errors and limits.

When to use it

The two models give different probabilities for the same question, so a threshold tuned on one model is not right for the other. If you set thresholds on one model, either leave fallback out, or read x-bineric-served-by and keep a threshold per model, as in the example above.

Fallback suits callers who need an answer now more than they need a particular model, such as live telephony, where a caller cannot wait for a retry.

Zuse API

Question types

Every question takes type and instructions: the question itself, in any language.

typecriteriaWhat you get
choiceObject of option id to description, 1 to 255 options. A description can be null.choice (the most likely option id), confidence, and probabilities for every option.
noulNone. State the yes/no question in instructions.noul: the probability that the answer is yes.
scoreArray of levels in order, lowest first. Use at least 2: a single level is accepted and billed, but tells you nothing.score (the expected level, counted from 0), confidence, legend and probabilities per level.

What confidence means

confidence is not the top probability. It is rescaled so that 0 means the model cannot tell the options apart and 1 means it is certain, however many options you give it. With two options and a top probability of 0.95, confidence is 0.90.

  • choice: (p_max - 1/K) / (1 - 1/K), where p_max is the top probability and K the number of options. With one option it is 1.
  • score: max(0, 1 - E|level - mode| / D), where mode is the most likely level and D is the average distance from the middle of the scale. It is 1 when all the probability is on one level and 0 when it is spread evenly.
  • noul has no confidence field: it is the probability of yes, so a low value is a confident no. On the same scale as confidence, use |2 * noul - 1|.

Zuse API

Response

The answers, keyed by your question ids, with the tokens you are billed for.

The values here are an example. usage.input_tokens is what you are billed for. usage.output_tokens is reported for information: Zuse models are priced on input tokens. latency_ms is model time only: it leaves out the network and any time the request waited in the queue.

model is the model that answered. It is the model you asked for, unless you set `fallback` and the fallback model answered.

json
{
"model": "zuse-27b",
"answers": {
"team": {
"type": "choice",
"choice": "billing",
"confidence": 0.9883,
"probabilities": {
"billing": 0.9912,
"technical": 0.0031,
"travel": 0.0009,
"other": 0.0048
}
},
"refund": {
"type": "noul",
"noul": 0.9874
},
"urgency": {
"type": "score",
"score": 2.3001,
"legend": {
"0": "Not urgent",
"1": "Normal",
"2": "Urgent",
"3": "Critical"
},
"probabilities": {
"0": 0.0102,
"1": 0.0915,
"2": 0.4863,
"3": 0.412
},
"confidence": 0.4761
}
},
"usage": {
"input_tokens": 214,
"output_tokens": 209
},
"latency_ms": 18.6
}

Response headers

HeaderMeaning
x-bineric-modelThe model id you asked for.
x-bineric-served-byThe model that answered, the same as model in the body.
x-bineric-hostingWhere it ran, for example EU.

Zuse API

Errors and limits

Errors use the same OpenAI shape as the rest of the API, plus detail, where clients written for Jev look for the message.

json
{
"error": {
"message": "`questions` must contain at least one question.",
"type": "invalid_request_error",
"code": "invalid_request"
},
"detail": "`questions` must contain at least one question."
}
StatuscodeMeaning
400invalid_requestThe body is a JSON array, questions is missing, empty or not an object, or fallback is not the other model (Fallback).
400–The body is neither a JSON object nor an array, for example invalid JSON or a bare string. The parser refuses it before the API key is checked, in its own shape: {"success":false,"error":"...","message":"...","requestId":"..."}, without code or detail. A zstd-compressed body gets invalid_request in these cases instead.
400model_not_supportedA chat model was sent. Use a decision model.
401missing_api_key, invalid_api_keyNo key, or the key is wrong or disabled.
402insufficient_quotaNot enough credit. Buy credits.
403payment_requiredThis model needs credit on the account. Buy credits.
404model_not_foundUnknown model id. The message lists the decision models.
400, 413, 422–The decision server rejected the request, for example a malformed question or a document that is too long. Its body comes back as it was sent.
429rate_limit_exceededOver 1,200 requests a minute for the key, or 2,400 for the IP address. Wait for Retry-After seconds.
503server_busyThe model is at capacity. Comes with Retry-After: 2. Retry.
503model_not_availableThe model is not available right now. Retry later.
502upstream_unavailable, upstream_errorThe decision server could not be reached, or failed. Retry.
504upstream_timeoutNo answer within 55 seconds. Retry.

Requests that fail with a 5xx status are not billed.

When the model is busy

A request that arrives while its model is busy waits in a queue for up to about 25 seconds. If it is still not served, it gets 503 server_busy with Retry-After: 2. With `fallback` set, the fallback model is tried first, and 503 comes back only if that does not work either.

Retries and timeouts

  • Retry 429, 502, 503 and 504. Wait the seconds in Retry-After, or 2 seconds if there is none, plus a random 0 to 1 second, so that clients that failed together do not all retry at the same moment. Give up after a few attempts.
  • Set your client timeout to at least 60 seconds. The API gives up after 55 seconds and returns 504 upstream_timeout; a shorter timeout in your client can cut off an answer that is on its way.
  • Cap the requests you have in flight. Around 8 per process is a good start. /v1/zuse has no limit on requests at once, but more than the model can serve only wait in the queue, and come back as 503.
  • Reuse HTTPS connections, as shown in Speed and large batches.

Limits

  • 1,200 requests a minute per API key, and 2,400 a minute per IP address. These are separate from the chat limits. Over either, you get 429 rate_limit_exceeded with a Retry-After header, the seconds until the one-minute window resets, and the RateLimit-Policy, RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset headers.
  • No limit on how many requests run at once. The limit of 50 at once per account is for the chat API, not for /v1/zuse.
  • The document and questions must fit the model's context length, context_length in GET /v1/models.
  • Up to 255 options per choice question.

Zuse API

Speed and large batches

Reuse one connection, send requests in parallel, and ask every question about a document in one request.

Reuse connections

A new HTTPS connection for every call adds about 55 to 70 ms (DNS, TCP and TLS), and more if you call from far from Stockholm, where Zuse runs. Create one client when your program starts and send every request through it.

curl reuses a connection only within one command. A script that runs curl once per document opens a new connection every time; for batches, use a client library.

import os
import requests
session = requests.Session() # create once, reuse for every call
session.headers["Authorization"] = f"Bearer {os.environ['BINERIC_API_KEY']}"
def decide(state, questions):
response = session.post(
"https://api.bineric.com/v1/zuse",
json={"model": "zuse-27b", "state": state, "questions": questions},
timeout=60,
)
response.raise_for_status()
return response.json()["answers"]

Large batches

  • Send requests in parallel, not one at a time. Start with 4 to 8 in flight and raise it while responses stay fast. The limit is 1,200 requests a minute per key.
  • Ask every question about a document in one request. Each extra question adds only about 20 ms; a separate request costs 0.25 s or more, and bills the document again.
  • On 503 `server_busy`, wait and retry. Wait at least the seconds in the Retry-After header plus a random second (so that many clients do not retry at the same moment), and back off further if it happens again. Do the same for 429, 502 and 504.
  • Planning millions of documents? Write to support@bineric.com before you start, so we can arrange capacity.
import asyncio
import os
import random
import httpx
QUESTIONS = {
"team": {
"type": "choice",
"instructions": "Which team should handle it?",
"criteria": {"billing": "Payments and refunds", "technical": "The app or website is not working", "other": "Other"},
},
"refund": {"type": "noul", "instructions": "Is the customer asking for a refund?"},
}
RETRY = {429, 502, 503, 504}
async def decide(client, limit, state):
async with limit:
for attempt in range(5):
response = await client.post("/v1/zuse", json={"model": "zuse-27b", "state": state, "questions": QUESTIONS})
if response.status_code not in RETRY or attempt == 4:
response.raise_for_status()
return response.json()["answers"]
await asyncio.sleep(max(float(response.headers.get("retry-after", 0)), 2 ** attempt) + random.random())
async def decide_all(documents):
limit = asyncio.Semaphore(8) # requests in flight at once
async with httpx.AsyncClient(
base_url="https://api.bineric.com",
headers={"Authorization": f"Bearer {os.environ['BINERIC_API_KEY']}"},
timeout=60,
) as client:
return await asyncio.gather(*(decide(client, limit, doc) for doc in documents))
answers = asyncio.run(decide_all(["Hi, I was charged twice for my monthly pass ...", "The app crashes when I log in."]))

Zuse API

Using the probabilities

Act on the sure answers and send the rest to a person.

  • Set a threshold per question and send anything below it to a person. On our European suite, 77.2% of the 27B model's answers clear the threshold that keeps errors under 5%.
  • Add a "none of these" option to choice questions whose answer may not be in the list. The model is trained to pick it when nothing fits.
  • Routing, reading comprehension and entailment automate well. Keep legal interpretation, grammar judgements and questions that need world knowledge review-first.

Zuse API

Asking good questions

Each question is answered on its own, against the whole document. A choice question picks exactly one option.

Pick the question type

You want to knowUseExample
Which one of a set applieschoiceWhich team should handle this ticket?
Whether something is true, where several can be true at oncenoul, one question per thingDoes the email ask for a refund? Does it mention a delivery?
How much, on an ordered scalescoreHow angry is the customer?

If more than one option can be true at the same time, a choice question is the wrong tool: it has to pick one, and the probability is split between the true options. Ask one yes/no question per option instead.

Write the options

  • Short id, short description. "gather": "collect resources" works better than a long instruction. The id is what you get back.
  • Make the options exclusive. Where two overlap, say in the descriptions how they differ.
  • Add a `none` option wherever the answer may be missing, for example "none": "no card is played". You then get a clear "not in the text" instead of a guess you have to filter out.
  • Only offer options that are possible. If you know the context, leave out what cannot be the answer.

Put the context in the state

state can be a string or JSON. When the text only makes sense with context, send both, and build the options from the same context:

json
{
"state": {
"hand": ["Forest", "Quarry", "Market"],
"units": {"knight": "B3", "archer": "D1"},
"move": "I play the Forest card to gather wood, then move my knight to C4."
},
"questions": {
"card": {"type": "choice", "instructions": "Which card does the player play?",
"criteria": {"Forest": null, "Quarry": null, "Market": null, "none": "no card is played"}}
}
}

When one text holds several things

Take a player who describes a move in one sentence that can hold two or three actions. A single "Which action does the player take?" choice question splits its answer between the actions: on the move above, Zuse 9B gave move 0.63 and gather 0.34. "First action" and "second action" questions are no better: on a move with only one action, the second sometimes repeats the first instead of answering none. Work in two steps instead:

  1. One yes/no question per possible action, all in one request. Every action above your threshold is part of the move.
  2. Then the details of each action you found, in a second request: "Which tile does the 'move' action target?", with a none option.

On the move above, both models answered yes to gather and move with 0.92 or more, and kept the other actions at 0.20 or less. Act on clear answers, for example above 0.8 or below 0.3, and let the player or your own rules settle the ones in between. A detail question that comes back unsure often means step 1 found something that is not there.

A runnable version, with five moves and the recorded answers of both models: Zuse examples on GitHub.

json
"questions": {
"gather": {"type": "noul", "instructions": "Does the player's move include the action 'gather' (collect resources)?"},
"move": {"type": "noul", "instructions": "Does the player's move include the action 'move' (move a unit to another tile, not as part of an attack)?"},
"attack": {"type": "noul", "instructions": "Does the player's move include the action 'attack' (attack a unit or a tile)?"}
}

Cost

A request is billed for the document once, plus the text of each question, so many small questions in one request cost little more than one. A second request bills the document again: to save it, ask the detail questions in the first request too, and only use the ones that belong to the actions you found.

Zuse API

Moving from Jev

Code written for Jev, including TypeSafe's Python and JavaScript SDKs, runs on Zuse with a new base URL and key.

  • Install TypeSafe's Python SDK with pip install typesafe-sdk. For the JavaScript SDK, see TypeSafe's own documentation.
  • POST /v1/systemone, Jev's path, works the same as POST /v1/zuse.
  • Jev model names, such as jev-latest, are answered by Zuse 27B.
  • Bodies compressed with zstd (Content-Encoding: zstd), as the SDKs send them, are accepted.
  • Choice, yes/no and score questions are supported. Image (box) questions are not.

How the two compare: Zuse, the European Jev alternative.

diff
- TYPESAFE_BASE_URL=https://api.typesafe.ai
+ TYPESAFE_BASE_URL=https://api.bineric.com
- TYPESAFE_API_KEY=your-typesafe-key
+ TYPESAFE_API_KEY=your-bineric-key
TYPESAFE_DEFAULT_MODEL=jev-latest

Chat

Chat completions

Generate a response from a list of messages, in the OpenAI format.

POST/v1/chat/completions

Request body

FieldTypeDescription
modelstringRequired. A model id from Models.
messagesarrayRequired. The conversation so far; see Messages below.
streambooleanStream the response as server-sent events. Default false. See Streaming.
stream_optionsobject{"include_usage": true} adds a final chunk with token usage.
max_completion_tokensintegerMaximum tokens in the response, never above the model's own output limit. max_tokens also works.
temperaturenumber0 to 2. Out of range returns 400.
top_pnumber0 to 1. Out of range returns 400.
reasoning_effortstringnone, low, medium or high; minimal, xhigh and max are also accepted. none turns reasoning off where the model allows it. Used by models that reason; other values are ignored.
toolsarrayFunctions the model may call. See Tool calling.
tool_choicestring or objectauto, none, required, or {"type":"function","function":{"name":"..."}}.
parallel_tool_callsbooleanSent to OpenAI and Qwen models; others ignore it.
stopstring or arrayUp to 4 sequences; the response ends before the first one. See Output controls below.
seedintegerAsk the model for repeatable sampling. Best effort, not a guarantee.
presence_penaltynumber-2 to 2. Positive values push the model toward new topics.
frequency_penaltynumber-2 to 2. Positive values make repeated words less likely.
response_formatobject{"type": "json_object"} for JSON mode, or {"type": "json_schema", "json_schema": {"name": "...", "schema": {...}}} for output that matches a schema.
modelsarrayUp to 3 fallback model ids, tried in order when model fails. See Fallback models below.

Output controls

Not every model takes stop, seed, the penalties or response_format. A model that cannot honour one answers 400 with code unsupported_parameter and param naming it, so a setting is never ignored without you knowing. The defaults (presence_penalty: 0, frequency_penalty: 0, n: 1, response_format: {"type": "text"}) are accepted on every model.

ModelsstopseedPenaltiesresponse_format
GPT-4o, Borealis, DeepSeekYesYesYesJSON mode and JSON schema
GPT-5 family, o-seriesNoYesNoJSON mode and JSON schema
Claude, Lynx, Qwen, Llama, Mistral, gpt-ossYesNoNoNo
GeminiYesNoNoJSON mode
Image, speech, research and web search modelsNoNoNoNo

n above 1 and logprobs are not supported; send separate requests instead of n.

Fallback models

Add models to keep a request going when a model is down or rate limited. model is tried first, then each id in models, in order.

  • The next model is tried only when the current one fails before answering, with 408, 429 or a 5xx. A 400 or another error caused by the request is returned at once, since the next model would refuse it too.
  • Once the response has started, it stays with that model.
  • model in the response names the model that answered. Only that model is billed; a model that failed produced no tokens.
  • Every fallback must accept the request as sent: a chat model that supports its tools and parameters. Otherwise the request is refused with 400 and param such as models[1].
  • With EU-hosted models only switched on in Settings → Privacy, every fallback must be EU-hosted too.
  • With models set, a streamed response starts when the first content arrives rather than right away.

GPT-5 and the o-series ignore temperature and top_p, and so do Claude Opus 4.7 and later, Claude Sonnet 5, and any Claude request with reasoning on. Other Claude models use one of the two: temperature if both are sent.

Some models reason before they answer even when you send no reasoning_effort: Claude Haiku 5.5 and the other Claude 5 models, GPT-5 and the o-series. Reasoning tokens count toward max_completion_tokens and are billed as output tokens, so with a small limit the answer can come back empty with finish_reason: "length". For short answers, such as a one-word classification, send reasoning_effort: "none" or "low".

reasoning_effort: "none" turns reasoning off on Claude Haiku 5.5, Claude Opus 5, Claude Sonnet 5, Claude Opus 4.6 to 4.8, Claude Sonnet 4.6, older Claude models and Gemini 2.5 Flash. Models with no off switch, such as Claude Opus 5.5, Claude Sonnet 5.5 and GPT-5, reason at a low level instead.

Older integrations can still send stream, temperature, top_p and reasoning_effort inside an options object, and max_response_length at the top level. Top-level fields win when both are sent.

json
{
"model": "claude-sonnet-5.5",
"models": ["gpt-5.4", "gemini-3.1-pro"],
"messages": [{ "role": "user", "content": "Summarise this contract." }]
}

Messages

FieldTypeDescription
rolestringsystem, user, assistant or tool.
contentstring or arrayThe text, or an array of content parts (below). Can be null on an assistant message that only has tool_calls.
tool_callsarrayAssistant messages only: the tool calls the model made, sent back unchanged.
tool_call_idstringTool messages only: the id of the call this result answers.
attachmentsarrayBineric's own format: base64 data URLs. Content parts do the same thing.

Content parts

TypeDescription
text{"type": "text", "text": "..."}
image_urlimage_url.url is a base64 data URL or an http(s) URL. Images fetched from a URL can be up to 20 MB.
filefile.file_data is a base64 data URL; file.filename is optional. file_id is not supported.
input_audioinput_audio.data (base64) and input_audio.format (wav or mp3).

Images, files and audio are read from the last user message only; attach them to the message you are asking about. A malformed part returns 400 with param pointing at it, for example messages[0].content[1].

json
{
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": [
{ "type": "text", "text": "What is in this image, and what does the report say about it?" },
{ "type": "image_url", "image_url": { "url": "https://example.com/photo.jpg" } },
{ "type": "file", "file": { "filename": "report.pdf", "file_data": "data:application/pdf;base64,JVBERi0..." } }
]
}
]
}

Files

KindFormatsNotes
ImagesJPEG, PNG, WebP, GIFModels that support vision. Each model has its own size limit (Claude: 3.75 MB); a larger image returns 400. Images are scaled to fit 1024×1024.
DocumentsPDF, DOCX, DOC, XLSX, XLS, TXT, CSV, MD, JSON, HTMLThe text is extracted and sent to the model.
AudioWAV, MP3Gemini models and speech-to-text only. Other models return 400.

Response

usage.cost is what the call cost in USD, the amount taken from your balance. id identifies the call: look it up later with GET /v1/generation.

model in the response is the model's display name, such as GPT-4o, not the id you sent. finish_reason is stop, length (cut off by max_completion_tokens or the model's limit) or tool_calls; image models can also return content_filter.

When a model is retired, requests for its id are answered by its replacement, and model shows the replacement's name.

json
{
"id": "gen-1768817914002-3f9a1c7b2e4d6a80",
"object": "chat.completion",
"created": 1768817914,
"model": "GPT-4o",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "Hello! How can I help?" },
"finish_reason": "stop"
}
],
"usage": { "prompt_tokens": 9, "completion_tokens": 7, "total_tokens": 16, "cost": 0.0001 }
}

Chat

Streaming

Set stream: true to receive the response as server-sent events while it is written.

stream = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Write a haiku about the sea."}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")

Events

  • The first chunk carries the role, then come content chunks, then an empty delta with the finish_reason.
  • The usage chunk (empty choices) is only sent when the request sets "stream_options": {"include_usage": true}. It carries cost in USD.
  • Reasoning models also send delta.reasoning_content chunks with their reasoning.
  • Search models add _bineric.citations to the last chunk.
  • If an error happens after the stream has started, it arrives as data: {"error": {...}} and the stream closes without [DONE].
text
data: {"id":"gen-123","object":"chat.completion.chunk","created":1768818339,"model":"GPT-4o","choices":[{"index":0,"delta":{"role":"assistant"},"finish_reason":null}]}
data: {"id":"gen-123","object":"chat.completion.chunk","created":1768818339,"model":"GPT-4o","choices":[{"index":0,"delta":{"content":"Waves"},"finish_reason":null}]}
data: {"id":"gen-123","object":"chat.completion.chunk","created":1768818339,"model":"GPT-4o","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
data: {"id":"gen-123","object":"chat.completion.chunk","created":1768818339,"model":"GPT-4o","choices":[],"usage":{"prompt_tokens":14,"completion_tokens":17,"total_tokens":31,"cost":0.0002}}
data: [DONE]

Tool calls

Tool calls stream as delta.tool_calls. The first piece of each call carries its id and function name; join the arguments strings by index.

Image, speech and deep research models do not send OpenAI chunks; see their sections.

text
data: {"id":"gen-123","object":"chat.completion.chunk","created":1768818339,"model":"GPT-4o","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"id":"call_abc123","type":"function","function":{"name":"get_weather","arguments":""}}]},"finish_reason":null}]}
data: {"id":"gen-123","object":"chat.completion.chunk","created":1768818339,"model":"GPT-4o","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\"city\":\"Oslo\"}"}}]},"finish_reason":null}]}
data: {"id":"gen-123","object":"chat.completion.chunk","created":1768818339,"model":"GPT-4o","choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}]}

Chat

Tool calling

Give the model functions it can call. The model returns the call; your code runs it and sends the result back.

The Supports column in Models marks the models that support tool calling (Tools). Image, audio, search and research models return 400 with code: "tools_not_supported" and param: "tools", both when tools is sent and when the messages carry earlier tool calls or results.

1. Send tools

Describe each function with a name, a description and a JSON Schema for its parameters. tool_choice: "auto" lets the model decide; "required" makes it call one.

json
{
"model": "gpt-4o",
"messages": [
{ "role": "user", "content": "What's the weather in Oslo?" }
],
"tools": [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a city",
"parameters": {
"type": "object",
"properties": { "city": { "type": "string" } },
"required": ["city"]
}
}
}
],
"tool_choice": "auto"
}

2. The model calls a tool

finish_reason is tool_calls and message.tool_calls holds the calls. arguments is a JSON string: parse it, then run your function.

json
{
"id": "gen-1768817914002-3f9a1c7b2e4d6a80",
"object": "chat.completion",
"created": 1768817914,
"model": "GPT-4o",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": null,
"tool_calls": [
{
"id": "call_abc123",
"type": "function",
"function": { "name": "get_weather", "arguments": "{\"city\":\"Oslo\"}" }
}
]
},
"finish_reason": "tool_calls"
}
],
"usage": { "prompt_tokens": 62, "completion_tokens": 18, "total_tokens": 80 }
}

3. Send the result back

Add the assistant message unchanged, then a tool message with the matching tool_call_id. Keep sending tools. The model then answers in text with finish_reason: "stop".

json
{
"model": "gpt-4o",
"messages": [
{ "role": "user", "content": "What's the weather in Oslo?" },
{
"role": "assistant",
"content": null,
"tool_calls": [
{
"id": "call_abc123",
"type": "function",
"function": { "name": "get_weather", "arguments": "{\"city\":\"Oslo\"}" }
}
]
},
{ "role": "tool", "tool_call_id": "call_abc123", "content": "{\"temp_c\": 12, \"sky\": \"cloudy\"}" }
],
"tools": [ ... ]
}

Chat

Errors

Errors use the OpenAI shape, so SDKs raise their usual exceptions.

json
{
"error": {
"message": "temperature must be between 0 and 2",
"type": "invalid_request_error",
"param": "temperature",
"code": "invalid_request"
}
}
StatuscodeMeaning
400invalid_requestA field is wrong; param names it (for example temperature, tools[0].function.name or messages[0].content[1]).
400model_not_foundUnknown model id in a request. Use an id from GET /v1/models.
400model_not_supportedA decision model was sent to chat completions. Use POST /v1/zuse.
400tools_not_supportedThe model does not support tools.
400unsupported_parameterThe model does not support a parameter you sent (for example response_format on Claude, or n above 1); param names it. See Output controls.
400nullAn attachment is too large, of an unsupported type, or could not be processed.
401missing_api_key, invalid_api_keyNo key, or the key is wrong or disabled.
402insufficient_quotaBalance below $0.10. Buy credits.
403payment_requiredNo completed purchase on the account yet. Buy credits.
403eu_onlyThe account allows EU-hosted models only (Settings → Privacy) and model, or one of models, can run outside the EU; param names it. Nothing was sent to the provider.
404model_not_foundGET /v1/models/{model} with an id that is not in the list.
404generation_not_foundGET /v1/generation with an id that is not on your account, or not recorded yet. Retry after a second.
404unknown_endpointNo such endpoint.
429rate_limit_exceededToo many requests from your IP address. Wait for Retry-After seconds.
429concurrent_request_limitMore than 50 requests running at once on your account. Chat API only; /v1/zuse has no such limit.
500internal_errorSomething failed on our side. Retry.
502image_generation_failedThe image model failed.
503model_not_configuredThe model is listed but not available right now. Try another model.

Errors from the model provider, such as its own rate limits or content policy, are passed through with the provider's status and code. Retry 429 and 5xx responses with exponential backoff.

Chat

Rate limits

  • 500 requests a minute per IP address across /v1 and /api/v1. Over the limit you get 429 with a Retry-After header and the standard RateLimit-* headers.
  • Up to 50 requests running at once per account; more return 429 concurrent_request_limit. This limit is for the chat API only: /v1/zuse has no limit on requests at once, and its own rate limits.
  • Each model's context window and output limit apply; see Models.

Images, speech and research

Image generation

Use an image model with chat completions. The last user message is the prompt.

POST/v1/chat/completions
  • gpt-image-1 also reads size, quality, output_format and n at the top level of the body.
  • Attach images to the last user message to edit them instead; _bineric.operation is then editing.
  • Image models do not stream. With stream: true you still get one JSON response, not events, so call them without streaming.
json
{
"model": "gpt-image-1",
"messages": [
{ "role": "user", "content": "A lighthouse on a rocky coast at dawn, watercolour" }
],
"size": "1024x1024",
"quality": "high"
}

Response

message.content holds each image as a Markdown image with a data URL. The raw data URLs are also in _bineric.images.

When Stable Diffusion or a Gemini image model blocks a prompt, you get 200 with a short text reply, finish_reason: "content_filter" and an empty _bineric.images. gpt-image-1 returns the provider's content policy error instead.

json
{
"id": "gen-1768817914002-3f9a1c7b2e4d6a80",
"object": "chat.completion",
"created": 1768817914,
"model": "gpt-image-1",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "![image 1](data:image/png;base64,iVBORw0KGgo...)" },
"finish_reason": "stop"
}
],
"usage": { "prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0 },
"_bineric": {
"images": ["data:image/png;base64,iVBORw0KGgo..."],
"image_count": 1,
"operation": "generation",
"total_cost": 0.04
}
}

Images, speech and research

Text to speech

Turn text into speech with the text-to-speech model. The last user message is the text.

POST/v1/chat/completions
FieldDefaultDescription
voicenb-NO-FinnNeuralAn Azure neural voice name, such as nb-NO-PernilleNeural, en-US-JennyNeural or sv-SE-SofieNeural. The voice decides the language you hear.
languagenb-NOThe locale of the text, such as en-US. Also accepted as locale. It does not choose a voice, so set voice too.
ratemediumSpeaking rate, as SSML prosody: slow, medium, fast or a percentage like +10%.
pitchmediumPitch, such as low, high or +5%.
volumeloudVolume, such as soft, medium or +20%.

Send these at the top level of the body. Norwegian voices: Finn (male), Iselin and Pernille (female). Voices for English, Swedish, Danish and other languages follow the same pattern, <locale>-<Name>Neural.

json
{
"model": "text-to-speech",
"messages": [{ "role": "user", "content": "Hei, velkommen til Bineric!" }],
"voice": "nb-NO-PernilleNeural",
"language": "nb-NO",
"rate": "medium"
}

Response

The speech is MP3 (16 kHz, 32 kbps, mono), base64-encoded in message.audio.data. It is priced at $16 per million characters.

Long text is split into chunks of up to 500 characters at sentence ends. If some chunks fail, you still get 200 with the audio that worked; compare processedChunks with totalChunks.

json
{
"id": "gen-1768817914002-3f9a1c7b2e4d6a80",
"object": "chat.completion",
"created": 1768817914,
"model": "Text to Speech",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": null,
"audio": { "data": "<base64 mp3>", "format": "mp3" }
},
"finish_reason": "stop"
}
],
"usage": { "prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0 },
"_bineric": {
"metadata": {
"language": "nb-NO",
"voice": "nb-NO-PernilleNeural",
"textLength": 27,
"format": "mp3",
"quality": "16khz/32kbps",
"processedChunks": 1,
"totalChunks": 1,
"settings": { "rate": "medium", "pitch": "medium", "volume": "loud" }
},
"characters": 27,
"total_cost": 0.00043
}
}
python
import base64
data = response.json()
audio = base64.b64decode(data["choices"][0]["message"]["audio"]["data"])
with open("speech.mp3", "wb") as f:
f.write(audio)

Images, speech and research

Speech to text

Transcribe audio with speaker labels using the speech-to-text model.

POST/v1/chat/completions

Send one audio file in the last user message, as an input_audio content part (WAV or MP3), a file part, or a data URL in attachments. Only the first file is transcribed.

language (or locale, which wins if both are sent) is the main locale, default en-US. The transcriber also detects en-US, es-ES, de-DE, fr-FR, it-IT, pt-BR, nl-NL, nb-NO, fi-FI and sv-SE.

json
{
"model": "speech-to-text",
"messages": [
{
"role": "user",
"content": [
{ "type": "text", "text": "Transcribe this" },
{ "type": "input_audio", "input_audio": { "data": "<base64 audio>", "format": "mp3" } }
]
}
],
"language": "nb-NO"
}

Response

  • _bineric.phrases has one entry per phrase, with ISO 8601 startTime and duration.
  • Priced at $0.18 per hour of recognised speech.
  • Transcription runs as a batch job and does not stream. After 5 minutes it stops with 500 Transcription timed out after 5 minutes; split long recordings.
json
{
"id": "gen-1768817914002-3f9a1c7b2e4d6a80",
"object": "chat.completion",
"created": 1768817914,
"model": "Speech to Text",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Speaker 1: Hello and welcome.\nSpeaker 2: Thanks for having me."
},
"finish_reason": "stop"
}
],
"usage": { "prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0 },
"_bineric": {
"phrases": [
{ "speaker": 1, "text": "Hello and welcome.", "startTime": "PT0.5S", "duration": "PT1.8S" },
{ "speaker": 2, "text": "Thanks for having me.", "startTime": "PT2.4S", "duration": "PT1.6S" }
],
"total_cost": 0.0002
}
}

Images, speech and research

Deep research

Research a question on the web and get an answer with sources, using the deep-research model. $0.25 per call.

POST/v1/chat/completions
json
{
"model": "deep-research",
"messages": [
{ "role": "user", "content": "What changed in EU AI regulation this year?" }
],
"options": { "maxDepth": 5, "timeLimit": 180, "maxUrls": 5 }
}
OptionDefaultDescription
options.maxDepth5How many rounds of searching and reading.
options.timeLimit180Time limit in seconds.
options.maxUrls5Maximum number of pages to read.
streamfalseSend progress events while it works (top level or in options).

The research options are only read inside options. Each account can make 50 deep research calls a calendar month; unused calls do not carry over.

Response

Token counts in usage are estimates; you pay the fixed price per call.

json
{
"id": "gen-1768817914002-3f9a1c7b2e4d6a80",
"object": "chat.completion",
"created": 1768817914,
"model": "Deep Research",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "Based on my research..." },
"finish_reason": "stop"
}
],
"usage": { "prompt_tokens": 320, "completion_tokens": 540, "total_tokens": 860 },
"_bineric": {
"request_id": "req_abc123",
"citations": [
{ "url": "https://example.com/article", "title": "Article title", "description": "Relevant excerpt..." }
],
"activities": [
{ "type": "search", "status": "complete", "message": "Searching...", "timestamp": "2026-10-26T10:00:00Z", "depth": 1 }
],
"deep_research_info": { "usage_count": 5, "usage_limit": 50, "usage_left": 45 },
"total_cost": 0.25,
"response_time_ms": 12000
}
}

Streaming

With stream: true you get named events, not OpenAI chunks: info when research starts, activity for each step, and complete with the answer in response. There is no [DONE].

text
event: info
data: {"request_id":"req_abc123","model":"Deep Research","message":"Deep research started"}
event: activity
data: {"type":"search","message":"Searching...","request_id":"req_abc123"}
event: complete
data: {"success":true,"request_id":"req_abc123","model":"Deep Research","response":"Based on my research...","citations":[...],"activities":[...],"deep_research_info":{"usage_count":5,"usage_limit":50,"usage_left":45},"usage":{"prompt_tokens":320,"completion_tokens":540,"total_tokens":860,"total_cost":0.25,"response_time_ms":12000}}
event: error
data: {"success":false,"request_id":"req_abc123","error":{"type":"ProcessingError","message":"...","code":500}}

Errors

StatusMeaning
403 not_eligibleThis month's 50 calls are used up, or the balance is too low.
429Too many requests at once, or the research service's own limit.
500, 502The research failed.
503Deep research is temporarily unavailable.

When streaming, everything except the 403 arrives as an error event.

Files

Convert a file to base64

Upload a file and get it back as a data URL you can attach to a chat message.

POST/api/v1/media/base64

Multipart form data with one file in a field named file, up to 200 MB. Free; no credit is used.

curl -X POST https://api.bineric.com/api/v1/media/base64 \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@report.pdf"

Response

json
{
"success": true,
"request_id": "req_abc123",
"data": {
"base64String": "data:application/pdf;base64,JVBERi0xLjcK...",
"originalName": "report.pdf",
"fileInfo": { "mimeType": "application/pdf" },
"size": { "original": 102400, "base64": 136563 }
}
}

The MIME type is read from the file's bytes, so binary formats (images, audio, PDF, Office files) are recognised. Plain-text formats such as TXT, CSV, MD, JSON and HTML come back as application/octet-stream.

StatuscodeMeaning
400invalid_requestNo file, or larger than 200 MB.
401missing_api_key, invalid_api_keyNo key, or the key is wrong.
500internal_errorThe file could not be converted. A form field not named file also ends here.

Files

Decode base64

Send a base64 data URL and get the original file back.

POST/api/v1/decode-base64

The response is the file itself. Content-Type is detected from the decoded bytes, and Content-Disposition is inline; filename="file.<ext>". Errors: 400 invalid_request with param: "data" when data is missing, not a string or not valid base64, and 500 internal_error when decoding fails.

curl -X POST https://api.bineric.com/api/v1/decode-base64 \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"data": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="}' \
--output pixel.png

Integrations

Integrations

The API is OpenAI-compatible, so libraries and gateways built for OpenAI work with Bineric when you change the base URL and the key. These guides cover the Vercel AI SDK, LiteLLM and Portkey.

  • Vercel AI SDK: TypeScript, through @ai-sdk/openai-compatible.
  • LiteLLM: the Python SDK and the LiteLLM proxy.
  • Portkey: the hosted Portkey gateway or the open-source one.

Each of them reaches every chat model in Models. To keep data in the EU, pick models whose euHosted is true in the model list.

Integrations

Vercel AI SDK

Use Bineric with the AI SDK through its OpenAI-compatible provider.

Install

bash
npm install ai @ai-sdk/openai-compatible

Create the provider

Pass any model id from Models to bineric(...), for example lynx-30b, borealis-2, claude-sonnet-5.5 or gpt-5.4.

typescript
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
const bineric = createOpenAICompatible({
name: "bineric",
baseURL: "https://api.bineric.com/v1",
apiKey: process.env.BINERIC_API_KEY,
includeUsage: true,
});

Generate and stream text

includeUsage: true asks for token usage on streamed responses too. Tool calling works the same way as with any AI SDK provider, on the models that support it.

import { generateText } from "ai";
const { text } = await generateText({
model: bineric("lynx-30b"),
prompt: "Hva er hovedstaden i Norge?",
});
console.log(text);

Integrations

LiteLLM

Call Bineric from the LiteLLM Python SDK or serve it through a LiteLLM proxy.

Python SDK

The openai/ prefix tells LiteLLM to use its OpenAI-compatible client. The part after it is the Bineric model id.

python
import os
import litellm
response = litellm.completion(
model="openai/lynx-30b",
api_base="https://api.bineric.com/v1",
api_key=os.environ["BINERIC_API_KEY"],
messages=[{"role": "user", "content": "Say hello in Norwegian."}],
)
print(response.choices[0].message.content)

LiteLLM proxy

Add more models the same way. model_info gives the proxy's spend tracking the price; take it from Models, where prices are per million tokens, and divide by 1,000,000.

yaml
model_list:
- model_name: lynx-30b
litellm_params:
model: openai/lynx-30b
api_base: https://api.bineric.com/v1
api_key: os.environ/BINERIC_API_KEY
model_info:
input_cost_per_token: 0.000003
output_cost_per_token: 0.000015
general_settings:
master_key: os.environ/LITELLM_MASTER_KEY
bash
pip install 'litellm[proxy]'
export BINERIC_API_KEY=YOUR_API_KEY
export LITELLM_MASTER_KEY=sk-local-test
litellm --config config.yaml
curl http://localhost:4000/v1/chat/completions \
-H "Authorization: Bearer $LITELLM_MASTER_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "lynx-30b", "messages": [{"role": "user", "content": "Say hello"}]}'

Integrations

Portkey

Reach Bineric through the Portkey gateway with its custom_host setting and the openai provider format.

Store Bineric in the Model Catalog

  1. In Portkey, open Model Catalog, then Add Provider, and turn on Local/Privately hosted provider.
  2. Choose OpenAI as the API specification and set Custom Host to https://api.bineric.com/v1.
  3. Add the header Authorization with the value Bearer YOUR_API_KEY.
  4. Name the provider bineric and save.
python
from portkey_ai import Portkey
portkey = Portkey(api_key="PORTKEY_API_KEY", provider="@bineric")
response = portkey.chat.completions.create(
model="lynx-30b",
messages=[{"role": "user", "content": "Hva er hovedstaden i Norge?"}],
)
print(response.choices[0].message.content)

Or pass Bineric on each request

Portkey's open-source gateway (npx @portkey-ai/gateway) takes the same headers. Send requests to http://localhost:8787/v1 and leave out x-portkey-api-key.

import os
from portkey_ai import Portkey
portkey = Portkey(
api_key="PORTKEY_API_KEY", # leave out for a self-hosted gateway
provider="openai",
custom_host="https://api.bineric.com/v1",
Authorization=f"Bearer {os.environ['BINERIC_API_KEY']}",
)
response = portkey.chat.completions.create(
model="lynx-30b",
messages=[{"role": "user", "content": "Hva er hovedstaden i Norge?"}],
)
print(response.choices[0].message.content)

Account

Usage

Your API usage and cost, per model.

GET/api/v1/monitoring/usage

Filter with startDate and endDate (YYYY-MM-DD). Send both: with only one, the result covers all time. Without dates, period is {"start": "all time", "end": "current"}.

model is the model's display name. recent_requests holds the last 5 paid requests. All numbers are JSON numbers.

bash
curl "https://api.bineric.com/api/v1/monitoring/usage?startDate=2026-10-01&endDate=2026-10-31" \
-H "Authorization: Bearer YOUR_API_KEY"
json
{
"success": true,
"data": {
"by_model": [
{
"model": "GPT-4o",
"usage": { "input_tokens": 50000, "output_tokens": 75000, "total_cost": 0.88, "request_count": 150 }
}
],
"total_usage": { "total_cost": 10.25, "total_tokens": 500000, "total_requests": 500 },
"recent_requests": [
{ "model": "GPT-4o", "cost": 0.0213, "tokens": 1840, "timestamp": "2026-10-31T14:30:00.000Z" }
],
"period": { "start": "2026-10-01", "end": "2026-10-31" }
}
}

Account

Daily usage

Today's usage and whether your credit is active.

GET/api/v1/monitoring/daily-usage
  • "Today" is the server's calendar day.
  • requests counts paid requests; the token and cost totals include every API request today.
  • last_request is null when there are no paid requests yet.
  • expires_at is only present while active is true.
bash
curl https://api.bineric.com/api/v1/monitoring/daily-usage \
-H "Authorization: Bearer YOUR_API_KEY"
json
{
"success": true,
"data": {
"payment_status": { "active": true, "expires_at": "2026-11-20T09:12:00.000Z" },
"today_usage": { "requests": 42, "input_tokens": 15000, "output_tokens": 22000, "total_cost": 0.85 },
"last_request": { "time": "2026-10-26T14:30:00.000Z", "model": "Claude Sonnet 4.6", "cost": 0.015 }
}
}

Account

Balance

Your credit balance and lifetime token usage.

GET/api/v1/monitoring/balance

balance is in USD. payment_status.active means a completed purchase in the last 30 days, and expires (present only while active) is 30 days after it. A new account has balance: 0 and lastUpdated: null.

bash
curl https://api.bineric.com/api/v1/monitoring/balance \
-H "Authorization: Bearer YOUR_API_KEY"
json
{
"success": true,
"data": {
"balance": 25.5,
"inputTokens": 500000,
"outputTokens": 750000,
"lastUpdated": "2026-10-26T14:30:00.000Z",
"payment_status": { "active": true, "expires": "2026-11-20T09:12:00.000Z" },
"usage": {
"daily": { "requests": 42, "tokens": { "input": 15000, "output": 22000 }, "cost": 0.85 },
"total": { "input_tokens": 500000, "output_tokens": 750000 }
}
}
}

Account

Credits

Your balance and what the API has cost so far.

GET/v1/credits
  • balance is what you can still spend, in USD. A new account has 0 until its first top-up.
  • total_usage is everything the API has cost on this account.
  • source is promo_code when the account spends a promo-code balance, otherwise credits.
bash
curl https://api.bineric.com/v1/credits \
-H "Authorization: Bearer YOUR_API_KEY"
json
{
"data": {
"balance": 42.5,
"total_usage": 157.5,
"currency": "USD",
"source": "credits"
}
}

Account

Key

The key you call with: its spending limit, what it has spent and when it expires.

GET/v1/key
  • limit is the key's spending limit in USD, null when it has none; then limit_remaining and limit_resets_at are null too.
  • limit_reset is daily, weekly, monthly or null (never resets). Periods start at 00:00 UTC; a week starts on Monday.
  • usage is what the key has spent in the current period, total_usage since it was created.
  • An expired key, or one at its limit, gets 401 or 402 on every call, this one included; the error says which.
bash
curl https://api.bineric.com/v1/key \
-H "Authorization: Bearer YOUR_API_KEY"
json
{
"data": {
"name": "Production",
"preview": "api_…a1b2",
"created_at": "2026-10-01T08:00:00.000Z",
"last_used_at": "2026-11-19T09:12:00.000Z",
"expires_at": "2027-10-01T08:00:00.000Z",
"limit": 50,
"limit_reset": "monthly",
"limit_remaining": 37.5,
"limit_resets_at": "2026-12-01T00:00:00.000Z",
"usage": 12.5,
"total_usage": 80.25,
"currency": "USD"
}
}

Account

Generation

One call, by the id its response carried: model, tokens and cost.

GET/v1/generation?id={id}
  • You see only calls made with your account's keys; any other id answers 404 generation_not_found.
  • Usage is recorded just after the response is sent, so a lookup in the same instant can answer 404. Retry after a second.
  • total_cost is the amount taken from your balance, the same as usage.cost in the response.
bash
curl "https://api.bineric.com/v1/generation?id=gen-1768817914002-3f9a1c7b2e4d6a80" \
-H "Authorization: Bearer YOUR_API_KEY"
json
{
"data": {
"id": "gen-1768817914002-3f9a1c7b2e4d6a80",
"model": "GPT-4o",
"created_at": "2026-11-19T10:00:00.000Z",
"tokens_prompt": 9,
"tokens_completion": 7,
"total_tokens": 16,
"total_cost": 0.0001,
"currency": "USD"
}
}

Start building

Create a key, buy credits and make your first call in a few minutes.