> ## Documentation Index
> Fetch the complete documentation index at: https://lava.so/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Tool Setup Guides

> Connect Lava spend keys to Cursor, Claude Code, Raycast, Vercel AI SDK, and more

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.

> [!TIP]
>
> **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**

```bash theme={null}
npm install ai @ai-sdk/openai
```

**3. Configure Lava in your app**

Add your spend key as an environment variable:

```bash theme={null}
export LAVA_SPEND_KEY="lava_sk_your_key_here"
```

Then create an OpenAI client pointed at Lava:

```ts theme={null}
import { streamText } from 'ai';
import { createOpenAI } from '@ai-sdk/openai';

const lava = createOpenAI({
  apiKey: process.env.LAVA_SPEND_KEY,
  baseURL: 'https://api.lava.so/v1',
});

const result = await streamText({
  model: lava('claude-opus-4-6'),
  messages: [{ role: 'user', content: 'Write a one-line release note.' }],
});

for await (const textPart of result.textStream) {
  process.stdout.write(textPart);
}
```

**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:

```bash theme={null}
export ANTHROPIC_AUTH_TOKEN="lava_sk_your_key_here"
export ANTHROPIC_BASE_URL="https://api.lava.so"
```

**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**

```bash theme={null}
export ANTHROPIC_API_KEY="lava_sk_your_key_here"
export ANTHROPIC_BASE_URL="https://api.lava.so"
```

> [!NOTE]
>
> Keep the base URL at `https://api.lava.so` (without `/v1`). Anthropic clients automatically append `/v1/messages`.

**3. Use the Anthropic client as usual**

```ts theme={null}
import Anthropic from '@anthropic-ai/sdk';

const client = new Anthropic({
  apiKey: process.env.ANTHROPIC_API_KEY,
  baseURL: process.env.ANTHROPIC_BASE_URL,
});

const response = await client.messages.create({
  model: 'claude-opus-4-6',
  max_tokens: 512,
  messages: [{ role: 'user', content: 'Summarize this in one paragraph.' }],
});

console.log(response.content);
```

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`):

```json5 theme={null}
{
  models: {
    mode: "merge",
    providers: {
      lava: {
        baseUrl: "https://api.lava.so/v1",
        apiKey: "lava_sk_your_key_here",
        api: "openai-completions",
        models: [
          { id: "claude-opus-4-6", name: "Claude Opus 4.6" },
          { id: "gpt-4o", name: "GPT-4o" }
        ]
      }
    }
  }
}
```

**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**

```bash theme={null}
npm install @langchain/openai @langchain/core
```

**3. Use ChatOpenAI with Lava base URL**

```ts theme={null}
import { ChatOpenAI } from "@langchain/openai";

const llm = new ChatOpenAI({
  model: "claude-opus-4-6",
  apiKey: process.env.LAVA_SPEND_KEY,
  configuration: {
    baseURL: "https://api.lava.so/v1",
  },
});

const response = await llm.invoke("Give me 3 bullet points about this repo.");
console.log(response.content);
```

**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**

```bash theme={null}
cline auth -p openai -k lava_sk_your_key_here -b https://api.lava.so/v1 -m claude-opus-4-6
```

**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**

```bash theme={null}
export LAVA_SPEND_KEY="lava_sk_your_key_here"
```

**3. Add Lava to Codex config**

In `~/.codex/config.toml`:

```toml theme={null}
model = "claude-opus-4-6"
model_provider = "lava"

[model_providers.lava]
name = "Lava"
base_url = "https://api.lava.so/v1"
env_key = "LAVA_SPEND_KEY"
wire_api = "chat"
```

**4. Start Codex**

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


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.