Setup
Install the LlamaIndex packages and OpenAI-compatible adapters:Global Settings Configuration
Use the LlamaIndexSettings module to set both the generation LLM and the embedding provider globally.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Get a Virtual Private Server for just Rp 20,000 - the perfect fit for your server needs. Get here
Build production RAG pipelines and index custom data using Neosantara and LlamaIndex.
pip install -U llama-index llama-index-llms-openai-like llama-index-embeddings-openai-like
export NEOSANTARA_API_KEY="nsk_your_api_key_here"
NEOSANTARA_API_KEY=nsk_your_api_key_here
$env:NEOSANTARA_API_KEY="nsk_your_api_key_here"
Settings module to set both the generation LLM and the embedding provider globally.
import os
from llama_index.core import Settings
from llama_index.llms.openai_like import OpenAILike
from llama_index.embeddings.openai_like import OpenAILikeEmbedding
Settings.llm = OpenAILike(
model="deepseek-v4.1-flash",
api_key=os.environ["NEOSANTARA_API_KEY"],
api_base="https://api.neosantara.xyz/v1",
temperature=0.2,
max_tokens=1024,
is_chat_model=True
)
Settings.embed_model = OpenAILikeEmbedding(
model="text-embedding-3-small",
api_key=os.environ["NEOSANTARA_API_KEY"],
api_base="https://api.neosantara.xyz/v1"
)
import os
from llama_index.core import Document, VectorStoreIndex, Settings
from llama_index.llms.openai_like import OpenAILike
from llama_index.embeddings.openai_like import OpenAILikeEmbedding
# 1. Configure generation and embedding models
Settings.llm = OpenAILike(
model="deepseek-v4.1-flash",
api_key=os.environ["NEOSANTARA_API_KEY"],
api_base="https://api.neosantara.xyz/v1",
is_chat_model=True
)
Settings.embed_model = OpenAILikeEmbedding(
model="text-embedding-3-small",
api_key=os.environ["NEOSANTARA_API_KEY"],
api_base="https://api.neosantara.xyz/v1"
)
# 2. Define source documents
documents = [
Document(text="Neosantara is Indonesia's AI Gateway providing Rupiah PAYG billing and multi-provider routing."),
Document(text="The Free tier rate limits are 10 RPM, 30,000 ITPM, and 8,000 OTPM with a minimum deposit floor of IDR 50,000."),
Document(text="The Indonesian UU PDP No. 27/2022 automated PII guardrail is enabled per-request via the X-Guard: on header.")
]
# 3. Build vector index
index = VectorStoreIndex.from_documents(documents)
# 4. Instantiate query engine and ask questions
query_engine = index.as_query_engine(similarity_top_k=2)
response = query_engine.query("How do developers enable Indonesian PII redaction on Neosantara?")
print("Answer:", response)
query_engine = index.as_query_engine(streaming=True)
streaming_response = query_engine.query("What are the rate limits for the Free tier?")
for text in streaming_response.response_gen:
print(text, end="", flush=True)
print()
| Workflow | Embedding Model | Generation Model (LLM) |
|---|---|---|
| High Throughput & Low Cost | text-embedding-3-small | gemini-3.8-flash |
| Deep Synthesis & Long Documents | text-embedding-3-small | deepseek-v4.1-flash |
| High Precision & Legal Compliance | text-embedding-3-large | claude-4.5-sonnet |