OpenAILike with api_base swap.
Check out our upcoming events and meetups! View events →
OpenAILike with api_base swap.
pip install llama-index-core llama-index-llms-openai-like
import os
from llama_index.llms.openai_like import OpenAILike
from llama_index.core.llms import ChatMessage
llm = OpenAILike(
api_base="https://api.telnyx.com/v2/ai/openai",
api_key=os.getenv("TELNYX_API_KEY"),
model="moonshotai/Kimi-K2.6",
is_chat_model=True,
)
chat = llm.stream_chat([ChatMessage(role="user", content="Help me plan my vacation")])
for chunk in chat:
print(chunk.delta, end="")
Was this page helpful?