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

# Analyze an image and generate a text prompt

> Analyzes an image and returns a descriptive text prompt suitable for use in generation endpoints.

Two modes are supported:
- `standalone`: produces a single `<image1>` reference tag prompt.
- `reference`: produces per-person `<imageN>` tags using gender and
  count hints, suitable for multi-person scene prompts.


No credits are deducted; this is a utility endpoint.




## OpenAPI

````yaml /openapi.yaml post /api/v2/image-to-prompt
openapi: 3.0.3
info:
  title: GoStudio API
  version: 2.0.0
  description: >
    The GoStudio v2 REST API. Every response uses a standard envelope: successes
    return `{ status, data }`; errors return `{ status, error: { type, code,
    message } }`.


    All endpoints require a **Bearer token** in the `Authorization` header. The
    one exception is the provider webhook callback, which is authenticated by
    signature.
servers:
  - url: https://www.gostudio.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Watermark Remover
    description: AI watermark removal — orchestration, model metadata, and job polling.
  - name: Photo
    description: >-
      AI photo generation — generate, recreate, and manage trained profile
      photos.
  - name: Image
    description: Image utilities — group photo composition and image-to-prompt analysis.
  - name: Media
    description: Media upload and CDN management.
  - name: Apps
    description: GoStudio application tools — age modifier and other transformations.
  - name: Job Status
    description: Generic job polling — works across all GoStudio tools.
  - name: Webhooks
    description: Endpoints called by external services, not by your application.
paths:
  /api/v2/image-to-prompt:
    post:
      tags:
        - Image
      summary: Analyze an image and generate a text prompt
      description: >
        Analyzes an image and returns a descriptive text prompt suitable for use
        in generation endpoints.


        Two modes are supported:

        - `standalone`: produces a single `<image1>` reference tag prompt.

        - `reference`: produces per-person `<imageN>` tags using gender and
          count hints, suitable for multi-person scene prompts.


        No credits are deducted; this is a utility endpoint.
      operationId: imageToPrompt
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImageToPromptRequest'
            examples:
              standalone:
                summary: Standalone mode
                value:
                  image_url: https://example.com/landscape.jpg
                  prompt_mode: standalone
              reference:
                summary: Reference mode (multi-person)
                value:
                  image_url: https://example.com/group-photo.jpg
                  prompt_mode: reference
                  reference_info:
                    num_persons: 2
                    genders:
                      - male
                      - female
      responses:
        '200':
          description: Prompt generated successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 200
                  prompt:
                    type: string
                    description: Generated text prompt describing the image.
                    example: >-
                      Two professionals, <image1> male and <image2> female,
                      standing in a modern glass office lobby with city views
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/ServerError'
        '502':
          $ref: '#/components/responses/BadGateway'
components:
  schemas:
    ImageToPromptRequest:
      type: object
      required:
        - image_url
        - prompt_mode
      properties:
        image_url:
          type: string
          format: uri
          description: HTTPS URL of the image to analyze.
          example: https://example.com/photo.jpg
        prompt_mode:
          type: string
          description: >
            Analysis mode. `standalone` produces a single `<image1>` reference
            tag. `reference` produces per-person `<imageN>` tags using gender
            and count hints.
          enum:
            - standalone
            - reference
        reference_info:
          type: object
          description: Required when `prompt_mode` is `reference`.
          properties:
            num_persons:
              type: integer
              description: Number of people in the scene.
              minimum: 1
              example: 2
            genders:
              type: array
              description: >
                Gender per person. Length must equal `num_persons`. Use `null`
                for unknown.
              items:
                type: string
                enum:
                  - male
                  - female
                  - pets
                  - others
                nullable: true
              example:
                - male
                - female
    ErrorResponse:
      type: object
      properties:
        status:
          type: integer
          example: 400
        error:
          type: object
          properties:
            type:
              type: string
              example: validation_error
            code:
              type: string
              example: invalid_input
            dev:
              type: integer
              example: 40001
            message:
              type: string
              example: Some information is invalid.
  responses:
    BadRequest:
      description: The request was malformed or failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            status: 400
            error:
              type: validation_error
              code: invalid_input
              dev: 40001
              message: Some information is invalid.
    Unauthorized:
      description: Missing or invalid Authorization Bearer token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            status: 401
            error:
              type: authentication_error
              code: unauthorized
              dev: 40100
              message: Missing or invalid Authorization Bearer token.
    RateLimited:
      description: Too many requests.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            status: 429
            error:
              type: rate_limit_error
              code: rate_limited
              dev: 42900
              message: You're doing that too often. Please wait a moment.
    ServerError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            status: 500
            error:
              type: system_error
              code: internal_error
              dev: 50000
              message: Something went wrong on our end.
    BadGateway:
      description: >
        The upstream model provider rejected the submission, was unreachable, or
        returned an unusable response while the job was being submitted or
        checked. The generation is marked failed and the credits reserved for it
        are refunded.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            status: 502
            error:
              type: provider_error
              code: provider_bad_gateway
              dev: 50200
              message: Generation is having trouble right now. Please try again.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >
        Supabase user JWT (or an internal service token). Send as
        `Authorization: Bearer <token>`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.