Framework
LlamaIndex
The data/agent framework. Use its OpenAI-like LLM for any OpenAI-compatible endpoint.
Step by step
01
Install
pip install llama-index-llms-openai-like
02
Create the LLM
OpenAILike with model, api_base and api_key below.
03
Run it
Call .complete("Hello").
Copy this
llamaindex
from llama_index.llms.openai_like import OpenAILike
llm = OpenAILike(
model="YOUR_MODEL_ID", # any model id from the /models page
api_base="https://api.luxechain.si/v1",
api_key="lxc_live_YOUR_KEY",
is_chat_model=True,
)
print(llm.complete("Hello"))
OpenAILike is the right class for a non-OpenAI endpoint; it skips the strict OpenAI model check.