复制
1. claude mcp add runapi -s user -- npx -y @runapi.ai/mcp
2. 重启 Claude Code
3. 粘贴这个 prompt:生成一张图像:"{ "image_type": "Hyper-realistic cinematic food photography", "resolution": "8K", "aspect_ratio": "3:4", "camera": { "shot_type": "Hero shot", "angle": "Slightly low-angle with central focus", "focus": "Ultra-sharp foreground with controlled depth of field", "motion_capture": "Frozen mid-air action with splash dynamics" }, "lighting": { "style": "Cinematic studio lighting", "highlights": "Strong specular highlights emphasizing oil, glaze, and moisture", "shadows": "Deep, dramatic shadows for contrast and depth", "rim_light": "Visible edge lighting outlining food elements", "ambient": "Low-key lighting environment" }, "background": { "color": "Dark charcoal to deep maroon tones", "texture": "Smoky, atmospheric backdrop", "elements": [ "Rising steam", "Spice-infused smoke", "Floating embers and sparks" ] }, "primary_subjects": [ { "item": "Cooked food pieces", "position": "Suspended mid-air", "surface_detail": "Charred edges, textured crust, glossy coating", "motion": "Erupting upward with dynamic splash behavior" } ], "secondary_elements": [ { "item": "Sauce or gravy", "state": "Thick and glossy", "motion": "Explosive splash with visible droplets and arcs", "detail": "Oil separation visible as shimmering droplets" }, { "item": "Herbs", "types": [ "Fresh coriander leaves", "Mint leaves" ], "motion": "Scattered and floating naturally" }, { "item": "Spices", "types": [ "Whole dried red chilies", "Whole spices (clearly visible star-shaped and pod-like forms)", "Crushed spice particles" ], "behavior": "Suspended mid-air, dispersed unevenly" }, { "item": "Vegetables", "types": [ "Bell peppers (green and red)", "Onion chunks" ], "cut": "Large rustic chunks", "surface": "Light char and gloss" } ], "supporting_food_items": [ { "item": "Rice grains", "detail": "Individual grains clearly visible, mid-air dispersion", "motion": "Erupting outward with spices" }, { "item": "Nuts and dry fruits", "types": [ "Cashews", "Raisins" ], "position": "Mixed with rice and floating" }, { "item": "Flatbread pieces", "detail": "Torn edges, soft interior texture, char marks visible", "motion": "Suspended mid-air with crumbs" } ], "condiments": [ { "item": "Green chutney", "texture": "Thick, coarse", "motion": "Upward splash from a bowl", "container": "Dark stone bowl with matte finish" }, { "item": "White yogurt-based sauce", "texture": "Smooth and creamy", "container": "Dark stone bowl" } ], "surface_environment": { "base": "Dark textured surface", "elements": [ "Scattered spice flakes", "Burnt crumbs", "Small glowing embers", "Charcoal-like stones" ] }, "color_palette": [ "Deep reds", "Burnt orange", "Charcoal black", "Smoky maroon", "Herb green", "Creamy white highlights" ], "mood": "Bold, intense, premium, cinematic, high-impact food commercial aesthetic", "realism_level": "Extreme hyper-realism with tactile textures and moisture detail", "post_processing": { "contrast": "High", "clarity": "Very high", "sharpening": "Selective sharpening on food textures", "noise": "Minimal", "color_grading": "Warm highlights with deep shadows" } }"
复制
1. codex plugin install runapi-mcp@agents
2. 重启 Codex
3. 粘贴这个 prompt:生成一张图像:"{ "image_type": "Hyper-realistic cinematic food photography", "resolution": "8K", "aspect_ratio": "3:4", "camera": { "shot_type": "Hero shot", "angle": "Slightly low-angle with central focus", "focus": "Ultra-sharp foreground with controlled depth of field", "motion_capture": "Frozen mid-air action with splash dynamics" }, "lighting": { "style": "Cinematic studio lighting", "highlights": "Strong specular highlights emphasizing oil, glaze, and moisture", "shadows": "Deep, dramatic shadows for contrast and depth", "rim_light": "Visible edge lighting outlining food elements", "ambient": "Low-key lighting environment" }, "background": { "color": "Dark charcoal to deep maroon tones", "texture": "Smoky, atmospheric backdrop", "elements": [ "Rising steam", "Spice-infused smoke", "Floating embers and sparks" ] }, "primary_subjects": [ { "item": "Cooked food pieces", "position": "Suspended mid-air", "surface_detail": "Charred edges, textured crust, glossy coating", "motion": "Erupting upward with dynamic splash behavior" } ], "secondary_elements": [ { "item": "Sauce or gravy", "state": "Thick and glossy", "motion": "Explosive splash with visible droplets and arcs", "detail": "Oil separation visible as shimmering droplets" }, { "item": "Herbs", "types": [ "Fresh coriander leaves", "Mint leaves" ], "motion": "Scattered and floating naturally" }, { "item": "Spices", "types": [ "Whole dried red chilies", "Whole spices (clearly visible star-shaped and pod-like forms)", "Crushed spice particles" ], "behavior": "Suspended mid-air, dispersed unevenly" }, { "item": "Vegetables", "types": [ "Bell peppers (green and red)", "Onion chunks" ], "cut": "Large rustic chunks", "surface": "Light char and gloss" } ], "supporting_food_items": [ { "item": "Rice grains", "detail": "Individual grains clearly visible, mid-air dispersion", "motion": "Erupting outward with spices" }, { "item": "Nuts and dry fruits", "types": [ "Cashews", "Raisins" ], "position": "Mixed with rice and floating" }, { "item": "Flatbread pieces", "detail": "Torn edges, soft interior texture, char marks visible", "motion": "Suspended mid-air with crumbs" } ], "condiments": [ { "item": "Green chutney", "texture": "Thick, coarse", "motion": "Upward splash from a bowl", "container": "Dark stone bowl with matte finish" }, { "item": "White yogurt-based sauce", "texture": "Smooth and creamy", "container": "Dark stone bowl" } ], "surface_environment": { "base": "Dark textured surface", "elements": [ "Scattered spice flakes", "Burnt crumbs", "Small glowing embers", "Charcoal-like stones" ] }, "color_palette": [ "Deep reds", "Burnt orange", "Charcoal black", "Smoky maroon", "Herb green", "Creamy white highlights" ], "mood": "Bold, intense, premium, cinematic, high-impact food commercial aesthetic", "realism_level": "Extreme hyper-realism with tactile textures and moisture detail", "post_processing": { "contrast": "High", "clarity": "Very high", "sharpening": "Selective sharpening on food textures", "noise": "Minimal", "color_grading": "Warm highlights with deep shadows" } }"
复制
1. npx @runapi.ai/mcp init cursor
2. 重启 Cursor
3. 粘贴这个 prompt:生成一张图像:"{ "image_type": "Hyper-realistic cinematic food photography", "resolution": "8K", "aspect_ratio": "3:4", "camera": { "shot_type": "Hero shot", "angle": "Slightly low-angle with central focus", "focus": "Ultra-sharp foreground with controlled depth of field", "motion_capture": "Frozen mid-air action with splash dynamics" }, "lighting": { "style": "Cinematic studio lighting", "highlights": "Strong specular highlights emphasizing oil, glaze, and moisture", "shadows": "Deep, dramatic shadows for contrast and depth", "rim_light": "Visible edge lighting outlining food elements", "ambient": "Low-key lighting environment" }, "background": { "color": "Dark charcoal to deep maroon tones", "texture": "Smoky, atmospheric backdrop", "elements": [ "Rising steam", "Spice-infused smoke", "Floating embers and sparks" ] }, "primary_subjects": [ { "item": "Cooked food pieces", "position": "Suspended mid-air", "surface_detail": "Charred edges, textured crust, glossy coating", "motion": "Erupting upward with dynamic splash behavior" } ], "secondary_elements": [ { "item": "Sauce or gravy", "state": "Thick and glossy", "motion": "Explosive splash with visible droplets and arcs", "detail": "Oil separation visible as shimmering droplets" }, { "item": "Herbs", "types": [ "Fresh coriander leaves", "Mint leaves" ], "motion": "Scattered and floating naturally" }, { "item": "Spices", "types": [ "Whole dried red chilies", "Whole spices (clearly visible star-shaped and pod-like forms)", "Crushed spice particles" ], "behavior": "Suspended mid-air, dispersed unevenly" }, { "item": "Vegetables", "types": [ "Bell peppers (green and red)", "Onion chunks" ], "cut": "Large rustic chunks", "surface": "Light char and gloss" } ], "supporting_food_items": [ { "item": "Rice grains", "detail": "Individual grains clearly visible, mid-air dispersion", "motion": "Erupting outward with spices" }, { "item": "Nuts and dry fruits", "types": [ "Cashews", "Raisins" ], "position": "Mixed with rice and floating" }, { "item": "Flatbread pieces", "detail": "Torn edges, soft interior texture, char marks visible", "motion": "Suspended mid-air with crumbs" } ], "condiments": [ { "item": "Green chutney", "texture": "Thick, coarse", "motion": "Upward splash from a bowl", "container": "Dark stone bowl with matte finish" }, { "item": "White yogurt-based sauce", "texture": "Smooth and creamy", "container": "Dark stone bowl" } ], "surface_environment": { "base": "Dark textured surface", "elements": [ "Scattered spice flakes", "Burnt crumbs", "Small glowing embers", "Charcoal-like stones" ] }, "color_palette": [ "Deep reds", "Burnt orange", "Charcoal black", "Smoky maroon", "Herb green", "Creamy white highlights" ], "mood": "Bold, intense, premium, cinematic, high-impact food commercial aesthetic", "realism_level": "Extreme hyper-realism with tactile textures and moisture detail", "post_processing": { "contrast": "High", "clarity": "Very high", "sharpening": "Selective sharpening on food textures", "noise": "Minimal", "color_grading": "Warm highlights with deep shadows" } }"
复制
1. npx @runapi.ai/mcp init windsurf
2. 重启 Windsurf
3. 粘贴这个 prompt:生成一张图像:"{ "image_type": "Hyper-realistic cinematic food photography", "resolution": "8K", "aspect_ratio": "3:4", "camera": { "shot_type": "Hero shot", "angle": "Slightly low-angle with central focus", "focus": "Ultra-sharp foreground with controlled depth of field", "motion_capture": "Frozen mid-air action with splash dynamics" }, "lighting": { "style": "Cinematic studio lighting", "highlights": "Strong specular highlights emphasizing oil, glaze, and moisture", "shadows": "Deep, dramatic shadows for contrast and depth", "rim_light": "Visible edge lighting outlining food elements", "ambient": "Low-key lighting environment" }, "background": { "color": "Dark charcoal to deep maroon tones", "texture": "Smoky, atmospheric backdrop", "elements": [ "Rising steam", "Spice-infused smoke", "Floating embers and sparks" ] }, "primary_subjects": [ { "item": "Cooked food pieces", "position": "Suspended mid-air", "surface_detail": "Charred edges, textured crust, glossy coating", "motion": "Erupting upward with dynamic splash behavior" } ], "secondary_elements": [ { "item": "Sauce or gravy", "state": "Thick and glossy", "motion": "Explosive splash with visible droplets and arcs", "detail": "Oil separation visible as shimmering droplets" }, { "item": "Herbs", "types": [ "Fresh coriander leaves", "Mint leaves" ], "motion": "Scattered and floating naturally" }, { "item": "Spices", "types": [ "Whole dried red chilies", "Whole spices (clearly visible star-shaped and pod-like forms)", "Crushed spice particles" ], "behavior": "Suspended mid-air, dispersed unevenly" }, { "item": "Vegetables", "types": [ "Bell peppers (green and red)", "Onion chunks" ], "cut": "Large rustic chunks", "surface": "Light char and gloss" } ], "supporting_food_items": [ { "item": "Rice grains", "detail": "Individual grains clearly visible, mid-air dispersion", "motion": "Erupting outward with spices" }, { "item": "Nuts and dry fruits", "types": [ "Cashews", "Raisins" ], "position": "Mixed with rice and floating" }, { "item": "Flatbread pieces", "detail": "Torn edges, soft interior texture, char marks visible", "motion": "Suspended mid-air with crumbs" } ], "condiments": [ { "item": "Green chutney", "texture": "Thick, coarse", "motion": "Upward splash from a bowl", "container": "Dark stone bowl with matte finish" }, { "item": "White yogurt-based sauce", "texture": "Smooth and creamy", "container": "Dark stone bowl" } ], "surface_environment": { "base": "Dark textured surface", "elements": [ "Scattered spice flakes", "Burnt crumbs", "Small glowing embers", "Charcoal-like stones" ] }, "color_palette": [ "Deep reds", "Burnt orange", "Charcoal black", "Smoky maroon", "Herb green", "Creamy white highlights" ], "mood": "Bold, intense, premium, cinematic, high-impact food commercial aesthetic", "realism_level": "Extreme hyper-realism with tactile textures and moisture detail", "post_processing": { "contrast": "High", "clarity": "Very high", "sharpening": "Selective sharpening on food textures", "noise": "Minimal", "color_grading": "Warm highlights with deep shadows" } }"
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": "{ \"image_type\": \"Hyper-realistic cinematic food photography\", \"resolution\": \"8K\", \"aspect_ratio\": \"3:4\", \"camera\": { \"shot_type\": \"Hero shot\", \"angle\": \"Slightly low-angle with central focus\", \"focus\": \"Ultra-sharp foreground with controlled depth of field\", \"motion_capture\": \"Frozen mid-air action with splash dynamics\" }, \"lighting\": { \"style\": \"Cinematic studio lighting\", \"highlights\": \"Strong specular highlights emphasizing oil, glaze, and moisture\", \"shadows\": \"Deep, dramatic shadows for contrast and depth\", \"rim_light\": \"Visible edge lighting outlining food elements\", \"ambient\": \"Low-key lighting environment\" }, \"background\": { \"color\": \"Dark charcoal to deep maroon tones\", \"texture\": \"Smoky, atmospheric backdrop\", \"elements\": [ \"Rising steam\", \"Spice-infused smoke\", \"Floating embers and sparks\" ] }, \"primary_subjects\": [ { \"item\": \"Cooked food pieces\", \"position\": \"Suspended mid-air\", \"surface_detail\": \"Charred edges, textured crust, glossy coating\", \"motion\": \"Erupting upward with dynamic splash behavior\" } ], \"secondary_elements\": [ { \"item\": \"Sauce or gravy\", \"state\": \"Thick and glossy\", \"motion\": \"Explosive splash with visible droplets and arcs\", \"detail\": \"Oil separation visible as shimmering droplets\" }, { \"item\": \"Herbs\", \"types\": [ \"Fresh coriander leaves\", \"Mint leaves\" ], \"motion\": \"Scattered and floating naturally\" }, { \"item\": \"Spices\", \"types\": [ \"Whole dried red chilies\", \"Whole spices (clearly visible star-shaped and pod-like forms)\", \"Crushed spice particles\" ], \"behavior\": \"Suspended mid-air, dispersed unevenly\" }, { \"item\": \"Vegetables\", \"types\": [ \"Bell peppers (green and red)\", \"Onion chunks\" ], \"cut\": \"Large rustic chunks\", \"surface\": \"Light char and gloss\" } ], \"supporting_food_items\": [ { \"item\": \"Rice grains\", \"detail\": \"Individual grains clearly visible, mid-air dispersion\", \"motion\": \"Erupting outward with spices\" }, { \"item\": \"Nuts and dry fruits\", \"types\": [ \"Cashews\", \"Raisins\" ], \"position\": \"Mixed with rice and floating\" }, { \"item\": \"Flatbread pieces\", \"detail\": \"Torn edges, soft interior texture, char marks visible\", \"motion\": \"Suspended mid-air with crumbs\" } ], \"condiments\": [ { \"item\": \"Green chutney\", \"texture\": \"Thick, coarse\", \"motion\": \"Upward splash from a bowl\", \"container\": \"Dark stone bowl with matte finish\" }, { \"item\": \"White yogurt-based sauce\", \"texture\": \"Smooth and creamy\", \"container\": \"Dark stone bowl\" } ], \"surface_environment\": { \"base\": \"Dark textured surface\", \"elements\": [ \"Scattered spice flakes\", \"Burnt crumbs\", \"Small glowing embers\", \"Charcoal-like stones\" ] }, \"color_palette\": [ \"Deep reds\", \"Burnt orange\", \"Charcoal black\", \"Smoky maroon\", \"Herb green\", \"Creamy white highlights\" ], \"mood\": \"Bold, intense, premium, cinematic, high-impact food commercial aesthetic\", \"realism_level\": \"Extreme hyper-realism with tactile textures and moisture detail\", \"post_processing\": { \"contrast\": \"High\", \"clarity\": \"Very high\", \"sharpening\": \"Selective sharpening on food textures\", \"noise\": \"Minimal\", \"color_grading\": \"Warm highlights with deep shadows\" } }"
}
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": "{ \"image_type\": \"Hyper-realistic cinematic food photography\", \"resolution\": \"8K\", \"aspect_ratio\": \"3:4\", \"camera\": { \"shot_type\": \"Hero shot\", \"angle\": \"Slightly low-angle with central focus\", \"focus\": \"Ultra-sharp foreground with controlled depth of field\", \"motion_capture\": \"Frozen mid-air action with splash dynamics\" }, \"lighting\": { \"style\": \"Cinematic studio lighting\", \"highlights\": \"Strong specular highlights emphasizing oil, glaze, and moisture\", \"shadows\": \"Deep, dramatic shadows for contrast and depth\", \"rim_light\": \"Visible edge lighting outlining food elements\", \"ambient\": \"Low-key lighting environment\" }, \"background\": { \"color\": \"Dark charcoal to deep maroon tones\", \"texture\": \"Smoky, atmospheric backdrop\", \"elements\": [ \"Rising steam\", \"Spice-infused smoke\", \"Floating embers and sparks\" ] }, \"primary_subjects\": [ { \"item\": \"Cooked food pieces\", \"position\": \"Suspended mid-air\", \"surface_detail\": \"Charred edges, textured crust, glossy coating\", \"motion\": \"Erupting upward with dynamic splash behavior\" } ], \"secondary_elements\": [ { \"item\": \"Sauce or gravy\", \"state\": \"Thick and glossy\", \"motion\": \"Explosive splash with visible droplets and arcs\", \"detail\": \"Oil separation visible as shimmering droplets\" }, { \"item\": \"Herbs\", \"types\": [ \"Fresh coriander leaves\", \"Mint leaves\" ], \"motion\": \"Scattered and floating naturally\" }, { \"item\": \"Spices\", \"types\": [ \"Whole dried red chilies\", \"Whole spices (clearly visible star-shaped and pod-like forms)\", \"Crushed spice particles\" ], \"behavior\": \"Suspended mid-air, dispersed unevenly\" }, { \"item\": \"Vegetables\", \"types\": [ \"Bell peppers (green and red)\", \"Onion chunks\" ], \"cut\": \"Large rustic chunks\", \"surface\": \"Light char and gloss\" } ], \"supporting_food_items\": [ { \"item\": \"Rice grains\", \"detail\": \"Individual grains clearly visible, mid-air dispersion\", \"motion\": \"Erupting outward with spices\" }, { \"item\": \"Nuts and dry fruits\", \"types\": [ \"Cashews\", \"Raisins\" ], \"position\": \"Mixed with rice and floating\" }, { \"item\": \"Flatbread pieces\", \"detail\": \"Torn edges, soft interior texture, char marks visible\", \"motion\": \"Suspended mid-air with crumbs\" } ], \"condiments\": [ { \"item\": \"Green chutney\", \"texture\": \"Thick, coarse\", \"motion\": \"Upward splash from a bowl\", \"container\": \"Dark stone bowl with matte finish\" }, { \"item\": \"White yogurt-based sauce\", \"texture\": \"Smooth and creamy\", \"container\": \"Dark stone bowl\" } ], \"surface_environment\": { \"base\": \"Dark textured surface\", \"elements\": [ \"Scattered spice flakes\", \"Burnt crumbs\", \"Small glowing embers\", \"Charcoal-like stones\" ] }, \"color_palette\": [ \"Deep reds\", \"Burnt orange\", \"Charcoal black\", \"Smoky maroon\", \"Herb green\", \"Creamy white highlights\" ], \"mood\": \"Bold, intense, premium, cinematic, high-impact food commercial aesthetic\", \"realism_level\": \"Extreme hyper-realism with tactile textures and moisture detail\", \"post_processing\": { \"contrast\": \"High\", \"clarity\": \"Very high\", \"sharpening\": \"Selective sharpening on food textures\", \"noise\": \"Minimal\", \"color_grading\": \"Warm highlights with deep shadows\" } }"
});
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: "{ \"image_type\": \"Hyper-realistic cinematic food photography\", \"resolution\": \"8K\", \"aspect_ratio\": \"3:4\", \"camera\": { \"shot_type\": \"Hero shot\", \"angle\": \"Slightly low-angle with central focus\", \"focus\": \"Ultra-sharp foreground with controlled depth of field\", \"motion_capture\": \"Frozen mid-air action with splash dynamics\" }, \"lighting\": { \"style\": \"Cinematic studio lighting\", \"highlights\": \"Strong specular highlights emphasizing oil, glaze, and moisture\", \"shadows\": \"Deep, dramatic shadows for contrast and depth\", \"rim_light\": \"Visible edge lighting outlining food elements\", \"ambient\": \"Low-key lighting environment\" }, \"background\": { \"color\": \"Dark charcoal to deep maroon tones\", \"texture\": \"Smoky, atmospheric backdrop\", \"elements\": [ \"Rising steam\", \"Spice-infused smoke\", \"Floating embers and sparks\" ] }, \"primary_subjects\": [ { \"item\": \"Cooked food pieces\", \"position\": \"Suspended mid-air\", \"surface_detail\": \"Charred edges, textured crust, glossy coating\", \"motion\": \"Erupting upward with dynamic splash behavior\" } ], \"secondary_elements\": [ { \"item\": \"Sauce or gravy\", \"state\": \"Thick and glossy\", \"motion\": \"Explosive splash with visible droplets and arcs\", \"detail\": \"Oil separation visible as shimmering droplets\" }, { \"item\": \"Herbs\", \"types\": [ \"Fresh coriander leaves\", \"Mint leaves\" ], \"motion\": \"Scattered and floating naturally\" }, { \"item\": \"Spices\", \"types\": [ \"Whole dried red chilies\", \"Whole spices (clearly visible star-shaped and pod-like forms)\", \"Crushed spice particles\" ], \"behavior\": \"Suspended mid-air, dispersed unevenly\" }, { \"item\": \"Vegetables\", \"types\": [ \"Bell peppers (green and red)\", \"Onion chunks\" ], \"cut\": \"Large rustic chunks\", \"surface\": \"Light char and gloss\" } ], \"supporting_food_items\": [ { \"item\": \"Rice grains\", \"detail\": \"Individual grains clearly visible, mid-air dispersion\", \"motion\": \"Erupting outward with spices\" }, { \"item\": \"Nuts and dry fruits\", \"types\": [ \"Cashews\", \"Raisins\" ], \"position\": \"Mixed with rice and floating\" }, { \"item\": \"Flatbread pieces\", \"detail\": \"Torn edges, soft interior texture, char marks visible\", \"motion\": \"Suspended mid-air with crumbs\" } ], \"condiments\": [ { \"item\": \"Green chutney\", \"texture\": \"Thick, coarse\", \"motion\": \"Upward splash from a bowl\", \"container\": \"Dark stone bowl with matte finish\" }, { \"item\": \"White yogurt-based sauce\", \"texture\": \"Smooth and creamy\", \"container\": \"Dark stone bowl\" } ], \"surface_environment\": { \"base\": \"Dark textured surface\", \"elements\": [ \"Scattered spice flakes\", \"Burnt crumbs\", \"Small glowing embers\", \"Charcoal-like stones\" ] }, \"color_palette\": [ \"Deep reds\", \"Burnt orange\", \"Charcoal black\", \"Smoky maroon\", \"Herb green\", \"Creamy white highlights\" ], \"mood\": \"Bold, intense, premium, cinematic, high-impact food commercial aesthetic\", \"realism_level\": \"Extreme hyper-realism with tactile textures and moisture detail\", \"post_processing\": { \"contrast\": \"High\", \"clarity\": \"Very high\", \"sharpening\": \"Selective sharpening on food textures\", \"noise\": \"Minimal\", \"color_grading\": \"Warm highlights with deep shadows\" } }"
)
puts result.id
复制
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader("{\"model\":\"gpt-image-2\",\"prompt\":\"{ \\\"image_type\\\": \\\"Hyper-realistic cinematic food photography\\\", \\\"resolution\\\": \\\"8K\\\", \\\"aspect_ratio\\\": \\\"3:4\\\", \\\"camera\\\": { \\\"shot_type\\\": \\\"Hero shot\\\", \\\"angle\\\": \\\"Slightly low-angle with central focus\\\", \\\"focus\\\": \\\"Ultra-sharp foreground with controlled depth of field\\\", \\\"motion_capture\\\": \\\"Frozen mid-air action with splash dynamics\\\" }, \\\"lighting\\\": { \\\"style\\\": \\\"Cinematic studio lighting\\\", \\\"highlights\\\": \\\"Strong specular highlights emphasizing oil, glaze, and moisture\\\", \\\"shadows\\\": \\\"Deep, dramatic shadows for contrast and depth\\\", \\\"rim_light\\\": \\\"Visible edge lighting outlining food elements\\\", \\\"ambient\\\": \\\"Low-key lighting environment\\\" }, \\\"background\\\": { \\\"color\\\": \\\"Dark charcoal to deep maroon tones\\\", \\\"texture\\\": \\\"Smoky, atmospheric backdrop\\\", \\\"elements\\\": [ \\\"Rising steam\\\", \\\"Spice-infused smoke\\\", \\\"Floating embers and sparks\\\" ] }, \\\"primary_subjects\\\": [ { \\\"item\\\": \\\"Cooked food pieces\\\", \\\"position\\\": \\\"Suspended mid-air\\\", \\\"surface_detail\\\": \\\"Charred edges, textured crust, glossy coating\\\", \\\"motion\\\": \\\"Erupting upward with dynamic splash behavior\\\" } ], \\\"secondary_elements\\\": [ { \\\"item\\\": \\\"Sauce or gravy\\\", \\\"state\\\": \\\"Thick and glossy\\\", \\\"motion\\\": \\\"Explosive splash with visible droplets and arcs\\\", \\\"detail\\\": \\\"Oil separation visible as shimmering droplets\\\" }, { \\\"item\\\": \\\"Herbs\\\", \\\"types\\\": [ \\\"Fresh coriander leaves\\\", \\\"Mint leaves\\\" ], \\\"motion\\\": \\\"Scattered and floating naturally\\\" }, { \\\"item\\\": \\\"Spices\\\", \\\"types\\\": [ \\\"Whole dried red chilies\\\", \\\"Whole spices (clearly visible star-shaped and pod-like forms)\\\", \\\"Crushed spice particles\\\" ], \\\"behavior\\\": \\\"Suspended mid-air, dispersed unevenly\\\" }, { \\\"item\\\": \\\"Vegetables\\\", \\\"types\\\": [ \\\"Bell peppers (green and red)\\\", \\\"Onion chunks\\\" ], \\\"cut\\\": \\\"Large rustic chunks\\\", \\\"surface\\\": \\\"Light char and gloss\\\" } ], \\\"supporting_food_items\\\": [ { \\\"item\\\": \\\"Rice grains\\\", \\\"detail\\\": \\\"Individual grains clearly visible, mid-air dispersion\\\", \\\"motion\\\": \\\"Erupting outward with spices\\\" }, { \\\"item\\\": \\\"Nuts and dry fruits\\\", \\\"types\\\": [ \\\"Cashews\\\", \\\"Raisins\\\" ], \\\"position\\\": \\\"Mixed with rice and floating\\\" }, { \\\"item\\\": \\\"Flatbread pieces\\\", \\\"detail\\\": \\\"Torn edges, soft interior texture, char marks visible\\\", \\\"motion\\\": \\\"Suspended mid-air with crumbs\\\" } ], \\\"condiments\\\": [ { \\\"item\\\": \\\"Green chutney\\\", \\\"texture\\\": \\\"Thick, coarse\\\", \\\"motion\\\": \\\"Upward splash from a bowl\\\", \\\"container\\\": \\\"Dark stone bowl with matte finish\\\" }, { \\\"item\\\": \\\"White yogurt-based sauce\\\", \\\"texture\\\": \\\"Smooth and creamy\\\", \\\"container\\\": \\\"Dark stone bowl\\\" } ], \\\"surface_environment\\\": { \\\"base\\\": \\\"Dark textured surface\\\", \\\"elements\\\": [ \\\"Scattered spice flakes\\\", \\\"Burnt crumbs\\\", \\\"Small glowing embers\\\", \\\"Charcoal-like stones\\\" ] }, \\\"color_palette\\\": [ \\\"Deep reds\\\", \\\"Burnt orange\\\", \\\"Charcoal black\\\", \\\"Smoky maroon\\\", \\\"Herb green\\\", \\\"Creamy white highlights\\\" ], \\\"mood\\\": \\\"Bold, intense, premium, cinematic, high-impact food commercial aesthetic\\\", \\\"realism_level\\\": \\\"Extreme hyper-realism with tactile textures and moisture detail\\\", \\\"post_processing\\\": { \\\"contrast\\\": \\\"High\\\", \\\"clarity\\\": \\\"Very high\\\", \\\"sharpening\\\": \\\"Selective sharpening on food textures\\\", \\\"noise\\\": \\\"Minimal\\\", \\\"color_grading\\\": \\\"Warm highlights with deep shadows\\\" } }\"}")
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)
}