CAELUM

Quick start

From install to your first saved API call in under five minutes.

1. Install (30 seconds)

pip install "caelum-ai[openai]"        # OpenAI
pip install "caelum-ai[anthropic]"     # Anthropic
pip install "caelum-ai[openai,anthropic,rich]"  # both, with pretty metrics

Python 3.10 or later. No server, no database, no account.

2. Change one line

from caelum import OpenAI  # was: from openai import OpenAI

client = OpenAI(cache=True)  # reads OPENAI_API_KEY, like the SDK

response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "How do I return an item?"}],
)
print(response.choices[0].message.content)

Run the same request twice: the second answer comes from the local cache, instantly and for free.

3. See what you saved

client.metrics.print_summary()
CAELUM Local Metrics
Requests:          2
Cache hits:        1 (50%)
Cost saved:    $ 0.000007
Cost spent:    $ 0.000007
Avg latency:     310ms
p95 latency:     600ms

4. Go further

import caelum
from caelum import OpenAI

client = OpenAI(
    cache=True,
    semantic_cache=True,  # paraphrases reuse answers (sends the question to the embeddings API)
    retry=True,
)
response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "How can I send back a product?"}],
)
caelum.cache_type(response)  # "exact", "semantic" or None
  • Caching — exact and semantic cache.
  • Routing — send requests to cheaper models with simple rules.
  • Reliability — retries and multi-provider fallback.