Your first Liho LLM API request
An account, a key and the first model response. The API uses the OpenAI Chat Completions format, so curl and the official OpenAI SDK for Python or TypeScript work: you only change the address and the key.
What you need
- A Liho LLM account with a positive ruble balance.
- curl, Python 3 with the
openaipackage, or Node.js with theopenaipackage.
Steps
Sign up
Open the Liho LLM sign-up page and click “Create account”. You need an email, a name and a password of at least 12 characters.
Sign up for Liho LLMTop up the balance
In the dashboard, open “Balance & payments” and top up the balance in rubles. Before each request the service reserves its highest possible cost, and after the response it charges the actual cost. If the available funds do not cover the reservation, the request returns error
402.Create an API key
Go to “API keys” → “Create key”. Give the key a name and, if you need them, a spending limit and an expiry date. The key starts with
lh_and is shown only once: copy it, then click “I have saved the key”. Keep the key in an environment variable, not in your code.shellexport LIHO_API_KEY="lh_…"powershell$env:LIHO_API_KEY = "lh_…"Send a request
Requests go to
https://llm.liho.dev/v1/chat/completions. Themodel,messagesandmax_tokensfields are required:max_tokenscaps the response length and sets the cost reservation. For reasoning models, reasoning tokens count toward this limit, so leave headroom. With the OpenAI SDK you only changebase_urland the key.shellcurl https://llm.liho.dev/v1/chat/completions \ -H "Authorization: Bearer $LIHO_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-6-sol", "max_tokens": 512, "messages": [ {"role": "user", "content": "Explain what an API gateway is in two sentences."} ] }'pythonimport os from openai import OpenAI client = OpenAI( base_url="https://llm.liho.dev/v1", api_key=os.environ["LIHO_API_KEY"], timeout=900, ) response = client.chat.completions.create( model="gpt-6-sol", max_tokens=512, messages=[{"role": "user", "content": "Explain what an API gateway is in two sentences."}], ) print(response.choices[0].message.content)typescriptimport OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://llm.liho.dev/v1", apiKey: process.env.LIHO_API_KEY, timeout: 900_000, }); const response = await client.chat.completions.create({ model: "gpt-6-sol", max_tokens: 512, messages: [{ role: "user", content: "Explain what an API gateway is in two sentences." }], }); console.log(response.choices[0].message.content);Check the cost
The
usagefield of the response holds the token counts andcost, the amount charged in rubles. The same request appears under “Logs” in the dashboard with the model, key, tokens, cost and response time.If the charge is not final yet, the response has no
costfield; the final amount appears in “Logs”.Turn on streaming
With
"stream": truethe response arrives in parts as SSE and ends withdata: [DONE]. The last chunk before it carriesusagewith the cost. A response can take up to 15 minutes, so set the client timeout to at least 900 seconds.shellcurl -N https://llm.liho.dev/v1/chat/completions \ -H "Authorization: Bearer $LIHO_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gemini-3.8-flash", "max_tokens": 512, "stream": true, "messages": [ {"role": "user", "content": "Explain what an API gateway is in two sentences."} ] }'pythonstream = client.chat.completions.create( model="gemini-3.8-flash", max_tokens=512, stream=True, messages=[{"role": "user", "content": "Explain what an API gateway is in two sentences."}], ) for chunk in stream: if chunk.choices and chunk.choices[0].delta.content: print(chunk.choices[0].delta.content, end="", flush=True) if chunk.usage: print("\n", chunk.usage) # the last chunk carries tokens and cost in rublesPick a model
Model ids and prices per 1M tokens are in the catalog. You switch models with the
Model catalogmodelfield alone. Supported parameters differ between models; each model card lists them.
What you get
- A working
lh_…key and a tested API request. - The cost of every request in rubles, in the response and under “Logs”.
- A request template for curl, Python or TypeScript that you can move into your own app.
Limits
- Only
POST /v1/chat/completionsis supported. There is no Responses API, embeddings, image generation or audio. - Without
max_tokens(ormax_completion_tokens) a request returns error400. - The Anthropic protocol (
/v1/messages) is not supported. - Structured output (
response_format) andstopare currently not enabled for any model in the catalog. - The documentation in the dashboard opens after sign-in. Without signing in,
openapi.yamlandllms.txtare available. - A key is shown only when it is created. If you lose it, revoke it and create a new one.