overlay: 1.0.0
x-speakeasy-jsonpath: rfc9535
info:
  title: Add HTTP-Referer and X-OpenRouter-Title as global parameters
  version: 0.0.0
actions:
  # Add global parameters for app identification
  - target: $
    description: Add x-speakeasy-globals for HTTP-Referer, X-OpenRouter-Title, and X-OpenRouter-Categories headers
    update:
      x-speakeasy-globals:
        parameters:
          - $ref: "#/components/parameters/AppIdentifier"
          - $ref: "#/components/parameters/AppDisplayName"
          - $ref: "#/components/parameters/AppCategories"

  # Add component parameters
  - target: $.components
    description: Add parameters for app identification headers
    update:
      parameters:
        AppIdentifier:
          name: HTTP-Referer
          in: header
          schema:
            type: string
          description: |
            The app identifier should be your app's URL and is used as the primary identifier for rankings.
            This is used to track API usage per application.
        AppDisplayName:
          name: X-OpenRouter-Title
          in: header
          schema:
            type: string
          description: |
            The app display name allows you to customize how your app appears in OpenRouter's dashboard.
        AppCategories:
          name: X-OpenRouter-Categories
          in: header
          schema:
            type: string
          description: |
            Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.

  # Add header parameters to all paths so Speakeasy matches them with globals
  - target: $.paths[*]
    description: Reference app identification headers on all paths so Speakeasy injects them via globals
    update:
      parameters:
        - $ref: "#/components/parameters/AppIdentifier"
        - $ref: "#/components/parameters/AppDisplayName"
        - $ref: "#/components/parameters/AppCategories"
