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 openai package, or Node.js with the openai package.

Steps

  1. 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 LLM
  2. Top 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.

  3. 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.

    shell
    export LIHO_API_KEY="lh_…"
  4. Send a request

    Requests go to https://llm.liho.dev/v1/chat/completions. The model, messages and max_tokens fields are required: max_tokens caps 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 change base_url and the key.

    shell
    curl 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."}
        ]
      }'
  5. Check the cost

    The usage field of the response holds the token counts and cost, 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 cost field; the final amount appears in “Logs”.

  6. Turn on streaming

    With "stream": true the response arrives in parts as SSE and ends with data: [DONE]. The last chunk before it carries usage with the cost. A response can take up to 15 minutes, so set the client timeout to at least 900 seconds.

    shell
    curl -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."}
        ]
      }'
  7. Pick a model

    Model ids and prices per 1M tokens are in the catalog. You switch models with the model field alone. Supported parameters differ between models; each model card lists them.

    Model catalog

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/completions is supported. There is no Responses API, embeddings, image generation or audio.
  • Without max_tokens (or max_completion_tokens) a request returns error 400.
  • The Anthropic protocol (/v1/messages) is not supported.
  • Structured output (response_format) and stop are currently not enabled for any model in the catalog.
  • The documentation in the dashboard opens after sign-in. Without signing in, openapi.yaml and llms.txt are available.
  • A key is shown only when it is created. If you lose it, revoke it and create a new one.