Skip to content

Caveman Cloud· HostedIntegrations

Framework Integrations for Caveman Cloud

Route traffic from Vercel AI SDK, LangChain, LiteLLM, CrewAI, and Pydantic AI through Caveman Cloud. Each framework needs only a base URL and header change.

Caveman Cloud integrates with popular AI frameworks by changing the base URL and adding authentication headers. Each framework example below shows the minimal configuration needed to route calls through the gateway.

Prerequisites#

  • A Caveman Cloud account with a gateway URL (CAVE_GATEWAY_URL)
  • Your Cave API key (CAVE_API_KEY)
  • Your model provider key (e.g., OPENAI_API_KEY, ANTHROPIC_API_KEY)

Use @ai-sdk/openai-compatible for OpenAI-protocol models. The Anthropic provider takes a baseURL too. Either way, the gateway keeps each model on its native protocol.

import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { generateText } from "ai";

const caveman = createOpenAICompatible({
name: "caveman",
baseURL: `${process.env.CAVE_GATEWAY_URL}/w/{{app}}/openai/v1`,
apiKey: process.env.OPENAI_API_KEY,
headers: {
"x-cave-api-key": process.env.CAVE_API_KEY!,
"x-cave-upstream-key": process.env.OPENAI_API_KEY!, // your provider key, per request
},
});

const { text } = await generateText({
model: caveman("gpt-5.5"),
prompt: "Why is the sky blue?",
});

For Anthropic models, keep the native protocol:

import { createAnthropic } from "@ai-sdk/anthropic";

const anthropic = createAnthropic({
baseURL: `${process.env.CAVE_GATEWAY_URL}/w/{{app}}/v1`,
headers: {
"x-cave-api-key": process.env.CAVE_API_KEY!,
"x-cave-upstream-key": process.env.ANTHROPIC_API_KEY!,
},
});

Labeling traffic#

Add x-cave-agent or x-cave-workflow headers to identify different parts of your system in Traces. These labels do not grant access; they only tag requests for filtering and analysis.

Next steps#

Esc

Start here