1. claude mcp add runapi -s user -- npx -y @runapi.ai/mcp
2. 重启 Claude Code
3. 粘贴这个 prompt:生成一张图像:"Overhead food photography of a freshly baked round sourdough boule on a rustic wooden cutting board. The bread has been sliced to reveal the open, airy crumb structure with large irregular holes. A bread knife with a dark wood handle rests beside it. Scattered flour dusts the board and surrounding dark slate countertop. A small ceramic bowl of salted butter sits in the upper right corner. Natural side lighting from a kitchen window creates long soft shadows. Warm tones, high detail on the crust texture showing deep caramelization and ear scoring patterns."
1. codex plugin install runapi-mcp@agents
2. 重启 Codex
3. 粘贴这个 prompt:生成一张图像:"Overhead food photography of a freshly baked round sourdough boule on a rustic wooden cutting board. The bread has been sliced to reveal the open, airy crumb structure with large irregular holes. A bread knife with a dark wood handle rests beside it. Scattered flour dusts the board and surrounding dark slate countertop. A small ceramic bowl of salted butter sits in the upper right corner. Natural side lighting from a kitchen window creates long soft shadows. Warm tones, high detail on the crust texture showing deep caramelization and ear scoring patterns."
1. npx @runapi.ai/mcp init cursor
2. 重启 Cursor
3. 粘贴这个 prompt:生成一张图像:"Overhead food photography of a freshly baked round sourdough boule on a rustic wooden cutting board. The bread has been sliced to reveal the open, airy crumb structure with large irregular holes. A bread knife with a dark wood handle rests beside it. Scattered flour dusts the board and surrounding dark slate countertop. A small ceramic bowl of salted butter sits in the upper right corner. Natural side lighting from a kitchen window creates long soft shadows. Warm tones, high detail on the crust texture showing deep caramelization and ear scoring patterns."
1. npx @runapi.ai/mcp init windsurf
2. 重启 Windsurf
3. 粘贴这个 prompt:生成一张图像:"Overhead food photography of a freshly baked round sourdough boule on a rustic wooden cutting board. The bread has been sliced to reveal the open, airy crumb structure with large irregular holes. A bread knife with a dark wood handle rests beside it. Scattered flour dusts the board and surrounding dark slate countertop. A small ceramic bowl of salted butter sits in the upper right corner. Natural side lighting from a kitchen window creates long soft shadows. Warm tones, high detail on the crust texture showing deep caramelization and ear scoring patterns."
curl -X POST https://runapi.ai/api/v1/gpt_4o_image/text_to_image \
-H "Authorization: Bearer $RUNAPI_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'JSON'
{
"model": "gpt-4o-image",
"prompt": "Overhead food photography of a freshly baked round sourdough boule on a rustic wooden cutting board. The bread has been sliced to reveal the open, airy crumb structure with large irregular holes. A bread knife with a dark wood handle rests beside it. Scattered flour dusts the board and surrounding dark slate countertop. A small ceramic bowl of salted butter sits in the upper right corner. Natural side lighting from a kitchen window creates long soft shadows. Warm tones, high detail on the crust texture showing deep caramelization and ear scoring patterns."
}
JSON
import { Gpt4oImageClient } from "@runapi.ai/gpt-4o-image";
const client = new Gpt4oImageClient({
apiKey: process.env.RUNAPI_API_KEY,
});
const result = await client.textToImage.run({
"model": "gpt-4o-image",
"prompt": "Overhead food photography of a freshly baked round sourdough boule on a rustic wooden cutting board. The bread has been sliced to reveal the open, airy crumb structure with large irregular holes. A bread knife with a dark wood handle rests beside it. Scattered flour dusts the board and surrounding dark slate countertop. A small ceramic bowl of salted butter sits in the upper right corner. Natural side lighting from a kitchen window creates long soft shadows. Warm tones, high detail on the crust texture showing deep caramelization and ear scoring patterns."
});
console.log(result.id);
require "runapi/gpt_4o_image"
client = RunApi::Gpt4oImage::Client.new
result = client.text_to_image.run(
model: "gpt-4o-image",
prompt: "Overhead food photography of a freshly baked round sourdough boule on a rustic wooden cutting board. The bread has been sliced to reveal the open, airy crumb structure with large irregular holes. A bread knife with a dark wood handle rests beside it. Scattered flour dusts the board and surrounding dark slate countertop. A small ceramic bowl of salted butter sits in the upper right corner. Natural side lighting from a kitchen window creates long soft shadows. Warm tones, high detail on the crust texture showing deep caramelization and ear scoring patterns."
)
puts result.id
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader("{\"model\":\"gpt-4o-image\",\"prompt\":\"Overhead food photography of a freshly baked round sourdough boule on a rustic wooden cutting board. The bread has been sliced to reveal the open, airy crumb structure with large irregular holes. A bread knife with a dark wood handle rests beside it. Scattered flour dusts the board and surrounding dark slate countertop. A small ceramic bowl of salted butter sits in the upper right corner. Natural side lighting from a kitchen window creates long soft shadows. Warm tones, high detail on the crust texture showing deep caramelization and ear scoring patterns.\"}")
req, err := http.NewRequestWithContext(context.Background(), http.MethodPost, "https://runapi.ai/api/v1/gpt_4o_image/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)
}
gpt-4o-image/api/v1/gpt_4o_image/text_to_image获取 API Key
Overhead food photography of a freshly baked round sourdough boule on a rustic wooden cutting board. The bread has been sliced to reveal the open, airy crumb structure with large irregular holes. A bread knife with a dark wood handle rests beside it. Scattered flour dusts the board and surrounding dark slate countertop. A small ceramic bowl of salted butter sits in the upper right corner. Natural side lighting from a kitchen window creates long soft shadows. Warm tones, high detail on the crust texture showing deep caramelization and ear scoring patterns.
curl -X POST https://runapi.ai/api/v1/gpt_4o_image/text_to_image \
-H "Authorization: Bearer $RUNAPI_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'JSON'
{
"model": "gpt-4o-image",
"prompt": "Overhead food photography of a freshly baked round sourdough boule on a rustic wooden cutting board. The bread has been sliced to reveal the open, airy crumb structure with large irregular holes. A bread knife with a dark wood handle rests beside it. Scattered flour dusts the board and surrounding dark slate countertop. A small ceramic bowl of salted butter sits in the upper right corner. Natural side lighting from a kitchen window creates long soft shadows. Warm tones, high detail on the crust texture showing deep caramelization and ear scoring patterns."
}
JSON