翻篇收录说明
翻篇网页快照

LionBox test API documentation

https://www.lionbox.ai/docs/test-api

最近抓取:2026-12-03 23:37:08(北京时间)

最近内容变化:2026-11-30 19:17:34(北京时间)

这是最近一次有效抓取的文本快照,不含网页脚本、图片和动态交互内容。实际网页可能已更新。

访问原网页

页面简介

The invite-only LionBox test API: OpenAI-compatible Chat Completions with curl, Python and JavaScript examples, parameters, limits and errors.

正文摘录

Docs · Test APIThe LionBox test APIThe standard OpenAI Chat Completions API, answered by a real LionBox. Use any OpenAI client or SDK and change three things: the base URL, the API key and the model.At a glanceThree settings, nothing else to learnBase URLhttps://app.lionbox.ai/api/test/v1API keyYour personal key, from the approval emailModellionboxAuthenticationAuthorization: Bearer lbx_test_…EndpointsPOST /chat/completionsGET /modelsGET /models/lionboxFormatOpenAI Chat Completions, with or without streamingWhat it isThe 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 accessAsk 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 access Keep 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:ShellCopyexport LIONBOX_API_KEY="lbx_test_..."QuickstartSend your key as a bearer token in the Authorization header and use the model lionbox. The same request in curl, Python and JavaScript:curlPythonJavaScriptCopycurl 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.StreamingWith 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.curlPythonJavaScriptCopycurl -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 }'ImagesSend 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.PythonCopyimport 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 toolsAny 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:SettingsCopyBase URL: https://app.lionbox.ai/api/test/v1 API key: your lbx_test_ key Model: lionboxLangChain (Python), with pip install langchain-openai:LangChainCopyimport 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:LlamaIndexCopyimport 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 parametersPOST /chat/completions takes these fields, as OpenAI defines them. Any other field is refused with a 400 error that names it.SupportedParameterNotesmodelRequired. Always lionbox.messagesRequired. 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_tokensmax_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.temperature0 to 2.top_pAbove 0, up to 1.stopA string, or a list of up to 4 strings of 1 to 64 characters each.seedA whole number.streamtrue or false (the default).stream_optionsOnly include_usage, and only with stream: true.Accepted at their default and ignoredOpenAI 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 supportedtools, 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.ResponsesWithout streaming, the whole answer comes back once it is written:JSONCopy{ "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_reason is stop when the model finished, or length when the answer reached max_tokens or the key's longest answer and ends there.usage counts tokens as the box counts them. prompt_tokens includes the LionBox system message as well as your own messages.id starts with chatcmpl- and model is always lionbox. No reasoning, timings or other extra fields are returned.Streaming formatStreamed, 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].Server-sent eventsCopydata: {"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].ModelsGET /models lists the one model and GET /models/lionbox returns it. They need a key too, and do not count towards your limits.curlJSONCopycurl https://app.lionbox.ai/api/test/v1/models -H "Authorization: Bearer $LIONBOX_API_KEY"LimitsEvery key has its own limits, set when it is made, and your approval email states yours. A new key starts with these:LimitNew keyRequests a minute10Requests in any 24 hours300Requests at once1Longest input, in tokens (LionBox system message included)32,000Longest answer, in tokens6,144Images a request8Key works untilThe date in your approval emailThe 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 headersEvery 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.HeaderMeaningx-ratelimit-limit-requestsRequests a minute your key may makex-ratelimit-remaining-requestsRequests left