Skip to main content
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.
1

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.
2

Install dependencies

3

Configure Lava in your app

Add your spend key as an environment variable:
Then create an OpenAI client pointed at Lava:
4

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.
1

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).
2

Point Claude Code to Lava

Set these environment variables before launching Claude Code:
3

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.
1

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).
2

Set Anthropic environment variables

Keep the base URL at https://api.lava.so (without /v1). Anthropic clients automatically append /v1/messages.
3

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

1

Create a Spend Key

Go to Dashboard > AI Spend and create a key with OpenAI (/v1/chat/completions) format.
2

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.
3

Start coding

Select a model and start coding. Usage appears in your AI Spend dashboard.

Raycast

1

Create a Spend Key

Go to Dashboard > AI Spend and create a key with OpenAI (/v1/chat/completions) format.
2

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
3

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.
1

Create a Spend Key

Go to Dashboard > AI Spend and create a key with OpenAI (/v1/chat/completions) format.
2

Add Lava to your agent's model config

In your agent’s model config (e.g. ~/.openclaw/agents/<agentId>/agent/models.json):
3

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.
1

Create a Spend Key

Go to Dashboard > AI Spend and create a key with OpenAI (/v1/chat/completions) format.
2

Install LangChain OpenAI package

3

Use ChatOpenAI with Lava base URL

4

Verify in AI Spend

Run a request and confirm usage appears on your AI Spend dashboard.

Cline

1

Create a Spend Key

Go to Dashboard > AI Spend and create a key with OpenAI (/v1/chat/completions) format.
2

Authenticate Cline against Lava

3

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.
1

Create a Spend Key

Go to Dashboard > AI Spend and create a key with OpenAI (/v1/chat/completions) format.
2

Set the environment variable

3

Add Lava to Codex config

In ~/.codex/config.toml:
4

Start Codex

Run codex as normal. Requests route through Lava, and usage appears in AI Spend.