Quickstart Guide
Thalam is a drop-in replacement for the OpenAI API. If you are already using the OpenAI Python SDK, you need to change exactly two things: the base_url and your api_key. Every model, parameter, and response schema stays identical.
Zero migration cost. Any framework that accepts an OpenAI client — LangChain, LlamaIndex, Instructor, Guidance, Vercel AI SDK — works out of the box. Just override the base_url.
Python example
The example below uses the official openai Python package. Install it once with pip install openai, then paste your Thalam key.
#60a5fa]">import openai
client = openai.OpenAI(
api_key=#60a5fa]">class="text-emerald-400">"tl-xxxxxxxxxxxxxxxxxxxxxxxx",
base_url=#60a5fa]">class="text-emerald-400">"https://api.thalam.ai/v1",
)
response = client.chat.completions.create(
model=#60a5fa]">class="text-emerald-400">"deepseek/deepseek-v3.2",
messages=[
{
#60a5fa]">class="text-emerald-400">"role": class="text-emerald-400">"system",
#60a5fa]">class="text-emerald-400">"content": class="text-emerald-400">"You are a helpful assistant.",
},
{
#60a5fa]">class="text-emerald-400">"role": class="text-emerald-400">"user",
#60a5fa]">class="text-emerald-400">"content": class="text-emerald-400">"Explain quantum entanglement in 2 sentences.",
},
],
temperature=0.7,
max_tokens=256,
)
#60a5fa]">print(response.choices[0].message.content)Response payload
The response is a verbatim OpenAI ChatCompletion object. Your existing response parsers, Pydantic models, and output validators need zero modification.
{
#60a5fa]">class="text-emerald-400">"id": class="text-emerald-400">"chatcmpl-9gw3kQ8fBxJvYpR2mNzLhT",
#60a5fa]">class="text-emerald-400">"object": class="text-emerald-400">"chat.completion",
#60a5fa]">class="text-emerald-400">"created": 1720012345,
#60a5fa]">class="text-emerald-400">"model": class="text-emerald-400">"deepseek/deepseek-v3.2",
#60a5fa]">class="text-emerald-400">"choices": [
{
#60a5fa]">class="text-emerald-400">"index": 0,
#60a5fa]">class="text-emerald-400">"message": {
#60a5fa]">class="text-emerald-400">"role": class="text-emerald-400">"assistant",
#60a5fa]">class="text-emerald-400">"content": class="text-emerald-400">"Quantum entanglement is a phenomenon where two particles become correlated so that measuring one instantly determines the state of the other, regardless of distance. This 'spooky action at a distance' is not a transfer of information but a fundamental correlation baked into their shared quantum state."
},
#60a5fa]">class="text-emerald-400">"finish_reason": class="text-emerald-400">"stop"
}
],
#60a5fa]">class="text-emerald-400">"usage": {
#60a5fa]">class="text-emerald-400">"prompt_tokens": 37,
#60a5fa]">class="text-emerald-400">"completion_tokens": 58,
#60a5fa]">class="text-emerald-400">"total_tokens": 95
}
}Ready to go?
Get your API key in 30 seconds — no credit card required.