Step-by-step instructions for connecting Lava to popular AI tools. In every case, the pattern is the same: set the API key to your lava_sk_* key, and point the base URL to Lava.
Which API format? Tools that use the OpenAI SDK or OpenAI-compatible APIs need the OpenAI format. Tools that use the Anthropic SDK (like Claude Code) need the Anthropic format. When in doubt, start with OpenAI.
Vercel AI SDK
Use Lava as your OpenAI-compatible backend in any Vercel AI SDK app.
Create a Spend Key
Go to Dashboard > AI Spend and click Create Spend Key. Set the API format to OpenAI (/v1/chat/completions), choose the model(s) you want, and copy the key.
Configure Lava in your app
Add your spend key as an environment variable:Then create an OpenAI client pointed at Lava: Run and verify usage
Send a test prompt from your app. You’ll see spend and usage on your AI Spend dashboard for that key.
Claude Code
Route Claude Code requests through Lava using Anthropic-format spend keys.
Create a Spend Key in Anthropic format
Go to Dashboard > AI Spend, click Create Spend Key, and set the API format to Anthropic (/v1/messages).
Point Claude Code to Lava
Set these environment variables before launching Claude Code: Run Claude Code
Start Claude Code as normal. Requests now go through Lava’s /v1/messages path and usage is tracked in AI Spend.
Anthropic SDK
Use a Lava spend key with any Anthropic-style client or agent runtime.
Create a Spend Key for Anthropic format
Go to Dashboard > AI Spend, click Create Spend Key, and set the API format to Anthropic (/v1/messages).
Set Anthropic environment variables
Keep the base URL at https://api.lava.so (without /v1). Anthropic clients automatically append /v1/messages.
Use the Anthropic client as usual
Most Anthropic-based agent SDKs use the same ANTHROPIC_API_KEY and base URL settings, so once those are set, requests route through Lava automatically.
Cursor
Create a Spend Key
Go to Dashboard > AI Spend and create a key with OpenAI (/v1/chat/completions) format.
Configure Cursor
In Cursor, go to Settings > Models > OpenAI API Key. Paste your lava_sk_* key and set the base URL to https://api.lava.so/v1.
Start coding
Select a model and start coding. Usage appears in your AI Spend dashboard.
Raycast
Create a Spend Key
Go to Dashboard > AI Spend and create a key with OpenAI (/v1/chat/completions) format.
Configure Raycast
Open Raycast > Settings > Extensions > AI. Under provider settings, add a custom OpenAI-compatible provider:
- API Key: your
lava_sk_* key
- Base URL:
https://api.lava.so/v1
Start chatting
Pick a model and start chatting. Usage is tracked in AI Spend.
OpenClaw
Use Lava as a custom OpenAI-compatible provider in OpenClaw.
Create a Spend Key
Go to Dashboard > AI Spend and create a key with OpenAI (/v1/chat/completions) format.
Add Lava to your agent's model config
In your agent’s model config (e.g. ~/.openclaw/agents/<agentId>/agent/models.json): Select a Lava model
Choose one of the model IDs you configured. OpenClaw will route calls through Lava with spend controls and usage tracking.
LangChain
Connect LangChain to Lava using ChatOpenAI custom base URL support.
Create a Spend Key
Go to Dashboard > AI Spend and create a key with OpenAI (/v1/chat/completions) format.
Install LangChain OpenAI package
Use ChatOpenAI with Lava base URL
Verify in AI Spend
Run a request and confirm usage appears on your AI Spend dashboard.
Cline
Create a Spend Key
Go to Dashboard > AI Spend and create a key with OpenAI (/v1/chat/completions) format.
Authenticate Cline against Lava
Run Cline normally
Start Cline and run a prompt. Calls route through Lava with your key limits and usage tracking.
Codex CLI
Use Lava as a custom model provider in OpenAI Codex CLI.
Create a Spend Key
Go to Dashboard > AI Spend and create a key with OpenAI (/v1/chat/completions) format.
Set the environment variable
Start Codex
Run codex as normal. Requests route through Lava, and usage appears in AI Spend.