LlamaIndex LLM integration for thalam. — one OpenAI-compatible endpoint for every leading AI model.
Project description
llama-index-llms-thalam
LlamaIndex LLM integration for thalam. — one OpenAI-compatible endpoint for every leading AI model.
Built in the UAE. Text, image, and video models from a single endpoint, with per-key spend caps and audit logs as a built-in governance layer.
- One endpoint — DeepSeek, Qwen, Kimi, GLM, MiniMax, Claude, GPT, Llama, Grok, Mistral and more
- Drop-in LlamaIndex compatibility — RAG, query engines, agents, streaming, async all work unchanged
- Pay per token — no subscription, no minimums
- AED or USD invoicing on Enterprise contracts
Install
pip install llama-index-llms-thalam
Sign up at thalam.ai — no card required: new accounts get $1 in starter credit to use right away, then add a card to top up.
Quickstart
import os
from llama_index.llms.thalam import Thalam
os.environ["THALAM_API_KEY"] = "tl-..."
llm = Thalam(model="deepseek/deepseek-v3.2", temperature=0)
response = llm.complete("Explain quantum entanglement in 2 sentences.")
print(response.text)
Chat interface
from llama_index.core.llms import ChatMessage
from llama_index.llms.thalam import Thalam
llm = Thalam(model="deepseek/deepseek-v3.2")
response = llm.chat([
ChatMessage(role="system", content="You are a senior MENA fintech analyst."),
ChatMessage(role="user", content="Top 3 fintech trends in the UAE in 2026?"),
])
print(response.message.content)
Streaming
from llama_index.llms.thalam import Thalam
llm = Thalam(model="deepseek/deepseek-v3.2")
for chunk in llm.stream_complete("Write a haiku about Dubai."):
print(chunk.delta, end="", flush=True)
Async
import asyncio
from llama_index.llms.thalam import Thalam
async def main():
llm = Thalam(model="deepseek/deepseek-v3.2")
response = await llm.acomplete("Hi")
print(response.text)
asyncio.run(main())
Use as the global default LLM (RAG / query engines)
from llama_index.core import Settings, VectorStoreIndex, SimpleDirectoryReader
from llama_index.llms.thalam import Thalam
Settings.llm = Thalam(model="deepseek/deepseek-v3.2")
documents = SimpleDirectoryReader("./docs").load_data()
index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine()
print(query_engine.query("Summarise these documents."))
Tool calling (function calling)
from llama_index.core.tools import FunctionTool
from llama_index.llms.thalam import Thalam
def get_weather(city: str) -> dict:
"""Get the weather in a city."""
return {"temp": 32, "unit": "C", "city": city}
weather_tool = FunctionTool.from_defaults(fn=get_weather)
llm = Thalam(model="deepseek/deepseek-v4-pro")
response = llm.predict_and_call(
[weather_tool],
"What's the weather in Dubai?",
)
print(response)
Structured prediction
from pydantic import BaseModel, Field
from llama_index.llms.thalam import Thalam
class BlogMetadata(BaseModel):
title: str = Field(description="The post title")
tags: list[str] = Field(description="3-5 relevant tags")
llm = Thalam(model="deepseek/deepseek-v3.2")
result = llm.structured_predict(
BlogMetadata,
"Generate metadata for a blog post about MENA fintech.",
)
print(result.title, result.tags)
Available models
The full live catalog is at thalam.ai/models or via:
import os, requests
r = requests.get(
"https://api.thalam.ai/v1/models",
headers={"Authorization": f"Bearer {os.environ['THALAM_API_KEY']}"},
)
for m in r.json()["data"]:
print(m["id"], "-", m["display_name"], "-", m["category"])
Common text-model IDs:
| ID | Notes |
|---|---|
deepseek/deepseek-v4-pro |
Flagship reasoning, 1M context |
deepseek/deepseek-v4-flash |
Fast, low-cost |
deepseek/deepseek-v3.2 |
Strong general intelligence |
deepseek/deepseek-r1-0528 |
Open reasoning |
qwen/qwen3-max |
Frontier multilingual + Arabic |
qwen/qwen3.5-397b-a17b |
Large MoE, top open quality |
qwen/qwen3-coder-480b-a35b-instruct |
Coding flagship |
zhipu/glm-5.1 |
Multimodal-capable |
moonshotai/kimi-k2-thinking |
Long-context reasoning |
anthropic/claude-opus-4.8 |
Flagship reasoning (via gateway) |
anthropic/claude-opus-4.7 |
Premium reasoning (via gateway) |
anthropic/claude-sonnet-4.6 |
Balanced (via gateway) |
openai/gpt-5.4 |
OpenAI flagship (via gateway) |
xai/grok-4 |
xAI flagship |
meta-llama/llama-3.3-70b-instruct |
Open Llama |
Configuration
from llama_index.llms.thalam import Thalam
llm = Thalam(
model="deepseek/deepseek-v3.2",
api_key="tl-...", # default: env THALAM_API_KEY
api_base="https://api.thalam.ai/v1", # default
context_window=131072, # set 1_000_000 for v4-pro
is_function_calling_model=True,
temperature=0.7,
max_tokens=512,
timeout=60,
max_retries=2,
)
Every keyword argument that llama_index.llms.openai_like.OpenAILike accepts is supported.
Context window note
The default context_window is conservative at 128k. For 1M-context models like deepseek/deepseek-v4-pro, pass context_window=1_000_000 to let LlamaIndex pack the full prompt budget.
Links
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llama_index_llms_thalam-0.1.0.tar.gz.
File metadata
- Download URL: llama_index_llms_thalam-0.1.0.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6e2aae70f5f08030e553b333eb94f31bf66989e454d3e95c10a8567cf962a47
|
|
| MD5 |
196f60d182863cfc7acf4cf648006cd7
|
|
| BLAKE2b-256 |
d90ea512f31702fb11c4a4fe2d04ac5bbc0b8671c72694e3ed38b75d72e61095
|
File details
Details for the file llama_index_llms_thalam-0.1.0-py3-none-any.whl.
File metadata
- Download URL: llama_index_llms_thalam-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68693e55fc2c7e41f88163ea7985eb14538a457d7fe759dad323496225a978d1
|
|
| MD5 |
6acd99f991ac7e7f66a55ec6893579e4
|
|
| BLAKE2b-256 |
980950e5e252664ebc8624294a92fd8bb149a84939dbaa40e2bc35df80b1db19
|