Caveman / Switching

A clear path from your current stack.

Move an optimization workflow to Caveman, or add it beside your current tools. Each guide covers setup, validation, and rollback.

01

AI gateways

How to add Caveman to Bifrost: step by step setup

Keep Bifrost as your AI gateway and wrap one agent's client with Caveman Middleware to send fewer tool-result tokens. Setup, checks, and a one-line rollback.

Add Caveman to Cloudflare AI Gateway

Wrap your OpenAI client with Caveman Middleware, keep the Cloudflare AI Gateway compat URL, and compare token counts in gateway analytics. Rollback included.

Add Caveman to Helicone: compress tool output

Keep your Helicone AI gateway and session logs. Wrap the OpenAI client with Caveman Middleware, compare two tagged sessions, and roll back in one line.

How to add Caveman to LiteLLM: SDK, Router and proxy

Add the Caveman callback to LiteLLM step by step: start the runtime, wrap one agent's calls, confirm tool results shrink, and turn it off with one setting.

Add Caveman to OpenRouter: wrap the OpenAI client

Keep your OpenRouter key, models and headers. Wrap the OpenAI client with Caveman Middleware, pin one model to measure fairly, then compare usage or roll back.

How to add Caveman to Portkey without changing configs

Keep Portkey as your gateway and wrap one agent's OpenAI client with Caveman Middleware. Step by step setup, how to confirm it in Portkey logs, and rollback.

Add Caveman to Vercel AI Gateway with the AI SDK

Wrap your Vercel AI Gateway model with withCaveman, keep budgets and fallbacks, and compare input tokens in the gateway logs. Covers Functions and rollback.

02

Context compression

03

Model routing

04

Agent observability

Add Caveman to AgentOps: compress a CrewAI crew

Keep AgentOps recording your crew. Wrap one CrewAI agent with Caveman Middleware, compare two tagged AgentOps sessions, and roll back by removing one wrapper.

Add Caveman to Arize Phoenix: trace and grade compression

Keep Arize Phoenix tracing your agent. Wrap it with Caveman Middleware, run one Phoenix experiment per mode, and check that quality held before you roll it out.

Add Caveman to Braintrust: run it as an Eval

Add Caveman Middleware to a Vercel AI SDK agent logged to Braintrust, then run one Braintrust Eval in record and compress mode to check quality before shipping.

Add Caveman to Langfuse: setup and quality check

Keep Langfuse tracing and add Caveman Middleware to a Python agent, then run one Langfuse dataset experiment in record and compress mode to confirm quality.

Add Caveman to LangSmith: setup and eval check

Add Caveman Middleware to a LangChain or LangGraph agent traced in LangSmith, then compare a record and a compress experiment to confirm answers held up.

Add Caveman to PromptLayer without touching prompts

Keep PromptLayer's registry, labels and logs. Call through a Caveman-wrapped OpenAI client, log both arms with tags, and score them in one PromptLayer Table.

05

Agent frameworks

How to add Caveman Middleware to a LangGraph agent

Add token compression to a LangGraph agent through LangChain middleware: install caveman-middleware, start the runtime, wrap create_agent, scope by thread_id.

How to add token compression to a Mastra agent

Add Caveman Middleware to an existing Mastra agent with withCavemanMastra: install, start the local runtime, wrap the agent, check the reports and roll back.

How to add token compression to Pydantic AI agents

Add Caveman Middleware to a Pydantic AI agent as one capability: install the extra, start the local runtime, add CavemanCapability, check reports, roll back.

How to add token compression to the Vercel AI SDK

Add Caveman Middleware to a Vercel AI SDK app in one wrap: install, start the local runtime, wrap streamText with withCaveman, read the reports, roll back.