At a glance
Three settings, nothing else to learn
- Base URL
https://app.lionbox.ai/api/test/v1- API key
- Your personal key, from the approval email
- Model
lionbox- Authentication
Authorization: Bearer lbx_test_…- Endpoints
POST /chat/completionsGET /modelsGET /models/lionbox- Format
- OpenAI Chat Completions, with or without streaming
What it is
The test API is an invite-only way to try a real LionBox from your own code. Every request is answered by LionBox's own demo unit, running Qwen3.8-27B, never by a customer's box.
It is the standard OpenAI Chat Completions API. The endpoint, the request and response format, streaming and the error shape are OpenAI's, so the official OpenAI SDKs and the tools built on them work as they are. Answers are text; your messages may include images.
It is for testing and evaluation only: no production use, and no guarantee of availability, speed or answers. The box is shared with other testers and with visitors of the live demo, who go first, so a request may wait a little before it starts.
Getting access
Ask for access with the form under the live demo. Our team reads every request and usually answers within two working days. If your request is approved, you receive an email with your personal key, your limits and the date the key stops working.
Request API accessKeep the key to yourself: anybody who has it can use your allowance. Keys start with lbx_test_. The examples on this page read the key from an environment variable rather than from the code:
export LIONBOX_API_KEY="lbx_test_..."Quickstart
Send your key as a bearer token in the Authorization header and use the model lionbox. The same request in curl, Python and JavaScript:
curl https://app.lionbox.ai/api/test/v1/chat/completions \
-H "Authorization: Bearer $LIONBOX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "lionbox",
"messages": [
{"role": "user", "content": "Explain in two sentences what an on-premise AI server is."}
],
"max_tokens": 200
}'Python: pip install openai. JavaScript and TypeScript: npm install openai, then run the file as an ES module (for example quickstart.mjs) or compile it as TypeScript.
Streaming
With stream: true the answer arrives as server-sent events while it is written, in OpenAI's format. Add stream_options with include_usage: true to receive a last chunk with the token counts. Streaming is the better choice for long answers, which can take minutes.
curl -N https://app.lionbox.ai/api/test/v1/chat/completions \
-H "Authorization: Bearer $LIONBOX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "lionbox",
"stream": true,
"stream_options": {"include_usage": true},
"messages": [{"role": "user", "content": "Write a haiku about servers."}],
"max_tokens": 100
}'Images
Send images in user messages as image_url parts holding a base64 data URL (PNG, JPEG, WebP or GIF). Links to images are not fetched. A new key may send up to 8 images a request; your approval email states your key's number.
import base64
import os
from openai import OpenAI
client = OpenAI(
base_url="https://app.lionbox.ai/api/test/v1",
api_key=os.environ["LIONBOX_API_KEY"],
)
with open("photo.jpg", "rb") as file:
image = base64.b64encode(file.read()).decode()
response = client.chat.completions.create(
model="lionbox",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "Describe this image in one sentence."},
{"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{image}"}},
],
}
],
max_tokens=150,
)
print(response.choices[0].message.content)Other OpenAI-compatible tools
Any library, framework or app that lets you set a custom OpenAI base URL works with the test API. Set these three values and leave the rest at their defaults:
Base URL: https://app.lionbox.ai/api/test/v1
API key: your lbx_test_ key
Model: lionboxLangChain (Python), with pip install langchain-openai:
import os
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="lionbox",
base_url="https://app.lionbox.ai/api/test/v1",
api_key=os.environ["LIONBOX_API_KEY"],
max_tokens=200,
)
print(llm.invoke("Explain in two sentences what an on-premise AI server is.").content)LlamaIndex (Python 3.10 or later), with pip install llama-index-llms-openai-like:
import os
from llama_index.llms.openai_like import OpenAILike
llm = OpenAILike(
model="lionbox",
api_base="https://app.lionbox.ai/api/test/v1",
api_key=os.environ["LIONBOX_API_KEY"],
is_chat_model=True,
context_window=32000,
max_tokens=200,
)
print(llm.complete("Explain in two sentences what an on-premise AI server is."))Tools, function calling and JSON output modes are not supported, so features that rely on them, such as agents that call tools or structured output, do not work.
Request parameters
POST /chat/completions takes these fields, as OpenAI defines them. Any other field is refused with a 400 error that names it.
| Parameter | Notes |
|---|---|
model | Required. Always lionbox. |
messages | Required. 1 to 100 messages, the LionBox system message counted. Roles system or developer (only at the start), user and assistant; the last message is from the user. Content is a string or a list of text parts; user messages may also hold image parts. name is accepted and ignored. |
max_tokens | max_tokens or max_completion_tokens. Defaults to the key's longest answer (6,144 tokens for a new key). A larger value is lowered to that limit, not refused. |
temperature | 0 to 2. |
top_p | Above 0, up to 1. |
stop | A string, or a list of up to 4 strings of 1 to 64 characters each. |
seed | A whole number. |
stream | true or false (the default). |
stream_options | Only include_usage, and only with stream: true. |
Accepted at their default and ignored
OpenAI clients often send these with their default value, so that value is accepted and ignored: n: 1, presence_penalty: 0, frequency_penalty: 0, logprobs: false, store: false, response_format of type text, and user. Any other value is refused with unsupported_value.
Not supported
tools, tool_choice, functions and function_call, the JSON modes of response_format, more than one answer (n above 1), logprobs, audio, and any field not listed above. The model answers in text, does not call tools and does not return its reasoning.
Responses
Without streaming, the whole answer comes back once it is written:
{
"id": "chatcmpl-7jWhR4VS2D3KJClm",
"object": "chat.completion",
"created": 1795714418,
"model": "lionbox",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "An on-premise AI server is a physical computing device ..." },
"finish_reason": "stop",
"logprobs": null
}
],
"usage": { "prompt_tokens": 85, "completion_tokens": 60, "total_tokens": 145 }
}finish_reasonisstopwhen the model finished, orlengthwhen the answer reachedmax_tokensor the key's longest answer and ends there.usagecounts tokens as the box counts them.prompt_tokensincludes the LionBox system message as well as your own messages.idstarts withchatcmpl-andmodelis alwayslionbox. No reasoning, timings or other extra fields are returned.
Streaming format
Streamed, each event is a data: line holding a chat.completion.chunk: the first carries the role, the next ones pieces of the content, the last one finish_reason. With include_usage, a final chunk has an empty choices list and the usage. The stream ends with data: [DONE].
data: {"id":"chatcmpl-olLEDZFS2F6TMlp4","object":"chat.completion.chunk","created":1795714421,"model":"lionbox","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}
data: {"id":"chatcmpl-olLEDZFS2F6TMlp4","object":"chat.completion.chunk","created":1795714421,"model":"lionbox","choices":[{"index":0,"delta":{"content":"Fans"},"finish_reason":null}]}
data: {"id":"chatcmpl-olLEDZFS2F6TMlp4","object":"chat.completion.chunk","created":1795714421,"model":"lionbox","choices":[{"index":0,"delta":{"content":" hum"},"finish_reason":null}]}
...
data: {"id":"chatcmpl-olLEDZFS2F6TMlp4","object":"chat.completion.chunk","created":1795714421,"model":"lionbox","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
data: {"id":"chatcmpl-olLEDZFS2F6TMlp4","object":"chat.completion.chunk","created":1795714421,"model":"lionbox","choices":[],"usage":{"prompt_tokens":78,"completion_tokens":20,"total_tokens":98}}
data: [DONE]While a request waits for the box, the stream sends comment lines (: waiting), which SSE clients ignore. If an answer fails after the stream began, the last event is an error object and there is no [DONE].
Models
GET /models lists the one model and GET /models/lionbox returns it. They need a key too, and do not count towards your limits.
curl https://app.lionbox.ai/api/test/v1/models -H "Authorization: Bearer $LIONBOX_API_KEY"Limits
Every key has its own limits, set when it is made, and your approval email states yours. A new key starts with these:
| Limit | New key |
|---|---|
| Requests a minute | 10 |
| Requests in any 24 hours | 300 |
| Requests at once | 1 |
| Longest input, in tokens (LionBox system message included) | 32,000 |
| Longest answer, in tokens | 6,144 |
| Images a request | 8 |
| Key works until | The date in your approval email |
The windows are rolling: a request counts for the minute and the 24 hours after it was made. All testers together also share a daily cap, and one network address may send at most 120 requests in 10 minutes, whatever the key. Every request the limits admit counts, however it ends.
Rate-limit headers
Every chat completion your key's limits counted, answered or refused, carries these headers, counted with that request included. A stream has them before its first chunk. Errors raised before the limits apply (an invalid key or body, for example) and the /models endpoints carry none.
| Header | Meaning |
|---|---|
x-ratelimit-limit-requests | Requests a minute your key may make |
x-ratelimit-remaining-requests | Requests left in the last minute |
x-ratelimit-reset-requests | Time until the oldest request counted leaves the minute and one more is free, for example 45s |
x-ratelimit-limit-requests-day | Requests in 24 hours your key may make |
x-ratelimit-remaining-requests-day | Requests left in the last 24 hours |
x-ratelimit-reset-requests-day | The same for 24 hours, for example 23h59m12s |
x-ratelimit-limit-requests: 10
x-ratelimit-remaining-requests: 6
x-ratelimit-reset-requests: 20s
x-ratelimit-limit-requests-day: 300
x-ratelimit-remaining-requests-day: 283
x-ratelimit-reset-requests-day: 23h47m7sErrors
Errors have OpenAI's shape, with an English message. param names the field at fault, or is null; type is invalid_request_error, rate_limit_error or server_error.
HTTP/2 400
content-type: application/json
{
"error": {
"message": "tools is not supported by the LionBox test API: it answers in text only, without tools.",
"type": "invalid_request_error",
"param": "tools",
"code": "unsupported_parameter"
}
}| Status | Code | When | What to do |
|---|---|---|---|
| 400 | unsupported_parameter | A field the API does not take, such as tools | Remove the field named in param. |
| 400 | unsupported_value | A field taken only at its default, with another value, such as n: 2, a JSON response_format or a link to an image | Use the default value or leave the field out. |
| 400 | missing_required_parameter | model or messages is missing | Add the field named in param. |
| 400 | invalid_value | A value of the wrong type or range, such as temperature: 3 or an empty message | Correct the value named in param. |
| 400 | invalid_request_error | The body is not valid JSON, not a JSON object, or larger than 12 MiB | Send one JSON object. |
| 400 | too_many_images | More images than your key allows | Send fewer images per request. |
| 400 | input_too_long | The input is longer than your key's input limit | Shorten the conversation or the text you send. |
| 401 | invalid_api_key | No key, or a key that is not valid | Send Authorization: Bearer with your key. |
| 401 | key_revokedkey_expired | The key was revoked (key_revoked) or has expired (key_expired) | Ask us for a new key. |
| 404 | model_not_found | A model other than lionbox | Use lionbox. |
| 429 | rate_limit_exceeded | Too many requests this minute from your key or your network address, or the box is busy with other API requests | Wait the seconds in Retry-After, then try again. |
| 429 | daily_limit | Your key's requests in 24 hours are used up, or those of all testers together | Wait the seconds in Retry-After. |
| 429 | concurrency_limit | Your key already has as many requests running as it may | Wait for the answer in progress to finish (Retry-After: 5). |
| 503 | api_disabled | The test API is switched off for the moment | Try again later. |
| 503 | box_unavailable | The demo box does not answer, or broke off an answer | Try again after the seconds in Retry-After. |
| 504 | timeout | The answer took too long and was stopped | Ask for a shorter answer, or stream it. |
The LionBox system message
Before every conversation the API adds a short system message, so the model knows it is LionBox. It sets the identity only: your own instructions take precedence.
Without a system message of yours, the model receives:
You are LionBox, a private AI assistant running on a LionBox server. The underlying model is Qwen3.8-27B, an open model from Alibaba's Qwen team, tuned by LionBox. Reply in the language the user writes in.With one, yours follows in the same system message, under a heading that gives it precedence:
You are LionBox, a private AI assistant running on a LionBox server. The underlying model is Qwen3.8-27B, an open model from Alibaba's Qwen team, tuned by LionBox. Unless the developer instructions below say otherwise, reply in the language the user writes in.
Developer instructions (these take precedence):
(your system message)It counts like any input, in prompt_tokens and towards your key's input limit: about 70 tokens on its own and about 90 with the heading. Several system or developer messages at the start are joined into one; a system message later in the conversation is refused.
Privacy
Neither LionBox Cloud nor the demo box stores what you send or what the model answers. To apply your limits, LionBox Cloud records counts and timings only: when each request was made, how many tokens and images it had, whether it streamed and how long the answer took. These records are deleted after 90 days. Please do not send personal or confidential information. See Test API access in the Privacy Policy.
Good practice
- On a 429 or 503, wait the seconds in
Retry-After, then try again. The official OpenAI SDKs retry these errors by themselves. - Send one request at a time unless your key allows more: wait for an answer to finish before you send the next.
- Long answers take time: a full-length answer can take about four minutes, after a wait at the box. Stream long answers, and give your client a timeout of at least 10 minutes.
- Set
max_tokensto what you need. Shorter answers come back sooner and leave room for other testers. - Pace scripts with
x-ratelimit-remaining-requestsinstead of waiting for a 429. - Keep the key out of source code and repositories; load it from an environment variable or a secret store.
Frequently asked questions
Is it really the OpenAI API?
It implements OpenAI's Chat Completions API: the same endpoint, request and response format, streaming format and error shape. Only the base URL, the key and the model differ. Other OpenAI APIs, such as Responses, Assistants, embeddings, audio or images, are not offered.
Which model answers?
Qwen3.8-27B, an open model from Alibaba's Qwen team, tuned by LionBox, running on a LionBox. See the model card.
Is it the same as a LionBox in an office?
It runs the same model on a LionBox, but this unit is shared with other testers and with the live demo, and you reach it over the internet. A LionBox in your office is reached over your own network and is not shared with anyone outside your organization.
Can it call tools or return JSON?
Not through the API: tools, function calling and JSON output modes are not supported. You can still ask for JSON in your prompt and parse the text of the answer.
Which language does it answer in?
By default, the language you write in. A system message of yours can ask for another one. Answer quality can vary between languages.
My key stopped working. What now?
A key stops on the date in its approval email, or when it is revoked. Write to hello@lionbox.ai if you need more time.
Can I use it in production?
No. It is for testing and evaluation only. To run LionBox for your own organization, see the product.
How do I end my test?
Reply to the approval email or write to hello@lionbox.ai, and we revoke the key. Otherwise it stops by itself on its end date.
Contact
Questions, feedback or trouble with your key: write to hello@lionbox.ai. Include the time of the request and the error code, never your key.
Back to documentation