> ## Documentation Index
> Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# LlamaIndex Integration

> Use Telnyx Inference with LlamaIndex to build RAG applications. Configure the OpenAI-compatible client to index documents and run retrieval-augmented queries.

OpenAI-compatible. Use `OpenAILike` with `api_base` swap.

## Setup

```shell theme={null}
pip install llama-index-core llama-index-llms-openai-like
```

## Usage

```python theme={null}
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="zai-org/GLM-5.1-FP8",
    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="")
```

## RAG with Embeddings

Combine with [Telnyx Embeddings](/docs/inference/embeddings) for retrieval-augmented generation. See the [Embeddings guide](/docs/inference/embeddings) for document upload and indexing.
