Skip to main content

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.

License

Apache-2.0

Metadata

Release files for llama-index-llms-thalam 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llama-index-llms-thalam 0.1.0
File Size Uploaded Provenance Actions
llama_index_llms_thalam-0.1.0.tar.gz 6.2 kB Without provenance Details for llama_index_llms_thalam-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-llms-thalam 0.1.0
File Interpreter ABI Platform Actions
llama_index_llms_thalam-0.1.0-py3-none-any.whl Python 3 none any Details for llama_index_llms_thalam-0.1.0-py3-none-any.whl

Total release size: 13.0 kB

Release files / llama_index_llms_thalam-0.1.0.tar.gz

Download URL llama_index_llms_thalam-0.1.0.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b6e2aae70f5f08030e553b333eb94f31bf66989e454d3e95c10a8567cf962a47
BLAKE2b-256 checksum
How to use checksums
d90ea512f31702fb11c4a4fe2d04ac5bbc0b8671c72694e3ed38b75d72e61095
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / llama_index_llms_thalam-0.1.0-py3-none-any.whl

Download URL llama_index_llms_thalam-0.1.0-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68693e55fc2c7e41f88163ea7985eb14538a457d7fe759dad323496225a978d1
BLAKE2b-256 checksum
How to use checksums
980950e5e252664ebc8624294a92fd8bb149a84939dbaa40e2bc35df80b1db19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for llama-index-llms-thalam 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page