复制
1. claude mcp add runapi -s user -- npx -y @runapi.ai/mcp
2. 重启 Claude Code
3. 粘贴这个 prompt:生成一张图像:"{ "global_settings": { "resolution": "8K ultra-high-definition", "aspect_ratio": "3:4 vertical", "render_style": "photorealistic high-end biscuit photography", "quality": "luxury advertising standard", "clarity": "ultra-sharp with visible fine textures", "grain": "zero", "visual_artifacts": "none", "depth_of_field": "selective focus with soft background falloff", "motion_capture": "ingredients suspended in mid-air", "background_style": "clean monochrome studio backdrop" }, "subject": { "main_food": "assorted biscuit-style cookies", "quantity": 4, "appearance": [ "uniform baked biscuits with refined edges", "lightly toasted surface with subtle cracks", "visible chocolate bits and butter layers", "dry-crisp texture typical of premium biscuits", "precise handcrafted finish" ], "branding_rules": [ "no typography", "no logos", "no imprints", "no decorative marks", "no symbols" ] }, "secondary_elements": { "ingredients_floating": [ "mini chocolate chips", "biscuit crumbs", "powdered sugar dust" ], "motion_style": "controlled burst with natural spread", "distribution": "organic scatter surrounding the biscuits", "particle_detail": "high-speed frozen motion with layered depth" }, "composition": { "camera_angle": "slightly elevated three-quarter angle", "framing": "central hero focus with visual breathing space", "spacing": "ample negative space for premium feel", "focus_priority": "foreground biscuit in extreme sharp focus" }, "lighting": { "type": "studio-grade cinematic lighting", "key_light": "soft diffused directional light", "fill_light": "low-intensity fill to reveal surface detail", "rim_light": "delicate edge glow for separation", "shadows": "smooth and realistic with gentle falloff" }, "color_palette": { "background_color": "muted pastel teal", "biscuit_tones": "light golden beige and toasted browns", "accent_colors": "deep cocoa browns, soft sugar whites", "contrast": "strong subject isolation from background" }, "photography_style": { "genre": "premium biscuit advertising", "mood": "clean, refined, indulgent", "cleanliness": "immaculate studio finish", "post_processing": "subtle professional retouching, natural tones" }, "exclusions": [ "text", "branding", "watermarks", "hands", "serving ware", "props", "wrappers", "environmental elements", "illustration", "cartoon rendering" ] }"
复制
1. codex plugin install runapi-mcp@agents
2. 重启 Codex
3. 粘贴这个 prompt:生成一张图像:"{ "global_settings": { "resolution": "8K ultra-high-definition", "aspect_ratio": "3:4 vertical", "render_style": "photorealistic high-end biscuit photography", "quality": "luxury advertising standard", "clarity": "ultra-sharp with visible fine textures", "grain": "zero", "visual_artifacts": "none", "depth_of_field": "selective focus with soft background falloff", "motion_capture": "ingredients suspended in mid-air", "background_style": "clean monochrome studio backdrop" }, "subject": { "main_food": "assorted biscuit-style cookies", "quantity": 4, "appearance": [ "uniform baked biscuits with refined edges", "lightly toasted surface with subtle cracks", "visible chocolate bits and butter layers", "dry-crisp texture typical of premium biscuits", "precise handcrafted finish" ], "branding_rules": [ "no typography", "no logos", "no imprints", "no decorative marks", "no symbols" ] }, "secondary_elements": { "ingredients_floating": [ "mini chocolate chips", "biscuit crumbs", "powdered sugar dust" ], "motion_style": "controlled burst with natural spread", "distribution": "organic scatter surrounding the biscuits", "particle_detail": "high-speed frozen motion with layered depth" }, "composition": { "camera_angle": "slightly elevated three-quarter angle", "framing": "central hero focus with visual breathing space", "spacing": "ample negative space for premium feel", "focus_priority": "foreground biscuit in extreme sharp focus" }, "lighting": { "type": "studio-grade cinematic lighting", "key_light": "soft diffused directional light", "fill_light": "low-intensity fill to reveal surface detail", "rim_light": "delicate edge glow for separation", "shadows": "smooth and realistic with gentle falloff" }, "color_palette": { "background_color": "muted pastel teal", "biscuit_tones": "light golden beige and toasted browns", "accent_colors": "deep cocoa browns, soft sugar whites", "contrast": "strong subject isolation from background" }, "photography_style": { "genre": "premium biscuit advertising", "mood": "clean, refined, indulgent", "cleanliness": "immaculate studio finish", "post_processing": "subtle professional retouching, natural tones" }, "exclusions": [ "text", "branding", "watermarks", "hands", "serving ware", "props", "wrappers", "environmental elements", "illustration", "cartoon rendering" ] }"
复制
1. npx @runapi.ai/mcp init cursor
2. 重启 Cursor
3. 粘贴这个 prompt:生成一张图像:"{ "global_settings": { "resolution": "8K ultra-high-definition", "aspect_ratio": "3:4 vertical", "render_style": "photorealistic high-end biscuit photography", "quality": "luxury advertising standard", "clarity": "ultra-sharp with visible fine textures", "grain": "zero", "visual_artifacts": "none", "depth_of_field": "selective focus with soft background falloff", "motion_capture": "ingredients suspended in mid-air", "background_style": "clean monochrome studio backdrop" }, "subject": { "main_food": "assorted biscuit-style cookies", "quantity": 4, "appearance": [ "uniform baked biscuits with refined edges", "lightly toasted surface with subtle cracks", "visible chocolate bits and butter layers", "dry-crisp texture typical of premium biscuits", "precise handcrafted finish" ], "branding_rules": [ "no typography", "no logos", "no imprints", "no decorative marks", "no symbols" ] }, "secondary_elements": { "ingredients_floating": [ "mini chocolate chips", "biscuit crumbs", "powdered sugar dust" ], "motion_style": "controlled burst with natural spread", "distribution": "organic scatter surrounding the biscuits", "particle_detail": "high-speed frozen motion with layered depth" }, "composition": { "camera_angle": "slightly elevated three-quarter angle", "framing": "central hero focus with visual breathing space", "spacing": "ample negative space for premium feel", "focus_priority": "foreground biscuit in extreme sharp focus" }, "lighting": { "type": "studio-grade cinematic lighting", "key_light": "soft diffused directional light", "fill_light": "low-intensity fill to reveal surface detail", "rim_light": "delicate edge glow for separation", "shadows": "smooth and realistic with gentle falloff" }, "color_palette": { "background_color": "muted pastel teal", "biscuit_tones": "light golden beige and toasted browns", "accent_colors": "deep cocoa browns, soft sugar whites", "contrast": "strong subject isolation from background" }, "photography_style": { "genre": "premium biscuit advertising", "mood": "clean, refined, indulgent", "cleanliness": "immaculate studio finish", "post_processing": "subtle professional retouching, natural tones" }, "exclusions": [ "text", "branding", "watermarks", "hands", "serving ware", "props", "wrappers", "environmental elements", "illustration", "cartoon rendering" ] }"
复制
1. npx @runapi.ai/mcp init windsurf
2. 重启 Windsurf
3. 粘贴这个 prompt:生成一张图像:"{ "global_settings": { "resolution": "8K ultra-high-definition", "aspect_ratio": "3:4 vertical", "render_style": "photorealistic high-end biscuit photography", "quality": "luxury advertising standard", "clarity": "ultra-sharp with visible fine textures", "grain": "zero", "visual_artifacts": "none", "depth_of_field": "selective focus with soft background falloff", "motion_capture": "ingredients suspended in mid-air", "background_style": "clean monochrome studio backdrop" }, "subject": { "main_food": "assorted biscuit-style cookies", "quantity": 4, "appearance": [ "uniform baked biscuits with refined edges", "lightly toasted surface with subtle cracks", "visible chocolate bits and butter layers", "dry-crisp texture typical of premium biscuits", "precise handcrafted finish" ], "branding_rules": [ "no typography", "no logos", "no imprints", "no decorative marks", "no symbols" ] }, "secondary_elements": { "ingredients_floating": [ "mini chocolate chips", "biscuit crumbs", "powdered sugar dust" ], "motion_style": "controlled burst with natural spread", "distribution": "organic scatter surrounding the biscuits", "particle_detail": "high-speed frozen motion with layered depth" }, "composition": { "camera_angle": "slightly elevated three-quarter angle", "framing": "central hero focus with visual breathing space", "spacing": "ample negative space for premium feel", "focus_priority": "foreground biscuit in extreme sharp focus" }, "lighting": { "type": "studio-grade cinematic lighting", "key_light": "soft diffused directional light", "fill_light": "low-intensity fill to reveal surface detail", "rim_light": "delicate edge glow for separation", "shadows": "smooth and realistic with gentle falloff" }, "color_palette": { "background_color": "muted pastel teal", "biscuit_tones": "light golden beige and toasted browns", "accent_colors": "deep cocoa browns, soft sugar whites", "contrast": "strong subject isolation from background" }, "photography_style": { "genre": "premium biscuit advertising", "mood": "clean, refined, indulgent", "cleanliness": "immaculate studio finish", "post_processing": "subtle professional retouching, natural tones" }, "exclusions": [ "text", "branding", "watermarks", "hands", "serving ware", "props", "wrappers", "environmental elements", "illustration", "cartoon rendering" ] }"
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": "{ \"global_settings\": { \"resolution\": \"8K ultra-high-definition\", \"aspect_ratio\": \"3:4 vertical\", \"render_style\": \"photorealistic high-end biscuit photography\", \"quality\": \"luxury advertising standard\", \"clarity\": \"ultra-sharp with visible fine textures\", \"grain\": \"zero\", \"visual_artifacts\": \"none\", \"depth_of_field\": \"selective focus with soft background falloff\", \"motion_capture\": \"ingredients suspended in mid-air\", \"background_style\": \"clean monochrome studio backdrop\" }, \"subject\": { \"main_food\": \"assorted biscuit-style cookies\", \"quantity\": 4, \"appearance\": [ \"uniform baked biscuits with refined edges\", \"lightly toasted surface with subtle cracks\", \"visible chocolate bits and butter layers\", \"dry-crisp texture typical of premium biscuits\", \"precise handcrafted finish\" ], \"branding_rules\": [ \"no typography\", \"no logos\", \"no imprints\", \"no decorative marks\", \"no symbols\" ] }, \"secondary_elements\": { \"ingredients_floating\": [ \"mini chocolate chips\", \"biscuit crumbs\", \"powdered sugar dust\" ], \"motion_style\": \"controlled burst with natural spread\", \"distribution\": \"organic scatter surrounding the biscuits\", \"particle_detail\": \"high-speed frozen motion with layered depth\" }, \"composition\": { \"camera_angle\": \"slightly elevated three-quarter angle\", \"framing\": \"central hero focus with visual breathing space\", \"spacing\": \"ample negative space for premium feel\", \"focus_priority\": \"foreground biscuit in extreme sharp focus\" }, \"lighting\": { \"type\": \"studio-grade cinematic lighting\", \"key_light\": \"soft diffused directional light\", \"fill_light\": \"low-intensity fill to reveal surface detail\", \"rim_light\": \"delicate edge glow for separation\", \"shadows\": \"smooth and realistic with gentle falloff\" }, \"color_palette\": { \"background_color\": \"muted pastel teal\", \"biscuit_tones\": \"light golden beige and toasted browns\", \"accent_colors\": \"deep cocoa browns, soft sugar whites\", \"contrast\": \"strong subject isolation from background\" }, \"photography_style\": { \"genre\": \"premium biscuit advertising\", \"mood\": \"clean, refined, indulgent\", \"cleanliness\": \"immaculate studio finish\", \"post_processing\": \"subtle professional retouching, natural tones\" }, \"exclusions\": [ \"text\", \"branding\", \"watermarks\", \"hands\", \"serving ware\", \"props\", \"wrappers\", \"environmental elements\", \"illustration\", \"cartoon rendering\" ] }"
}
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": "{ \"global_settings\": { \"resolution\": \"8K ultra-high-definition\", \"aspect_ratio\": \"3:4 vertical\", \"render_style\": \"photorealistic high-end biscuit photography\", \"quality\": \"luxury advertising standard\", \"clarity\": \"ultra-sharp with visible fine textures\", \"grain\": \"zero\", \"visual_artifacts\": \"none\", \"depth_of_field\": \"selective focus with soft background falloff\", \"motion_capture\": \"ingredients suspended in mid-air\", \"background_style\": \"clean monochrome studio backdrop\" }, \"subject\": { \"main_food\": \"assorted biscuit-style cookies\", \"quantity\": 4, \"appearance\": [ \"uniform baked biscuits with refined edges\", \"lightly toasted surface with subtle cracks\", \"visible chocolate bits and butter layers\", \"dry-crisp texture typical of premium biscuits\", \"precise handcrafted finish\" ], \"branding_rules\": [ \"no typography\", \"no logos\", \"no imprints\", \"no decorative marks\", \"no symbols\" ] }, \"secondary_elements\": { \"ingredients_floating\": [ \"mini chocolate chips\", \"biscuit crumbs\", \"powdered sugar dust\" ], \"motion_style\": \"controlled burst with natural spread\", \"distribution\": \"organic scatter surrounding the biscuits\", \"particle_detail\": \"high-speed frozen motion with layered depth\" }, \"composition\": { \"camera_angle\": \"slightly elevated three-quarter angle\", \"framing\": \"central hero focus with visual breathing space\", \"spacing\": \"ample negative space for premium feel\", \"focus_priority\": \"foreground biscuit in extreme sharp focus\" }, \"lighting\": { \"type\": \"studio-grade cinematic lighting\", \"key_light\": \"soft diffused directional light\", \"fill_light\": \"low-intensity fill to reveal surface detail\", \"rim_light\": \"delicate edge glow for separation\", \"shadows\": \"smooth and realistic with gentle falloff\" }, \"color_palette\": { \"background_color\": \"muted pastel teal\", \"biscuit_tones\": \"light golden beige and toasted browns\", \"accent_colors\": \"deep cocoa browns, soft sugar whites\", \"contrast\": \"strong subject isolation from background\" }, \"photography_style\": { \"genre\": \"premium biscuit advertising\", \"mood\": \"clean, refined, indulgent\", \"cleanliness\": \"immaculate studio finish\", \"post_processing\": \"subtle professional retouching, natural tones\" }, \"exclusions\": [ \"text\", \"branding\", \"watermarks\", \"hands\", \"serving ware\", \"props\", \"wrappers\", \"environmental elements\", \"illustration\", \"cartoon rendering\" ] }"
});
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: "{ \"global_settings\": { \"resolution\": \"8K ultra-high-definition\", \"aspect_ratio\": \"3:4 vertical\", \"render_style\": \"photorealistic high-end biscuit photography\", \"quality\": \"luxury advertising standard\", \"clarity\": \"ultra-sharp with visible fine textures\", \"grain\": \"zero\", \"visual_artifacts\": \"none\", \"depth_of_field\": \"selective focus with soft background falloff\", \"motion_capture\": \"ingredients suspended in mid-air\", \"background_style\": \"clean monochrome studio backdrop\" }, \"subject\": { \"main_food\": \"assorted biscuit-style cookies\", \"quantity\": 4, \"appearance\": [ \"uniform baked biscuits with refined edges\", \"lightly toasted surface with subtle cracks\", \"visible chocolate bits and butter layers\", \"dry-crisp texture typical of premium biscuits\", \"precise handcrafted finish\" ], \"branding_rules\": [ \"no typography\", \"no logos\", \"no imprints\", \"no decorative marks\", \"no symbols\" ] }, \"secondary_elements\": { \"ingredients_floating\": [ \"mini chocolate chips\", \"biscuit crumbs\", \"powdered sugar dust\" ], \"motion_style\": \"controlled burst with natural spread\", \"distribution\": \"organic scatter surrounding the biscuits\", \"particle_detail\": \"high-speed frozen motion with layered depth\" }, \"composition\": { \"camera_angle\": \"slightly elevated three-quarter angle\", \"framing\": \"central hero focus with visual breathing space\", \"spacing\": \"ample negative space for premium feel\", \"focus_priority\": \"foreground biscuit in extreme sharp focus\" }, \"lighting\": { \"type\": \"studio-grade cinematic lighting\", \"key_light\": \"soft diffused directional light\", \"fill_light\": \"low-intensity fill to reveal surface detail\", \"rim_light\": \"delicate edge glow for separation\", \"shadows\": \"smooth and realistic with gentle falloff\" }, \"color_palette\": { \"background_color\": \"muted pastel teal\", \"biscuit_tones\": \"light golden beige and toasted browns\", \"accent_colors\": \"deep cocoa browns, soft sugar whites\", \"contrast\": \"strong subject isolation from background\" }, \"photography_style\": { \"genre\": \"premium biscuit advertising\", \"mood\": \"clean, refined, indulgent\", \"cleanliness\": \"immaculate studio finish\", \"post_processing\": \"subtle professional retouching, natural tones\" }, \"exclusions\": [ \"text\", \"branding\", \"watermarks\", \"hands\", \"serving ware\", \"props\", \"wrappers\", \"environmental elements\", \"illustration\", \"cartoon rendering\" ] }"
)
puts result.id
复制
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader("{\"model\":\"gpt-image-2\",\"prompt\":\"{ \\\"global_settings\\\": { \\\"resolution\\\": \\\"8K ultra-high-definition\\\", \\\"aspect_ratio\\\": \\\"3:4 vertical\\\", \\\"render_style\\\": \\\"photorealistic high-end biscuit photography\\\", \\\"quality\\\": \\\"luxury advertising standard\\\", \\\"clarity\\\": \\\"ultra-sharp with visible fine textures\\\", \\\"grain\\\": \\\"zero\\\", \\\"visual_artifacts\\\": \\\"none\\\", \\\"depth_of_field\\\": \\\"selective focus with soft background falloff\\\", \\\"motion_capture\\\": \\\"ingredients suspended in mid-air\\\", \\\"background_style\\\": \\\"clean monochrome studio backdrop\\\" }, \\\"subject\\\": { \\\"main_food\\\": \\\"assorted biscuit-style cookies\\\", \\\"quantity\\\": 4, \\\"appearance\\\": [ \\\"uniform baked biscuits with refined edges\\\", \\\"lightly toasted surface with subtle cracks\\\", \\\"visible chocolate bits and butter layers\\\", \\\"dry-crisp texture typical of premium biscuits\\\", \\\"precise handcrafted finish\\\" ], \\\"branding_rules\\\": [ \\\"no typography\\\", \\\"no logos\\\", \\\"no imprints\\\", \\\"no decorative marks\\\", \\\"no symbols\\\" ] }, \\\"secondary_elements\\\": { \\\"ingredients_floating\\\": [ \\\"mini chocolate chips\\\", \\\"biscuit crumbs\\\", \\\"powdered sugar dust\\\" ], \\\"motion_style\\\": \\\"controlled burst with natural spread\\\", \\\"distribution\\\": \\\"organic scatter surrounding the biscuits\\\", \\\"particle_detail\\\": \\\"high-speed frozen motion with layered depth\\\" }, \\\"composition\\\": { \\\"camera_angle\\\": \\\"slightly elevated three-quarter angle\\\", \\\"framing\\\": \\\"central hero focus with visual breathing space\\\", \\\"spacing\\\": \\\"ample negative space for premium feel\\\", \\\"focus_priority\\\": \\\"foreground biscuit in extreme sharp focus\\\" }, \\\"lighting\\\": { \\\"type\\\": \\\"studio-grade cinematic lighting\\\", \\\"key_light\\\": \\\"soft diffused directional light\\\", \\\"fill_light\\\": \\\"low-intensity fill to reveal surface detail\\\", \\\"rim_light\\\": \\\"delicate edge glow for separation\\\", \\\"shadows\\\": \\\"smooth and realistic with gentle falloff\\\" }, \\\"color_palette\\\": { \\\"background_color\\\": \\\"muted pastel teal\\\", \\\"biscuit_tones\\\": \\\"light golden beige and toasted browns\\\", \\\"accent_colors\\\": \\\"deep cocoa browns, soft sugar whites\\\", \\\"contrast\\\": \\\"strong subject isolation from background\\\" }, \\\"photography_style\\\": { \\\"genre\\\": \\\"premium biscuit advertising\\\", \\\"mood\\\": \\\"clean, refined, indulgent\\\", \\\"cleanliness\\\": \\\"immaculate studio finish\\\", \\\"post_processing\\\": \\\"subtle professional retouching, natural tones\\\" }, \\\"exclusions\\\": [ \\\"text\\\", \\\"branding\\\", \\\"watermarks\\\", \\\"hands\\\", \\\"serving ware\\\", \\\"props\\\", \\\"wrappers\\\", \\\"environmental elements\\\", \\\"illustration\\\", \\\"cartoon rendering\\\" ] }\"}")
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)
}