Session Playground

POST /pg/images/generations

Native access token · POST /pg/images/generations

使用原生登录 access_token 直接扣减本人钱包生成图片,支持 complexity、markup、svg、frame_count、frame_duration_ms 等扩展字段与稳定 Idempotency-Key 恢复。

POST/pg/images/generations

Authorizations

Authorizationstringrequired

Use a native login access_token (required access: Native access token) with owner isolation and trusted browser Origin; generation writes use wallet billing while reads do not precharge; inference API Keys (sk-…) and PATs (nap_…) are rejected.

Authorization: Bearer $ONEASTER_ACCESS_TOKEN

Parameters

Idempotency-Keystring

header · 每次新发起的 /pg 生成提交建议由前端生成并持久化稳定的 1–100 位无空格可打印 ASCII 标识(推荐 UUID),断线重试保持原标识与原请求字节。同账号跨所有 /pg POST 协议共用一个命名空间;省略时后端兼容生成并通过 X-OneAster-Intent-ID 返回,但若响应头丢失将无法按意图恢复。

Body · application/json

modelstringrequired

目录中的公开调用 ID(model_name),不能填写 display_name

promptstringrequired

图片生成提示词

ninteger

生成张数(默认 1,上限 128)

sizestring

尺寸规格,如 1024x1024

qualitystring

画质档位,依模型能力而定

response_formatstring

返回格式,如 url 或 b64_json

output_formatstring

输出图片编码格式,依模型能力而定

backgroundstring

背景设置,依模型能力而定

watermarkboolean

可选水印开关

complexityanyOf

可选复杂度或档位(字符串或整数,显式 0 保留并原样转发;依模型和渠道能力而定)

markupanyOf

可选标注输入(对象或布尔值,显式 false 保留并原样转发)

svganyOf

可选 SVG 扩展配置(对象或布尔值,显式 false 保留并原样转发)

frame_countinteger

可选帧数(显式 0 保留并原样转发;依模型和渠道能力而定)

frame_duration_msinteger

可选单帧时长毫秒(显式 0 保留并原样转发;依模型和渠道能力而定)

JSON Schema
{
  "type": "object",
  "required": [
    "model",
    "prompt"
  ],
  "properties": {
    "model": {
      "type": "string",
      "description": "目录中的公开调用 ID(model_name),不能填写 display_name"
    },
    "prompt": {
      "type": "string",
      "description": "图片生成提示词"
    },
    "n": {
      "type": "integer",
      "minimum": 1,
      "maximum": 128,
      "description": "生成张数(默认 1,上限 128)"
    },
    "size": {
      "type": "string",
      "description": "尺寸规格,如 1024x1024"
    },
    "quality": {
      "type": "string",
      "description": "画质档位,依模型能力而定"
    },
    "response_format": {
      "type": "string",
      "description": "返回格式,如 url 或 b64_json"
    },
    "output_format": {
      "type": "string",
      "description": "输出图片编码格式,依模型能力而定"
    },
    "background": {
      "type": "string",
      "description": "背景设置,依模型能力而定"
    },
    "watermark": {
      "type": "boolean",
      "description": "可选水印开关"
    },
    "complexity": {
      "description": "可选复杂度或档位(字符串或整数,显式 0 保留并原样转发;依模型和渠道能力而定)",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "integer"
        }
      ]
    },
    "markup": {
      "description": "可选标注输入(对象或布尔值,显式 false 保留并原样转发)",
      "anyOf": [
        {
          "type": "object",
          "additionalProperties": true
        },
        {
          "type": "boolean"
        }
      ]
    },
    "svg": {
      "description": "可选 SVG 扩展配置(对象或布尔值,显式 false 保留并原样转发)",
      "anyOf": [
        {
          "type": "object",
          "additionalProperties": true
        },
        {
          "type": "boolean"
        }
      ]
    },
    "frame_count": {
      "type": "integer",
      "minimum": 0,
      "description": "可选帧数(显式 0 保留并原样转发;依模型和渠道能力而定)"
    },
    "frame_duration_ms": {
      "type": "integer",
      "minimum": 0,
      "description": "可选单帧时长毫秒(显式 0 保留并原样转发;依模型和渠道能力而定)"
    }
  },
  "additionalProperties": true
}