Trismegistus API
One key, one base URL, every model. The API is OpenAI-compatible — point any OpenAI SDK at our base URL and call any model by its slug. Frontier models route direct to the vendor; you get one bill in credits.
https://trismegistus.app/api/v1Quickstart
Install the OpenAI SDK, set your key, and make your first call.
from openai import OpenAI
client = OpenAI(base_url="https://trismegistus.app/api/v1", api_key="$TRISMEGISTUS_API_KEY")
resp = client.chat.completions.create(
model="anthropic/claude-sonnet-4.6",
messages=[{"role": "user", "content": "Explain consensus in one sentence."}],
)
print(resp.choices[0].message.content)Authentication
Every request needs a bearer token. Create a key in your account — it starts with tris_. Send it in the Authorization header.
Authorization: Bearer tris_xxxxxxxxxxxxxxxxxxxxChat completions
POST /chat/completions — identical shape to OpenAI. The model field takes any slug from the catalog.
curl https://trismegistus.app/api/v1/chat/completions \
-H "Authorization: Bearer $TRISMEGISTUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4.1",
"messages": [{"role": "user", "content": "Hello!"}],
"temperature": 0.7,
"max_tokens": 512
}'The response includes an x_trismegistus.credits_charged field so you can reconcile spend per call.
Streaming
Set stream: true for token-by-token Server-Sent Events, in the same data: {...} chunk format as OpenAI, terminated by data: [DONE].
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://trismegistus.app/api/v1", apiKey: process.env.TRISMEGISTUS_API_KEY });
const stream = await client.chat.completions.create({
model: "google/gemini-2.5-flash",
messages: [{ role: "user", content: "Write a haiku about routing." }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}List models
GET /models returns every available model with pricing, context, and capabilities.
curl https://trismegistus.app/api/v1/models -H "Authorization: Bearer $TRISMEGISTUS_API_KEY"Embeddings
POST /embeddings — OpenAI-compatible. Route across providers by slug (openai/, google/, together/) to compare price and quality.
client.embeddings.create(
model="together/BAAI/bge-large-en-v1.5",
input=["The quick brown fox", "jumps over the lazy dog"],
)Entity API (multi-model)
Beyond single models, you can call a saved Entity — a multi-model blend with judging and synthesis (our Ensemble differentiator) — by its slug: POST /api/v1/chat with { "entity": "<slug>", "message": "…" }. Build one in the builder.
Pricing & credits
Usage is billed in credits. Every plan and credit pack shows exactly what you pay — no surprise per-token math. Per-model prices are on each model's page. Track spend in Credits.
Errors & rate limits
Errors use OpenAI's shape:
{ "error": { "message": "…", "type": "invalid_request_error" } }401— missing/invalid key402— out of credits404— unknown model (see/models)429— plan rate limit; upgrade for higher throughput