Skip to content
Lumean

AI API: connecting and requests

How to connect to Lumean language and image models over the OpenAI and Anthropic protocols. Base URL, key, endpoints, streaming, limits and errors.

The AI API is an entry point to language and image models, separate from orders. It speaks the OpenAI and Anthropic protocols, so any client that works with OpenAI or Anthropic will do: SDKs, curl, Cursor, Claude Code, Codex CLI, opencode. You don't change the client code, only the base URL and the key.

Image generation is covered in AI API: images. Prices and spending are covered in AI API: prices and spending.

Base URL

ClientBase URL
OpenAI SDK, curl, Cursor, Codex CLI, opencode, Continue, Clinehttps://api.lumean.app/v1
Anthropic SDK, Claude Codehttps://api.lumean.app (no /v1)

The Anthropic SDK and Claude Code append /v1/messages themselves. If you give them a URL with /v1, the path is doubled and the request gets 404.

The AI API doesn't live under /api/public like orders do. It lives directly under /v1.

Key

Any API key from My API keys works, the same one you use for orders. The key's permissions (orders.read and others) aren't checked here. The only requirement is that the "AI" checkbox is on in the key settings. It's on for a new key. With the checkbox off, the request gets 401 not_a_gateway_key.

Send the key in one of these headers:

Authorization: Bearer <key>
x-api-key: <key>

OpenAI clients send Authorization themselves, Anthropic clients send x-api-key.

In the key settings you can set a monthly AI spending limit. The calendar month is counted in UTC. When spending reaches the limit, requests get 402 key_budget_exceeded until the next month starts.

Payment

The AI API is paid only from the LUMC balance, at the model's price per token or per call. Subscription tokens and quotas aren't spent here. If the balance runs short, the request gets 402 insufficient_quota. More in AI API: prices and spending.

Models

Pass the model name in the model field, for example gpt-image-2.5-sunburst or claude-opus-5-5. The catalog with prices and descriptions is on the Models page.

From code, you can get the model list in two ways:

  • GET /v1/models is a list in the OpenAI shape: name, kind (chat or image), context size and the response ceiling. It has no prices.
  • GET /api/public/ai/models is the same list with current prices and model capabilities. It's described in the reference below.

Endpoints

Method and pathWhat it does
POST /v1/chat/completionsOpenAI-format chat. Supports streaming, tools (function calling), response_format and image input
POST /v1/responsesOpenAI Responses format, used by Codex CLI
POST /v1/messagesAnthropic Messages format, used by Claude Code and the Anthropic SDK
POST /v1/messages/count_tokensEstimates the number of input tokens. Free
GET /v1/models, GET /v1/models/{id}The model list, or one model
POST /v1/images/generationsAn image from a description
POST /v1/images/editsAn image from a description and reference images

Every response carries an X-Request-Id header. If you write to support about a specific request, include it.

First request

curl https://api.lumean.app/v1/chat/completions \
  -H "Authorization: Bearer $LUMEAN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.4",
    "messages": [{"role": "user", "content": "Hi! Tell me a joke."}]
  }'

The response is in the OpenAI shape, and token usage is in the usage field:

{
  "id": "chatcmpl-…",
  "object": "chat.completion",
  "model": "gpt-5.4",
  "choices": [{
    "index": 0,
    "message": {"role": "assistant", "content": "…"},
    "finish_reason": "stop"
  }],
  "usage": {"prompt_tokens": 14, "completion_tokens": 52, "total_tokens": 66}
}

The model name in the example is for illustration. Use a model from the catalog.

Connecting apps and SDKs

Ready-made settings with your key are in your dashboard, in the AI connection section, and on each model's page. The same settings in general form:

OpenAI SDK (Python)

from openai import OpenAI

client = OpenAI(base_url="https://api.lumean.app/v1", api_key="LUMEAN_API_KEY")

reply = client.chat.completions.create(
    model="<model>",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(reply.choices[0].message.content)

OpenAI SDK (JavaScript)

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.lumean.app/v1", apiKey: "LUMEAN_API_KEY" });

Anthropic SDK (Python): the URL has no /v1:

from anthropic import Anthropic

client = Anthropic(base_url="https://api.lumean.app", api_key="LUMEAN_API_KEY")

Claude Code: environment variables, the URL has no /v1:

export ANTHROPIC_BASE_URL=https://api.lumean.app
export ANTHROPIC_AUTH_TOKEN=<key>
export ANTHROPIC_MODEL=<model>
export ANTHROPIC_SMALL_FAST_MODEL=<model>

Codex CLI: the ~/.codex/config.toml file:

model = "<model>"
model_provider = "lumean"

[model_providers.lumean]
name = "Lumean"
base_url = "https://api.lumean.app/v1"
env_key = "LUMEAN_API_KEY"
wire_api = "responses"

opencode: the opencode.json file:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "lumean": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Lumean",
      "options": { "baseURL": "https://api.lumean.app/v1", "apiKey": "{env:LUMEAN_API_KEY}" },
      "models": { "<model>": { "name": "<name>" } }
    }
  }
}

