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.
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.
Context compression
Switch from Headroom to Caveman: step by step guide
Move a coding agent or a Vercel AI SDK app from Headroom to Caveman: free port 8787, swap the wrapper or adapter, check recovery, compare, and roll back.
Switch from LLMLingua to Caveman for tool output
Move agent tool-result compression from LLMLingua to Caveman Middleware in a LangChain app, keep LLMLingua on RAG passages, check recovery, and roll back fast.
RTK alternative: try Caveman shrink and the proxy
Compare RTK and Caveman on one real command, check exit codes and byte-exact recovery, then swap the shell hook or add the proxy. Includes a one-step rollback.
Model routing
Use Caveman with Martian Gateway: compress tool output
Keep your Martian Gateway key and base URL, wrap the OpenAI client with Caveman Middleware, and send fewer input tokens from tool output. Setup and rollback.
Use Caveman with Not Diamond: add token compression
Keep Not Diamond choosing the model and wrap the provider call with Caveman Middleware so tool output costs fewer input tokens. Setup, checks and rollback.
Use Caveman with RouteLLM: route, then compress
Keep RouteLLM choosing between your strong and weak model, and send the routed call through Caveman's LiteLLM adapter so tool output costs fewer tokens.
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.
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.