basePath: /
definitions:
  proxy.ErrorResponse:
    properties:
      error:
        example: unauthorized
        type: string
    type: object
info:
  contact:
    name: go-llm-proxy
  description: Multi-provider LLM gateway. Bring your own OpenAI, Anthropic, Gemini,
    Groq, Mistral, DeepSeek, xAI, OpenRouter, or Azure OpenAI key and call it through
    this proxy. Get your RavenGate API key from the dashboard at gate.ravenlabs.studio.
  title: go-llm-proxy API
  version: "1.0"
paths:
  /azure/deployments/{deployment}/chat/completions:
    post:
      consumes:
      - application/json
      description: Forwards to your Azure OpenAI / Microsoft Foundry resource. Requires
        X-Azure-Endpoint (e.g. https://<resource>.openai.azure.com) in addition to
        the usual auth headers.
      parameters:
      - description: Azure deployment name
        in: path
        name: deployment
        required: true
        type: string
      - description: Your Azure OpenAI resource endpoint
        in: header
        name: X-Azure-Endpoint
        required: true
        type: string
      - description: Free-form app label, recorded in usage analytics
        in: header
        name: X-App-Name
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: Upstream Azure OpenAI response, unchanged
          schema:
            type: object
        "401":
          description: invalid/revoked proxy key, or missing X-Provider-Key
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "402":
          description: monthly or daily spend cap reached
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "429":
          description: per-key rate limit exceeded
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "503":
          description: RavenGate backing store temporarily unavailable — retry (never
            a credential problem)
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
      security:
      - ProxyKeyAuth: []
      - ProviderKeyAuth: []
      summary: Chat completions — Azure OpenAI
      tags:
      - gateway
  /deepseek/v1/chat/completions:
    post:
      consumes:
      - application/json
      description: Forwards to api.deepseek.com/v1/chat/completions. Point your OpenAI-compatible
        SDK's base_url at this proxy with the /deepseek prefix and set X-Provider-Key
        to your DeepSeek key.
      parameters:
      - description: Free-form app label, recorded in usage analytics
        in: header
        name: X-App-Name
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: Upstream DeepSeek response, unchanged
          schema:
            type: object
        "401":
          description: invalid/revoked proxy key, or missing X-Provider-Key
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "402":
          description: monthly or daily spend cap reached
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "429":
          description: per-key rate limit exceeded
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "503":
          description: RavenGate backing store temporarily unavailable — retry (never
            a credential problem)
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
      security:
      - ProxyKeyAuth: []
      - ProviderKeyAuth: []
      summary: Chat completions — DeepSeek
      tags:
      - gateway
  /groq/v1/chat/completions:
    post:
      consumes:
      - application/json
      description: Forwards to api.groq.com/openai/v1/chat/completions. Point your
        OpenAI-compatible SDK's base_url at this proxy with the /groq prefix and set
        X-Provider-Key to your Groq key.
      parameters:
      - description: Free-form app label, recorded in usage analytics
        in: header
        name: X-App-Name
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: Upstream Groq response, unchanged
          schema:
            type: object
        "401":
          description: invalid/revoked proxy key, or missing X-Provider-Key
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "402":
          description: monthly or daily spend cap reached
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "429":
          description: per-key rate limit exceeded
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "503":
          description: RavenGate backing store temporarily unavailable — retry (never
            a credential problem)
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
      security:
      - ProxyKeyAuth: []
      - ProviderKeyAuth: []
      summary: Chat completions — Groq
      tags:
      - gateway
  /mistral/v1/chat/completions:
    post:
      consumes:
      - application/json
      description: Forwards to api.mistral.ai/v1/chat/completions. Point your OpenAI-compatible
        SDK's base_url at this proxy with the /mistral prefix and set X-Provider-Key
        to your Mistral key.
      parameters:
      - description: Free-form app label, recorded in usage analytics
        in: header
        name: X-App-Name
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: Upstream Mistral response, unchanged
          schema:
            type: object
        "401":
          description: invalid/revoked proxy key, or missing X-Provider-Key
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "402":
          description: monthly or daily spend cap reached
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "429":
          description: per-key rate limit exceeded
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "503":
          description: RavenGate backing store temporarily unavailable — retry (never
            a credential problem)
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
      security:
      - ProxyKeyAuth: []
      - ProviderKeyAuth: []
      summary: Chat completions — Mistral
      tags:
      - gateway
  /openrouter/v1/chat/completions:
    post:
      consumes:
      - application/json
      description: Forwards to openrouter.ai/api/v1/chat/completions. Point your OpenAI-compatible
        SDK's base_url at this proxy with the /openrouter prefix and set X-Provider-Key
        to your OpenRouter key.
      parameters:
      - description: Free-form app label, recorded in usage analytics
        in: header
        name: X-App-Name
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: Upstream OpenRouter response, unchanged
          schema:
            type: object
        "401":
          description: invalid/revoked proxy key, or missing X-Provider-Key
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "402":
          description: monthly or daily spend cap reached
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "429":
          description: per-key rate limit exceeded
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "503":
          description: RavenGate backing store temporarily unavailable — retry (never
            a credential problem)
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
      security:
      - ProxyKeyAuth: []
      - ProviderKeyAuth: []
      summary: Chat completions — OpenRouter
      tags:
      - gateway
  /v1/chat/completions:
    post:
      consumes:
      - application/json
      description: 'Forwards the request body unchanged (byte-for-byte; the only mutations
        are the proxy-only `cache` field strip, optional plan-gated PII redaction,
        and `stream_options.include_usage` injection on streaming requests) to api.openai.com.
        Default route: anything that doesn''t match one of the other 8 providers below
        (so /v1/responses etc. also land here).'
      parameters:
      - description: Free-form app label, recorded in usage analytics
        in: header
        name: X-App-Name
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: Upstream OpenAI response, unchanged
          schema:
            type: object
        "401":
          description: invalid/revoked proxy key, or missing X-Provider-Key
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "402":
          description: monthly or daily spend cap reached
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "429":
          description: per-key rate limit exceeded
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "503":
          description: RavenGate backing store temporarily unavailable — retry (never
            a credential problem)
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
      security:
      - ProxyKeyAuth: []
      - ProviderKeyAuth: []
      summary: Chat completions — OpenAI
      tags:
      - gateway
  /v1/messages:
    post:
      consumes:
      - application/json
      description: Forwards the request body unchanged to api.anthropic.com/v1/messages
        — native Anthropic format, no OpenAI-shape translation (byte-for-byte; the
        only mutations are the proxy-only `cache` field strip and optional plan-gated
        PII redaction). The proxy sets anthropic-version automatically.
      parameters:
      - description: Free-form app label, recorded in usage analytics
        in: header
        name: X-App-Name
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: Upstream Anthropic response, unchanged
          schema:
            type: object
        "401":
          description: invalid/revoked proxy key, or missing X-Provider-Key
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "402":
          description: monthly or daily spend cap reached
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "429":
          description: per-key rate limit exceeded
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "503":
          description: RavenGate backing store temporarily unavailable — retry (never
            a credential problem)
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
      security:
      - ProxyKeyAuth: []
      - ProviderKeyAuth: []
      summary: Messages — Anthropic (Claude)
      tags:
      - gateway
  /v1beta/models/{model}:generateContent:
    post:
      consumes:
      - application/json
      description: Forwards the request body unchanged to generativelanguage.googleapis.com
        — native Gemini format, no OpenAI-shape translation (byte-for-byte; the only
        mutations are the proxy-only `cache` field strip and optional plan-gated PII
        redaction). Use :streamGenerateContent?alt=sse for streaming.
      parameters:
      - description: Gemini model, e.g. gemini-2.5-flash
        in: path
        name: model
        required: true
        type: string
      - description: Free-form app label, recorded in usage analytics
        in: header
        name: X-App-Name
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: Upstream Gemini response, unchanged
          schema:
            type: object
        "401":
          description: invalid/revoked proxy key, or missing X-Provider-Key
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "402":
          description: monthly or daily spend cap reached
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "429":
          description: per-key rate limit exceeded
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "503":
          description: RavenGate backing store temporarily unavailable — retry (never
            a credential problem)
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
      security:
      - ProxyKeyAuth: []
      - ProviderKeyAuth: []
      summary: Generate content — Google Gemini
      tags:
      - gateway
  /xai/v1/chat/completions:
    post:
      consumes:
      - application/json
      description: Forwards to api.x.ai/v1/chat/completions. Point your OpenAI-compatible
        SDK's base_url at this proxy with the /xai prefix and set X-Provider-Key to
        your xAI key.
      parameters:
      - description: Free-form app label, recorded in usage analytics
        in: header
        name: X-App-Name
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: Upstream xAI response, unchanged
          schema:
            type: object
        "401":
          description: invalid/revoked proxy key, or missing X-Provider-Key
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "402":
          description: monthly or daily spend cap reached
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "429":
          description: per-key rate limit exceeded
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
        "503":
          description: RavenGate backing store temporarily unavailable — retry (never
            a credential problem)
          schema:
            $ref: '#/definitions/proxy.ErrorResponse'
      security:
      - ProxyKeyAuth: []
      - ProviderKeyAuth: []
      summary: Chat completions — xAI (Grok)
      tags:
      - gateway
schemes:
- https
- http
securityDefinitions:
  ProviderKeyAuth:
    description: Your own API key for the target provider (OpenAI, Anthropic, Gemini,
      Groq, Mistral, DeepSeek, xAI, OpenRouter, or Azure OpenAI)
    in: header
    name: X-Provider-Key
    type: apiKey
  ProxyKeyAuth:
    description: Your RavenGate API key, created from the dashboard — prefix with
      "Bearer "
    in: header
    name: Authorization
    type: apiKey
swagger: "2.0"
