开发者路线
GPT Image 2 VIP API
基于 YingTu 当前模型注册表生成的路线说明。代码沿用现有工作台代码生成器,绝不会包含你的真实 Key。
快速开始
- 1
创建或选择一个 LaoZhang API Key。
- 2
复制当前模型 ID 与生成的 Python 示例。
- 3
先执行一个小请求并检查响应,再扩大调用。
请求合同
- 接口地址
- POST /v1/images/generations
- 认证方式
- Bearer API Key
- 请求类型
- OpenAI Images
- 参考图
- 支持
生成的 Python 请求
只替换占位 Key 与你自己的提示词;需要参考图时按文档使用编辑路线。
gpt-image-2-vip
import requests
import base64
# Configuration
API_KEY = "sk-YOUR_API_KEY" # Replace with your API Key
API_URL = "https://api2.laozhang.ai/v1/images/generations"
# Request headers
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
# Generate request
payload = {
"model": "gpt-image-2-vip",
"prompt": "极简咖啡海报,准确显示标题“COFFEE MADE SIMPLE”,高对比排版,温暖自然光,干净商业版式。",
"size": "2048x2048",
"quality": "high"
}
print("Generating image...")
response = requests.post(API_URL, headers=headers, json=payload, timeout=180)
if response.status_code != 200:
print(f"Error: {response.status_code} - {response.text}")
exit(1)
result = response.json()
image_base64 = result.get("data", [{}])[0].get("b64_json")
image_url = result.get("data", [{}])[0].get("url")
if not image_base64 and image_url:
image_response = requests.get(image_url, timeout=60)
image_response.raise_for_status()
image_base64 = base64.b64encode(image_response.content).decode("utf-8")
if not image_base64:
print("No image data in response")
print(result)
exit(1)
with open("output.png", "wb") as f:
f.write(base64.b64decode(image_base64))
print("Image saved: output.png")
正式调用前,请在 LaoZhang 账户确认实时价格、余额和模型权限。
价格权威来源
模型注册表展示 YingTu 配置的每次调用估价;实时价格、余额、权限和扣费以 LaoZhang 账户为准。
路线凭条
- 模型 ID
- gpt-image-2-vip
- 配置估价
- $0.03/ 次
- 输出尺寸
- 1K · 2K · 4K · 30
- API 类型
- OpenAI Images
在工作台测试此模型
本页数值与图片工作台读取同一份模型配置。
YingTu · LaoZhang