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

# OC Maker

> Two-stage generation in a single request: an LLM turns your prompt into a structured character sheet, then that result is rendered into an image.

**You supply the full LLM prompt.** No style presets or prompt templates are applied server-side — compose whatever prompt you need.

**Required output contract:** your prompt MUST instruct the model to return a JSON object containing an `oc_prompt` field. That field becomes the image prompt. If the model does not return parseable JSON with `oc_prompt`, the job fails.

Optionally include `oc_ratio` in that JSON to let the model pick the aspect ratio; the `ratio` request field overrides it.

**Pricing:** 1 token per request (= $0.02). Covers both the text and image stages.

Returns an `img_uuid`; poll GET /api/v1/jobs/detail (or use `custom_callback_url`) to get the result. The result contains two entries: the full LLM JSON (`type: "json"`) and the rendered image (`type: "image"`, `image_type: "main_view"`).

## Prompt contract

This endpoint runs two stages: a language model turns your prompt into a structured character
sheet, then that sheet is rendered into an image.

Your prompt **must** instruct the model to return a JSON object containing an `oc_prompt` field —
that field becomes the image prompt. If the model returns anything that cannot be parsed as JSON,
or the JSON has no `oc_prompt`, the job fails.

```text theme={null}
Create a character based on: a stoic knight with silver hair.

Return ONLY a JSON object in this format:
{"role_name":"","appearance":"","personality":"","oc_prompt":"","oc_ratio":"3:4"}

"oc_prompt" must be an English image prompt starting with
"Anime style, Single character, full body, front view".
```

Any other keys you ask for (`role_name`, `personality`, `character_backstory`, …) are passed
through to the result untouched, so you can shape the character sheet however you like.

`oc_ratio` is optional — it lets the model choose the aspect ratio. The `ratio` request field
overrides it, and `3:4` is used when neither is present.

## Result

Unlike the other image endpoints, the result array contains **two entries**: the full JSON from the
text stage, then the rendered image. Poll `GET /api/v1/jobs/detail` or use `custom_callback_url`.

```json theme={null}
{
  "code": 0,
  "msg": "Success",
  "data": {
    "img_uuid": "0f1b8c2e-4a7d-4c31-9f28-6de4a1b9c503",
    "status": "success",
    "type": "oc-maker",
    "start_time": "2026-08-02T09:14:22.108Z",
    "end_time": "2026-08-02T09:15:04.771Z",
    "model_id": "-1",
    "json": [
      {
        "type": "json",
        "value": {
          "role_name": "Sir Aldric",
          "appearance": "Tall knight with long silver hair and a scarred jaw",
          "personality": "Stoic, loyal, slow to anger",
          "oc_prompt": "Anime style, Single character, full body, front view, a tall knight with long silver hair...",
          "oc_ratio": "3:4"
        },
        "duration": 28.4,
        "link_expired_at": "2026-08-03T09:15:04.771Z"
      },
      {
        "type": "image",
        "image_type": "main_view",
        "value": "https://cdn3.goenhance.ai/user/seedream/9dfdb4b5-7ef7-4fe7-93ff-b9eb76cc431d.jpg",
        "duration": 28.4,
        "link_expired_at": "2026-08-03T09:15:04.771Z"
      }
    ],
    "job_type": "oc-maker"
  }
}
```

<Note>
  The `value` of the `type: "json"` entry is an **object**, not a URL string — the only endpoint
  where this happens. Read the image from the entry with `type: "image"` rather than assuming
  `json[0]` is the image.
</Note>

A few details worth knowing:

* `link_expired_at` applies to the image link. It is also present on the JSON entry, where it has
  no meaning — ignore it there.
* `duration` measures the image stage only, not the text stage, so it under-reports total latency.
* Both stages share one `img_uuid` and are billed once. A failure in either stage fails the whole
  job and refunds the tokens.


## OpenAPI

````yaml POST /api/v1/oc-maker
openapi: 3.1.0
info:
  title: GoEnhance API
  description: ''
  version: 1.0.0
servers:
  - url: https://api.goenhance.ai
