LangChain
Overview
Any framework built on the OpenAI SDK works unchanged.
You need a LIBRA API key (libra_sk_...) from the console (API keys > Create key), and the base URL https://<your-host>/v1.
Installation
pip install langchain-openai
Configure LIBRA
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="libra/smart", base_url="https://<your-host>/v1", api_key="libra_sk_...")
print(llm.invoke("Siapa kamu?").content)
Quick start (up and running in 5 minutes)
- Install, paste the snippet, run it.
- Open Usage in the console: the call is there with its IDR cost.
FAQ
- 404 / timeout? The base URL is missing
/v1or has an extra/chat/completions. Use exactlyhttps://<your-host>/v1. - Model not found? Model ids are case-sensitive and must match the console Models page, e.g.
libra/smartorasix-deepseek-v4/deepseek-v4-flash. - 401? The key is wrong, disabled or expired. 402? Your organization balance is Rp 0; see Credits.
- 403
model_not_allowed? The key's guardrails block that model. Ask your workspace Admin or pick another model.