* Build the ImageGenerationProvider that registers BlockRun image models * with OpenClaw's native image generation UI. * Delegates to the local proxy (which handles x402 payment).
()
| 1082 | * Delegates to the local proxy (which handles x402 payment). |
| 1083 | */ |
| 1084 | function buildImageGenerationProvider(): ImageGenerationProviderPlugin { |
| 1085 | return { |
| 1086 | id: "blockrun", |
| 1087 | label: "BlockRun", |
| 1088 | defaultModel: "google/nano-banana", |
| 1089 | models: [ |
| 1090 | "google/nano-banana", |
| 1091 | "google/nano-banana-pro", |
| 1092 | "openai/gpt-image-1", |
| 1093 | "openai/dall-e-3", |
| 1094 | "black-forest/flux-1.1-pro", |
| 1095 | "xai/grok-imagine-image", |
| 1096 | "xai/grok-imagine-image-pro", |
| 1097 | "zai/cogview-4", |
| 1098 | ], |
| 1099 | capabilities: { |
| 1100 | generate: { |
| 1101 | maxCount: 1, |
| 1102 | supportsSize: true, |
| 1103 | supportsAspectRatio: false, |
| 1104 | supportsResolution: false, |
| 1105 | }, |
| 1106 | // Only openai/gpt-image-1 supports edit server-side; OpenClaw's UI picks a |
| 1107 | // compatible model at edit time via /v1/images/image2image. |
| 1108 | edit: { enabled: true }, |
| 1109 | geometry: { |
| 1110 | sizes: [ |
| 1111 | "512x512", |
| 1112 | "768x768", |
| 1113 | "768x1344", |
| 1114 | "1024x1024", |
| 1115 | "1216x832", |
| 1116 | "1344x768", |
| 1117 | "1440x1440", |
| 1118 | "1536x1024", |
| 1119 | "1024x1536", |
| 1120 | "1792x1024", |
| 1121 | "1024x1792", |
| 1122 | "2048x2048", |
| 1123 | "4096x4096", |
| 1124 | ], |
| 1125 | }, |
| 1126 | }, |
| 1127 | isConfigured: () => existsSync(WALLET_FILE), |
| 1128 | generateImage: async (req: ImageGenerationRequest) => { |
| 1129 | const port = getProxyPort(); |
| 1130 | const body = JSON.stringify({ |
| 1131 | model: req.model, |
| 1132 | prompt: req.prompt, |
| 1133 | size: req.size ?? "1024x1024", |
| 1134 | n: req.count ?? 1, |
| 1135 | }); |
| 1136 | const resp = await fetch(`http://127.0.0.1:${port}/v1/images/generations`, { |
| 1137 | method: "POST", |
| 1138 | headers: { "content-type": "application/json" }, |
| 1139 | body, |
| 1140 | signal: req.timeoutMs ? AbortSignal.timeout(req.timeoutMs) : undefined, |
| 1141 | }); |
no test coverage detected