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

Get Your Forward Token

A self forward token is auto-generated when you sign up. Go to Developers > Secrets in your dashboard, copy it, and save it as an environment variable:
export LAVA_FORWARD_TOKEN=your_copied_token_here
What’s a “self” token? It’s a forward token that isn’t linked to a customer or meter — perfect for testing. No additional setup required. Learn more in the Forward Proxy guide.
2

Make Your First Request

Your forward token goes in the Authorization header, and the request body stays unchanged from the provider’s API.
curl -X POST 'https://api.lavapayments.com/v1/forward?u=https%3A%2F%2Fapi.openai.com%2Fv1%2Fchat%2Fcompletions' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $LAVA_FORWARD_TOKEN" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [{ "role": "user", "content": "Say hello in one sentence." }]
  }'
3

Check the Dashboard

Go to Analytics > Requests 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 for multi-provider examples, streaming, error handling, and advanced configuration.

What’s Next?

Troubleshooting

Go to Gateway > Secrets. If the section is missing, verify you’re logged into a merchant account (not a wallet-only account).
Verify you copied the complete token and included the Bearer prefix in the Authorization header. See the Forward Proxy troubleshooting for more details.
Your Lava wallet needs funds. Go to Wallet > Billing to add a payment method.
A secret key is your base credential. A forward token combines your secret key + connection + meter into a single auth token for API calls. The self forward token charges your own wallet and is auto-generated for testing. For production, you’ll generate tokens per-customer using the SDK.