Cursor: Settings → Models. Paste the key into the OpenAI API Key field, turn on Override OpenAI Base URL and enter https://api.lumean.app/v1, then add the model name.

Continue: the config.yaml file:

models:
  - name: Lumean
    provider: openai
    model: <model>
    apiBase: https://api.lumean.app/v1
    apiKey: <key>

Cline and Roo Code: use the "OpenAI Compatible" provider. Set Base URL to https://api.lumean.app/v1, then enter the key and the model name.

Streaming and long responses

With stream: true the response arrives in parts (SSE), as with OpenAI and Anthropic. An OpenAI-format stream ends with the line data: [DONE].

If the model hasn't started responding within 20 seconds, the stream still opens: you get 200, and then a : ping line every 15 seconds until the response appears. This is a service SSE comment. Standard SDKs and EventSource skip it, and a hand-written stream parser must skip lines that start with :.

An error after the stream has opened arrives as an event in the stream itself, without data: [DONE]. The SDK will throw an exception, but it won't retry the request on its own.

Warning

Without streaming, the full response arrives only after the model finishes. If generation takes longer than two minutes, an intermediate proxy on the api.lumean.net mirror may drop the connection. Turn on stream: true for long responses.

Reasoning effort

The client sets how much the model reasons before answering, in the request body. The AI API passes this field to the provider unchanged.

FormatFieldValues
POST /v1/messages"output_config": {"effort": "low"}low, medium, high, xhigh, max
POST /v1/responses"reasoning": {"effort": "low"}per the model's documentation
POST /v1/chat/completions"reasoning_effort": "low"per the model's documentation

Reasoning is paid as output tokens, so a high level costs noticeably more. For Claude models, /v1/messages is more reliable: in /v1/chat/completions the field may get lost when the request is translated to the provider's format.

What's not supported

  • The provider's built-in tools that it bills separately: web search, page fetching, code execution, mcp_servers. In /v1/responses and /v1/messages such a request gets 400 unsupported_tool. Regular tools (function calling) and the agents' client-side tools (bash, text_editor, computer, apply_patch and similar) work.
  • Response storage in /v1/responses: responses aren't saved, so previous_response_id, conversation and background: true get 400 unsupported_parameter. Pass the whole conversation in input.
  • Expensive service modes: in /v1/responses and /v1/messages service_tier accepts only auto, default, flex and standard_only.
  • n greater than 1 for images.
  • If a model doesn't work in the chosen format, the request gets 404 endpoint_not_supported. Use /v1/chat/completions then.

Limits

LimitValueResponse
Requests per minute for one key300429 rate_limit_exceeded and a Retry-After header
Concurrent requests for one keylimited429 concurrent_requests_limit_exceeded and a Retry-After header
Request body size32 MiB413 request_too_large
Model response without streamingthe response must start within 300 seconds502 upstream_timeout

Errors

Errors come in the OpenAI shape:

{
  "error": {
    "message": "No API key provided. Send it as `Authorization: Bearer <key>` or `X-API-KEY: <key>`.",
    "type": "authentication_error",
    "param": null,
    "code": "missing_api_key"
  }
}

On /v1/messages they come in the Anthropic shape: {"type": "error", "error": {"type": "…", "message": "…"}}.

CodecodeCauseWhat to do
401missing_api_keyNo key in the requestSend the key in Authorization: Bearer or x-api-key
401unknown_key, key_inactive, key_expiredThe key isn't found, is off or has expiredCheck the key in My API keys
401not_a_gateway_keyThe "AI" checkbox is off for the keyTurn it on in the key settings
402insufficient_quotaNot enough LUMC on the balanceTop up the balance
402key_budget_exceededThe key used up its monthly limitRaise the key's limit or wait for the next month
400invalid_request_body, missing_required_parameterThe request body is invalid or lacks a required fieldFix the request using the message text
400unsupported_parameter, unsupported_toolThe parameter or tool isn't supportedSee the "What's not supported" section
400context_length_exceededThe conversation doesn't fit the model's contextShorten the conversation or pick a model with a bigger context
404model_not_found, model_disabledThe model doesn't exist or is temporarily offPick another model from the catalog
404endpoint_not_supportedThe model doesn't work in this formatUse /v1/chat/completions
413request_too_largeThe body is larger than 32 MiBReduce the attachments
429rate_limit_exceeded, concurrent_requests_limit_exceededThe key's limit is exceededWait Retry-After seconds
429provider_keys_coolingThe model's provider has a temporary capRetry later or pick another model
502upstream_timeout, upstream_errorThe model's provider didn't respond or returned an errorRetry the request
503gateway_at_capacity, catalog_unavailable, quota_check_unavailableTemporary overloadRetry in a few seconds

Errors that occur only with images are listed in AI API: images.

This page for AI

Open .mdllm.md

Updated 12/01/2026 · API version 1.0.0