1. Images
PeakkAI-Doc
English
  • 中文
  • English
  • 首页
  • English
    • Home Page
    • PeakkAI-API
      • Model
        • Native OpenAI Format
        • Native Gemini Format
      • Chat
        • Native OpenAI Format
        • Native Gemini Format
        • Native Claude Format
        • Responses Request (openai)
      • Audio
        • Native OpenAI Format TTS
        • Native Gemini Format TTS
      • Images
        • Native OpenAI Format Image Editing (JSON)
          POST
        • Native OpenAI Format Image Generation
          POST
        • Native OpenAI Format Image Editing (Multipart)
          POST
        • Native Gemini Format Image Generation
          POST
      • Video
        • Seedance2.0 format
          • Create Video Generation Task
          • Query Video Generation Task Status
      • Vector
        • Embeddings
          • Create Embedding
      • Translation
        • Speech Translation
    • AI application
      • PeakkAI API Integration with Claude Code
      • PeakkAI API Integration with Cursor
      • PeakkAI API Integration with Codex-cli
      • PeakkAI API Integration with Codex Desktop
      • PeakkAI API Integration with Hermes Agent
  1. Images

Native OpenAI Format Image Editing (JSON)

POST
/v1/images/edits

请求参数

Header 参数

Body 参数application/json必填

示例
{
    "model": "gpt-image-2",
    "prompt": "Convert the uploaded image to comic style",
    "images": [
        {
            "image_url": "https://example.com/photo.png"
        }
    ],
    "n": 1,
    "size": "1024x1024",
    "quality": "low",
    "response_format": "b64_json"
}

请求示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location 'https://api.peakkai.ai/v1/images/edits' \
--header 'Authorization: Bearer sk-xxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
    "model": "gpt-image-2",
    "prompt": "Convert the uploaded image to comic style",
    "images": [
        {
            "image_url": "https://example.com/photo.png"
        }
    ],
    "n": 1,
    "size": "1024x1024",
    "quality": "low",
    "response_format": "b64_json"
}'

返回响应

🟢200
application/json
Bodyapplication/json

示例
{
    "created": 53,
    "data": [
        {
            "b64_json": "voluptate sed labore occaecat",
            "revised_prompt": "proident",
            "url": "https://yearly-other.info/"
        },
        {
            "b64_json": "dolore eiusmod Duis elit",
            "revised_prompt": "sint nostrud Duis laborum",
            "url": "https://youthful-volleyball.name/"
        },
        {
            "b64_json": "nulla occaecat reprehenderit esse",
            "revised_prompt": "ut",
            "url": "https://acceptable-napkin.org/"
        }
    ],
    "usage": {
        "input_tokens": 16,
        "output_tokens": 39,
        "total_tokens": 92,
        "input_tokens_details": {
            "image_tokens": 45,
            "text_tokens": 64
        },
        "output_tokens_details": {
            "image_tokens": 43,
            "text_tokens": 1
        }
    }
}
修改于 2026-11-02 09:46:28
上一页
Native Gemini Format TTS
下一页
Native OpenAI Format Image Generation
Built with