LibraOS model API
The LibraOS model API serves models from several providers behind one key. Use it from the self-hosted Runtime, from your own code, or from a coding agent such as Claude Code or Codex.
| Base URL | |
|---|---|
| OpenAI-compatible | https://api.libraos.com/v1 |
| Anthropic-compatible | https://api.libraos.com |
The endpoints are chat completions (POST /v1/chat/completions), embeddings
(POST /v1/embeddings), the model list (GET /v1/models), the OpenAI
Responses API (POST /v1/responses) and the Anthropic Messages API
(POST /v1/messages). The model API does not provide web search; see
Web search.
Get a key
- Sign in at console.libraos.com.
- Open API keys and choose Create a key under Model API keys.
- Give it a name. Optionally limit it to some models (comma-separated; empty allows every model) and set its requests per minute.
- Copy the secret. It starts with
lk_and is shown once; LibraOS keeps only a fingerprint of it.
Send the key as Authorization: Bearer lk_… or x-api-key: lk_…. Keep keys
on servers: never put one in a web page or a mobile app. Manage on a key
rotates it (the old secret stops at once) or revokes it.
Model names
Name a model with its provider prefix, as on the price list on the Console's Credits & billing page, for example:
anthropic/claude-opus-5-5openai/gpt-6.1-solopenai/gpt-5.6-solQwen/Qwen3-Embedding-8B(embeddings)
A bare name that matches exactly one model the key may call also works.
GET /v1/models lists the models a key may call:
curl https://api.libraos.com/v1/models \
-H "Authorization: Bearer $LIBRAOS_API_KEY"
Clients
These are the Console's own examples. Replace lk_… with your key, or read
it from an environment variable.
curl
curl https://api.libraos.com/v1/chat/completions \
-H "Authorization: Bearer $LIBRAOS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"openai/gpt-5.6-terra","messages":[{"role":"user","content":"Hello"}]}'
OpenAI SDK and other OpenAI-compatible clients:
from openai import OpenAI
client = OpenAI(base_url="https://api.libraos.com/v1", api_key="lk_…")
Anthropic SDK:
from anthropic import Anthropic
client = Anthropic(base_url="https://api.libraos.com", api_key="lk_…")
Claude Code, with an anthropic/… model:
export ANTHROPIC_BASE_URL=https://api.libraos.com
export ANTHROPIC_API_KEY=lk_…
claude --model anthropic/claude-sonnet-5-5
Codex, with an openai/… model. In ~/.codex/config.toml:
model_provider = "libraos"
model = "openai/gpt-5.6-terra"
[model_providers.libraos]
name = "LibraOS"
base_url = "https://api.libraos.com/v1"
env_key = "LIBRAOS_API_KEY"
wire_api = "responses"
then export LIBRAOS_API_KEY=lk_….
The self-hosted Runtime
Point the Runtime's model settings at the OpenAI-compatible base URL:
export OPENAI_API_BASE=https://api.libraos.com/v1
export OPENAI_API_KEY='lk_...'
export OPENAI_MODEL='anthropic/claude-opus-5-5'
With no embedding settings, the Runtime also embeds through this endpoint with
Qwen/Qwen3-Embedding-8B. See Model settings for the other
model slots, and Getting started for a full first run.
Any other OpenAI-compatible gateway, or a local model server, also works with the Runtime; the LibraOS model API is one choice.
Billing and limits
Calls are billed to the key's account, in LibraOS credits or against a Token Plan; see Credits and billing. Calls with your own provider key or a local model are not charged by LibraOS.
| Response | Meaning |
|---|---|
401 invalid_api_key | No key, or a key that was revoked or rotated. |
402 insufficient_credits | The account's credits are used up. Buy credits on Credits & billing. |
403 model_not_allowed | The key may not call this model. Check GET /v1/models and the key's model list. |
403 account_suspended | The key's account is suspended or closed. |
429 rate_limit_exceeded | The key's requests-per-minute limit. |
429 concurrency_limit_exceeded | Too many calls from the account running at once. |
429 plan_limit_reached | A Token Plan limit is reached and Use credits after the plan limit is off. |
503 service_unavailable | The API is starting. Retry in a few seconds. |