复制
1. claude mcp add runapi -s user -- npx -y @runapi.ai/mcp
2. 重启 Claude Code
3. 粘贴这个 prompt:生成一张图像:"{ "objective": "Generate a hyper-realistic black and white street fashion photograph with selective color accents.", "image_type": "photography", "prompt": { "subject": "A stylish, confident woman crossing a busy city intersection", "wardrobe": { "outerwear": "Oversized blazer in neutral tone", "innerwear": "Bright red fitted top (selective color)", "bottoms": "Loose tailored trousers in neutral tone", "accessories": [ "Bright red leather clutch in hand", "Bright red sunglasses" ] }, "action_motion": "Walking briskly toward the camera, hair flowing backward due to motion, blazer and trousers moving naturally", "scene": "Busy urban crosswalk with pedestrians and cars motion-blurred in the background", "perspective": "Frontal tracking shot at waist level", "style": [ "High-end street fashion", "Paparazzi aesthetic", "Editorial candid", "Dynamic movement photography" ], "visual_details": [ "Realistic fabric physics", "Detailed hair movement", "Sharp facial features", "Asphalt road texture", "Motion blur on background crowd", "Bokeh city lights" ], "mood": [ "Confident", "Cosmopolitan", "Urgent", "Powerful" ] }, "camera_and_composition": { "angle": "Waist-level", "framing": "Subject centered, background expanding outward with motion blur", "depth_of_field": "Shallow depth of field isolating the subject" }, "lighting": { "type": "Natural backlight with rim lighting", "contrast": "High contrast emphasizing silhouette and edges" }, "post_processing": { "color_mode": "Black and white with selective red color accents only on innerwear, sunglasses, and clutch bag", "effects": [ "Subtle lens flare", "Vintage film stock emulation", "High micro-contrast", "Film grain texture" ] }, "negative_prompt": [ "Posed studio look", "Empty street", "Static posture", "Low realism", "Full color image", "Overexposed highlights", "Flat lighting" ], "output_quality": { "resolution": "Ultra high resolution", "detail_level": "Maximum photorealism", "sharpness": "Crisp subject, soft background" } }"
复制
1. codex plugin install runapi-mcp@agents
2. 重启 Codex
3. 粘贴这个 prompt:生成一张图像:"{ "objective": "Generate a hyper-realistic black and white street fashion photograph with selective color accents.", "image_type": "photography", "prompt": { "subject": "A stylish, confident woman crossing a busy city intersection", "wardrobe": { "outerwear": "Oversized blazer in neutral tone", "innerwear": "Bright red fitted top (selective color)", "bottoms": "Loose tailored trousers in neutral tone", "accessories": [ "Bright red leather clutch in hand", "Bright red sunglasses" ] }, "action_motion": "Walking briskly toward the camera, hair flowing backward due to motion, blazer and trousers moving naturally", "scene": "Busy urban crosswalk with pedestrians and cars motion-blurred in the background", "perspective": "Frontal tracking shot at waist level", "style": [ "High-end street fashion", "Paparazzi aesthetic", "Editorial candid", "Dynamic movement photography" ], "visual_details": [ "Realistic fabric physics", "Detailed hair movement", "Sharp facial features", "Asphalt road texture", "Motion blur on background crowd", "Bokeh city lights" ], "mood": [ "Confident", "Cosmopolitan", "Urgent", "Powerful" ] }, "camera_and_composition": { "angle": "Waist-level", "framing": "Subject centered, background expanding outward with motion blur", "depth_of_field": "Shallow depth of field isolating the subject" }, "lighting": { "type": "Natural backlight with rim lighting", "contrast": "High contrast emphasizing silhouette and edges" }, "post_processing": { "color_mode": "Black and white with selective red color accents only on innerwear, sunglasses, and clutch bag", "effects": [ "Subtle lens flare", "Vintage film stock emulation", "High micro-contrast", "Film grain texture" ] }, "negative_prompt": [ "Posed studio look", "Empty street", "Static posture", "Low realism", "Full color image", "Overexposed highlights", "Flat lighting" ], "output_quality": { "resolution": "Ultra high resolution", "detail_level": "Maximum photorealism", "sharpness": "Crisp subject, soft background" } }"
复制
1. npx @runapi.ai/mcp init cursor
2. 重启 Cursor
3. 粘贴这个 prompt:生成一张图像:"{ "objective": "Generate a hyper-realistic black and white street fashion photograph with selective color accents.", "image_type": "photography", "prompt": { "subject": "A stylish, confident woman crossing a busy city intersection", "wardrobe": { "outerwear": "Oversized blazer in neutral tone", "innerwear": "Bright red fitted top (selective color)", "bottoms": "Loose tailored trousers in neutral tone", "accessories": [ "Bright red leather clutch in hand", "Bright red sunglasses" ] }, "action_motion": "Walking briskly toward the camera, hair flowing backward due to motion, blazer and trousers moving naturally", "scene": "Busy urban crosswalk with pedestrians and cars motion-blurred in the background", "perspective": "Frontal tracking shot at waist level", "style": [ "High-end street fashion", "Paparazzi aesthetic", "Editorial candid", "Dynamic movement photography" ], "visual_details": [ "Realistic fabric physics", "Detailed hair movement", "Sharp facial features", "Asphalt road texture", "Motion blur on background crowd", "Bokeh city lights" ], "mood": [ "Confident", "Cosmopolitan", "Urgent", "Powerful" ] }, "camera_and_composition": { "angle": "Waist-level", "framing": "Subject centered, background expanding outward with motion blur", "depth_of_field": "Shallow depth of field isolating the subject" }, "lighting": { "type": "Natural backlight with rim lighting", "contrast": "High contrast emphasizing silhouette and edges" }, "post_processing": { "color_mode": "Black and white with selective red color accents only on innerwear, sunglasses, and clutch bag", "effects": [ "Subtle lens flare", "Vintage film stock emulation", "High micro-contrast", "Film grain texture" ] }, "negative_prompt": [ "Posed studio look", "Empty street", "Static posture", "Low realism", "Full color image", "Overexposed highlights", "Flat lighting" ], "output_quality": { "resolution": "Ultra high resolution", "detail_level": "Maximum photorealism", "sharpness": "Crisp subject, soft background" } }"
复制
1. npx @runapi.ai/mcp init windsurf
2. 重启 Windsurf
3. 粘贴这个 prompt:生成一张图像:"{ "objective": "Generate a hyper-realistic black and white street fashion photograph with selective color accents.", "image_type": "photography", "prompt": { "subject": "A stylish, confident woman crossing a busy city intersection", "wardrobe": { "outerwear": "Oversized blazer in neutral tone", "innerwear": "Bright red fitted top (selective color)", "bottoms": "Loose tailored trousers in neutral tone", "accessories": [ "Bright red leather clutch in hand", "Bright red sunglasses" ] }, "action_motion": "Walking briskly toward the camera, hair flowing backward due to motion, blazer and trousers moving naturally", "scene": "Busy urban crosswalk with pedestrians and cars motion-blurred in the background", "perspective": "Frontal tracking shot at waist level", "style": [ "High-end street fashion", "Paparazzi aesthetic", "Editorial candid", "Dynamic movement photography" ], "visual_details": [ "Realistic fabric physics", "Detailed hair movement", "Sharp facial features", "Asphalt road texture", "Motion blur on background crowd", "Bokeh city lights" ], "mood": [ "Confident", "Cosmopolitan", "Urgent", "Powerful" ] }, "camera_and_composition": { "angle": "Waist-level", "framing": "Subject centered, background expanding outward with motion blur", "depth_of_field": "Shallow depth of field isolating the subject" }, "lighting": { "type": "Natural backlight with rim lighting", "contrast": "High contrast emphasizing silhouette and edges" }, "post_processing": { "color_mode": "Black and white with selective red color accents only on innerwear, sunglasses, and clutch bag", "effects": [ "Subtle lens flare", "Vintage film stock emulation", "High micro-contrast", "Film grain texture" ] }, "negative_prompt": [ "Posed studio look", "Empty street", "Static posture", "Low realism", "Full color image", "Overexposed highlights", "Flat lighting" ], "output_quality": { "resolution": "Ultra high resolution", "detail_level": "Maximum photorealism", "sharpness": "Crisp subject, soft background" } }"
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": "{ \"objective\": \"Generate a hyper-realistic black and white street fashion photograph with selective color accents.\", \"image_type\": \"photography\", \"prompt\": { \"subject\": \"A stylish, confident woman crossing a busy city intersection\", \"wardrobe\": { \"outerwear\": \"Oversized blazer in neutral tone\", \"innerwear\": \"Bright red fitted top (selective color)\", \"bottoms\": \"Loose tailored trousers in neutral tone\", \"accessories\": [ \"Bright red leather clutch in hand\", \"Bright red sunglasses\" ] }, \"action_motion\": \"Walking briskly toward the camera, hair flowing backward due to motion, blazer and trousers moving naturally\", \"scene\": \"Busy urban crosswalk with pedestrians and cars motion-blurred in the background\", \"perspective\": \"Frontal tracking shot at waist level\", \"style\": [ \"High-end street fashion\", \"Paparazzi aesthetic\", \"Editorial candid\", \"Dynamic movement photography\" ], \"visual_details\": [ \"Realistic fabric physics\", \"Detailed hair movement\", \"Sharp facial features\", \"Asphalt road texture\", \"Motion blur on background crowd\", \"Bokeh city lights\" ], \"mood\": [ \"Confident\", \"Cosmopolitan\", \"Urgent\", \"Powerful\" ] }, \"camera_and_composition\": { \"angle\": \"Waist-level\", \"framing\": \"Subject centered, background expanding outward with motion blur\", \"depth_of_field\": \"Shallow depth of field isolating the subject\" }, \"lighting\": { \"type\": \"Natural backlight with rim lighting\", \"contrast\": \"High contrast emphasizing silhouette and edges\" }, \"post_processing\": { \"color_mode\": \"Black and white with selective red color accents only on innerwear, sunglasses, and clutch bag\", \"effects\": [ \"Subtle lens flare\", \"Vintage film stock emulation\", \"High micro-contrast\", \"Film grain texture\" ] }, \"negative_prompt\": [ \"Posed studio look\", \"Empty street\", \"Static posture\", \"Low realism\", \"Full color image\", \"Overexposed highlights\", \"Flat lighting\" ], \"output_quality\": { \"resolution\": \"Ultra high resolution\", \"detail_level\": \"Maximum photorealism\", \"sharpness\": \"Crisp subject, soft background\" } }"
}
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": "{ \"objective\": \"Generate a hyper-realistic black and white street fashion photograph with selective color accents.\", \"image_type\": \"photography\", \"prompt\": { \"subject\": \"A stylish, confident woman crossing a busy city intersection\", \"wardrobe\": { \"outerwear\": \"Oversized blazer in neutral tone\", \"innerwear\": \"Bright red fitted top (selective color)\", \"bottoms\": \"Loose tailored trousers in neutral tone\", \"accessories\": [ \"Bright red leather clutch in hand\", \"Bright red sunglasses\" ] }, \"action_motion\": \"Walking briskly toward the camera, hair flowing backward due to motion, blazer and trousers moving naturally\", \"scene\": \"Busy urban crosswalk with pedestrians and cars motion-blurred in the background\", \"perspective\": \"Frontal tracking shot at waist level\", \"style\": [ \"High-end street fashion\", \"Paparazzi aesthetic\", \"Editorial candid\", \"Dynamic movement photography\" ], \"visual_details\": [ \"Realistic fabric physics\", \"Detailed hair movement\", \"Sharp facial features\", \"Asphalt road texture\", \"Motion blur on background crowd\", \"Bokeh city lights\" ], \"mood\": [ \"Confident\", \"Cosmopolitan\", \"Urgent\", \"Powerful\" ] }, \"camera_and_composition\": { \"angle\": \"Waist-level\", \"framing\": \"Subject centered, background expanding outward with motion blur\", \"depth_of_field\": \"Shallow depth of field isolating the subject\" }, \"lighting\": { \"type\": \"Natural backlight with rim lighting\", \"contrast\": \"High contrast emphasizing silhouette and edges\" }, \"post_processing\": { \"color_mode\": \"Black and white with selective red color accents only on innerwear, sunglasses, and clutch bag\", \"effects\": [ \"Subtle lens flare\", \"Vintage film stock emulation\", \"High micro-contrast\", \"Film grain texture\" ] }, \"negative_prompt\": [ \"Posed studio look\", \"Empty street\", \"Static posture\", \"Low realism\", \"Full color image\", \"Overexposed highlights\", \"Flat lighting\" ], \"output_quality\": { \"resolution\": \"Ultra high resolution\", \"detail_level\": \"Maximum photorealism\", \"sharpness\": \"Crisp subject, soft background\" } }"
});
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: "{ \"objective\": \"Generate a hyper-realistic black and white street fashion photograph with selective color accents.\", \"image_type\": \"photography\", \"prompt\": { \"subject\": \"A stylish, confident woman crossing a busy city intersection\", \"wardrobe\": { \"outerwear\": \"Oversized blazer in neutral tone\", \"innerwear\": \"Bright red fitted top (selective color)\", \"bottoms\": \"Loose tailored trousers in neutral tone\", \"accessories\": [ \"Bright red leather clutch in hand\", \"Bright red sunglasses\" ] }, \"action_motion\": \"Walking briskly toward the camera, hair flowing backward due to motion, blazer and trousers moving naturally\", \"scene\": \"Busy urban crosswalk with pedestrians and cars motion-blurred in the background\", \"perspective\": \"Frontal tracking shot at waist level\", \"style\": [ \"High-end street fashion\", \"Paparazzi aesthetic\", \"Editorial candid\", \"Dynamic movement photography\" ], \"visual_details\": [ \"Realistic fabric physics\", \"Detailed hair movement\", \"Sharp facial features\", \"Asphalt road texture\", \"Motion blur on background crowd\", \"Bokeh city lights\" ], \"mood\": [ \"Confident\", \"Cosmopolitan\", \"Urgent\", \"Powerful\" ] }, \"camera_and_composition\": { \"angle\": \"Waist-level\", \"framing\": \"Subject centered, background expanding outward with motion blur\", \"depth_of_field\": \"Shallow depth of field isolating the subject\" }, \"lighting\": { \"type\": \"Natural backlight with rim lighting\", \"contrast\": \"High contrast emphasizing silhouette and edges\" }, \"post_processing\": { \"color_mode\": \"Black and white with selective red color accents only on innerwear, sunglasses, and clutch bag\", \"effects\": [ \"Subtle lens flare\", \"Vintage film stock emulation\", \"High micro-contrast\", \"Film grain texture\" ] }, \"negative_prompt\": [ \"Posed studio look\", \"Empty street\", \"Static posture\", \"Low realism\", \"Full color image\", \"Overexposed highlights\", \"Flat lighting\" ], \"output_quality\": { \"resolution\": \"Ultra high resolution\", \"detail_level\": \"Maximum photorealism\", \"sharpness\": \"Crisp subject, soft background\" } }"
)
puts result.id
复制
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader("{\"model\":\"gpt-image-2\",\"prompt\":\"{ \\\"objective\\\": \\\"Generate a hyper-realistic black and white street fashion photograph with selective color accents.\\\", \\\"image_type\\\": \\\"photography\\\", \\\"prompt\\\": { \\\"subject\\\": \\\"A stylish, confident woman crossing a busy city intersection\\\", \\\"wardrobe\\\": { \\\"outerwear\\\": \\\"Oversized blazer in neutral tone\\\", \\\"innerwear\\\": \\\"Bright red fitted top (selective color)\\\", \\\"bottoms\\\": \\\"Loose tailored trousers in neutral tone\\\", \\\"accessories\\\": [ \\\"Bright red leather clutch in hand\\\", \\\"Bright red sunglasses\\\" ] }, \\\"action_motion\\\": \\\"Walking briskly toward the camera, hair flowing backward due to motion, blazer and trousers moving naturally\\\", \\\"scene\\\": \\\"Busy urban crosswalk with pedestrians and cars motion-blurred in the background\\\", \\\"perspective\\\": \\\"Frontal tracking shot at waist level\\\", \\\"style\\\": [ \\\"High-end street fashion\\\", \\\"Paparazzi aesthetic\\\", \\\"Editorial candid\\\", \\\"Dynamic movement photography\\\" ], \\\"visual_details\\\": [ \\\"Realistic fabric physics\\\", \\\"Detailed hair movement\\\", \\\"Sharp facial features\\\", \\\"Asphalt road texture\\\", \\\"Motion blur on background crowd\\\", \\\"Bokeh city lights\\\" ], \\\"mood\\\": [ \\\"Confident\\\", \\\"Cosmopolitan\\\", \\\"Urgent\\\", \\\"Powerful\\\" ] }, \\\"camera_and_composition\\\": { \\\"angle\\\": \\\"Waist-level\\\", \\\"framing\\\": \\\"Subject centered, background expanding outward with motion blur\\\", \\\"depth_of_field\\\": \\\"Shallow depth of field isolating the subject\\\" }, \\\"lighting\\\": { \\\"type\\\": \\\"Natural backlight with rim lighting\\\", \\\"contrast\\\": \\\"High contrast emphasizing silhouette and edges\\\" }, \\\"post_processing\\\": { \\\"color_mode\\\": \\\"Black and white with selective red color accents only on innerwear, sunglasses, and clutch bag\\\", \\\"effects\\\": [ \\\"Subtle lens flare\\\", \\\"Vintage film stock emulation\\\", \\\"High micro-contrast\\\", \\\"Film grain texture\\\" ] }, \\\"negative_prompt\\\": [ \\\"Posed studio look\\\", \\\"Empty street\\\", \\\"Static posture\\\", \\\"Low realism\\\", \\\"Full color image\\\", \\\"Overexposed highlights\\\", \\\"Flat lighting\\\" ], \\\"output_quality\\\": { \\\"resolution\\\": \\\"Ultra high resolution\\\", \\\"detail_level\\\": \\\"Maximum photorealism\\\", \\\"sharpness\\\": \\\"Crisp subject, soft background\\\" } }\"}")
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)
}