LlamaIndex

LlamaIndex has an OpenAI-like LLM for any OpenAI-compatible endpoint. Give it the base URL, your key and the model's context length.

What you need

  • Base URLhttps://api.opencheap.si/v1
  • API keyA kl_live_… key from the console, kept in OPENCHEAP_API_KEY.
  • ModelAn id from Models, for example claude-sonnet-5.
pip install llama-index-llms-openai-like

The LLM

import os
from llama_index.llms.openai_like import OpenAILike

llm = OpenAILike(
    model="claude-sonnet-5",
    api_base="https://api.opencheap.si/v1",
    api_key=os.environ["OPENCHEAP_API_KEY"],
    is_chat_model=True,
    is_function_calling_model=True,
    context_window=1000000,
)
print(llm.complete("Say hello in five words."))

for r in llm.stream_complete("Count from 1 to 5."):
    print(r.delta, end="", flush=True)

OpenAILike cannot look a model up, so say what it is: is_chat_model sends chat requests, is_function_calling_model lets agents and chat_with_tools use tools, and context_window is the model's context length from the Models page. Leave is_function_calling_model off for a model that cannot call tools.

Tool calls

from llama_index.core.tools import FunctionTool

def multiply(a: int, b: int) -> int:
    """Multiply two integers."""
    return a * b

resp = llm.chat_with_tools([FunctionTool.from_defaults(fn=multiply)], user_msg="What is 6 times 7? Use the tool.")
print(llm.get_tool_calls_from_response(resp, error_on_no_tool_call=False))

What was checked

Run on October 28, 2026 with llama-index-llms-openai-like 0.8.1 and llama-index-core 0.14.25 on claude-sonnet-5: complete, stream_complete and chat_with_tools as above; the tool call came back as multiply with a=6 and b=7.