curl https://api.pipellm.ai/v1/images/generations \ -H "Authorization: Bearer $PIPELLM_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-image-2.5-sunburst", "prompt": "A red bicycle leaning against a cafe window, morning light", "size": "1024x1024", "quality": "medium", "n": 1 }'
import base64import osfrom openai import OpenAIclient = OpenAI( api_key=os.environ["PIPELLM_API_KEY"], base_url="https://api.pipellm.ai/v1",)result = client.images.generate( model="gpt-image-2.5-sunburst", prompt="A red bicycle leaning against a cafe window, morning light", size="1024x1024", quality="medium",)with open("bicycle.png", "wb") as f: f.write(base64.b64decode(result.data[0].b64_json))
import fs from "node:fs";import OpenAI from "openai";const client = new OpenAI({ apiKey: process.env.PIPELLM_API_KEY, baseURL: "https://api.pipellm.ai/v1",});const result = await client.images.generate({ model: "gpt-image-2.5-sunburst", prompt: "A red bicycle leaning against a cafe window, morning light", size: "1024x1024", quality: "medium",});fs.writeFileSync("bicycle.png", Buffer.from(result.data[0].b64_json, "base64"));
Generate images from a text prompt with GPT image models.
POST
/
v1
/
images
/
generations
curl https://api.pipellm.ai/v1/images/generations \ -H "Authorization: Bearer $PIPELLM_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-image-2.5-sunburst", "prompt": "A red bicycle leaning against a cafe window, morning light", "size": "1024x1024", "quality": "medium", "n": 1 }'
import base64import osfrom openai import OpenAIclient = OpenAI( api_key=os.environ["PIPELLM_API_KEY"], base_url="https://api.pipellm.ai/v1",)result = client.images.generate( model="gpt-image-2.5-sunburst", prompt="A red bicycle leaning against a cafe window, morning light", size="1024x1024", quality="medium",)with open("bicycle.png", "wb") as f: f.write(base64.b64decode(result.data[0].b64_json))
import fs from "node:fs";import OpenAI from "openai";const client = new OpenAI({ apiKey: process.env.PIPELLM_API_KEY, baseURL: "https://api.pipellm.ai/v1",});const result = await client.images.generate({ model: "gpt-image-2.5-sunburst", prompt: "A red bicycle leaning against a cafe window, morning light", size: "1024x1024", quality: "medium",});fs.writeFileSync("bicycle.png", Buffer.from(result.data[0].b64_json, "base64"));
OpenAI-compatible image generation. Point the OpenAI SDK at https://api.pipellm.ai/v1 and the request works unchanged.For Gemini image models, use generateContent instead — the two families take different request shapes.
Model IDs change over time. List the ones available to your account with GET /v1/models.
string
required
Text description of the image. Up to 32,000 characters on GPT image models.
string
Image model ID, for example gpt-image-2.5-sunburst. Defaults to dall-e-2 upstream, so set it explicitly.
integer
default:"1"
Number of images to generate, 1–10.
string
default:"auto"
auto, 1024x1024, 1536x1024, or 1024x1536 on GPT image models. A custom WIDTHxHEIGHT is accepted when both sides divide by 16 and the aspect ratio stays between 1:3 and 3:1.
string
default:"auto"
low, medium, high, or auto. The gpt-image-2.5 variants add xhigh and max.
Higher quality costs more output tokens.
string
default:"auto"
transparent, opaque, or auto. Transparent requires output_format of png or webp.
string
default:"png"
png, jpeg, or webp.
integer
default:"100"
Compression level 0–100, for jpeg and webp only.
string
default:"auto"
low or auto.
string
Stable end-user identifier, passed through for abuse monitoring.
curl https://api.pipellm.ai/v1/images/generations \ -H "Authorization: Bearer $PIPELLM_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-image-2.5-sunburst", "prompt": "A red bicycle leaning against a cafe window, morning light", "size": "1024x1024", "quality": "medium", "n": 1 }'
import base64import osfrom openai import OpenAIclient = OpenAI( api_key=os.environ["PIPELLM_API_KEY"], base_url="https://api.pipellm.ai/v1",)result = client.images.generate( model="gpt-image-2.5-sunburst", prompt="A red bicycle leaning against a cafe window, morning light", size="1024x1024", quality="medium",)with open("bicycle.png", "wb") as f: f.write(base64.b64decode(result.data[0].b64_json))
import fs from "node:fs";import OpenAI from "openai";const client = new OpenAI({ apiKey: process.env.PIPELLM_API_KEY, baseURL: "https://api.pipellm.ai/v1",});const result = await client.images.generate({ model: "gpt-image-2.5-sunburst", prompt: "A red bicycle leaning against a cafe window, morning light", size: "1024x1024", quality: "medium",});fs.writeFileSync("bicycle.png", Buffer.from(result.data[0].b64_json, "base64"));
Base64-encoded image bytes. GPT image models always return the image this way — there is no URL to fetch.
string
The rewritten prompt. DALL-E 3 only.
string
Resolved output size, useful when the request asked for auto.
string
Resolved quality.
string
png, jpeg, or webp.
string
transparent or opaque.
object
Token counts that back the charge. output_tokens_details.image_tokens is the part that scales with size and quality.
Long requests
Image generation can run for minutes. On a non-streaming request PipeLLM holds the connection open: if the upstream has not answered after 90 seconds, the gateway writes a padding chunk every 30 seconds until the real body arrives.The padding is whitespace before the JSON document, so any standard JSON parser handles it. Two things to watch:
Do not assume the first bytes on the wire are {.
Set a generous client read timeout. The default in most HTTP clients is shorter than a slow high-quality generation.
{ "error": { "type": "rate_limit_error", "code": "429", "message": "Rate limit exceeded. Your current limit is 120 requests per minute (approximately 2.00 requests per second). Please visit https://console.pipellm.ai/billing to upgrade your plan for higher limits." }}
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"PipeLLM","colors":{"primary":"#12B76A","light":"#3DF58F","dark":"#0E9152"},"logo":{"light":"https://mintcdn.com/pipellm/c14KpYQEcMuO-i7Z/logo/light.svg?fit=max\u0026auto=format\u0026n=c14KpYQEcMuO-i7Z\u0026q=85\u0026s=e63d66e7731e79c17fab3ac12709e0b1","dark":"https://mintcdn.com/pipellm/c14KpYQEcMuO-i7Z/logo/dark.svg?fit=max\u0026auto=format\u0026n=c14KpYQEcMuO-i7Z\u0026q=85\u0026s=3205f7a8fd0d53df4ccbd10fc7fff796"},"favicon":"https://mintcdn.com/pipellm/c14KpYQEcMuO-i7Z/favicon.svg?fit=max\u0026auto=format\u0026n=c14KpYQEcMuO-i7Z\u0026q=85\u0026s=696ba46d25b2028f32c94b319736a36c","api":{"params":{"expanded":"all"},"playground":{"display":"interactive"},"examples":{"defaults":"required","languages":["curl","python","javascript","go"],"prefill":true},"mdx":{"auth":{"method":"bearer"},"server":"https://api.pipellm.ai"}},"appearance":{"default":"dark"},"background":{"color":{"light":"#FCFCFD","dark":"#05080A"}},"navbar":{"links":[{"href":"https://pipellm.ai/models","label":"Models"},{"href":"https://pipellm.ai/playground","label":"Playground"},{"href":"https://pipellm.ai/pricing","label":"Pricing"},{"href":"https://pipellm.ai/blog","label":"Blog"},{"href":"mailto:support@pipellm.ai","label":"Support"}],"primary":{"type":"button","label":"Console","href":"https://console.pipellm.ai"}},"footer":{"socials":{"x":"https://x.com/pipellm","github":"https://github.com/pipellm","linkedin":"https://linkedin.com/company/pipellm"}},"search":{},"fonts":{"heading":{"family":"Plus Jakarta Sans","weight":400},"body":{"family":"Plus Jakarta Sans","weight":400}},"icons":{"library":"lucide"},"styling":{"eyebrows":"breadcrumbs","codeblocks":"dark","latex":true},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"navigation":{"languages":[{"language":"en","href":""},{"language":"zh","href":"zh"}]}},"deployment":{"deploymentMetadataValue":{"subdomain":"pipellm","hasAudioNarration":false,"actualSubdomain":"pipellm","customDomains":["docs.pipellm.ai"],"gitSource":{"type":"github","owner":"pipellm-ai","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true},"entitlements":{},"buildId":"6ab0bf26528446e729be3cf7","clientVersion":"0.0.4177","searchFilterCounts":[{"language":"en","tag":"API Reference","count":51},{"language":"zh","tag":"API 参考","count":51},{"language":"en","tag":"Relay","count":16},{"language":"zh","tag":"Relay","count":16},{"language":"en","tag":"Integrations","count":7},{"language":"zh","tag":"集成","count":7},{"language":"en","tag":"Guides","count":6},{"language":"en","tag":"WebSearch","count":6},{"language":"zh","tag":"指南","count":6},{"language":"zh","tag":"WebSearch","count":6},{"language":"en","tag":"API Guides","count":5},{"language":"en","tag":"Protocol Conversion","count":5},{"language":"zh","tag":"API 指南","count":5},{"language":"zh","tag":"协议转换","count":5},{"language":"en","tag":"Images","count":4},{"language":"en","tag":"Video","count":4},{"language":"zh","tag":"图像","count":4},{"language":"zh","tag":"视频","count":4},{"language":"en","tag":"V2 (Recommended)","count":3},{"language":"zh","tag":"V2(推荐)","count":3}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[],"googleFontsInlined":true},"customCss":[{"filePath":"style.css","content":".dark img[src*=\"/logo/providers/\"]{filter:brightness(0.715)}:root:root{--gray-50: 246 248 249;--gray-100: 240 243 244;--gray-200: 224 228 230;--gray-300: 206 211 214;--gray-400: 158 165 169;--gray-500: 112 119 123;--gray-600: 80 87 91;--gray-700: 62 69 73;--gray-800: 36 42 46;--gray-900: 22 27 30;--gray-950: 10 14 16}.dark{--default-border-color: rgb(252 252 253 / 0.14)}#request-example,#response-example{border-radius:0.75rem}method-pill,.method-pill{letter-spacing:0.04em}#pipellm-playground-mask{display:none}[data-pipellm-playground]>[role=\"presentation\"].bg-black\\/40{background:rgb(3 8 12 / 0.55)!important;backdrop-filter:blur(14px) saturate(1.2);-webkit-backdrop-filter:blur(14px) saturate(1.2);transition-duration:320ms!important}:root:not(.dark) [data-pipellm-playground]>[role=\"presentation\"].bg-black\\/40{background:rgb(248 250 250 / 0.55)!important}[data-pipellm-playground] [role=\"dialog\"]{border-radius:16px!important;box-shadow:0 0 0 1px rgb(255 255 255 / 0.08),\n 0 32px 96px rgb(0 0 0 / 0.55),\n 0 8px 24px rgb(0 0 0 / 0.35)!important;transition-property:transform, scale, translate, opacity!important;transition-duration:320ms!important;transition-timing-function:cubic-bezier(0.16, 1, 0.3, 1)!important}:root:not(.dark) [data-pipellm-playground] [role=\"dialog\"]{box-shadow:0 0 0 1px rgb(0 0 0 / 0.06),\n 0 32px 96px rgb(0 0 0 / 0.18),\n 0 8px 24px rgb(0 0 0 / 0.10)!important}[data-pipellm-playground] [role=\"dialog\"][data-starting-style]{opacity:0!important;scale:0.97!important;translate:0 18px!important}[data-pipellm-playground] [role=\"dialog\"][data-ending-style]{opacity:0!important;scale:0.985!important;translate:0 8px!important;transition-duration:180ms!important}"}],"page":{"pagePath":"api-reference/image/generations","slug":"/api-reference/image/generations","pageMetadata":{"title":"Create an image","api":"POST /v1/images/generations","description":"Generate images from a text prompt with GPT image models.","i18n":"en","href":"/api-reference/image/generations"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Generate images from a text prompt with GPT image models.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,ul:`ul`,..._provideComponents(),...props.components},{Accordion,AccordionGroup,CodeBlock,Expandable,Heading,Info,ParamField,ResponseField}=_components;if(!Accordion)_missingMdxReference(`Accordion`,true);if(!AccordionGroup)_missingMdxReference(`AccordionGroup`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Expandable)_missingMdxReference(`Expandable`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Info)_missingMdxReference(`Info`,true);if(!ParamField)_missingMdxReference(`ParamField`,true);if(!ResponseField)_missingMdxReference(`ResponseField`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`OpenAI-compatible image generation. Point the OpenAI SDK at `,_jsx(_components.code,{children:`https://api.pipellm.ai/v1`}),` and the request works unchanged.`]}),`\n`,_jsxs(_components.p,{children:[`For Gemini image models, use `,_jsx(_components.a,{href:`/api-reference/image/gemini`,children:_jsx(_components.code,{children:`generateContent`})}),` instead — the two families take different request shapes.`]}),`\n`,_jsx(Info,{children:_jsxs(_components.p,{children:[`Model IDs change over time. List the ones available to your account with `,_jsx(_components.a,{href:`/api-reference/list-models`,children:_jsx(_components.code,{children:`GET /v1/models`})}),`.`]})}),`\n`,_jsx(ParamField,{body:`prompt`,type:`string`,required:true,id:`param-prompt`,children:_jsx(_components.p,{children:`Text description of the image. Up to 32,000 characters on GPT image models.`})}),`\n`,_jsx(ParamField,{body:`model`,type:`string`,id:`param-model`,children:_jsxs(_components.p,{children:[`Image model ID, for example `,_jsx(_components.code,{children:`gpt-image-2.5-sunburst`}),`. Defaults to `,_jsx(_components.code,{children:`dall-e-2`}),` upstream, so set it explicitly.`]})}),`\n`,_jsx(ParamField,{body:`n`,type:`integer`,default:`1`,id:`param-n`,children:_jsx(_components.p,{children:`Number of images to generate, 1–10.`})}),`\n`,_jsx(ParamField,{body:`size`,type:`string`,default:`auto`,id:`param-size`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`auto`}),`, `,_jsx(_components.code,{children:`1024x1024`}),`, `,_jsx(_components.code,{children:`1536x1024`}),`, or `,_jsx(_components.code,{children:`1024x1536`}),` on GPT image models. A custom `,_jsx(_components.code,{children:`WIDTHxHEIGHT`}),` is accepted when both sides divide by 16 and the aspect ratio stays between 1:3 and 3:1.`]})}),`\n`,_jsx(ParamField,{body:`quality`,type:`string`,default:`auto`,id:`param-quality`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`low`}),`, `,_jsx(_components.code,{children:`medium`}),`, `,_jsx(_components.code,{children:`high`}),`, or `,_jsx(_components.code,{children:`auto`}),`. The `,_jsx(_components.code,{children:`gpt-image-2.5`}),` variants add `,_jsx(_components.code,{children:`xhigh`}),` and `,_jsx(_components.code,{children:`max`}),`.\nHigher quality costs more output tokens.`]})}),`\n`,_jsx(ParamField,{body:`background`,type:`string`,default:`auto`,id:`param-background`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`transparent`}),`, `,_jsx(_components.code,{children:`opaque`}),`, or `,_jsx(_components.code,{children:`auto`}),`. Transparent requires `,_jsx(_components.code,{children:`output_format`}),` of `,_jsx(_components.code,{children:`png`}),` or `,_jsx(_components.code,{children:`webp`}),`.`]})}),`\n`,_jsx(ParamField,{body:`output_format`,type:`string`,default:`png`,id:`param-output-format`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`png`}),`, `,_jsx(_components.code,{children:`jpeg`}),`, or `,_jsx(_components.code,{children:`webp`}),`.`]})}),`\n`,_jsx(ParamField,{body:`output_compression`,type:`integer`,default:`100`,id:`param-output-compression`,children:_jsxs(_components.p,{children:[`Compression level 0–100, for `,_jsx(_components.code,{children:`jpeg`}),` and `,_jsx(_components.code,{children:`webp`}),` only.`]})}),`\n`,_jsx(ParamField,{body:`moderation`,type:`string`,default:`auto`,id:`param-moderation`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`low`}),` or `,_jsx(_components.code,{children:`auto`}),`.`]})}),`\n`,_jsx(ParamField,{body:`user`,type:`string`,id:`param-user`,children:_jsx(_components.p,{children:`Stable end-user identifier, passed through for abuse monitoring.`})}),`\n`,`\n`,`\n`,_jsx(ResponseField,{name:`created`,type:`integer`,id:`param-created`,children:_jsx(_components.p,{children:`Unix timestamp of the generation.`})}),`\n`,_jsxs(ResponseField,{name:`data`,type:`array`,id:`param-data`,children:[_jsx(_components.p,{children:`One entry per generated image.`}),_jsxs(Expandable,{title:`data[]`,children:[_jsx(ResponseField,{name:`b64_json`,type:`string`,id:`param-b64-json`,children:_jsx(_components.p,{children:`Base64-encoded image bytes. GPT image models always return the image this way — there is no URL to fetch.`})}),_jsx(ResponseField,{name:`revised_prompt`,type:`string`,id:`param-revised-prompt`,children:_jsx(_components.p,{children:`The rewritten prompt. DALL-E 3 only.`})})]})]}),`\n`,_jsx(ResponseField,{name:`size`,type:`string`,id:`param-size-1`,children:_jsxs(_components.p,{children:[`Resolved output size, useful when the request asked for `,_jsx(_components.code,{children:`auto`}),`.`]})}),`\n`,_jsx(ResponseField,{name:`quality`,type:`string`,id:`param-quality-1`,children:_jsx(_components.p,{children:`Resolved quality.`})}),`\n`,_jsx(ResponseField,{name:`output_format`,type:`string`,id:`param-output-format-1`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`png`}),`, `,_jsx(_components.code,{children:`jpeg`}),`, or `,_jsx(_components.code,{children:`webp`}),`.`]})}),`\n`,_jsx(ResponseField,{name:`background`,type:`string`,id:`param-background-1`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`transparent`}),` or `,_jsx(_components.code,{children:`opaque`}),`.`]})}),`\n`,_jsx(ResponseField,{name:`usage`,type:`object`,id:`param-usage`,children:_jsxs(_components.p,{children:[`Token counts that back the charge. `,_jsx(_components.code,{children:`output_tokens_details.image_tokens`}),` is the part that scales with size and quality.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`long-requests`,children:`Long requests`}),`\n`,_jsx(_components.p,{children:`Image generation can run for minutes. On a non-streaming request PipeLLM holds the connection open: if the upstream has not answered after 90 seconds, the gateway writes a padding chunk every 30 seconds until the real body arrives.`}),`\n`,_jsx(_components.p,{children:`The padding is whitespace before the JSON document, so any standard JSON parser handles it. Two things to watch:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Do not assume the first bytes on the wire are `,_jsx(_components.code,{children:`{`}),`.`]}),`\n`,_jsx(_components.li,{children:`Set a generous client read timeout. The default in most HTTP clients is shorter than a slow high-quality generation.`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`errors`,children:`Errors`}),`\n`,_jsxs(_components.p,{children:[`Same envelope as `,_jsx(_components.a,{href:`/api-reference/errors`,children:`Errors`}),`.`]}),`\n`,_jsxs(AccordionGroup,{children:[_jsxs(Accordion,{title:`400 invalid_request_error`,id:`400-invalid-request-error`,children:[_jsxs(_components.p,{children:[`Missing `,_jsx(_components.code,{children:`prompt`}),`, a `,_jsx(_components.code,{children:`size`}),` the model does not accept, or `,_jsx(_components.code,{children:`background: transparent`}),` with `,_jsx(_components.code,{children:`output_format: jpeg`}),`.`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"error\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"invalid_request_error\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"code\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"400\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"message\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"Invalid value for 'size'\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})]}),_jsx(Accordion,{title:`401 authentication_error`,id:`401-authentication-error`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"error\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"authentication_error\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"code\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"401\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"message\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"Incorrect API key provided. Please visit https://console.pipellm.ai/account/api-keys to find your API key.\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})}),_jsx(Accordion,{title:`402 insufficient_balance`,id:`402-insufficient-balance`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"error\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"insufficient_balance\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"code\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"402\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"message\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"Insufficient balance. Please recharge your account at https://console.pipellm.ai/billing.\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})}),_jsxs(Accordion,{title:`429 rate_limit_error`,id:`429-rate-limit-error`,children:[_jsxs(_components.p,{children:[`See `,_jsx(_components.a,{href:`/api-reference/rate-limits`,children:`Rate Limits`}),`.`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"error\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"rate_limit_error\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"code\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"429\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"message\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"Rate limit exceeded. Your current limit is 120 requests per minute (approximately 2.00 requests per second). Please visit https://console.pipellm.ai/billing to upgrade your plan for higher limits.\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})]})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"codeStyling":"dark","config":{},"pageMetadata":{"title":"Create an image","api":"POST /v1/images/generations","description":"Generate images from a text prompt with GPT image models.","i18n":"en","href":"/api-reference/image/generations"}}},"mdxSourceWithNoJs":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,ul:`ul`,..._provideComponents(),...props.components},{Accordion,AccordionGroup,CodeBlock,Expandable,Heading,Info,ParamField,RequestExample,ResponseExample,ResponseField}=_components;if(!Accordion)_missingMdxReference(`Accordion`,true);if(!AccordionGroup)_missingMdxReference(`AccordionGroup`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Expandable)_missingMdxReference(`Expandable`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Info)_missingMdxReference(`Info`,true);if(!ParamField)_missingMdxReference(`ParamField`,true);if(!RequestExample)_missingMdxReference(`RequestExample`,true);if(!ResponseExample)_missingMdxReference(`ResponseExample`,true);if(!ResponseField)_missingMdxReference(`ResponseField`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`OpenAI-compatible image generation. Point the OpenAI SDK at `,_jsx(_components.code,{children:`https://api.pipellm.ai/v1`}),` and the request works unchanged.`]}),`\n`,_jsxs(_components.p,{children:[`For Gemini image models, use `,_jsx(_components.a,{href:`/api-reference/image/gemini`,children:_jsx(_components.code,{children:`generateContent`})}),` instead — the two families take different request shapes.`]}),`\n`,_jsx(Info,{children:_jsxs(_components.p,{children:[`Model IDs change over time. List the ones available to your account with `,_jsx(_components.a,{href:`/api-reference/list-models`,children:_jsx(_components.code,{children:`GET /v1/models`})}),`.`]})}),`\n`,_jsx(ParamField,{body:`prompt`,type:`string`,required:true,id:`param-prompt`,children:_jsx(_components.p,{children:`Text description of the image. Up to 32,000 characters on GPT image models.`})}),`\n`,_jsx(ParamField,{body:`model`,type:`string`,id:`param-model`,children:_jsxs(_components.p,{children:[`Image model ID, for example `,_jsx(_components.code,{children:`gpt-image-2.5-sunburst`}),`. Defaults to `,_jsx(_components.code,{children:`dall-e-2`}),` upstream, so set it explicitly.`]})}),`\n`,_jsx(ParamField,{body:`n`,type:`integer`,default:`1`,id:`param-n`,children:_jsx(_components.p,{children:`Number of images to generate, 1–10.`})}),`\n`,_jsx(ParamField,{body:`size`,type:`string`,default:`auto`,id:`param-size`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`auto`}),`, `,_jsx(_components.code,{children:`1024x1024`}),`, `,_jsx(_components.code,{children:`1536x1024`}),`, or `,_jsx(_components.code,{children:`1024x1536`}),` on GPT image models. A custom `,_jsx(_components.code,{children:`WIDTHxHEIGHT`}),` is accepted when both sides divide by 16 and the aspect ratio stays between 1:3 and 3:1.`]})}),`\n`,_jsx(ParamField,{body:`quality`,type:`string`,default:`auto`,id:`param-quality`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`low`}),`, `,_jsx(_components.code,{children:`medium`}),`, `,_jsx(_components.code,{children:`high`}),`, or `,_jsx(_components.code,{children:`auto`}),`. The `,_jsx(_components.code,{children:`gpt-image-2.5`}),` variants add `,_jsx(_components.code,{children:`xhigh`}),` and `,_jsx(_components.code,{children:`max`}),`.\nHigher quality costs more output tokens.`]})}),`\n`,_jsx(ParamField,{body:`background`,type:`string`,default:`auto`,id:`param-background`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`transparent`}),`, `,_jsx(_components.code,{children:`opaque`}),`, or `,_jsx(_components.code,{children:`auto`}),`. Transparent requires `,_jsx(_components.code,{children:`output_format`}),` of `,_jsx(_components.code,{children:`png`}),` or `,_jsx(_components.code,{children:`webp`}),`.`]})}),`\n`,_jsx(ParamField,{body:`output_format`,type:`string`,default:`png`,id:`param-output-format`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`png`}),`, `,_jsx(_components.code,{children:`jpeg`}),`, or `,_jsx(_components.code,{children:`webp`}),`.`]})}),`\n`,_jsx(ParamField,{body:`output_compression`,type:`integer`,default:`100`,id:`param-output-compression`,children:_jsxs(_components.p,{children:[`Compression level 0–100, for `,_jsx(_components.code,{children:`jpeg`}),` and `,_jsx(_components.code,{children:`webp`}),` only.`]})}),`\n`,_jsx(ParamField,{body:`moderation`,type:`string`,default:`auto`,id:`param-moderation`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`low`}),` or `,_jsx(_components.code,{children:`auto`}),`.`]})}),`\n`,_jsx(ParamField,{body:`user`,type:`string`,id:`param-user`,children:_jsx(_components.p,{children:`Stable end-user identifier, passed through for abuse monitoring.`})}),`\n`,_jsxs(RequestExample,{children:[_jsx(CodeBlock,{filename:`cURL`,numberOfLines:`10`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#DCDCAA`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` https://api.pipellm.ai/v1/images/generations`}),_jsx(_components.span,{style:{color:`#D7BA7D`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#569CD6`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` \"Authorization: Bearer `}),_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:`$PIPELLM_API_KEY`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#D7BA7D`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#569CD6`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type: application/json\"`}),_jsx(_components.span,{style:{color:`#D7BA7D`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#569CD6`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` '{`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` \"model\": \"gpt-image-2.5-sunburst\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` \"prompt\": \"A red bicycle leaning against a cafe window, morning light\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` \"size\": \"1024x1024\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` \"quality\": \"medium\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` \"n\": 1`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` }'`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`Python`,numberOfLines:`18`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`18`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#C586C0`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` base64`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#C586C0`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` os`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#C586C0`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` openai `}),_jsx(_components.span,{style:{color:`#C586C0`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` OpenAI`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`client = OpenAI(`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` api_key`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`=os.environ[`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"PIPELLM_API_KEY\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` base_url`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"https://api.pipellm.ai/v1\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`result = client.images.generate(`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` model`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"gpt-image-2.5-sunburst\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` prompt`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"A red bicycle leaning against a cafe window, morning light\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` size`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"1024x1024\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` quality`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"medium\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#C586C0`,\"--shiki-dark\":`#C586C0`},children:`with`}),_jsx(_components.span,{style:{color:`#DCDCAA`,\"--shiki-dark\":`#DCDCAA`},children:` open`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"bicycle.png\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"wb\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#C586C0`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` f:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` f.write(base64.b64decode(result.data[`}),_jsx(_components.span,{style:{color:`#B5CEA8`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`].b64_json))`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`TypeScript`,numberOfLines:`16`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`16`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#C586C0`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` fs`}),_jsx(_components.span,{style:{color:`#C586C0`,\"--shiki-dark\":`#C586C0`},children:` from`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` \"node:fs\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#C586C0`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` OpenAI`}),_jsx(_components.span,{style:{color:`#C586C0`,\"--shiki-dark\":`#C586C0`},children:` from`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` \"openai\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#569CD6`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#4FC1FF`,\"--shiki-dark\":`#4FC1FF`},children:` client`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` = `}),_jsx(_components.span,{style:{color:`#569CD6`,\"--shiki-dark\":`#569CD6`},children:`new`}),_jsx(_components.span,{style:{color:`#DCDCAA`,\"--shiki-dark\":`#DCDCAA`},children:` OpenAI`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` apiKey:`}),_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#4FC1FF`,\"--shiki-dark\":`#4FC1FF`},children:`PIPELLM_API_KEY`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` baseURL:`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` \"https://api.pipellm.ai/v1\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#569CD6`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#4FC1FF`,\"--shiki-dark\":`#4FC1FF`},children:` result`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` = `}),_jsx(_components.span,{style:{color:`#C586C0`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` client`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:`images`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#DCDCAA`,\"--shiki-dark\":`#DCDCAA`},children:`generate`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` model:`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` \"gpt-image-2.5-sunburst\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` prompt:`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` \"A red bicycle leaning against a cafe window, morning light\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` size:`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` \"1024x1024\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` quality:`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:` \"medium\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:`fs`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#DCDCAA`,\"--shiki-dark\":`#DCDCAA`},children:`writeFileSync`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"bicycle.png\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:`Buffer`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#DCDCAA`,\"--shiki-dark\":`#DCDCAA`},children:`from`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:`result`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#B5CEA8`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:`b64_json`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"base64\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`));`})]}),`\n`]})})})]}),`\n`,_jsx(ResponseExample,{children:_jsx(CodeBlock,{filename:``,numberOfLines:`16`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`16`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"created\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#B5CEA8`,\"--shiki-dark\":`#B5CEA8`},children:`1726400000`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"size\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"1024x1024\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"quality\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"medium\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"output_format\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"png\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"background\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"opaque\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"data\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:`\"b64_json\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"iVBORw0KGgoAAAANSUhEUgAA...\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` ],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"usage\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"input_tokens\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#B5CEA8`,\"--shiki-dark\":`#B5CEA8`},children:`18`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"input_tokens_details\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:`\"text_tokens\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#B5CEA8`,\"--shiki-dark\":`#B5CEA8`},children:`18`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:`\"image_tokens\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#B5CEA8`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"output_tokens\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#B5CEA8`,\"--shiki-dark\":`#B5CEA8`},children:`1056`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"output_tokens_details\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:`\"image_tokens\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#B5CEA8`,\"--shiki-dark\":`#B5CEA8`},children:`1056`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})}),`\n`,_jsx(ResponseField,{name:`created`,type:`integer`,id:`param-created`,children:_jsx(_components.p,{children:`Unix timestamp of the generation.`})}),`\n`,_jsxs(ResponseField,{name:`data`,type:`array`,id:`param-data`,children:[_jsx(_components.p,{children:`One entry per generated image.`}),_jsxs(Expandable,{title:`data[]`,children:[_jsx(ResponseField,{name:`b64_json`,type:`string`,id:`param-b64-json`,children:_jsx(_components.p,{children:`Base64-encoded image bytes. GPT image models always return the image this way — there is no URL to fetch.`})}),_jsx(ResponseField,{name:`revised_prompt`,type:`string`,id:`param-revised-prompt`,children:_jsx(_components.p,{children:`The rewritten prompt. DALL-E 3 only.`})})]})]}),`\n`,_jsx(ResponseField,{name:`size`,type:`string`,id:`param-size-1`,children:_jsxs(_components.p,{children:[`Resolved output size, useful when the request asked for `,_jsx(_components.code,{children:`auto`}),`.`]})}),`\n`,_jsx(ResponseField,{name:`quality`,type:`string`,id:`param-quality-1`,children:_jsx(_components.p,{children:`Resolved quality.`})}),`\n`,_jsx(ResponseField,{name:`output_format`,type:`string`,id:`param-output-format-1`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`png`}),`, `,_jsx(_components.code,{children:`jpeg`}),`, or `,_jsx(_components.code,{children:`webp`}),`.`]})}),`\n`,_jsx(ResponseField,{name:`background`,type:`string`,id:`param-background-1`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`transparent`}),` or `,_jsx(_components.code,{children:`opaque`}),`.`]})}),`\n`,_jsx(ResponseField,{name:`usage`,type:`object`,id:`param-usage`,children:_jsxs(_components.p,{children:[`Token counts that back the charge. `,_jsx(_components.code,{children:`output_tokens_details.image_tokens`}),` is the part that scales with size and quality.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`long-requests`,children:`Long requests`}),`\n`,_jsx(_components.p,{children:`Image generation can run for minutes. On a non-streaming request PipeLLM holds the connection open: if the upstream has not answered after 90 seconds, the gateway writes a padding chunk every 30 seconds until the real body arrives.`}),`\n`,_jsx(_components.p,{children:`The padding is whitespace before the JSON document, so any standard JSON parser handles it. Two things to watch:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Do not assume the first bytes on the wire are `,_jsx(_components.code,{children:`{`}),`.`]}),`\n`,_jsx(_components.li,{children:`Set a generous client read timeout. The default in most HTTP clients is shorter than a slow high-quality generation.`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`errors`,children:`Errors`}),`\n`,_jsxs(_components.p,{children:[`Same envelope as `,_jsx(_components.a,{href:`/api-reference/errors`,children:`Errors`}),`.`]}),`\n`,_jsxs(AccordionGroup,{children:[_jsxs(Accordion,{title:`400 invalid_request_error`,id:`400-invalid-request-error`,children:[_jsxs(_components.p,{children:[`Missing `,_jsx(_components.code,{children:`prompt`}),`, a `,_jsx(_components.code,{children:`size`}),` the model does not accept, or `,_jsx(_components.code,{children:`background: transparent`}),` with `,_jsx(_components.code,{children:`output_format: jpeg`}),`.`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"error\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"invalid_request_error\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"code\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"400\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"message\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"Invalid value for 'size'\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})]}),_jsx(Accordion,{title:`401 authentication_error`,id:`401-authentication-error`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"error\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"authentication_error\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"code\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"401\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"message\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"Incorrect API key provided. Please visit https://console.pipellm.ai/account/api-keys to find your API key.\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})}),_jsx(Accordion,{title:`402 insufficient_balance`,id:`402-insufficient-balance`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"error\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"insufficient_balance\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"code\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"402\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"message\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"Insufficient balance. Please recharge your account at https://console.pipellm.ai/billing.\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})}),_jsxs(Accordion,{title:`429 rate_limit_error`,id:`429-rate-limit-error`,children:[_jsxs(_components.p,{children:[`See `,_jsx(_components.a,{href:`/api-reference/rate-limits`,children:`Rate Limits`}),`.`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"error\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"rate_limit_error\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"code\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"429\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:` \"message\"`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CE9178`,\"--shiki-dark\":`#CE9178`},children:`\"Rate limit exceeded. Your current limit is 120 requests per minute (approximately 2.00 requests per second). Please visit https://console.pipellm.ai/billing to upgrade your plan for higher limits.\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})]})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"codeStyling":"dark","config":{},"pageMetadata":{"title":"Create an image","api":"POST /v1/images/generations","description":"Generate images from a text prompt with GPT image models.","i18n":"en","href":"/api-reference/image/generations"}}}},"mdxExtracts":{"tableOfContents":[{"title":"Long requests","slug":"long-requests","depth":2,"children":[]},{"title":"Errors","slug":"errors","depth":2,"children":[]}],"codeExamples":{"request":{"type":"RequestExample","children":[{"filename":"cURL","html":"\u003cpre class=\"shiki shiki-themes dark-plus dark-plus\" style=\"background-color:#0B0C0E;--shiki-dark-bg:#0B0C0E;color:#D4D4D4;--shiki-dark:#D4D4D4\" language=\"shellscript\">\u003ccode language=\"shellscript\" numberOfLines=\"10\">\u003cspan class=\"line\">\u003cspan style=\"color:#DCDCAA;--shiki-dark:#DCDCAA\">curl\u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\"> https://api.pipellm.ai/v1/images/generations\u003c/span>\u003cspan style=\"color:#D7BA7D;--shiki-dark:#D7BA7D\"> \\\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#569CD6;--shiki-dark:#569CD6\"> -H\u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\"> \"Authorization: Bearer \u003c/span>\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\">$PIPELLM_API_KEY\u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\">\"\u003c/span>\u003cspan style=\"color:#D7BA7D;--shiki-dark:#D7BA7D\"> \\\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#569CD6;--shiki-dark:#569CD6\"> -H\u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\"> \"Content-Type: application/json\"\u003c/span>\u003cspan style=\"color:#D7BA7D;--shiki-dark:#D7BA7D\"> \\\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#569CD6;--shiki-dark:#569CD6\"> -d\u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\"> '{\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\"> \"model\": \"gpt-image-2.5-sunburst\",\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\"> \"prompt\": \"A red bicycle leaning against a cafe window, morning light\",\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\"> \"size\": \"1024x1024\",\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\"> \"quality\": \"medium\",\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\"> \"n\": 1\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\"> }'\u003c/span>\u003c/span>\n\u003c/code>\u003c/pre>"},{"filename":"Python","html":"\u003cpre class=\"shiki shiki-themes dark-plus dark-plus\" style=\"background-color:#0B0C0E;--shiki-dark-bg:#0B0C0E;color:#D4D4D4;--shiki-dark:#D4D4D4\" language=\"python\">\u003ccode language=\"python\" numberOfLines=\"18\">\u003cspan class=\"line\">\u003cspan style=\"color:#C586C0;--shiki-dark:#C586C0\">import\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\"> base64\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#C586C0;--shiki-dark:#C586C0\">import\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\"> os\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#C586C0;--shiki-dark:#C586C0\">from\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\"> openai \u003c/span>\u003cspan style=\"color:#C586C0;--shiki-dark:#C586C0\">import\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\"> OpenAI\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">client = OpenAI(\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> api_key\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">=os.environ[\u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\">\"PIPELLM_API_KEY\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">],\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> base_url\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">=\u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\">\"https://api.pipellm.ai/v1\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">)\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">result = client.images.generate(\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> model\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">=\u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\">\"gpt-image-2.5-sunburst\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> prompt\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">=\u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\">\"A red bicycle leaning against a cafe window, morning light\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> size\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">=\u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\">\"1024x1024\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> quality\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">=\u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\">\"medium\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">)\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#C586C0;--shiki-dark:#C586C0\">with\u003c/span>\u003cspan style=\"color:#DCDCAA;--shiki-dark:#DCDCAA\"> open\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">(\u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\">\"bicycle.png\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">, \u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\">\"wb\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">) \u003c/span>\u003cspan style=\"color:#C586C0;--shiki-dark:#C586C0\">as\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\"> f:\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\"> f.write(base64.b64decode(result.data[\u003c/span>\u003cspan style=\"color:#B5CEA8;--shiki-dark:#B5CEA8\">0\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">].b64_json))\u003c/span>\u003c/span>\n\u003c/code>\u003c/pre>"},{"filename":"TypeScript","html":"\u003cpre class=\"shiki shiki-themes dark-plus dark-plus\" style=\"background-color:#0B0C0E;--shiki-dark-bg:#0B0C0E;color:#D4D4D4;--shiki-dark:#D4D4D4\" language=\"typescript\">\u003ccode language=\"typescript\" numberOfLines=\"16\">\u003cspan class=\"line\">\u003cspan style=\"color:#C586C0;--shiki-dark:#C586C0\">import\u003c/span>\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> fs\u003c/span>\u003cspan style=\"color:#C586C0;--shiki-dark:#C586C0\"> from\u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\"> \"node:fs\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">;\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#C586C0;--shiki-dark:#C586C0\">import\u003c/span>\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> OpenAI\u003c/span>\u003cspan style=\"color:#C586C0;--shiki-dark:#C586C0\"> from\u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\"> \"openai\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">;\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#569CD6;--shiki-dark:#569CD6\">const\u003c/span>\u003cspan style=\"color:#4FC1FF;--shiki-dark:#4FC1FF\"> client\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\"> = \u003c/span>\u003cspan style=\"color:#569CD6;--shiki-dark:#569CD6\">new\u003c/span>\u003cspan style=\"color:#DCDCAA;--shiki-dark:#DCDCAA\"> OpenAI\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">({\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> apiKey:\u003c/span>\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> process\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">.\u003c/span>\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\">env\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">.\u003c/span>\u003cspan style=\"color:#4FC1FF;--shiki-dark:#4FC1FF\">PIPELLM_API_KEY\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> baseURL:\u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\"> \"https://api.pipellm.ai/v1\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">});\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#569CD6;--shiki-dark:#569CD6\">const\u003c/span>\u003cspan style=\"color:#4FC1FF;--shiki-dark:#4FC1FF\"> result\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\"> = \u003c/span>\u003cspan style=\"color:#C586C0;--shiki-dark:#C586C0\">await\u003c/span>\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> client\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">.\u003c/span>\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\">images\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">.\u003c/span>\u003cspan style=\"color:#DCDCAA;--shiki-dark:#DCDCAA\">generate\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">({\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> model:\u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\"> \"gpt-image-2.5-sunburst\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> prompt:\u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\"> \"A red bicycle leaning against a cafe window, morning light\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> size:\u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\"> \"1024x1024\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> quality:\u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\"> \"medium\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">});\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\">fs\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">.\u003c/span>\u003cspan style=\"color:#DCDCAA;--shiki-dark:#DCDCAA\">writeFileSync\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">(\u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\">\"bicycle.png\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">, \u003c/span>\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\">Buffer\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">.\u003c/span>\u003cspan style=\"color:#DCDCAA;--shiki-dark:#DCDCAA\">from\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">(\u003c/span>\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\">result\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">.\u003c/span>\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\">data\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">[\u003c/span>\u003cspan style=\"color:#B5CEA8;--shiki-dark:#B5CEA8\">0\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">].\u003c/span>\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\">b64_json\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">, \u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\">\"base64\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">));\u003c/span>\u003c/span>\n\u003c/code>\u003c/pre>"}],"attributes":[]},"response":{"type":"ResponseExample","children":[{"filename":"","html":"\u003cpre class=\"shiki shiki-themes dark-plus dark-plus\" style=\"background-color:#0B0C0E;--shiki-dark-bg:#0B0C0E;color:#D4D4D4;--shiki-dark:#D4D4D4\" language=\"json\">\u003ccode language=\"json\" numberOfLines=\"16\">\u003cspan class=\"line\">\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">{\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> \"created\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#B5CEA8;--shiki-dark:#B5CEA8\">1726400000\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> \"size\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\">\"1024x1024\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> \"quality\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\">\"medium\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> \"output_format\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\">\"png\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> \"background\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\">\"opaque\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> \"data\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">: [\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\"> { \u003c/span>\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\">\"b64_json\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#CE9178;--shiki-dark:#CE9178\">\"iVBORw0KGgoAAAANSUhEUgAA...\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\"> }\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\"> ],\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> \"usage\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">: {\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> \"input_tokens\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#B5CEA8;--shiki-dark:#B5CEA8\">18\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> \"input_tokens_details\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">: { \u003c/span>\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\">\"text_tokens\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#B5CEA8;--shiki-dark:#B5CEA8\">18\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">, \u003c/span>\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\">\"image_tokens\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#B5CEA8;--shiki-dark:#B5CEA8\">0\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\"> },\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> \"output_tokens\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#B5CEA8;--shiki-dark:#B5CEA8\">1056\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\"> \"output_tokens_details\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">: { \u003c/span>\u003cspan style=\"color:#9CDCFE;--shiki-dark:#9CDCFE\">\"image_tokens\"\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#B5CEA8;--shiki-dark:#B5CEA8\">1056\u003c/span>\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\"> }\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\"> }\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#D4D4D4;--shiki-dark:#D4D4D4\">}\u003c/span>\u003c/span>\n\u003c/code>\u003c/pre>"}],"attributes":[]}},"endpoint":{"title":"Create an image","path":"/v1/images/generations","servers":[{"url":"https://api.pipellm.ai"}],"method":"post","request":{"security":[{"title":"Bearer Auth","parameters":{"header":{"Authorization":{"type":"http","scheme":"bearer","description":"Bearer authentication header of the form `Bearer \u003ctoken>`, where `\u003ctoken>` is your auth token."}},"query":{},"cookie":{}}}],"parameters":{"query":{},"header":{},"cookie":{},"path":{}},"body":{"application/json":{"schemaArray":[{"type":"object","properties":{"prompt":[{"type":"string","description":"Text description of the image. Up to 32,000 characters on GPT image models.","required":true}],"model":[{"type":"string","description":"Image model ID, for example `gpt-image-2.5-sunburst` . Defaults to `dall-e-2` upstream, so set it explicitly."}],"n":[{"type":"integer","description":"Number of images to generate, 1–10."}],"size":[{"type":"string","description":"`auto` , `1024x1024` , `1536x1024` , or `1024x1536` on GPT image models. A custom `WIDTHxHEIGHT` is accepted when both sides divide by 16 and the aspect ratio stays between 1:3 and 3:1."}],"quality":[{"type":"string","description":"`low` , `medium` , `high` , or `auto` . The `gpt-image-2.5` variants add `xhigh` and `max` . Higher quality costs more output tokens."}],"background":[{"type":"string","description":"`transparent` , `opaque` , or `auto` . Transparent requires `output_format` of `png` or `webp` ."}],"output_format":[{"type":"string","description":"`png` , `jpeg` , or `webp` ."}],"output_compression":[{"type":"integer","description":"Compression level 0–100, for `jpeg` and `webp` only."}],"moderation":[{"type":"string","description":"`low` or `auto` ."}],"user":[{"type":"string","description":"Stable end-user identifier, passed through for abuse monitoring."}]}}],"examples":{"example":{"value":{"prompt":"\u003cstring>","model":"\u003cstring>","n":123,"size":"\u003cstring>","quality":"\u003cstring>","background":"\u003cstring>","output_format":"\u003cstring>","output_compression":123,"moderation":"\u003cstring>","user":"\u003cstring>"}}}}}},"response":{"200":{"application/json":{"schemaArray":[{"type":"object","properties":{"created":[{"type":"integer","description":"Unix timestamp of the generation."}],"data":[{"type":"array","items":[{"type":"object","properties":{"b64_json":[{"type":"string","description":"Base64-encoded image bytes. GPT image models always return the image this way — there is no URL to fetch."}],"revised_prompt":[{"type":"string","description":"The rewritten prompt. DALL-E 3 only."}]}}],"description":"One entry per generated image."}],"size":[{"type":"string","description":"Resolved output size, useful when the request asked for `auto` ."}],"quality":[{"type":"string","description":"Resolved quality."}],"output_format":[{"type":"string","description":"`png` , `jpeg` , or `webp` ."}],"background":[{"type":"string","description":"`transparent` or `opaque` ."}],"usage":[{"type":"object","properties":{},"description":"Token counts that back the charge. `output_tokens_details.image_tokens` is the part that scales with size and quality."}]}}],"examples":{"example":{"value":{"created":123,"data":[{"b64_json":"\u003cstring>","revised_prompt":"\u003cstring>"}],"size":"\u003cstring>","quality":"\u003cstring>","output_format":"\u003cstring>","background":"\u003cstring>","usage":{}}}}}}},"deprecated":false}},"jsLinks":["/_mintlify/custom/pipellm/df480d64db6c22d0/playground.js"],"subdomain":"pipellm","siteName":"PipeLLM","title":"Create an image - PipeLLM","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{"en":{"href":"/api-reference/image/generations","matchLevel":0},"zh":{"href":"/zh/api-reference/image/generations","matchLevel":1}}},"lastModified":"2026-09-19T04:58:56.432Z","originalFileLocation":"api-reference/image/generations.mdx","locale":"en"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"dark\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Generate images from a text prompt with GPT image models.\">\u003cmeta data-mint-head name=\"application-name\" content=\"PipeLLM\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/pipellm/JKtU23MtMj4TtKyB/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/pipellm/JKtU23MtMj4TtKyB/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/pipellm/JKtU23MtMj4TtKyB/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/pipellm/JKtU23MtMj4TtKyB/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/pipellm/JKtU23MtMj4TtKyB/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/pipellm/JKtU23MtMj4TtKyB/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/pipellm/JKtU23MtMj4TtKyB/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/pipellm/JKtU23MtMj4TtKyB/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/pipellm/JKtU23MtMj4TtKyB/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Create an image - PipeLLM\">\u003cmeta data-mint-head property=\"og:description\" content=\"Generate images from a text prompt with GPT image models.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"PipeLLM\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.pipellm.ai/api-reference/image/generations\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://pipellm.mintlify.site/_mintlify/api/og/v2?division=Images\u0026amp;title=Create+an+image\u0026amp;description=Generate+images+from+a+text+prompt+with+GPT+image+models.\u0026amp;theme=3c00a4b989b0438e6fc46fe4\u0026amp;signature=725ff374c6de3de448d19c804e089b5e4f46d000c323d5953ac680c940d05504\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Create an image - PipeLLM\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Generate images from a text prompt with GPT image models.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://pipellm.mintlify.site/_mintlify/api/og/v2?division=Images\u0026amp;title=Create+an+image\u0026amp;description=Generate+images+from+a+text+prompt+with+GPT+image+models.\u0026amp;theme=3c00a4b989b0438e6fc46fe4\u0026amp;signature=725ff374c6de3de448d19c804e089b5e4f46d000c323d5953ac680c940d05504\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/pipellm/JKtU23MtMj4TtKyB/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"PipeLLM\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#12B76A\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.pipellm.ai/api-reference/image/generations\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/image/generations.md\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"en\" href=\"https://docs.pipellm.ai/api-reference/image/generations\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"zh\" href=\"https://docs.pipellm.ai/zh/api-reference/image/generations\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"x-default\" href=\"https://docs.pipellm.ai/api-reference/image/generations\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.pipellm.ai/#organization\",\"name\":\"PipeLLM\",\"url\":\"https://docs.pipellm.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/pipellm/c14KpYQEcMuO-i7Z/logo/light.svg?fit=max\u0026auto=format\u0026n=c14KpYQEcMuO-i7Z\u0026q=85\u0026s=e63d66e7731e79c17fab3ac12709e0b1\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.pipellm.ai#website\",\"name\":\"PipeLLM\",\"url\":\"https://docs.pipellm.ai\",\"publisher\":{\"@id\":\"https://docs.pipellm.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.pipellm.ai/api-reference/image/generations#webpage\",\"url\":\"https://docs.pipellm.ai/api-reference/image/generations\",\"name\":\"Create an image\",\"description\":\"Generate images from a text prompt with GPT image models.\",\"dateModified\":\"2026-09-19T04:58:56.432Z\",\"isPartOf\":{\"@id\":\"https://docs.pipellm.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.pipellm.ai/api-reference/image/generations#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.pipellm.ai/api-reference/image/generations#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"API Reference\",\"item\":\"https://docs.pipellm.ai/api-reference/list-models\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create an image\",\"item\":\"https://docs.pipellm.ai/api-reference/image/generations\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.pipellm.ai/api-reference/image/generations#apireference\",\"headline\":\"Create an image\",\"name\":\"Create an image\",\"description\":\"Generate images from a text prompt with GPT image models.\",\"url\":\"https://docs.pipellm.ai/api-reference/image/generations\",\"mainEntityOfPage\":{\"@id\":\"https://docs.pipellm.ai/api-reference/image/generations#webpage\"},\"dateModified\":\"2026-09-19T04:58:56.432Z\",\"publisher\":{\"@id\":\"https://docs.pipellm.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.pipellm.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"PipeLLM\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"PipeLLM\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/api-reference/image/generations.md","siteName":"PipeLLM","nav":{"global":null,"languages":[{"language":"en","tabs":[{"tab":"Relay","icon":"route","pages":[{"title":"Relay","href":""}]},{"tab":"API Reference","icon":"code","groups":[{"group":"API Guides","icon":"book-open","pages":[{"title":"Overview","sidebarTitle":"Overview","icon":"book-open","href":"/api-reference/introduction"},{"title":"Streaming","sidebarTitle":"Streaming","icon":"list","href":"/api-reference/streaming"},{"title":"Authentication","sidebarTitle":"Authentication","icon":"lock","href":"/api-reference/authentication"},{"title":"Rate Limits","sidebarTitle":"Limits","icon":"gauge","href":"/api-reference/rate-limits"},{"title":"Errors and Debugging","sidebarTitle":"Errors and Debugging","icon":"triangle-alert","href":"/api-reference/errors"}]},{"group":"API Reference","icon":"code","pages":[{"group":"Models","icon":"layers","pages":[{"title":"List models","api":"GET /v1/models","href":"/api-reference/list-models"},{"title":"Get model pricing","api":"GET /v1/models/pricing","href":"/api-reference/model-pricing"}]},{"group":"Chat Completions","icon":"/logo/providers/openai.svg","pages":[{"title":"Create a chat completion","api":"POST /v1/chat/completions","href":"/api-reference/openai/chat-completions"}]},{"group":"Responses","icon":"/logo/providers/openai.svg","pages":[{"title":"Create a response","api":"POST /v1/responses","href":"/api-reference/openai/responses"}]},{"group":"Anthropic","icon":"/logo/providers/anthropic.svg","pages":[{"title":"Create a message","api":"POST /v1/messages","href":"/api-reference/anthropic/messages"},{"title":"Tool Use","href":"/api-reference/anthropic/tool-use"}]},{"group":"Gemini","icon":"/logo/providers/gemini.svg","pages":[{"title":"Generate content","api":"POST /v1beta/models/{model}:generateContent","href":"/api-reference/gemini/generate-content"},{"title":"Stream generate content","api":"POST /v1beta/models/{model}:streamGenerateContent","description":"Stream Gemini generateContent output as server-sent events.","href":"/api-reference/gemini/stream-generate-content"}]},{"group":"Images","icon":"image","pages":[{"title":"Create an image","api":"POST /v1/images/generations","href":"/api-reference/image/generations"},{"title":"Edit an image","api":"POST /v1/images/edits","description":"Edit an existing image, optionally masked, with GPT image models.","href":"/api-reference/image/edits"},{"title":"Create an image variation","api":"POST /v1/images/variations","href":"/api-reference/image/variations"},{"title":"Generate an image with Gemini","api":"POST /v1beta/models/{model}:generateContent","href":"/api-reference/image/gemini"}]},{"group":"Jev / System One","icon":"brain","pages":[{"title":"Jev / System One","api":"POST /v1/systemone","href":"/api-reference/systemone"}]},{"group":"Video","icon":"clapperboard","pages":[{"group":"V2 (Recommended)","pages":[{"title":"Create a video","api":"POST /v2/videos","href":"/api-reference/video/create"},{"title":"Get a video","api":"GET /v2/videos/{id}","href":"/api-reference/video/get"},{"title":"Cancel a video","api":"DELETE /v2/videos/{id}","href":"/api-reference/video/cancel"}]},{"group":"V1 (Legacy)","pages":[{"title":"Create a video (V1)","api":"POST /v1/videos/generations","href":"/api-reference/video/create-v1"}]}]},{"group":"Tasks","icon":"list-checks","pages":[{"title":"Get a task","api":"GET /v1/tasks/{task_id}","href":"/api-reference/tasks/get"},{"title":"Cancel a task","api":"POST /v1/tasks/{task_id}/cancel","href":"/api-reference/tasks/cancel"}]},{"group":"WebSearch","icon":"globe","pages":[{"title":"Deep search","api":"GET /v1/websearch/search","href":"/websearch/search-api"},{"title":"Simple search","api":"GET /v1/websearch/simple-search","href":"/websearch/simple-search"},{"title":"Read a page","api":"GET /v1/websearch/reader","href":"/websearch/reader"},{"title":"Search news","api":"GET /v1/websearch/search-news","href":"/websearch/news-search"}]}]}]},{"tab":"Integrations","icon":"plug","pages":[{"title":"Integrations","href":"/integrations/overview"}]}]},{"language":"zh","pages":[{"title":"zh","href":"/zh/api-reference/image/generations"}]}]},"basePath":"","title":"Create an image - PipeLLM","deploymentId":"dpl_HhUetB7eHHDAmK9T1Teip38TgFx9","buildId":"dpl_HhUetB7eHHDAmK9T1Teip38TgFx9","dynamics":["c2aa737661","2b790eda92","b0f84f53ff"],"chunks":["OpenApiReferenceProvider-jJHA3WSo.js","utils-DbZn3Mjn.js","cloneDeep-CnBnaSyy.js","_Uint8Array-CMQtTgBR.js","isObject-FP1Yky1u.js","utils-Bl2DvzOJ.js","addUniqueKeysToSchema-BwOLo9p1.js","snippetPresets-BBiPpKa-.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","conditional-requirements-CFM0id0Q.js","ApiExamples-C0px4Tml.js","isEqual-zAyttAAO.js","usePlaygroundInputsStore-Dell6dGw.js","shallow-0VKqkSqN.js","getApiPlaygroundDisplay-CP_ctPEB.js","CodeSnippet-5L35ic0s.js","CodeSnippets-DOXbNhJw.js","Page-DRLI_2Ue.js","getPastedJson-VhzT9m2P.js","icon-CD8_AtCO.js","MethodPill-DGgOMftG.js","DuplicateIcon-DZ6A_EtN.js","createIcon-DUl4oM5f.js","DynamicMarkdown-BGHukeRM.js","SectionHeading-ChrEUs8u.js","axios-vUo_bRtp.js"]}