Skip to main content

Tessera SDK — drop-in LLM cost optimization. One line patches OpenAI, Anthropic, Mistral, Groq, Cohere clients to route through Tessera's auto-route + auto-cache + auto-compress + auto-batch proxy. Free tier: 60M tokens/mo. Production: 20% of measured savings, $0 if none.

Project description

tessera-llm-proxy

PyPI version Python

Drop-in cost optimization for LLM applications. One line of code patches your existing OpenAI / Anthropic / Mistral / DeepSeek / Groq / Together / Fireworks / OpenRouter / Perplexity / Cerebras / xAI client to route through Tessera's measurement + auto-optimize proxy. You keep your provider account and keys; we route + cache + compress and measure savings on every request.

Free Dev tier: 60M tokens / month · no card required · no fee until you upgrade. Get your free key at tesseraai.io/dev.

Get a free API key

Get free key (email + ToS, 30 seconds, no card)

After signup you get:

  • Your tk_ API key (shown once)
  • A magic-link for the dashboard — see your token counter + savings counter live
  • 60M tokens/month at 10 req/min — generous for hobby + side projects

Install

pip install tessera-llm-proxy

One-line setup

Drop this at the top of your application's entry point (main.py, app.py, manage.py, wherever your app boots):

import tessera
tessera.activate("tk_your_tessera_key")

That's it. Your existing code runs unchanged — openai.OpenAI(), anthropic.Anthropic(), mistralai.Mistral(), and other supported SDK constructors are transparently patched to route through Tessera. Your provider keys (OpenAI sk-..., Anthropic sk-ant-..., etc.) stay in your environment as before; Tessera forwards them upstream untouched.

Environment variable form

If you'd rather not put the key in code:

export TESSERA_KEY=tk_your_tessera_key
import tessera
tessera.activate()  # reads TESSERA_KEY from environment

What gets patched

Calling tessera.activate(...) patches the following SDKs at import time (each is opt-in: only patched if the library is installed):

SDK Tessera route
openai (≥1.0) https://api.tesseraai.io/v1/openai
anthropic https://api.tesseraai.io/v1/anthropic
mistralai https://api.tesseraai.io/v1/mistral
cohere https://api.tesseraai.io/v1/cohere (Wave 2)
groq https://api.tesseraai.io/v1/groq

If you use a framework that wraps these SDKs (LangChain, LlamaIndex, CrewAI, AutoGen, Mastra, Pydantic AI, etc.), the patch applies transparently because those frameworks call the underlying SDK constructors which are what we patched.

Direct provider URLs

If you call providers that aren't covered by an official Python SDK (DeepSeek, Together, Fireworks, OpenRouter, Perplexity, Cerebras, xAI), construct an openai.OpenAI client manually with the matching Tessera URL:

from openai import OpenAI

# DeepSeek via Tessera
client = OpenAI(
    api_key="sk-deepseek-...",
    base_url=tessera.url("deepseek"),  # → https://api.tesseraai.io/v1/deepseek
    default_headers=tessera.headers(),
)

# Same pattern for: together, fireworks, openrouter, perplexity, cerebras, groq, xai

tessera.url(provider) and tessera.headers() are pure helpers — no globals, no patching. Use them when you want explicit, traceable wiring.

Verification

import tessera
tessera.activate("tk_...")

assert tessera.is_active(), "Tessera should be active after activate()"
print(tessera.status())  # → ProxyStatus(active=True, providers_patched=['openai', 'anthropic'], proxy_base='https://api.tesseraai.io/v1')

Deactivation

To restore the original SDK constructors (e.g. in test teardown):

tessera.deactivate()

Configuration

tessera.activate(
    key="tk_...",                              # or TESSERA_KEY env var
    proxy_base="https://api.tesseraai.io/v1",  # default; override for staging/dev
    feature_tag="checkout-summarizer",         # attaches to every request for per-feature attribution
)

feature_tag lets you split savings reporting per workload (e.g. one tag per logical feature in your app). You can also set per-request tags by passing extra_body={"tessera_feature_tag": "..."} on individual SDK calls.

How the pricing works

  • Free Sandbox tier: 60M tokens/month, no card required, $0 fee.
  • Production tier: 20% of measured savings, debited daily from a prepaid balance you control ($100 minimum top-up via Stripe).
  • Zero savings = zero fee. If our optimization doesn't save you anything in a period, you pay nothing for that period.
  • Kill-switch available anytime from your portal — pauses optimization, traffic still flows passthrough.

Full terms: https://tesseraai.io/terms

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tessera_llm_proxy-0.1.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tessera_llm_proxy-0.1.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file tessera_llm_proxy-0.1.0.tar.gz.

File metadata

  • Download URL: tessera_llm_proxy-0.1.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for tessera_llm_proxy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0e0aa144c531c48019410ce573ce094938a988dba7e8e9ce1b76313260cadc79
MD5 89607890c5e4459878b47f6a366deaa9
BLAKE2b-256 511ad8654bfb6984c0ca88ad9ca8c4d12a2bc1c38b39ca79a9abf8e0eb33092a

See more details on using hashes here.

File details

Details for the file tessera_llm_proxy-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tessera_llm_proxy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db513778ed59e5e7f7a09d6946363b4c373b3c310aaa90f096fa5d0aeaa0590f
MD5 010a79096a51127d5c27bc476b983b3d
BLAKE2b-256 a6893541c9ef1289e01d32c093866bc63c5607961a34201fd635a2cd3cf8c8f4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page