Tīrtha is still being built, so some features and models may not work as expected yet. Billing always follows the prices shown. Something broken? Email [email protected].

Tīrtha

Use the SDK you already have

Point the OpenAI SDK, the Vercel AI SDK, LangChain or LiteLLM at Tīrtha by changing the base URL and the key.

Switch from OpenAI in one line

Tīrtha speaks the OpenAI chat completions API. Keep the SDK you use and change two settings: the base URL to https://api.tirtha.ai/v1 and the key to your Tīrtha key (from your dashboard). Keep the key in an environment variable, here TIRTHA_API_KEY, not in a file you commit.

# pip install openai
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.tirtha.ai/v1",
    api_key=os.environ["TIRTHA_API_KEY"],
)
resp = client.chat.completions.create(
    model="catalog/qwen3.8-flash",
    messages=[{"role": "user", "content": "Say hello in five words."}],
    max_tokens=64,
)
print(resp.choices[0].message.content)
// npm install openai   (save as hello.mjs, run: node hello.mjs)
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.tirtha.ai/v1",
  apiKey: process.env.TIRTHA_API_KEY,
});
const resp = await client.chat.completions.create({
  model: "catalog/qwen3.8-flash",
  messages: [{ role: "user", content: "Say hello in five words." }],
  max_tokens: 64,
});
console.log(resp.choices[0].message.content);

Python: Tested with openai 3.57.0 on 2026-11-23: this exact code, with only the base URL and key pointed at our test server. JavaScript: Tested with openai 7.62.0 on 2026-11-23: this exact code, with only the base URL and key pointed at our test server.

Pick a model

Use tirtha/auto to let Tīrtha pick the model for each request, or catalog/<slug> for one model. The examples use catalog/qwen3.8-flash; every model page on Models shows its id and price.

Streaming

Add stream=True and read the chunks as they arrive. Some chunks carry no text (the first and the last), so check before you print.

Tested with openai 3.57.0 on 2026-11-23: this exact code, with only the base URL and key pointed at our test server.

# pip install openai
import os
from openai import OpenAI

client = OpenAI(base_url="https://api.tirtha.ai/v1", api_key=os.environ["TIRTHA_API_KEY"])
stream = client.chat.completions.create(
    model="catalog/qwen3.8-flash",
    messages=[{"role": "user", "content": "Count from one to five."}],
    max_tokens=64,
    stream=True,
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)
print()

Vercel AI SDK

Use the OpenAI-compatible provider and give it our base URL. The provider name is your own label.

Tested with ai 7.0.179, @ai-sdk/openai-compatible 3.0.94 on 2026-11-23: this exact code, with only the base URL and key pointed at our test server.

// npm install ai @ai-sdk/openai-compatible   (save as hello.mjs, run: node hello.mjs)
import { generateText } from "ai";
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";

const tirtha = createOpenAICompatible({
  name: "tirtha",
  baseURL: "https://api.tirtha.ai/v1",
  apiKey: process.env.TIRTHA_API_KEY,
});
const { text } = await generateText({
  model: tirtha("catalog/qwen3.8-flash"),
  prompt: "Say hello in five words.",
  maxOutputTokens: 64,
});
console.log(text);

LangChain

ChatOpenAI takes the base URL and key directly.

Tested with langchain-openai 1.8.5 on 2026-11-23: this exact code, with only the base URL and key pointed at our test server.

# pip install langchain-openai
import os
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="catalog/qwen3.8-flash",
    base_url="https://api.tirtha.ai/v1",
    api_key=os.environ["TIRTHA_API_KEY"],
    max_tokens=64,
)
print(llm.invoke("Say hello in five words.").content)

LiteLLM

LiteLLM needs the openai/ prefix on the model id, and the base URL without /chat/completions.

Tested with litellm 1.110.2 on 2026-11-23: this exact code, with only the base URL and key pointed at our test server.

# pip install litellm
import os
import litellm

resp = litellm.completion(
    model="openai/catalog/qwen3.8-flash",
    api_base="https://api.tirtha.ai/v1",
    api_key=os.environ["TIRTHA_API_KEY"],
    messages=[{"role": "user", "content": "Say hello in five words."}],
    max_tokens=64,
)
print(resp.choices[0].message.content)

Coding tools

OpenCode, Cline, Roo Code, Kilo Code, Continue, Aider and Cursor are set up in their own settings, not in code: see Coding tools. They use the same three settings as above: base URL, key and model.

Checked against the API code on 2026-11-23. Tīrtha is still being built; limits and fields may change, and this page changes with them.