复制
1. claude mcp add runapi -s user -- npx -y @runapi.ai/mcp
2. 重启 Claude Code
3. 粘贴这个 prompt:生成一张图像:"{ "type": "image_generation", "style": "ultra_realistic_cinematic", "aspect_ratio": "3:4", "resolution": "8K", "camera": { "model": "DSLR", "lens": "50mm", "angle": "dynamic slight tilt, courtside perspective", "depth_of_field": "shallow", "focus": "sharp on phone and players, soft background blur" }, "scene": { "subject": "smartphone lying on a wooden table", "concept": "phone screen transformed into a professional tennis court", "court_surface": "pristine blue hardcourt with fine scratches and chalk marks", "players": "miniature tennis players serving, volleying, diving for shots", "scale": "realistic miniature proportions" }, "lighting": { "type": "dramatic directional lighting", "source": "stadium-style lights from the side", "effect": "strong highlights and long shadows", "reflection": "soft reflection of floodlights on phone glass" }, "details": { "phone_surface": [ "visible fingerprints", "subtle smudges", "micro scratches on edges" ], "atmosphere": [ "floating dust particles", "light haze for depth" ], "textures": "hyper-detailed court surface, realistic materials" }, "environment": { "table": "natural wood with grain texture", "background": "softly blurred, cinematic indoor setting" }, "color_grading": { "palette": "vibrant yet natural", "contrast": "high but balanced", "tone": "cinematic realism" }, "aesthetic": { "mood": "dynamic, energetic, premium sports visual", "style": "high-end sports advertisement" }, "render_quality": { "sharpness": "ultra-crisp", "detail_level": "extreme", "photorealism": "DSLR-grade realism" } }"
复制
1. codex plugin install runapi-mcp@agents
2. 重启 Codex
3. 粘贴这个 prompt:生成一张图像:"{ "type": "image_generation", "style": "ultra_realistic_cinematic", "aspect_ratio": "3:4", "resolution": "8K", "camera": { "model": "DSLR", "lens": "50mm", "angle": "dynamic slight tilt, courtside perspective", "depth_of_field": "shallow", "focus": "sharp on phone and players, soft background blur" }, "scene": { "subject": "smartphone lying on a wooden table", "concept": "phone screen transformed into a professional tennis court", "court_surface": "pristine blue hardcourt with fine scratches and chalk marks", "players": "miniature tennis players serving, volleying, diving for shots", "scale": "realistic miniature proportions" }, "lighting": { "type": "dramatic directional lighting", "source": "stadium-style lights from the side", "effect": "strong highlights and long shadows", "reflection": "soft reflection of floodlights on phone glass" }, "details": { "phone_surface": [ "visible fingerprints", "subtle smudges", "micro scratches on edges" ], "atmosphere": [ "floating dust particles", "light haze for depth" ], "textures": "hyper-detailed court surface, realistic materials" }, "environment": { "table": "natural wood with grain texture", "background": "softly blurred, cinematic indoor setting" }, "color_grading": { "palette": "vibrant yet natural", "contrast": "high but balanced", "tone": "cinematic realism" }, "aesthetic": { "mood": "dynamic, energetic, premium sports visual", "style": "high-end sports advertisement" }, "render_quality": { "sharpness": "ultra-crisp", "detail_level": "extreme", "photorealism": "DSLR-grade realism" } }"
复制
1. npx @runapi.ai/mcp init cursor
2. 重启 Cursor
3. 粘贴这个 prompt:生成一张图像:"{ "type": "image_generation", "style": "ultra_realistic_cinematic", "aspect_ratio": "3:4", "resolution": "8K", "camera": { "model": "DSLR", "lens": "50mm", "angle": "dynamic slight tilt, courtside perspective", "depth_of_field": "shallow", "focus": "sharp on phone and players, soft background blur" }, "scene": { "subject": "smartphone lying on a wooden table", "concept": "phone screen transformed into a professional tennis court", "court_surface": "pristine blue hardcourt with fine scratches and chalk marks", "players": "miniature tennis players serving, volleying, diving for shots", "scale": "realistic miniature proportions" }, "lighting": { "type": "dramatic directional lighting", "source": "stadium-style lights from the side", "effect": "strong highlights and long shadows", "reflection": "soft reflection of floodlights on phone glass" }, "details": { "phone_surface": [ "visible fingerprints", "subtle smudges", "micro scratches on edges" ], "atmosphere": [ "floating dust particles", "light haze for depth" ], "textures": "hyper-detailed court surface, realistic materials" }, "environment": { "table": "natural wood with grain texture", "background": "softly blurred, cinematic indoor setting" }, "color_grading": { "palette": "vibrant yet natural", "contrast": "high but balanced", "tone": "cinematic realism" }, "aesthetic": { "mood": "dynamic, energetic, premium sports visual", "style": "high-end sports advertisement" }, "render_quality": { "sharpness": "ultra-crisp", "detail_level": "extreme", "photorealism": "DSLR-grade realism" } }"
复制
1. npx @runapi.ai/mcp init windsurf
2. 重启 Windsurf
3. 粘贴这个 prompt:生成一张图像:"{ "type": "image_generation", "style": "ultra_realistic_cinematic", "aspect_ratio": "3:4", "resolution": "8K", "camera": { "model": "DSLR", "lens": "50mm", "angle": "dynamic slight tilt, courtside perspective", "depth_of_field": "shallow", "focus": "sharp on phone and players, soft background blur" }, "scene": { "subject": "smartphone lying on a wooden table", "concept": "phone screen transformed into a professional tennis court", "court_surface": "pristine blue hardcourt with fine scratches and chalk marks", "players": "miniature tennis players serving, volleying, diving for shots", "scale": "realistic miniature proportions" }, "lighting": { "type": "dramatic directional lighting", "source": "stadium-style lights from the side", "effect": "strong highlights and long shadows", "reflection": "soft reflection of floodlights on phone glass" }, "details": { "phone_surface": [ "visible fingerprints", "subtle smudges", "micro scratches on edges" ], "atmosphere": [ "floating dust particles", "light haze for depth" ], "textures": "hyper-detailed court surface, realistic materials" }, "environment": { "table": "natural wood with grain texture", "background": "softly blurred, cinematic indoor setting" }, "color_grading": { "palette": "vibrant yet natural", "contrast": "high but balanced", "tone": "cinematic realism" }, "aesthetic": { "mood": "dynamic, energetic, premium sports visual", "style": "high-end sports advertisement" }, "render_quality": { "sharpness": "ultra-crisp", "detail_level": "extreme", "photorealism": "DSLR-grade realism" } }"
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": "{ \"type\": \"image_generation\", \"style\": \"ultra_realistic_cinematic\", \"aspect_ratio\": \"3:4\", \"resolution\": \"8K\", \"camera\": { \"model\": \"DSLR\", \"lens\": \"50mm\", \"angle\": \"dynamic slight tilt, courtside perspective\", \"depth_of_field\": \"shallow\", \"focus\": \"sharp on phone and players, soft background blur\" }, \"scene\": { \"subject\": \"smartphone lying on a wooden table\", \"concept\": \"phone screen transformed into a professional tennis court\", \"court_surface\": \"pristine blue hardcourt with fine scratches and chalk marks\", \"players\": \"miniature tennis players serving, volleying, diving for shots\", \"scale\": \"realistic miniature proportions\" }, \"lighting\": { \"type\": \"dramatic directional lighting\", \"source\": \"stadium-style lights from the side\", \"effect\": \"strong highlights and long shadows\", \"reflection\": \"soft reflection of floodlights on phone glass\" }, \"details\": { \"phone_surface\": [ \"visible fingerprints\", \"subtle smudges\", \"micro scratches on edges\" ], \"atmosphere\": [ \"floating dust particles\", \"light haze for depth\" ], \"textures\": \"hyper-detailed court surface, realistic materials\" }, \"environment\": { \"table\": \"natural wood with grain texture\", \"background\": \"softly blurred, cinematic indoor setting\" }, \"color_grading\": { \"palette\": \"vibrant yet natural\", \"contrast\": \"high but balanced\", \"tone\": \"cinematic realism\" }, \"aesthetic\": { \"mood\": \"dynamic, energetic, premium sports visual\", \"style\": \"high-end sports advertisement\" }, \"render_quality\": { \"sharpness\": \"ultra-crisp\", \"detail_level\": \"extreme\", \"photorealism\": \"DSLR-grade realism\" } }"
}
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": "{ \"type\": \"image_generation\", \"style\": \"ultra_realistic_cinematic\", \"aspect_ratio\": \"3:4\", \"resolution\": \"8K\", \"camera\": { \"model\": \"DSLR\", \"lens\": \"50mm\", \"angle\": \"dynamic slight tilt, courtside perspective\", \"depth_of_field\": \"shallow\", \"focus\": \"sharp on phone and players, soft background blur\" }, \"scene\": { \"subject\": \"smartphone lying on a wooden table\", \"concept\": \"phone screen transformed into a professional tennis court\", \"court_surface\": \"pristine blue hardcourt with fine scratches and chalk marks\", \"players\": \"miniature tennis players serving, volleying, diving for shots\", \"scale\": \"realistic miniature proportions\" }, \"lighting\": { \"type\": \"dramatic directional lighting\", \"source\": \"stadium-style lights from the side\", \"effect\": \"strong highlights and long shadows\", \"reflection\": \"soft reflection of floodlights on phone glass\" }, \"details\": { \"phone_surface\": [ \"visible fingerprints\", \"subtle smudges\", \"micro scratches on edges\" ], \"atmosphere\": [ \"floating dust particles\", \"light haze for depth\" ], \"textures\": \"hyper-detailed court surface, realistic materials\" }, \"environment\": { \"table\": \"natural wood with grain texture\", \"background\": \"softly blurred, cinematic indoor setting\" }, \"color_grading\": { \"palette\": \"vibrant yet natural\", \"contrast\": \"high but balanced\", \"tone\": \"cinematic realism\" }, \"aesthetic\": { \"mood\": \"dynamic, energetic, premium sports visual\", \"style\": \"high-end sports advertisement\" }, \"render_quality\": { \"sharpness\": \"ultra-crisp\", \"detail_level\": \"extreme\", \"photorealism\": \"DSLR-grade realism\" } }"
});
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: "{ \"type\": \"image_generation\", \"style\": \"ultra_realistic_cinematic\", \"aspect_ratio\": \"3:4\", \"resolution\": \"8K\", \"camera\": { \"model\": \"DSLR\", \"lens\": \"50mm\", \"angle\": \"dynamic slight tilt, courtside perspective\", \"depth_of_field\": \"shallow\", \"focus\": \"sharp on phone and players, soft background blur\" }, \"scene\": { \"subject\": \"smartphone lying on a wooden table\", \"concept\": \"phone screen transformed into a professional tennis court\", \"court_surface\": \"pristine blue hardcourt with fine scratches and chalk marks\", \"players\": \"miniature tennis players serving, volleying, diving for shots\", \"scale\": \"realistic miniature proportions\" }, \"lighting\": { \"type\": \"dramatic directional lighting\", \"source\": \"stadium-style lights from the side\", \"effect\": \"strong highlights and long shadows\", \"reflection\": \"soft reflection of floodlights on phone glass\" }, \"details\": { \"phone_surface\": [ \"visible fingerprints\", \"subtle smudges\", \"micro scratches on edges\" ], \"atmosphere\": [ \"floating dust particles\", \"light haze for depth\" ], \"textures\": \"hyper-detailed court surface, realistic materials\" }, \"environment\": { \"table\": \"natural wood with grain texture\", \"background\": \"softly blurred, cinematic indoor setting\" }, \"color_grading\": { \"palette\": \"vibrant yet natural\", \"contrast\": \"high but balanced\", \"tone\": \"cinematic realism\" }, \"aesthetic\": { \"mood\": \"dynamic, energetic, premium sports visual\", \"style\": \"high-end sports advertisement\" }, \"render_quality\": { \"sharpness\": \"ultra-crisp\", \"detail_level\": \"extreme\", \"photorealism\": \"DSLR-grade realism\" } }"
)
puts result.id
复制
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader("{\"model\":\"gpt-image-2\",\"prompt\":\"{ \\\"type\\\": \\\"image_generation\\\", \\\"style\\\": \\\"ultra_realistic_cinematic\\\", \\\"aspect_ratio\\\": \\\"3:4\\\", \\\"resolution\\\": \\\"8K\\\", \\\"camera\\\": { \\\"model\\\": \\\"DSLR\\\", \\\"lens\\\": \\\"50mm\\\", \\\"angle\\\": \\\"dynamic slight tilt, courtside perspective\\\", \\\"depth_of_field\\\": \\\"shallow\\\", \\\"focus\\\": \\\"sharp on phone and players, soft background blur\\\" }, \\\"scene\\\": { \\\"subject\\\": \\\"smartphone lying on a wooden table\\\", \\\"concept\\\": \\\"phone screen transformed into a professional tennis court\\\", \\\"court_surface\\\": \\\"pristine blue hardcourt with fine scratches and chalk marks\\\", \\\"players\\\": \\\"miniature tennis players serving, volleying, diving for shots\\\", \\\"scale\\\": \\\"realistic miniature proportions\\\" }, \\\"lighting\\\": { \\\"type\\\": \\\"dramatic directional lighting\\\", \\\"source\\\": \\\"stadium-style lights from the side\\\", \\\"effect\\\": \\\"strong highlights and long shadows\\\", \\\"reflection\\\": \\\"soft reflection of floodlights on phone glass\\\" }, \\\"details\\\": { \\\"phone_surface\\\": [ \\\"visible fingerprints\\\", \\\"subtle smudges\\\", \\\"micro scratches on edges\\\" ], \\\"atmosphere\\\": [ \\\"floating dust particles\\\", \\\"light haze for depth\\\" ], \\\"textures\\\": \\\"hyper-detailed court surface, realistic materials\\\" }, \\\"environment\\\": { \\\"table\\\": \\\"natural wood with grain texture\\\", \\\"background\\\": \\\"softly blurred, cinematic indoor setting\\\" }, \\\"color_grading\\\": { \\\"palette\\\": \\\"vibrant yet natural\\\", \\\"contrast\\\": \\\"high but balanced\\\", \\\"tone\\\": \\\"cinematic realism\\\" }, \\\"aesthetic\\\": { \\\"mood\\\": \\\"dynamic, energetic, premium sports visual\\\", \\\"style\\\": \\\"high-end sports advertisement\\\" }, \\\"render_quality\\\": { \\\"sharpness\\\": \\\"ultra-crisp\\\", \\\"detail_level\\\": \\\"extreme\\\", \\\"photorealism\\\": \\\"DSLR-grade realism\\\" } }\"}")
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)
}