OpenAI 图像生成
Changed on接口说明:OpenAI Images API /v1/images/generations 的兼容端点(文生图)。请求、响应与错误格式完全遵循 OpenAI 规范:返回 OpenAI 原始 ImagesResponse,不使用 AiToEarn 通用响应包裹;图片链接为上游原始返回,不做转存。鉴权使用 Authorization: Bearer <API Key>(OpenAI SDK 默认携带),已有 OpenAI SDK 或生态工具只需替换 baseURL 与 API Key 即可接入,按 AiToEarn 积分计费。
模型取值来自「图像生成模型」接口返回的 data[n].name。如需 AiToEarn 通用响应格式(code === 0)与转存后的稳定图片链接,请改用「生成图像」接口。
Request
- Base URLhttps://aitoearn.cn
- AuthAPI key in header Authorization
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Request body
Example request
{
"prompt": "A cute orange cat sitting by a window, soft natural light",
"model": "gpt-image-2",
"quality": "low",
"response_format": "url",
"size": "1024x1024"
}Response
第三方协议原生响应或 SSE 数据。不使用 AiToEarn 通用响应包裹。
Example response
{
"data": [
{
"url": "string"
}
],
"created": "number",
"quality": "string",
"size": "string",
"usage": {
"input_tokens": "number",
"output_tokens": "number",
"total_tokens": "number",
"input_tokens_details": {
"text_tokens": "number",
"image_tokens": "number"
},
"output_tokens_details": {
"text_tokens": "number",
"image_tokens": "number"
}
}
}Changes
- warning
removed the request property
- info
added the optional property
to the response with the status (media type: application/json) - info
added the optional property
to the response with the status (media type: application/json) - info
added the optional property
to the response with the status (media type: application/json) - info
added the optional property
to the response with the status (media type: application/json) - info
added the optional property
to the response with the status (media type: application/json)
- warning