01 · Overview
What is Lenout AI Platform?
It is a developer API for sending chat-completion requests to the Lenout-managed model. It keeps the familiar OpenAI request shape, while authentication, usage, and Lencon billing stay inside your existing Lenout account.
Works with the OpenAI JavaScript and Python SDKs by changing the base URL.
Use one public model ID while Lenout manages the model service behind the endpoint.
Your Platform balance is the same Lencon wallet used by Lenout Community.
The API supports non-streaming chat completions. Set stream to false or omit it.
02 · Quick start
Make your first request.
- 1Sign in to the Dashboard
Your regular Lenout account works here—there is no separate developer sign-up.
- 2Create an API key
Name the key for the app or environment that will use it. Copy it immediately; the full value is shown once.
- 3Store it on your server
Put the key in an environment variable such as
LENOUT_API_KEY. - 4Send a chat-completion request
Use
https://platform-staging.lenout.com/v1as the SDK base URL.
import OpenAI from "openai"
const client = new OpenAI({
baseURL: "https://platform-staging.lenout.com/v1",
apiKey: process.env.LENOUT_API_KEY
})
const response = await client.chat.completions.create({
model: "lenout-model",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "Explain Lenout in one sentence." }
]
})
console.log(response.choices[0].message.content)curl https://platform-staging.lenout.com/v1/chat/completions \
-H "Authorization: Bearer lnai_your_key" \
-H "Content-Type: application/json" \
-d '{"model":"lenout-model","messages":[{"role":"user","content":"Hello!"}]}'03 · Authentication
Authenticate with a Bearer key.
Every billable API request must include your Lenout API key in the Authorization header. Dashboard sessions and API keys serve different purposes: your browser session manages keys, while a key authenticates your server-to-server requests.
Authorization: Bearer lnai_your_key_here| Credential | Use it for | Where it belongs |
|---|---|---|
| Lenout session | Dashboard, Community, wallet | Secure browser cookie managed by Lenout |
lnai_… API key | /v1/chat/completions | Your server or secret manager |
04 · API reference
/v1/chat/completions
Generate one assistant message from a list of system, user, and assistant messages.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | A model ID from the table below. |
messages | array | Yes | At least one message with role and string content. |
temperature | number | No | Sampling temperature passed to the selected provider. |
max_tokens | number | No | Maximum number of output tokens requested. |
stream | boolean | No | Streaming is not available yet; omit this field or use false. |
Example request
{
"model": "lenout-model",
"messages": [
{ "role": "system", "content": "Answer clearly and briefly." },
{ "role": "user", "content": "What can I build with this API?" }
],
"temperature": 0.7,
"max_tokens": 512
}Example response
{
"id": "chatcmpl-…",
"object": "chat.completion",
"created": 1787200000,
"model": "lenout-model",
"choices": [{
"index": 0,
"message": { "role": "assistant", "content": "You can build…" },
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 24,
"completion_tokens": 42,
"total_tokens": 66
}
}/v1/models
Returns model IDs currently exposed by the Platform. This endpoint does not require an API key.
curl https://platform-staging.lenout.com/v1/models05 · Models & pricing
Use the Lenout-managed model.
Prices are measured in Lencon per one million input or output tokens. The final charge is rounded up to a minimum of 1 Lencon per completed generation.
| Model ID | Provider | Input / 1M | Output / 1M | Context |
|---|---|---|---|---|
lenout-modelRecommended start | Lenout | 0 LC | 1 LC | 8K |
Use GET /v1/models as the runtime source of available model IDs.
06 · Lencon & billing
One wallet across Lenout.
Lencon is Lenout's closed-loop usage credit. Your AI requests and Community activity draw from the same wallet, so a top-up made in the Platform is visible in Lenout Community as well.
Top-ups are one-time Stripe payments.
Select an available package in the Dashboard.
Usage is calculated from model input and output tokens.
Open your Dashboard and choose “Top up Lencon”. Credits are applied after Stripe confirms payment.
07 · Errors
Handle errors by code and status.
Error responses include an error.code and human-readable error.message. Your app should branch on the code, not the message text.
| Status | Code | What it means |
|---|---|---|
| 400 | invalid_request | The JSON body or one of its required fields is invalid. |
| 400 | not_supported | The requested feature, such as streaming, is not available. |
| 401 | invalid_api_key | The key is missing, invalid, expired, or revoked. |
| 402 | insufficient_balance | The shared Lencon wallet cannot cover the request. |
| 404 | model_not_found | The supplied model ID is not available. |
| 429 | rate_limited | The API key exceeded its per-minute request limit. |
| 502 | generation_failed | The Lenout model service could not complete the generation. |
Retry temporary 429 and 502 responses with exponential backoff. Do not automatically retry validation, authentication, or insufficient-balance errors.
08 · Security
Keep every API key server-side.
Never put a key in frontend code. Browser bundles, mobile packages, and public repositories can expose secrets.
Use one key per app or environment. Separate keys make rotation and incident response safer.
Revoke a key immediately if it leaks. Create a replacement first, update your service, then revoke the old key.
Avoid logging credentials. Redact the Authorization header in application and proxy logs.

Create a named key and copy it to your server secret store.