1. NanoBanana-生图
aokapi.com
  • 介绍
  • 快速开始
    • 注册账号
    • 登录账号
    • 购买额度
    • 创建 API 令牌
  • OPENAI
    • Codex 配置
  • Claude
    • Claude Code 配置
  • GEMINI
    • Gemini CLI 配置
  • 图片生成
    • GPT-image-2
      • 创建图像(文生图)使用文档
      • 创建图像(文生图)
    • NanoBanana-生图
      • Gemini原生格式
        POST
      • Gemini格式传图生图
        POST
      • OpenAI聊天格式
        POST
  • 管理接口
    • 鉴权体系说明(Auth)
    • 令牌管理
      • 获取所有令牌
    • 日志
      • 获取个人日志
  1. NanoBanana-生图

OpenAI聊天格式

POST
/v1/chat/completions
Chat Completions 走 OpenAI 聊天兼容格式

请求参数

Authorization
在 header 添加参数
Authorization
示例:
Authorization: ********************
Body 参数application/json必填

示例
{
  "model": "gemini-3-pro-image-preview",
  "stream": false,
  "messages": [
    {
      "role": "user",
      "content": "draw a cat"
    }
  ],
  "extra_body": {
    "google": {
      "image_config": {
        "aspect_ratio": "16:9",
        "image_size": "2K"
      }
    }
  }
}

请求示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location '/v1/chat/completions' \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
  "model": "gemini-3-pro-image-preview",
  "stream": false,
  "messages": [
    {
      "role": "user",
      "content": "draw a cat"
    }
  ],
  "extra_body": {
    "google": {
      "image_config": {
        "aspect_ratio": "16:9",
        "image_size": "2K"
      }
    }
  }
}'

返回响应

🟢200成功
application/json
Bodyapplication/json

示例
{
    "id": "chatcmpl-202606071318303198042478268d9d6d5ephPU8",
    "model": "gemini-2.5-flash-image",
    "object": "chat.completion",
    "created": 1780838321,
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "![image](data:image/png;base64,iVBORw0KGgoA_IMGBase64)"
            },
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 2,
        "completion_tokens": 1704,
        "total_tokens": 1706,
        "prompt_tokens_details": {
            "cached_tokens": 0,
            "text_tokens": 2,
            "audio_tokens": 0,
            "image_tokens": 0
        },
        "completion_tokens_details": {
            "text_tokens": 0,
            "audio_tokens": 0,
            "image_tokens": 0,
            "reasoning_tokens": 0
        },
        "input_tokens": 0,
        "output_tokens": 0,
        "input_tokens_details": null,
        "claude_cache_creation_5_m_tokens": 0,
        "claude_cache_creation_1_h_tokens": 0
    }
}
修改于 2026-06-07 14:24:09
上一页
Gemini格式传图生图
下一页
鉴权体系说明(Auth)
Built with