Lyber
Request access
DocsOpenAI SDKs

Integrations

Markdown

OpenAI SDKs

Use the official OpenAI Python and TypeScript SDKs by changing the base URL.

Install

terminal
pip install openai

Configure the client

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"],
)

Send a request

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)

Lyber-only fields

Fields that aren't part of the OpenAI schema, such as max_cost_micro_usdc or thinking_token_budget, go in extra_body in Python. In TypeScript, add them to the request object.

Retries

The OpenAI SDKs retry some failed requests by default. Lyber never deduplicates requests, so a retried request can run, and bill, twice. Set max_retries=0 (Python) or maxRetries: 0 (TypeScript) and retry yourself, only on 429 with x-lyber-admission: not-admitted or on errors returned before the request started.