Forward a POST request to a third-party API (like OpenAI, Anthropic, etc.) with usage tracking and billing. This is the core functionality of Lava that allows forwarding requests to AI services.
Special authentication used for the forward endpoint. Requires a base64-encoded JSON object containing secret_key, connection_secret, and product_secret. Optionally include provider_key to use your own API key for the request. When using your own API key, you can make requests that use metering only by setting both connection_secret and product_secret to null. Format: 'Bearer BASE64_ENCODED_JSON'
Optional metadata to associate with the request. Must be a JSON object with up to 100 key-value pairs, where both keys and values are strings between 1-255 characters. Keys must contain only ASCII letters, numbers, and underscores (no spaces or special characters). Alternative to metadata query parameter.
The API endpoint URL to forward the request to
Optional metadata to associate with the request. Must be a JSON object with up to 100 key-value pairs, where both keys and values are strings between 1-255 characters. Keys must contain only ASCII letters, numbers, and underscores (no spaces or special characters). Alternative to x-lava-metadata header.
Request body that will be forwarded to the AI provider API. Must include the 'model' field.
Successful response from the provider API
Response from the provider API