> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wanderersguide.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate AI text

> Bounded AI completions for signed-in Wanderer’s Guide accounts.



## OpenAPI

````yaml POST /open-ai-request
openapi: 3.1.0
info:
  title: Wanderer's Guide API
  description: >-
    Public HTTP API for Wanderer's Guide, the Pathfinder 2e character builder.
    Every endpoint is a Supabase Edge Function reached via `POST
    /functions/v1/<name>`. All responses follow the
    [JSend](https://github.com/omniti-labs/jsend) convention: `{ status:
    'success' | 'fail' | 'error', data?, message? }`.
  version: 1.0.0
  contact:
    name: Wanderer's Guide Discord
    url: https://discord.com/invite/FxsFZVvedr
  license:
    name: MIT
    url: https://github.com/wanderers-guide/wanderers-guide/blob/main/LICENSE
servers:
  - url: https://api.wanderersguide.app/functions/v1
    description: Production
  - url: '{supabaseUrl}/functions/v1'
    description: Self-hosted Supabase
    variables:
      supabaseUrl:
        default: http://127.0.0.1:54321
        description: Base URL of your Supabase instance, including scheme and port.
security:
  - apiKeyAuth: []
tags:
  - name: Content
    description: 'Pathfinder 2e content: spells, items, feats, ancestries, classes, etc.'
  - name: Characters
    description: Player characters.
  - name: Campaigns
    description: Campaigns and encounters.
  - name: GM
    description: 'Game-master tools: group management, access codes.'
  - name: Users
    description: Public user profiles, account management, Patreon integration.
  - name: Search
    description: Full-text and advanced search across content.
  - name: Files
    description: User-uploaded portrait and background images.
  - name: Integrations
    description: Vector DB and Discord webhooks.
paths:
  /open-ai-request:
    post:
      tags:
        - Integrations
      summary: Generate AI text
      description: >-
        Requires a verified, non-anonymous signed-in WG account; no subscription
        gate. Only gpt-4o-mini and gpt-4o are supported. 256 KiB wire limit and
        25-second upstream deadline. Each started 4,000-character input block
        costs one daily work unit for gpt-4o-mini or ten for gpt-4o. Limits are
        100 units per account and 5,000 globally. Failed or timed-out upstream
        calls retain their quota reservation because work may already be billed.
      operationId: openAiRequest
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - content
              properties:
                content:
                  type: string
                  minLength: 1
                  maxLength: 64000
                model:
                  type: string
                  enum:
                    - gpt-4o-mini
                    - gpt-4o
                  default: gpt-4o
      responses:
        '200':
          description: JSend success containing generated text.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - success
                  data:
                    type: string
        '400':
          description: Invalid input or unsupported model.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSendFail'
        '401':
          description: Sign in with a real user session.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSendFail'
        '403':
          description: A WG profile is required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSendFail'
        '413':
          description: Request body exceeds 256 KiB.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSendFail'
        '429':
          description: Daily work or admission budget exhausted; Retry-After is in seconds.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSendFail'
        '502':
          description: Upstream request failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSendError'
        '503':
          description: >-
            Service configuration or shared quota is unavailable; no upstream
            call is made.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSendError'
        '504':
          description: Upstream request timed out.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSendError'
components:
  schemas:
    JSendFail:
      type: object
      required:
        - status
        - data
      properties:
        status:
          type: string
          enum:
            - fail
        data:
          type: object
          properties:
            message:
              type: string
    JSendError:
      type: object
      required:
        - status
        - message
      properties:
        status:
          type: string
          enum:
            - error
        message:
          type: string
        data: {}
        code:
          type: integer
  securitySchemes:
    apiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key (UUID, 36 chars)
      description: >-
        API key created in your Wanderer's Guide account settings. Send as
        `Authorization: Bearer <key>`. Used for direct API access from external
        tools and scripts.

````