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

# Forward GET request

> Forward a GET request to a third-party API (like OpenAI, Anthropic, etc.) with usage tracking and billing.



## OpenAPI

````yaml /openapi.json get /forward
openapi: 3.0.0
info:
  title: Lava API
  description: >-
    Lava API enables businesses to implement usage-based billing for AI
    services. This API allows tracking, managing, and billing for third-party AI
    API usage through a forwarding system.
  version: 1.0.0
  contact:
    name: Lava support
    url: https://www.lava.so/contact
servers:
  - url: https://api.lava.so/v1/
    description: Lava API v1
security: []
tags:
  - name: Authentication
  - name: Core Endpoints
  - name: Models
  - name: Services
  - name: Requests
  - name: Wallet
  - name: Payment Methods
  - name: Spend Keys
  - name: Usage
  - name: Checkout Sessions
  - name: Customers
  - name: Plans
  - name: Subscriptions
  - name: Meters
  - name: Webhooks
  - name: Secret Keys
  - name: Credit Bundles
  - name: Gateway Settings
  - name: Skills
  - name: News Data
  - name: Search
  - name: Enrich
paths:
  /forward:
    get:
      tags:
        - Core Endpoints
      summary: Forward GET request
      description: >-
        Forward a GET request to a third-party API (like OpenAI, Anthropic,
        etc.) with usage tracking and billing.
      parameters:
        - name: u
          in: query
          required: true
          schema:
            type: string
          example: https://api.openai.com/v1/models
          description: The API endpoint URL to forward the request to
      responses:
        '200':
          description: Successful response from the provider API
          content:
            application/json:
              schema:
                type: object
                description: Response from the provider API
                additionalProperties: true
              examples:
                models-response:
                  summary: Example response from /v1/models endpoint
                  value:
                    object: list
                    data:
                      - id: gpt-4-1106-preview
                        object: model
                        created: 1699066192
                        owned_by: openai
                      - id: gpt-3.5-turbo
                        object: model
                        created: 1677610602
                        owned_by: openai
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                forward_url_missing:
                  summary: URL parameter is missing
                  value:
                    error:
                      message: >-
                        URL parameter is missing. Please include the target URL
                        using the ?u=<url> query parameter.
                      code: forward_url_missing
                      status: 400
                forward_endpoint_not_supported:
                  summary: Endpoint not supported
                  value:
                    error:
                      message: >-
                        This endpoint is not supported. Please refer to our
                        documentation for a list of available endpoints.
                      code: forward_endpoint_not_supported
                      status: 400
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                forward_token_missing:
                  summary: Forward token missing
                  value:
                    error:
                      message: >-
                        Forward token is missing. Please provide your token
                        using one of these methods: 'Authorization: Bearer
                        <key>' header, 'x-api-key: <key>' header, 'key' query
                        parameter, or 'x-goog-api-key: <key>' header.
                      code: forward_token_missing
                      status: 401
        '402':
          description: Payment required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                forward_token_customer_limit_reached:
                  summary: Customer usage limit reached
                  value:
                    error:
                      message: >-
                        Your customer has reached its usage limit. Please top up
                        your credit balance to continue using this service.
                      code: forward_token_customer_limit_reached
                      status: 402
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                forward_request_failed:
                  summary: Request forwarding failed
                  value:
                    error:
                      message: >-
                        Failed to forward your request to the target service.
                        This may be due to network issues or the target service
                        being unavailable.
                      code: forward_request_failed
                      status: 500
      security:
        - ForwardAuth: []
        - ForwardAuthAnthropic: []
        - ForwardAuthGoogle: []
        - ForwardAuthGoogleQueryParam: []
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              description: Human-readable error message describing what went wrong
              example: Invalid authentication credentials
            code:
              type: string
              description: Machine-readable error code describing what went wrong
              example: forward_token_json_invalid
            status:
              type: integer
              description: HTTP status code of the error
              example: 400
            issues:
              type: array
              items:
                type: object
                properties:
                  path:
                    type: array
                    items:
                      type: string
                    description: Path to the field that caused the validation error
                  message:
                    type: string
                    description: Error message describing the validation issue
                required:
                  - path
                  - message
              description: >-
                Optional array of specific validation issues with their paths
                and messages
              example:
                - path:
                    - model
                  message: 'Missing required field: model'
                - path:
                    - messages
                    - '0'
                    - content
                  message: Invalid message content format
          required:
            - message
            - code
            - status
      required:
        - error
  securitySchemes:
    ForwardAuth:
      type: http
      scheme: bearer
      description: >-
        Special authentication used for the forward endpoint. Requires a
        base64-encoded JSON object containing secret_key, customer_id, and
        meter_slug. 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 customer_id and meter_slug to null.
        Format: 'Bearer BASE64_ENCODED_JSON'
    ForwardAuthAnthropic:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        You can pass an x-api-key header to authenticate with the forward
        endpoint for compatibility with anthropic style clients. Requires a
        base64-encoded JSON object containing secret_key, customer_id, and
        meter_slug. 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 customer_id and meter_slug to null.
    ForwardAuthGoogle:
      type: apiKey
      in: header
      name: x-goog-api-key
      description: >-
        You can pass an x-goog-api-key header to authenticate with the forward
        endpoint for compatibility with Google style clients. Requires a
        base64-encoded JSON object containing secret_key, customer_id, and
        meter_slug. 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 customer_id and meter_slug to null.
    ForwardAuthGoogleQueryParam:
      type: apiKey
      in: query
      name: key
      description: >-
        You can pass a key query parameter to authenticate with the forward
        endpoint for compatibility with Google style clients. Requires a
        base64-encoded JSON object containing secret_key, customer_id, and
        meter_slug. 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 customer_id and meter_slug to null.

````