@tessera-llm/langchain
v0.1.3
Published
Drop-in Tessera integration for LangChain.js. One line of config routes your existing ChatOpenAI / ChatAnthropic / ChatMistralAI / ChatGroq / ChatCohere through Tessera's auto-route + auto-cache + auto-compress + auto-batch proxy.
Downloads
571
Maintainers
Readme
@tessera-llm/langchain
Drop-in cost optimization for LangChain.js ChatModels. One line of config in your existing ChatOpenAI / ChatAnthropic / ChatMistralAI / ChatGroq / ChatCohere constructor routes your traffic through the Tessera proxy — auto-route, exact + provider-prompt-cache hits, per-role compression, output-length ceiling, batch arbitrage. Free Sandbox tier: 60M tokens/month, no card. Paid tiers: flat monthly subscription by token volume, keep 100% of savings.
Companion package to @tessera-llm/sdk — same proxy, LangChain-shaped API.
Install
npm install @tessera-llm/langchainQuickstart
import { ChatOpenAI } from "@langchain/openai";
import { tesseraOpenAIConfig } from "@tessera-llm/langchain";
const llm = new ChatOpenAI({
model: "gpt-4o",
apiKey: process.env.OPENAI_API_KEY!,
...tesseraOpenAIConfig({ apiKey: process.env.TESSERA_API_KEY! }),
});
// Existing LangChain code (chains, agents, tools, streaming) runs unchanged.
const response = await llm.invoke("Summarize a Kubernetes operator architecture in 3 bullets.");Same pattern for the other providers — tesseraAnthropicConfig, tesseraMistralConfig, tesseraGroqConfig, tesseraCohereConfig.
Or wrap an existing instance:
import { wrapOpenAI } from "@tessera-llm/langchain";
const llm = wrapOpenAI(myExistingChatOpenAI, process.env.TESSERA_API_KEY!);Free key
Get a free API key (60M tokens/mo, no card) at tesseraai.io/dev — sign-up takes ~30 seconds and returns an instant tk_… key plus magic-link dashboard access.
Documentation
Full README with worked-numbers example ($24k → $9.4k OpenAI bill cut), mechanic table, FAQ, and architecture notes:
→ github.com/tessera-llm/tessera-langchain
Tessera platform:
License
Apache-2.0. The SDK is open source; the optimization proxy at api.tesseraai.io is closed. Wire format is open; mechanic implementations are not.
