复制
1. claude mcp add runapi -s user -- npx -y @runapi.ai/mcp
2. 重启 Claude Code
3. 粘贴这个 prompt:生成一张图像:"{ "master_prompt": { "global_settings": { "resolution": "8K ultra-high-definition", "aspect_ratio": "3:4 vertical", "style": "hyper-realistic AI-edited commercial beverage photography", "sharpness": "extreme clarity, micro-detail visibility", "lighting_quality": "cinematic studio lighting with controlled highlights and shadows", "motion_freeze": "high-speed capture, frozen liquid splashes and particles", "noise": "none", "artifacts": "none" }, "module_1_glass_beverage_style": { "subject": { "type": "transparent glass", "glass_style": "tall cylindrical glass with thick base", "surface_details": "cold condensation droplets on outer glass surface", "fill_level": "80 percent full", "label_text_visible": [ "mock up", "iced coffee / protein shake", "SEPARATED SHADOWS" ] }, "liquid_and_layers": { "beverage_type": "iced latte or chocolate protein shake", "liquid_color": "rich coffee brown or creamy cocoa", "layering": "soft milk-to-coffee gradient with subtle swirls", "texture": "smooth, thick, glossy, realistic viscosity" }, "motion_and_splash": { "action": "liquid splash erupting from inside the glass", "splash_behavior": "curved arcs rising above rim with suspended droplets", "droplet_detail": "micro droplets frozen mid-air with sharp definition" }, "floating_elements": { "ice_cubes": "large clear ice cubes rotating in mid-air", "coffee_beans_or_cocoa": "roasted coffee beans or cocoa powder particles floating", "cream_stream": "thin stream of milk or cream pouring into glass" }, "pose_and_camera": { "position": "centered hero composition", "angle": "three-quarter close-up", "camera_feel": "slightly low angle for premium, powerful presence" }, "background": { "color_palette": "deep espresso brown fading into warm beige highlights", "bokeh": "soft cinematic bokeh lights with warm glow", "atmosphere": "luxurious, indulgent, high-end café mood" }, "surface_and_reflection": { "base": "wet reflective surface with subtle liquid pooling", "shadow_style": "clean, soft separated shadow beneath glass", "reflection_quality": "controlled highlights along glass edges" } } } }"
复制
1. codex plugin install runapi-mcp@agents
2. 重启 Codex
3. 粘贴这个 prompt:生成一张图像:"{ "master_prompt": { "global_settings": { "resolution": "8K ultra-high-definition", "aspect_ratio": "3:4 vertical", "style": "hyper-realistic AI-edited commercial beverage photography", "sharpness": "extreme clarity, micro-detail visibility", "lighting_quality": "cinematic studio lighting with controlled highlights and shadows", "motion_freeze": "high-speed capture, frozen liquid splashes and particles", "noise": "none", "artifacts": "none" }, "module_1_glass_beverage_style": { "subject": { "type": "transparent glass", "glass_style": "tall cylindrical glass with thick base", "surface_details": "cold condensation droplets on outer glass surface", "fill_level": "80 percent full", "label_text_visible": [ "mock up", "iced coffee / protein shake", "SEPARATED SHADOWS" ] }, "liquid_and_layers": { "beverage_type": "iced latte or chocolate protein shake", "liquid_color": "rich coffee brown or creamy cocoa", "layering": "soft milk-to-coffee gradient with subtle swirls", "texture": "smooth, thick, glossy, realistic viscosity" }, "motion_and_splash": { "action": "liquid splash erupting from inside the glass", "splash_behavior": "curved arcs rising above rim with suspended droplets", "droplet_detail": "micro droplets frozen mid-air with sharp definition" }, "floating_elements": { "ice_cubes": "large clear ice cubes rotating in mid-air", "coffee_beans_or_cocoa": "roasted coffee beans or cocoa powder particles floating", "cream_stream": "thin stream of milk or cream pouring into glass" }, "pose_and_camera": { "position": "centered hero composition", "angle": "three-quarter close-up", "camera_feel": "slightly low angle for premium, powerful presence" }, "background": { "color_palette": "deep espresso brown fading into warm beige highlights", "bokeh": "soft cinematic bokeh lights with warm glow", "atmosphere": "luxurious, indulgent, high-end café mood" }, "surface_and_reflection": { "base": "wet reflective surface with subtle liquid pooling", "shadow_style": "clean, soft separated shadow beneath glass", "reflection_quality": "controlled highlights along glass edges" } } } }"
复制
1. npx @runapi.ai/mcp init cursor
2. 重启 Cursor
3. 粘贴这个 prompt:生成一张图像:"{ "master_prompt": { "global_settings": { "resolution": "8K ultra-high-definition", "aspect_ratio": "3:4 vertical", "style": "hyper-realistic AI-edited commercial beverage photography", "sharpness": "extreme clarity, micro-detail visibility", "lighting_quality": "cinematic studio lighting with controlled highlights and shadows", "motion_freeze": "high-speed capture, frozen liquid splashes and particles", "noise": "none", "artifacts": "none" }, "module_1_glass_beverage_style": { "subject": { "type": "transparent glass", "glass_style": "tall cylindrical glass with thick base", "surface_details": "cold condensation droplets on outer glass surface", "fill_level": "80 percent full", "label_text_visible": [ "mock up", "iced coffee / protein shake", "SEPARATED SHADOWS" ] }, "liquid_and_layers": { "beverage_type": "iced latte or chocolate protein shake", "liquid_color": "rich coffee brown or creamy cocoa", "layering": "soft milk-to-coffee gradient with subtle swirls", "texture": "smooth, thick, glossy, realistic viscosity" }, "motion_and_splash": { "action": "liquid splash erupting from inside the glass", "splash_behavior": "curved arcs rising above rim with suspended droplets", "droplet_detail": "micro droplets frozen mid-air with sharp definition" }, "floating_elements": { "ice_cubes": "large clear ice cubes rotating in mid-air", "coffee_beans_or_cocoa": "roasted coffee beans or cocoa powder particles floating", "cream_stream": "thin stream of milk or cream pouring into glass" }, "pose_and_camera": { "position": "centered hero composition", "angle": "three-quarter close-up", "camera_feel": "slightly low angle for premium, powerful presence" }, "background": { "color_palette": "deep espresso brown fading into warm beige highlights", "bokeh": "soft cinematic bokeh lights with warm glow", "atmosphere": "luxurious, indulgent, high-end café mood" }, "surface_and_reflection": { "base": "wet reflective surface with subtle liquid pooling", "shadow_style": "clean, soft separated shadow beneath glass", "reflection_quality": "controlled highlights along glass edges" } } } }"
复制
1. npx @runapi.ai/mcp init windsurf
2. 重启 Windsurf
3. 粘贴这个 prompt:生成一张图像:"{ "master_prompt": { "global_settings": { "resolution": "8K ultra-high-definition", "aspect_ratio": "3:4 vertical", "style": "hyper-realistic AI-edited commercial beverage photography", "sharpness": "extreme clarity, micro-detail visibility", "lighting_quality": "cinematic studio lighting with controlled highlights and shadows", "motion_freeze": "high-speed capture, frozen liquid splashes and particles", "noise": "none", "artifacts": "none" }, "module_1_glass_beverage_style": { "subject": { "type": "transparent glass", "glass_style": "tall cylindrical glass with thick base", "surface_details": "cold condensation droplets on outer glass surface", "fill_level": "80 percent full", "label_text_visible": [ "mock up", "iced coffee / protein shake", "SEPARATED SHADOWS" ] }, "liquid_and_layers": { "beverage_type": "iced latte or chocolate protein shake", "liquid_color": "rich coffee brown or creamy cocoa", "layering": "soft milk-to-coffee gradient with subtle swirls", "texture": "smooth, thick, glossy, realistic viscosity" }, "motion_and_splash": { "action": "liquid splash erupting from inside the glass", "splash_behavior": "curved arcs rising above rim with suspended droplets", "droplet_detail": "micro droplets frozen mid-air with sharp definition" }, "floating_elements": { "ice_cubes": "large clear ice cubes rotating in mid-air", "coffee_beans_or_cocoa": "roasted coffee beans or cocoa powder particles floating", "cream_stream": "thin stream of milk or cream pouring into glass" }, "pose_and_camera": { "position": "centered hero composition", "angle": "three-quarter close-up", "camera_feel": "slightly low angle for premium, powerful presence" }, "background": { "color_palette": "deep espresso brown fading into warm beige highlights", "bokeh": "soft cinematic bokeh lights with warm glow", "atmosphere": "luxurious, indulgent, high-end café mood" }, "surface_and_reflection": { "base": "wet reflective surface with subtle liquid pooling", "shadow_style": "clean, soft separated shadow beneath glass", "reflection_quality": "controlled highlights along glass edges" } } } }"
curl
Node.js
Ruby
Go
复制
curl -X POST https://runapi.ai/api/v1/gpt_image_2/text_to_image \
-H "Authorization: Bearer $RUNAPI_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'JSON'
{
"model": "gpt-image-2",
"prompt": "{ \"master_prompt\": { \"global_settings\": { \"resolution\": \"8K ultra-high-definition\", \"aspect_ratio\": \"3:4 vertical\", \"style\": \"hyper-realistic AI-edited commercial beverage photography\", \"sharpness\": \"extreme clarity, micro-detail visibility\", \"lighting_quality\": \"cinematic studio lighting with controlled highlights and shadows\", \"motion_freeze\": \"high-speed capture, frozen liquid splashes and particles\", \"noise\": \"none\", \"artifacts\": \"none\" }, \"module_1_glass_beverage_style\": { \"subject\": { \"type\": \"transparent glass\", \"glass_style\": \"tall cylindrical glass with thick base\", \"surface_details\": \"cold condensation droplets on outer glass surface\", \"fill_level\": \"80 percent full\", \"label_text_visible\": [ \"mock up\", \"iced coffee / protein shake\", \"SEPARATED SHADOWS\" ] }, \"liquid_and_layers\": { \"beverage_type\": \"iced latte or chocolate protein shake\", \"liquid_color\": \"rich coffee brown or creamy cocoa\", \"layering\": \"soft milk-to-coffee gradient with subtle swirls\", \"texture\": \"smooth, thick, glossy, realistic viscosity\" }, \"motion_and_splash\": { \"action\": \"liquid splash erupting from inside the glass\", \"splash_behavior\": \"curved arcs rising above rim with suspended droplets\", \"droplet_detail\": \"micro droplets frozen mid-air with sharp definition\" }, \"floating_elements\": { \"ice_cubes\": \"large clear ice cubes rotating in mid-air\", \"coffee_beans_or_cocoa\": \"roasted coffee beans or cocoa powder particles floating\", \"cream_stream\": \"thin stream of milk or cream pouring into glass\" }, \"pose_and_camera\": { \"position\": \"centered hero composition\", \"angle\": \"three-quarter close-up\", \"camera_feel\": \"slightly low angle for premium, powerful presence\" }, \"background\": { \"color_palette\": \"deep espresso brown fading into warm beige highlights\", \"bokeh\": \"soft cinematic bokeh lights with warm glow\", \"atmosphere\": \"luxurious, indulgent, high-end café mood\" }, \"surface_and_reflection\": { \"base\": \"wet reflective surface with subtle liquid pooling\", \"shadow_style\": \"clean, soft separated shadow beneath glass\", \"reflection_quality\": \"controlled highlights along glass edges\" } } } }"
}
JSON
复制
import { GptImage2Client } from "@runapi.ai/gpt-image-2";
const client = new GptImage2Client({
apiKey: process.env.RUNAPI_API_KEY,
});
const result = await client.textToImage.run({
"model": "gpt-image-2",
"prompt": "{ \"master_prompt\": { \"global_settings\": { \"resolution\": \"8K ultra-high-definition\", \"aspect_ratio\": \"3:4 vertical\", \"style\": \"hyper-realistic AI-edited commercial beverage photography\", \"sharpness\": \"extreme clarity, micro-detail visibility\", \"lighting_quality\": \"cinematic studio lighting with controlled highlights and shadows\", \"motion_freeze\": \"high-speed capture, frozen liquid splashes and particles\", \"noise\": \"none\", \"artifacts\": \"none\" }, \"module_1_glass_beverage_style\": { \"subject\": { \"type\": \"transparent glass\", \"glass_style\": \"tall cylindrical glass with thick base\", \"surface_details\": \"cold condensation droplets on outer glass surface\", \"fill_level\": \"80 percent full\", \"label_text_visible\": [ \"mock up\", \"iced coffee / protein shake\", \"SEPARATED SHADOWS\" ] }, \"liquid_and_layers\": { \"beverage_type\": \"iced latte or chocolate protein shake\", \"liquid_color\": \"rich coffee brown or creamy cocoa\", \"layering\": \"soft milk-to-coffee gradient with subtle swirls\", \"texture\": \"smooth, thick, glossy, realistic viscosity\" }, \"motion_and_splash\": { \"action\": \"liquid splash erupting from inside the glass\", \"splash_behavior\": \"curved arcs rising above rim with suspended droplets\", \"droplet_detail\": \"micro droplets frozen mid-air with sharp definition\" }, \"floating_elements\": { \"ice_cubes\": \"large clear ice cubes rotating in mid-air\", \"coffee_beans_or_cocoa\": \"roasted coffee beans or cocoa powder particles floating\", \"cream_stream\": \"thin stream of milk or cream pouring into glass\" }, \"pose_and_camera\": { \"position\": \"centered hero composition\", \"angle\": \"three-quarter close-up\", \"camera_feel\": \"slightly low angle for premium, powerful presence\" }, \"background\": { \"color_palette\": \"deep espresso brown fading into warm beige highlights\", \"bokeh\": \"soft cinematic bokeh lights with warm glow\", \"atmosphere\": \"luxurious, indulgent, high-end café mood\" }, \"surface_and_reflection\": { \"base\": \"wet reflective surface with subtle liquid pooling\", \"shadow_style\": \"clean, soft separated shadow beneath glass\", \"reflection_quality\": \"controlled highlights along glass edges\" } } } }"
});
console.log(result.id);
复制
require "runapi/gpt_image_2"
client = RunApi::GptImage2::Client.new
result = client.text_to_image.run(
model: "gpt-image-2",
prompt: "{ \"master_prompt\": { \"global_settings\": { \"resolution\": \"8K ultra-high-definition\", \"aspect_ratio\": \"3:4 vertical\", \"style\": \"hyper-realistic AI-edited commercial beverage photography\", \"sharpness\": \"extreme clarity, micro-detail visibility\", \"lighting_quality\": \"cinematic studio lighting with controlled highlights and shadows\", \"motion_freeze\": \"high-speed capture, frozen liquid splashes and particles\", \"noise\": \"none\", \"artifacts\": \"none\" }, \"module_1_glass_beverage_style\": { \"subject\": { \"type\": \"transparent glass\", \"glass_style\": \"tall cylindrical glass with thick base\", \"surface_details\": \"cold condensation droplets on outer glass surface\", \"fill_level\": \"80 percent full\", \"label_text_visible\": [ \"mock up\", \"iced coffee / protein shake\", \"SEPARATED SHADOWS\" ] }, \"liquid_and_layers\": { \"beverage_type\": \"iced latte or chocolate protein shake\", \"liquid_color\": \"rich coffee brown or creamy cocoa\", \"layering\": \"soft milk-to-coffee gradient with subtle swirls\", \"texture\": \"smooth, thick, glossy, realistic viscosity\" }, \"motion_and_splash\": { \"action\": \"liquid splash erupting from inside the glass\", \"splash_behavior\": \"curved arcs rising above rim with suspended droplets\", \"droplet_detail\": \"micro droplets frozen mid-air with sharp definition\" }, \"floating_elements\": { \"ice_cubes\": \"large clear ice cubes rotating in mid-air\", \"coffee_beans_or_cocoa\": \"roasted coffee beans or cocoa powder particles floating\", \"cream_stream\": \"thin stream of milk or cream pouring into glass\" }, \"pose_and_camera\": { \"position\": \"centered hero composition\", \"angle\": \"three-quarter close-up\", \"camera_feel\": \"slightly low angle for premium, powerful presence\" }, \"background\": { \"color_palette\": \"deep espresso brown fading into warm beige highlights\", \"bokeh\": \"soft cinematic bokeh lights with warm glow\", \"atmosphere\": \"luxurious, indulgent, high-end café mood\" }, \"surface_and_reflection\": { \"base\": \"wet reflective surface with subtle liquid pooling\", \"shadow_style\": \"clean, soft separated shadow beneath glass\", \"reflection_quality\": \"controlled highlights along glass edges\" } } } }"
)
puts result.id
复制
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader("{\"model\":\"gpt-image-2\",\"prompt\":\"{ \\\"master_prompt\\\": { \\\"global_settings\\\": { \\\"resolution\\\": \\\"8K ultra-high-definition\\\", \\\"aspect_ratio\\\": \\\"3:4 vertical\\\", \\\"style\\\": \\\"hyper-realistic AI-edited commercial beverage photography\\\", \\\"sharpness\\\": \\\"extreme clarity, micro-detail visibility\\\", \\\"lighting_quality\\\": \\\"cinematic studio lighting with controlled highlights and shadows\\\", \\\"motion_freeze\\\": \\\"high-speed capture, frozen liquid splashes and particles\\\", \\\"noise\\\": \\\"none\\\", \\\"artifacts\\\": \\\"none\\\" }, \\\"module_1_glass_beverage_style\\\": { \\\"subject\\\": { \\\"type\\\": \\\"transparent glass\\\", \\\"glass_style\\\": \\\"tall cylindrical glass with thick base\\\", \\\"surface_details\\\": \\\"cold condensation droplets on outer glass surface\\\", \\\"fill_level\\\": \\\"80 percent full\\\", \\\"label_text_visible\\\": [ \\\"mock up\\\", \\\"iced coffee / protein shake\\\", \\\"SEPARATED SHADOWS\\\" ] }, \\\"liquid_and_layers\\\": { \\\"beverage_type\\\": \\\"iced latte or chocolate protein shake\\\", \\\"liquid_color\\\": \\\"rich coffee brown or creamy cocoa\\\", \\\"layering\\\": \\\"soft milk-to-coffee gradient with subtle swirls\\\", \\\"texture\\\": \\\"smooth, thick, glossy, realistic viscosity\\\" }, \\\"motion_and_splash\\\": { \\\"action\\\": \\\"liquid splash erupting from inside the glass\\\", \\\"splash_behavior\\\": \\\"curved arcs rising above rim with suspended droplets\\\", \\\"droplet_detail\\\": \\\"micro droplets frozen mid-air with sharp definition\\\" }, \\\"floating_elements\\\": { \\\"ice_cubes\\\": \\\"large clear ice cubes rotating in mid-air\\\", \\\"coffee_beans_or_cocoa\\\": \\\"roasted coffee beans or cocoa powder particles floating\\\", \\\"cream_stream\\\": \\\"thin stream of milk or cream pouring into glass\\\" }, \\\"pose_and_camera\\\": { \\\"position\\\": \\\"centered hero composition\\\", \\\"angle\\\": \\\"three-quarter close-up\\\", \\\"camera_feel\\\": \\\"slightly low angle for premium, powerful presence\\\" }, \\\"background\\\": { \\\"color_palette\\\": \\\"deep espresso brown fading into warm beige highlights\\\", \\\"bokeh\\\": \\\"soft cinematic bokeh lights with warm glow\\\", \\\"atmosphere\\\": \\\"luxurious, indulgent, high-end café mood\\\" }, \\\"surface_and_reflection\\\": { \\\"base\\\": \\\"wet reflective surface with subtle liquid pooling\\\", \\\"shadow_style\\\": \\\"clean, soft separated shadow beneath glass\\\", \\\"reflection_quality\\\": \\\"controlled highlights along glass edges\\\" } } } }\"}")
req, err := http.NewRequestWithContext(context.Background(), http.MethodPost, "https://runapi.ai/api/v1/gpt_image_2/text_to_image", body)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("RUNAPI_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
fmt.Println(resp.Status)
}