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

# Quickstart: Make Your First Request

> Make your first Lava AI gateway request in under 5 minutes

In this quickstart, you'll route your first AI request through Lava's AI Gateway to track usage and costs. Routing through Lava is just a REST POST request — you swap the base URL and auth header, and everything else stays the same.

> [!NOTE]
>
> **Building with an AI agent?** See the [Agents guide](https://lava.so/docs/agents/route-traffic.md) for how to do this programmatically from code.

**1. Get Your Secret Key**

Use your existing secret key (`aks_live_...`). Secret keys are enabled on request: email [support@lava.so](mailto:support@lava.so) to get API access for your account.

> [!WARNING]
>
> New developer Secret Key creation is temporarily paused for all accounts,
> including automatic creation through the dashboard and SDK/CLI login.
> Existing keys continue to work. This quickstart requires an existing key.

```bash theme={null}
export LAVA_SECRET_KEY=aks_live_your_key_here
```

**2. Make Your First Request**

Use your secret key in the `Authorization` header. The request body stays unchanged from the provider's API.

> [tab] cURL
>
> ```bash theme={null}
> curl -X POST 'https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions' \
>   -H 'Content-Type: application/json' \
>   -H "Authorization: Bearer $LAVA_SECRET_KEY" \
>   -d '{
>     "model": "gpt-4o-mini",
>     "messages": [{ "role": "user", "content": "Say hello in one sentence." }]
>   }'
> ```

> [tab] SDK
>
> ```typescript theme={null}
> import { Lava } from '@lavapayments/nodejs';
>
> const lava = new Lava();
>
> const data = await lava.gateway('https://api.openai.com/v1/chat/completions', {
>   body: {
>     model: 'gpt-4o-mini',
>     messages: [{ role: 'user', content: 'Say hello in one sentence.' }]
>   }
> });
> ```

> [tab] TypeScript
>
> ```typescript theme={null}
> const response = await fetch(
>   'https://api.lava.so/v1/forward?u=' +
>     encodeURIComponent('https://api.openai.com/v1/chat/completions'),
>   {
>     method: 'POST',
>     headers: {
>       'Content-Type': 'application/json',
>       'Authorization': `Bearer ${process.env.LAVA_SECRET_KEY}`
>     },
>     body: JSON.stringify({
>       model: 'gpt-4o-mini',
>       messages: [{ role: 'user', content: 'Say hello in one sentence.' }]
>     })
>   }
> );
>
> const data = await response.json();
> ```

**3. Check the Dashboard**

Go to **[Analytics > Requests](https://lava.so/dashboard/monetize/explore)** in your dashboard. Find your request by timestamp or request ID to see token counts, cost breakdown, model, and provider — all captured automatically.

See the [Forward Proxy guide](https://lava.so/docs/gateway/forward-proxy.md) for multi-provider examples, streaming, error handling, and advanced configuration.

## What's Next?

> [card] [Charge Your First Customer](https://lava.so/docs/get-started/quickstart-charge.md)
>
> Set up pricing and checkout to monetize your AI service

> [card] [How Lava Works](https://lava.so/docs/gateway/how-lava-gateway-works.md)
>
> Understand Lava's architecture, gateway routing, and key concepts

## Troubleshooting

> [accordion] Where is my secret key?
>
> Secret keys are enabled on request. Email [support@lava.so](mailto:support@lava.so) to get API access for your account.

> [accordion] 401 Unauthorized
>
> Verify you included the `Bearer` prefix in the Authorization header and that your secret key matches the one in your dashboard. See the [Forward Proxy troubleshooting](https://lava.so/docs/gateway/forward-proxy.md#troubleshooting) for more details.

> [accordion] 402 Insufficient Balance
>
> Your Lava wallet needs funds. Go to **Wallet > Billing** to add a payment method.

> [accordion] What about forward tokens?
>
> Using your secret key directly is the simplest way to get started — costs are charged to your merchant wallet. When you need to **bill customers**, you'll use a **forward token** instead: a base64-encoded JSON that bundles your secret key with a `customer_id` and `meter_slug`. See the [Forward Proxy guide](https://lava.so/docs/gateway/forward-proxy.md) and [SDK reference](https://lava.so/docs/sdk/nodejs.md) for details.


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