Lyber
Request access
DocsChat completions

API reference

Markdown

Create a chat completion

POST /v1/chat/completions generates the next message in a conversation, as JSON or as a stream.

main.py
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://lyber-paid-acceptance-gateway-production.up.railway.app/v1",
    api_key=os.environ["LYBER_API_KEY"],
)

response = client.chat.completions.create(
    model="minimax-m3.1-flash-abliterated",
    messages=[{"role": "user", "content": "Explain abliteration in two sentences."}],
    max_tokens=1024,
)
print(response.model)
print(response.choices[0].message.content)

Request body

FieldTypeDescription
model requiredstringminimax-m3.1-flash-abliterated or deepseek-v4.1-flash-1017-abliterated.
messages requiredarray1–4,096 messages with role system, user, assistant or tool. User content is a string or an array of text and image_url parts.
max_tokensintegerMost output tokens, reasoning included. Defaults to the model's maximum. max_completion_tokens is accepted as an alias.
temperaturenumber0–2. Defaults per model; see Models.
top_pnumber0–1.
stopstring or arrayUp to 4 sequences where generation stops.
streambooleanSend the reply as server-sent events. See Streaming.
stream_optionsobjectOnly include_usage (boolean).
toolsarrayUp to 32 function tools. See Tool calling.
tool_choicestring or objectauto, none, required, or a named function.
reasoning_effortstringPer model; see Thinking.
thinking_token_budgetintegerDeepSeek only. Cap on reasoning tokens.
max_cost_micro_usdcintegerLyber only. Refuse the request if its credit hold would exceed this. See Spending controls.

Response

response.json
{
  "id": "chatcmpl-6f1c…",
  "object": "chat.completion",
  "created": 1793491200,
  "model": "minimax-m3.1-flash-abliterated",
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "Abliteration removes the direction in a model's activations…",
      "reasoning_content": "The user wants two sentences…"
    },
    "finish_reason": "stop"
  }],
  "usage": {"prompt_tokens": 18, "completion_tokens": 96, "total_tokens": 114}
}
finish_reasonMeaning
stopThe model finished, or hit a stop sequence.
lengthThe reply reached max_tokens. Raise it, or continue in a new request.
tool_callsThe model is waiting for tool results.

Response headers

HeaderValue
x-request-idLyber's ID for the request. Quote it when you contact support.
x-lyber-modelThe model that answered.
x-lyber-revisionThe exact checkpoint revision that answered.