security:
  - bearerAuth: []
tags:
  - name: Basic
  - name: Video2Video
paths:
  /api/v1/oc-maker:
    post:
      tags:
        - ImageAPI
      summary: OC Maker
      description: >-
        Two-stage generation in a single request: an LLM turns your prompt into
        a structured character sheet, then that result is rendered into an
        image.


        **You supply the full LLM prompt.** No style presets or prompt templates
        are applied server-side — compose whatever prompt you need.


        **Required output contract:** your prompt MUST instruct the model to
        return a JSON object containing an `oc_prompt` field. That field becomes
        the image prompt. If the model does not return parseable JSON with
        `oc_prompt`, the job fails.


        Optionally include `oc_ratio` in that JSON to let the model pick the
        aspect ratio; the `ratio` request field overrides it.


        **Pricing:** 1 token per request (= $0.02). Covers both the text and
        image stages.


        Returns an `img_uuid`; poll GET /api/v1/jobs/detail (or use
        `custom_callback_url`) to get the result. The result contains two
        entries: the full LLM JSON (`type: "json"`) and the rendered image
        (`type: "image"`, `image_type: "main_view"`).
      parameters:
        - name: Authorization
          in: header
          description: ''
          required: false
          example: '{{Authorization}}'
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                prompt:
                  type: string
                  minLength: 1
                  maxLength: 8000
                  description: >-
                    Full prompt for the text stage. Must instruct the model to
                    return a JSON object containing an `oc_prompt` field.
                image_render_model:
                  type: string
                  enum:
                    - seedream
                    - gpt-image-2
                  description: Rendering backend used for the image stage.
                system_prompt:
                  type: string
                  maxLength: 4000
                  description: >-
                    Optional system prompt for the text stage. Defaults to a
                    generic assistant prompt.
                text_model:
                  type: string
                  maxLength: 100
                  description: >-
                    Optional LLM model id for the text stage. Defaults to
                    `gemini-3-pro-preview`.
                ratio:
                  type: string
                  enum:
                    - '1:1'
                    - '2:3'
                    - '3:2'
                    - '4:3'
                    - '3:4'
                    - '16:9'
                    - '9:16'
                  description: >-
                    Optional. Aspect ratio of the generated image. Overrides
                    `oc_ratio` from the LLM output; defaults to 3:4.
                custom_callback_url:
                  type: string
                  format: uri
                  description: >-
                    Optional. A publicly accessible HTTPS URL. When the task
                    status changes (processing / success / failed), GoEnhance
                    sends a POST request to this URL. The request body is
                    identical to the response of GET /api/v1/jobs/detail. If
                    your server does not respond with HTTP 200, the notification
                    is retried up to 3 times, with a 3-second timeout per
                    attempt.
                  example: https://your-server.com/goenhance/callback
              required:
                - prompt
                - image_render_model
            example:
              prompt: A samurai standing in falling cherry blossoms, cinematic
              ratio: '16:9'
            examples:
              '1':
                summary: Character sheet
                value:
                  prompt: >-
                    You are an OC generator. Create a character based on: a
                    stoic knight with silver hair.

                    Return ONLY a JSON object:
                    {"role_name":"","appearance":"","personality":"","oc_prompt":"","oc_ratio":"3:4"}

                    The oc_prompt must be an English image prompt starting with
                    "Anime style, Single character, full body, front view".
                  image_render_model: seedream
                  ratio: '3:4'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  msg:
                    type: string
                  data:
                    type: object
                    properties:
                      img_uuid:
                        type: string
                    required:
                      - img_uuid
                required:
                  - code
                  - msg
                  - data
              examples:
                '1':
                  summary: Success
                  value:
                    code: 0
                    msg: Success
                    data:
                      img_uuid: c12b656c-747a-44fd-9c80-add79b0c52d5
                '2':
                  summary: Insufficient tokens
                  value:
                    code: 100
                    msg: tokens is not enough
          headers: {}
        '401':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  msg:
                    type: string
                required:
                  - code
                  - msg
          headers: {}
      deprecated: false
      security: []
components: {}

````