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

# LlamaIndex integration

> Use SynapsAI Cloud embeddings and chat models with LlamaIndex

Use SynapsAI Cloud for both LLM and embedding calls in LlamaIndex by configuring OpenAI-compatible settings.

## Environment setup

```bash theme={null}
export OPENAI_API_KEY="$SYNAPSAI_API_KEY"
export OPENAI_API_BASE="https://api.synapsai.cloud/v1"
```

## Chat + retrieval example

```python theme={null}
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, Settings
from llama_index.llms.openai import OpenAI
from llama_index.embeddings.openai import OpenAIEmbedding

Settings.llm = OpenAI(model="<YOUR_MODEL_ID>", temperature=0.2)
Settings.embed_model = OpenAIEmbedding(model="<YOUR_EMBEDDING_MODEL_ID>")

documents = SimpleDirectoryReader("example_docs/").load_data()
index = VectorStoreIndex.from_documents(documents)

query_engine = index.as_query_engine()
response = query_engine.query("What are the core steps to deploy a model?")
print(response)
```

<Tip>
  Install current LlamaIndex packages: `pip install llama-index llama-index-llms-openai llama-index-embeddings-openai`
</Tip>

See [Embeddings + FAISS](/guides/integrations-embeddings-faiss) for a lower-level embedding workflow.
