gpt-image-2 generalmente devuelve data[0].url. No envíe gpt-image-2 como response_format; si desea controlar el formato de archivo de la imagen, utilice output_format="png", "jpeg" o "webp". Para solicitudes de producción de imágenes se recomienda usar la línea principal https://api.crazyrouter.com/v1.
El costo de generar imágenes es alto; se recomienda probar primero los prompts con un tamaño pequeño y, cuando esté satisfecho, generar imágenes grandes y de alta calidad.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Crazyrouter","colors":{"primary":"#0D9373","light":"#07C983","dark":"#0D9373"},"logo":{"light":"https://mintcdn.com/personal-40b49350/FPp111D8La1Ewhd_/logo/wordmark-light.svg?fit=max\u0026auto=format\u0026n=FPp111D8La1Ewhd_\u0026q=85\u0026s=e914a5fb70e6cbaab535757a3c48d69f","dark":"https://mintcdn.com/personal-40b49350/FPp111D8La1Ewhd_/logo/wordmark-dark.svg?fit=max\u0026auto=format\u0026n=FPp111D8La1Ewhd_\u0026q=85\u0026s=09ac97bcd414bcd3a82eb032186bc0f4","href":"https://crazyrouter.com/"},"favicon":"https://mintcdn.com/personal-40b49350/ikfGrKL95lSPfswi/favicon.ico?fit=max\u0026auto=format\u0026n=ikfGrKL95lSPfswi\u0026q=85\u0026s=6971aaf4bd51d87df5db4bb5eff345dd","api":{},"contextual":{"options":["copy"],"display":"header"},"styling":{"latex":false},"navigation":{"languages":[{"language":"cn","href":"llms-guide"},{"language":"en","default":true,"href":"en/llms-guide"},{"language":"jp","href":"jp/llms-guide"},{"language":"ru","href":"ru/llms-guide"},{"language":"ko","href":"ko/llms-guide"},{"language":"es","default":true,"href":"es/llms-guide"}]}},"deployment":{"deploymentMetadataValue":{"subdomain":"personal-40b49350","hasAudioNarration":false,"actualSubdomain":"personal-40b49350","customDomains":["docs.crazyrouter.com"],"gitSource":{"type":"github","owner":"xujfcn","repo":"crazyrouter-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6adc791faad54c2adb247fc9","collectionId":"7ba2c383-4c3a-4d36-ad32-a787f780e555","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6adc791faad54c2adb247fc9"},"entitlements":{},"buildId":"6adc791faad54c2adb247fc9","clientVersion":"0.0.3964","searchFilterCounts":[{"language":"cn","tag":"API 参考","count":81},{"language":"en","tag":"API Reference","count":81},{"language":"es","tag":"Referencia de la API","count":81},{"language":"jp","tag":"API リファレンス","count":81},{"language":"ko","tag":"API 레퍼런스","count":81},{"language":"ru","tag":"API Reference","count":81},{"language":"en","tag":"Integrations","count":60},{"language":"es","tag":"Integraciones","count":60},{"language":"ru","tag":"Интеграции","count":60},{"language":"cn","tag":"集成","count":38},{"language":"jp","tag":"連携","count":38},{"language":"ko","tag":"연동","count":38},{"language":"cn","tag":"第三方集成","count":22},{"language":"jp","tag":"外部ツール連携","count":22},{"language":"ko","tag":"서드파티 연동","count":22},{"language":"cn","tag":"视频生成","count":20},{"language":"en","tag":"Video Generation","count":20},{"language":"es","tag":"Generación de vídeo","count":20},{"language":"jp","tag":"動画生成","count":20},{"language":"ko","tag":"비디오 생성","count":20},{"language":"ru","tag":"Генерация видео","count":20},{"language":"cn","tag":"图像生成","count":18},{"language":"en","tag":"Image Generation","count":18},{"language":"es","tag":"Generación de imágenes","count":18},{"language":"jp","tag":"画像生成","count":18},{"language":"ko","tag":"이미지 생성","count":18},{"language":"ru","tag":"Генерация изображений","count":18},{"language":"cn","tag":"文档","count":17},{"language":"en","tag":"Docs","count":17},{"language":"es","tag":"Documentación","count":17},{"language":"jp","tag":"ドキュメント","count":17},{"language":"ko","tag":"문서","count":17},{"language":"ru","tag":"Документация","count":17},{"language":"cn","tag":"开始使用","count":11},{"language":"cn","tag":"Chat - Gemini","count":11},{"language":"cn","tag":"Chat - OpenAI","count":11},{"language":"en","tag":"Getting Started","count":11},{"language":"en","tag":"Chat - Gemini","count":11},{"language":"en","tag":"Chat - OpenAI","count":11},{"language":"es","tag":"Primeros pasos","count":11},{"language":"es","tag":"Chat - Gemini","count":11},{"language":"es","tag":"Chat - OpenAI","count":11},{"language":"jp","tag":"はじめに","count":11},{"language":"jp","tag":"Chat - Gemini","count":11},{"language":"jp","tag":"Chat - OpenAI","count":11},{"language":"ko","tag":"시작하기","count":11},{"language":"ko","tag":"Chat - Gemini","count":11},{"language":"ko","tag":"Chat - OpenAI","count":11},{"language":"ru","tag":"Начало работы","count":11},{"language":"ru","tag":"Chat - Gemini","count":11},{"language":"ru","tag":"Chat - OpenAI","count":11},{"language":"cn","tag":"SDK \u0026 代码示例","count":9},{"language":"en","tag":"SDK \u0026 Code Examples","count":9},{"language":"es","tag":"SDK y ejemplos de código","count":9},{"language":"jp","tag":"SDK \u0026 コード例","count":9},{"language":"ko","tag":"SDK \u0026 코드 예제","count":9},{"language":"ru","tag":"SDK и примеры кода","count":9},{"language":"en","tag":"API Key \u0026 Console Management","count":7},{"language":"es","tag":"Claves API y gestión de la consola","count":7},{"language":"ru","tag":"API-ключи и управление консолью","count":7}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"isAtlas":false,"googleFontsInlined":false},"customCss":[{"filePath":"language-flags.css","content":":is(#localization-select-item-cn, #localization-select-item-en, #localization-select-item-jp, #localization-select-item-ru, #localization-select-item-ko, #localization-select-item-es)::before,[data-component-part=localization-select-trigger][data-docs-flag]::before{content:\"\";display:inline-block;width:20px;height:20px;flex:0 0 20px;border-radius:50%;background-image:var(--docs-language-flag);background-size:cover;background-position:center;box-shadow:0 0 0 1px rgb(128 128 128/20%)}#localization-select-item-es,[data-component-part=localization-select-trigger][data-docs-flag=es]{--docs-language-flag:linear-gradient(to bottom, #aa151b 0% 25%, #f1bf00 25% 75%, #aa151b 75% 100%)}#localization-select-item-cn,[data-component-part=localization-select-trigger][data-docs-flag=cn]{--docs-language-flag:url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9Ijc1LjI0IDAgMzQyIDM0MiI+PHBhdGggZmlsbD0iI0Q4MDAyNyIgZD0iTTAgMGg1MTN2MzQySDB6Ii8+PGcgZmlsbD0iI0ZGREE0NCI+PHBhdGggZD0ibTIyNi44IDIzOS4yLTkuNy0xNS42LTE3LjkgNC40IDExLjktMTQuMS05LjctMTUuNiAxNy4xIDYuOSAxMS44LTE0LjEtMS4zIDE4LjQgMTcuMSA2LjktMTcuOSA0LjR6TTI5MC42IDgybC0xMC4xIDE1LjQgMTEuNiAxNC4zLTE3LjctNC44LTEwLjEgMTUuNS0xLTE4LjQtMTcuNy00LjggMTcuMi02LjYtMS0xOC40IDExLjYgMTQuM3pNMjM2LjIgMjUuNGwtMiAxOC4zIDE2LjggNy42LTE4IDMuOC0yIDE4LjMtOS4yLTE2LTE3LjkgMy44IDEyLjMtMTMuNy05LjItMTUuOSAxNi44IDcuNXpNMjkyLjggMTYxLjhsLTE0LjkgMTAuOSA1LjggMTcuNS0xNC45LTEwLjgtMTQuOSAxMSA1LjYtMTcuNi0xNC45LTEwLjcgMTguNC0uMSA1LjYtMTcuNiA1LjggMTcuNXpNMTE1IDQ2LjNsMTcuMyA1My41aDU2LjJsLTQ1LjQgMzIuOSAxNy4zIDUzLjUtNDUuNC0zMy00NS41IDMzIDE3LjQtNTMuNS00NS41LTMyLjloNTYuM3oiLz48L2c+PC9zdmc+\")}#localization-select-item-en,[data-component-part=localization-select-trigger][data-docs-flag=en]{--docs-language-flag:url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjU5Ljg1IDAgMzQyIDM0MiI+PHBhdGggZmlsbD0iI0ZGRiIgZD0iTTAgMGg1MTN2MzQySDB6Ii8+PGcgZmlsbD0iI0Q4MDAyNyI+PHBhdGggZD0iTTAgMGg1MTN2MjYuM0gwek0wIDUyLjZoNTEzdjI2LjNIMHpNMCAxMDUuMmg1MTN2MjYuM0gwek0wIDE1Ny44aDUxM3YyNi4zSDB6TTAgMjEwLjVoNTEzdjI2LjNIMHpNMCAyNjMuMWg1MTN2MjYuM0gwek0wIDMxNS43aDUxM1YzNDJIMHoiLz48L2c+PHBhdGggZmlsbD0iIzJFNTJCMiIgZD0iTTAgMGgyNTYuNXYxODQuMUgweiIvPjxnIGZpbGw9IiNGRkYiPjxwYXRoIGQ9Im00Ny44IDEzOC45LTQtMTIuOC00LjQgMTIuOEgyNi4ybDEwLjcgNy43LTQgMTIuOCAxMC45LTcuOSAxMC42IDcuOS00LjEtMTIuOCAxMC45LTcuN3pNMTA0LjEgMTM4LjlsLTQuMS0xMi44LTQuMiAxMi44SDgyLjZsMTAuNyA3LjctNCAxMi44IDEwLjctNy45IDEwLjggNy45LTQtMTIuOCAxMC43LTcuN3pNMTYwLjYgMTM4LjlsLTQuMy0xMi44LTQgMTIuOGgtMTMuNWwxMSA3LjctNC4yIDEyLjggMTAuNy03LjkgMTEgNy45LTQuMi0xMi44IDEwLjctNy43ek0yMTYuOCAxMzguOWwtNC0xMi44LTQuMiAxMi44aC0xMy4zbDEwLjggNy43LTQgMTIuOCAxMC43LTcuOSAxMC44IDcuOS00LjMtMTIuOCAxMS03Ljd6TTEwMCA3NS4zbC00LjIgMTIuOEg4Mi42TDkzLjMgOTZsLTQgMTIuNiAxMC43LTcuOCAxMC44IDcuOC00LTEyLjYgMTAuNy03LjloLTEzLjR6TTQzLjggNzUuM2wtNC40IDEyLjhIMjYuMkwzNi45IDk2bC00IDEyLjYgMTAuOS03LjggMTAuNiA3LjhMNTAuMyA5NmwxMC45LTcuOUg0Ny44ek0xNTYuMyA3NS4zbC00IDEyLjhoLTEzLjVsMTEgNy45LTQuMiAxMi42IDEwLjctNy44IDExIDcuOC00LjItMTIuNiAxMC43LTcuOWgtMTMuMnpNMjEyLjggNzUuM2wtNC4yIDEyLjhoLTEzLjNsMTAuOCA3LjktNCAxMi42IDEwLjctNy44IDEwLjggNy44LTQuMy0xMi42IDExLTcuOWgtMTMuNXpNNDMuOCAyNC43bC00LjQgMTIuNkgyNi4ybDEwLjcgNy45LTQgMTIuN0w0My44IDUwbDEwLjYgNy45LTQuMS0xMi43IDEwLjktNy45SDQ3Ljh6TTEwMCAyNC43bC00LjIgMTIuNkg4Mi42bDEwLjcgNy45LTQgMTIuN0wxMDAgNTBsMTAuOCA3LjktNC0xMi43IDEwLjctNy45aC0xMy40ek0xNTYuMyAyNC43bC00IDEyLjZoLTEzLjVsMTEgNy45LTQuMiAxMi43IDEwLjctNy45IDExIDcuOS00LjItMTIuNyAxMC43LTcuOWgtMTMuMnpNMjEyLjggMjQuN2wtNC4yIDEyLjZoLTEzLjNsMTAuOCA3LjktNCAxMi43IDEwLjctNy45IDEwLjggNy45LTQuMy0xMi43IDExLTcuOWgtMTMuNXoiLz48L2c+PC9zdmc+\")}#localization-select-item-jp,[data-component-part=localization-select-trigger][data-docs-flag=jp]{--docs-language-flag:url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9Ijg1LjUgMCAzNDIgMzQyIj48cGF0aCBmaWxsPSIjRkZGIiBkPSJNMCAwaDUxMnYzNDJIMHoiLz48Y2lyY2xlIGZpbGw9IiNEODAwMjciIGN4PSIyNTYuNSIgY3k9IjE3MSIgcj0iOTYiLz48L3N2Zz4=\")}#localization-select-item-ru,[data-component-part=localization-select-trigger][data-docs-flag=ru]{--docs-language-flag:url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9Ijg1LjMzMyA4NS4zMzMgMzQxLjMzMyAzNDEuMzMzIj48cGF0aCBmaWxsPSIjRkZGIiBkPSJNMCA4NS4zM3YzNDEuMzMyaDUxMlY4NS4zM3oiLz48cGF0aCBmaWxsPSIjMDA1MkI0IiBkPSJNMCA4NS4zMzNoNTEyVjQyNi42N0gweiIvPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik0wIDg1LjMzM2g1MTJ2MTEzLjc3NUgweiIvPjxwYXRoIGZpbGw9IiNEODAwMjciIGQ9Ik0wIDMxMi44ODRoNTEydjExMy43NzVIMHoiLz48L3N2Zz4=\")}#localization-select-item-ko,[data-component-part=localization-select-trigger][data-docs-flag=ko]{--docs-language-flag:url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9Ijg1LjUgMCAzNDIgMzQyIj48cGF0aCBmaWxsPSIjRkZGIiBkPSJNMCAwaDUxM3YzNDJIMHoiLz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNTYuNSAxNzEpIHNjYWxlKDYuNSkiPjxnIHRyYW5zZm9ybT0icm90YXRlKC01Ni4zKSI+PHBhdGggZD0iTS02LTI2SDZ2MkgtNlptMCAzSDZ2MkgtNlptMCAzSDZ2MkgtNlpNLTYgMThINnYySC02Wm0wIDNINnYySC02Wm0wIDNINnYySC02WiIvPjxwYXRoIHN0cm9rZT0iI0ZGRiIgZD0iTTAgMTd2MTAiLz48cGF0aCBmaWxsPSIjQ0QyRTNBIiBkPSJNMC0xMmExMiAxMiAwIDAgMSAwIDI0WiIvPjxwYXRoIGZpbGw9IiMwMDQ3QTAiIGQ9Ik0wLTEyYTEyIDEyIDAgMCAwIDAgMjRBNiA2IDAgMCAwIDAgMFoiLz48Y2lyY2xlIGN5PSItNiIgcj0iNiIgZmlsbD0iI0NEMkUzQSIvPjwvZz48ZyB0cmFuc2Zvcm09InJvdGF0ZSgtMTIzLjcpIj48cGF0aCBkPSJNLTYtMjZINnYySC02Wm0wIDNINnYySC02Wm0wIDNINnYySC02Wk0tNiAxOEg2djJILTZabTAgM0g2djJILTZabTAgM0g2djJILTZaIi8+PHBhdGggc3Ryb2tlPSIjRkZGIiBkPSJNMC0yMy41djNNMCAxN3YzLjVtMCAzdjMiLz48L2c+PC9nPjwvc3ZnPg==\")}"}],"page":{"pagePath":"es/sdks/python/images","slug":"/es/sdks/python/images","pageMetadata":{"title":"Generación de imágenes en Python","description":"Genera y edita imágenes en Python usando DALL-E y GPT-Image-2","href":"/es/sdks/python/images"},"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: \"Genera y edita imágenes en Python usando DALL-E y GPT-Image-2\"\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`,blockquote:`blockquote`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Note,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.blockquote,{children:[`\n`,_jsx(_components.p,{children:`Contenido actualizado: 2026-06-06`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`generar-imágenes-con-dall-e-3`,children:`Generar imágenes con DALL-E 3`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`14`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`14`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` openai `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` OpenAI`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`client `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` OpenAI(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`api_key`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"sk-xxx\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`base_url`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://api.crazyrouter.com/v1\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.images.generate(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"dall-e-3\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` prompt`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"一只穿着宇航服的猫在月球上散步,数字艺术风格\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` size`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"1024x1024\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` quality`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"hd\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` n`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`image_url `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response.data[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].url`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"图片地址: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`image_url`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`parámetros-de-dall-e`,children:`Parámetros de DALL-E`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Parámetro`}),_jsx(_components.th,{children:`Valores opcionales`}),_jsx(_components.th,{children:`Descripción`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`size`})}),_jsxs(_components.td,{\"data-numeric\":`true`,children:[_jsx(_components.code,{children:`1024x1024`}),`, `,_jsx(_components.code,{children:`1792x1024`}),`, `,_jsx(_components.code,{children:`1024x1792`})]}),_jsx(_components.td,{children:`Tamaño de la imagen`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`quality`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`standard`}),`, `,_jsx(_components.code,{children:`hd`})]}),_jsx(_components.td,{children:`Calidad de la imagen`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`style`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`vivid`}),`, `,_jsx(_components.code,{children:`natural`})]}),_jsx(_components.td,{children:`Estilo`})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`generar-imágenes-con-gpt-image-2`,children:`Generar imágenes con GPT-Image-2`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.images.generate(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"gpt-image-2\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` prompt`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"一个现代简约风格的 Logo,主题是人工智能\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` size`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"1024x1024\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` quality`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"low\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` output_format`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"png\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` n`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(response.data[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].url)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`editar-imágenes-con-gpt-image-2`,children:`Editar imágenes con GPT-Image-2`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`10`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 图像编辑(需要原图)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.images.edit(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"gpt-image-2\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` image`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`open`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"original.png\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"rb\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` prompt`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"把背景改成海滩日落\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` size`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"1024x1024\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` quality`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"low\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(response.data[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].url)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`descargar-y-guardar-imágenes`,children:`Descargar y guardar imágenes`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`14`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`14`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.images.generate(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"dall-e-3\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` prompt`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"赛博朋克风格的城市夜景\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` size`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"1792x1024\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 下载图片`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`image_url `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response.data[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].url`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`img_data `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.get(image_url).content`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`with`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` open`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"cyberpunk_city.png\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"wb\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` f:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` f.write(img_data)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"图片已保存\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`gpt-image-2`}),` generalmente devuelve `,_jsx(_components.code,{children:`data[0].url`}),`. No envíe `,_jsx(_components.code,{children:`gpt-image-2`}),` como `,_jsx(_components.code,{children:`response_format`}),`; si desea controlar el formato de archivo de la imagen, utilice `,_jsx(_components.code,{children:`output_format=\"png\"`}),`, `,_jsx(_components.code,{children:`\"jpeg\"`}),` o `,_jsx(_components.code,{children:`\"webp\"`}),`. Para solicitudes de producción de imágenes se recomienda usar la línea principal `,_jsx(_components.code,{children:`https://api.crazyrouter.com/v1`}),`.`]})}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`El costo de generar imágenes es alto; se recomienda probar primero los prompts con un tamaño pequeño y, cuando esté satisfecho, generar imágenes grandes y de alta calidad.`})}),`\n`,_jsx(Heading,{level:`2`,id:`páginas-relacionadas`,children:`Páginas relacionadas`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`https://crazyrouter.com/es/models/openai/gpt-image-2?utm_source=docs\u0026utm_medium=related`,children:`Página del modelo GPT Image 2: Precio en tiempo real, ejemplos reales y código de llamada`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`https://crazyrouter.com/es/models/openai?utm_source=docs\u0026utm_medium=related`,children:`Todos los modelos y precios de OpenAI`})}),`\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":{"config":{},"pageMetadata":{"title":"Generación de imágenes en Python","description":"Genera y edita imágenes en Python usando DALL-E y GPT-Image-2","href":"/es/sdks/python/images"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Generar imágenes con DALL-E 3","slug":"generar-imágenes-con-dall-e-3","depth":2,"children":[{"title":"Parámetros de DALL-E","slug":"parámetros-de-dall-e","depth":3,"children":[]}]},{"title":"Generar imágenes con GPT-Image-2","slug":"generar-imágenes-con-gpt-image-2","depth":2,"children":[]},{"title":"Editar imágenes con GPT-Image-2","slug":"editar-imágenes-con-gpt-image-2","depth":2,"children":[]},{"title":"Descargar y guardar imágenes","slug":"descargar-y-guardar-imágenes","depth":2,"children":[]},{"title":"Páginas relacionadas","slug":"páginas-relacionadas","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/personal-40b49350/8c6f32f75f309c4e/language-flags.js"],"subdomain":"personal-40b49350","siteName":"Crazyrouter","title":"Generación de imágenes en Python - Crazyrouter","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{"cn":{"href":"/sdks/python/images","matchLevel":1},"en":{"href":"/en/sdks/python/images","matchLevel":1},"jp":{"href":"/jp/sdks/python/images","matchLevel":1},"ru":{"href":"/ru/sdks/python/images","matchLevel":1},"ko":{"href":"/ko/sdks/python/images","matchLevel":1},"es":{"href":"/es/sdks/python/images","matchLevel":0}}},"lastModified":"2026-10-24T09:24:41.215Z","originalFileLocation":"es/sdks/python/images.mdx","locale":"es"},"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=\"system\"}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=\"Genera y edita imágenes en Python usando DALL-E y GPT-Image-2\">\u003cmeta data-mint-head name=\"application-name\" content=\"Crazyrouter\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/personal-40b49350/NVVHVTlgfxl0NPnu/_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/personal-40b49350/NVVHVTlgfxl0NPnu/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/personal-40b49350/NVVHVTlgfxl0NPnu/_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/personal-40b49350/NVVHVTlgfxl0NPnu/_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/personal-40b49350/NVVHVTlgfxl0NPnu/_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/personal-40b49350/NVVHVTlgfxl0NPnu/_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/personal-40b49350/NVVHVTlgfxl0NPnu/_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/personal-40b49350/NVVHVTlgfxl0NPnu/_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/personal-40b49350/NVVHVTlgfxl0NPnu/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Generación de imágenes en Python - Crazyrouter\">\u003cmeta data-mint-head property=\"og:description\" content=\"Genera y edita imágenes en Python usando DALL-E y GPT-Image-2\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Crazyrouter\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.crazyrouter.com/es/sdks/python/images\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://personal-40b49350.mintlify.app/_mintlify/api/og/v2?division=SDK+y+ejemplos+de+c%C3%B3digo\u0026amp;title=Generaci%C3%B3n+de+im%C3%A1genes+en+Python\u0026amp;description=Genera+y+edita+im%C3%A1genes+en+Python+usando+DALL-E+y+GPT-Image-2\u0026amp;theme=d0e312b4f00f28632bb3c03b\u0026amp;signature=0085e46039e89d48fd50fe319a735be8bcdb8f1b593a84d1eab36041b41386ba\">\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=\"Generación de imágenes en Python - Crazyrouter\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Genera y edita imágenes en Python usando DALL-E y GPT-Image-2\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://personal-40b49350.mintlify.app/_mintlify/api/og/v2?division=SDK+y+ejemplos+de+c%C3%B3digo\u0026amp;title=Generaci%C3%B3n+de+im%C3%A1genes+en+Python\u0026amp;description=Genera+y+edita+im%C3%A1genes+en+Python+usando+DALL-E+y+GPT-Image-2\u0026amp;theme=d0e312b4f00f28632bb3c03b\u0026amp;signature=0085e46039e89d48fd50fe319a735be8bcdb8f1b593a84d1eab36041b41386ba\">\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/personal-40b49350/NVVHVTlgfxl0NPnu/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Crazyrouter\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0D9373\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.crazyrouter.com/es/sdks/python/images\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/es/sdks/python/images.md\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"es\" href=\"https://docs.crazyrouter.com/es/sdks/python/images\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"zh\" href=\"https://docs.crazyrouter.com/sdks/python/images\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"en\" href=\"https://docs.crazyrouter.com/en/sdks/python/images\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"ja\" href=\"https://docs.crazyrouter.com/jp/sdks/python/images\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"ru\" href=\"https://docs.crazyrouter.com/ru/sdks/python/images\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"ko\" href=\"https://docs.crazyrouter.com/ko/sdks/python/images\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"x-default\" href=\"https://docs.crazyrouter.com/en/sdks/python/images\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.crazyrouter.com/#organization\",\"name\":\"Crazyrouter\",\"url\":\"https://docs.crazyrouter.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/personal-40b49350/FPp111D8La1Ewhd_/logo/wordmark-light.svg?fit=max\u0026auto=format\u0026n=FPp111D8La1Ewhd_\u0026q=85\u0026s=e914a5fb70e6cbaab535757a3c48d69f\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.crazyrouter.com#website\",\"name\":\"Crazyrouter\",\"url\":\"https://docs.crazyrouter.com\",\"publisher\":{\"@id\":\"https://docs.crazyrouter.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.crazyrouter.com/es/sdks/python/images#webpage\",\"url\":\"https://docs.crazyrouter.com/es/sdks/python/images\",\"name\":\"Generación de imágenes en Python\",\"description\":\"Genera y edita imágenes en Python usando DALL-E y GPT-Image-2\",\"dateModified\":\"2026-10-24T09:24:41.215Z\",\"isPartOf\":{\"@id\":\"https://docs.crazyrouter.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.crazyrouter.com/es/sdks/python/images#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.crazyrouter.com/es/sdks/python/images#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"SDK y ejemplos de código\",\"item\":\"https://docs.crazyrouter.com/es/sdks/python/basic\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Generación de imágenes en Python\",\"item\":\"https://docs.crazyrouter.com/es/sdks/python/images\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.crazyrouter.com/es/sdks/python/images#article\",\"headline\":\"Generación de imágenes en Python\",\"name\":\"Generación de imágenes en Python\",\"description\":\"Genera y edita imágenes en Python usando DALL-E y GPT-Image-2\",\"url\":\"https://docs.crazyrouter.com/es/sdks/python/images\",\"mainEntityOfPage\":{\"@id\":\"https://docs.crazyrouter.com/es/sdks/python/images#webpage\"},\"dateModified\":\"2026-10-24T09:24:41.215Z\",\"publisher\":{\"@id\":\"https://docs.crazyrouter.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.crazyrouter.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Crazyrouter\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Crazyrouter","nav":{"global":null,"languages":[{"language":"cn","pages":[{"title":"cn","href":"/sdks/python/images"}]},{"language":"en","default":true,"pages":[{"title":"en","href":"/en/sdks/python/images"}]},{"language":"jp","pages":[{"title":"jp","href":"/jp/sdks/python/images"}]},{"language":"ru","pages":[{"title":"ru","href":"/ru/sdks/python/images"}]},{"language":"ko","pages":[{"title":"ko","href":"/ko/sdks/python/images"}]},{"language":"es","default":true,"tabs":[{"tab":"Documentación","pages":[{"title":"Documentación","href":"/es/llms-guide"}]},{"tab":"Referencia de la API","pages":[{"title":"Referencia de la API","href":"/es/chat/openai/overview"}]},{"tab":"Integraciones","groups":[{"group":"Claves API y gestión de la consola","pages":[{"title":"Obtener lista de tokens","api":"GET /api/token/","href":"/es/token-management/list"},{"title":"Agregar token","api":"POST /api/token/","href":"/es/token-management/create"},{"title":"Modificar token","api":"PUT /api/token/","href":"/es/token-management/update"},{"title":"Eliminar token","api":"DELETE /api/token/{id}","href":"/es/token-management/delete"},{"title":"Buscar tokens","api":"GET /api/token/search","href":"/es/token-management/search"},{"title":"Monitor de registros de llamadas y gastos","href":"/es/token-management/logs-and-costs"},{"title":"Obtener modelos compatibles con el token","api":"GET /v1/models","href":"/es/token-management/models"}]},{"group":"SDK y ejemplos de código","pages":[{"title":"Diálogo básico de Python","href":"/es/sdks/python/basic"},{"title":"SDK de Python para OpenAI","href":"/es/sdks/python/openai-sdk"},{"title":"Python reconocimiento de imágenes","href":"/es/sdks/python/vision"},{"title":"Embeddings de Python","href":"/es/sdks/python/embeddings"},{"title":"Python voz","description":"Implementación de Python para convertir texto a voz (TTS) y voz a texto (STT)","href":"/es/sdks/python/tts-stt"},{"title":"Generación de imágenes en Python","href":"/es/sdks/python/images"},{"title":"Llamada de Funciones en Python","description":"Ejemplo completo de llamada de funciones en Python","href":"/es/sdks/python/function-calling"},{"title":"Diálogo básico de Node.js","href":"/es/sdks/nodejs"},{"title":"Ejemplo de PHP","href":"/es/sdks/php"}]},{"group":"Integraciones","pages":[{"title":"Tutorial de configuración de Cursor","href":"/es/integrations/cursor"},{"title":"Guía de configuración de Claude Code","href":"/es/integrations/claude-code"},{"title":"Tutorial de configuración de Cline","href":"/es/integrations/cline"},{"title":"Tutorial de configuración de Aider","href":"/es/integrations/aider"},{"title":"Tutorial de configuración de OpenAI Codex CLI","href":"/es/integrations/codex"},{"title":"Tutorial de configuración de Gemini CLI","href":"/es/integrations/gemini-cli"},{"title":"Tutorial de configuración de Cherry Studio","href":"/es/integrations/cherry-studio"},{"title":"Guía de Configuración de ChatBox","href":"/es/integrations/chatbox"},{"title":"Tutorial de configuración de LobeChat","href":"/es/integrations/lobechat"},{"title":"Guía de configuración de NextChat","href":"/es/integrations/nextchat"},{"title":"Tutorial de configuración de Dify","href":"/es/integrations/dify"},{"title":"Guía de integración de LiteLLM","href":"/es/integrations/litellm"},{"title":"Guía de configuración de n8n","href":"/es/integrations/n8n"},{"title":"Guía de configuración de Coze","href":"/es/integrations/coze"},{"title":"Tutorial de configuración de RikkaHub","href":"/es/integrations/rikkahub"},{"title":"Guía de configuración de GPT Academic","href":"/es/integrations/gpt-academic"},{"title":"Guía de configuración de Zotero","href":"/es/integrations/zotero"},{"title":"Guía de configuración de Claude Dev","href":"/es/integrations/claude-dev"},{"title":"Tutorial de configuración de traducción inmersiva","href":"/es/integrations/immersive-translate"},{"title":"Tutorial de configuración de ChatGPT Sidebar","href":"/es/integrations/chatgpt-sidebar"},{"title":"ChatGPT en WeChat tutorial de configuración","href":"/es/integrations/chatgpt-on-wechat"},{"title":"Tutorial de configuración de LangChain","href":"/es/integrations/langchain"}]}]},{"tab":"SDK","pages":[{"title":"SDK","href":"/es/sdks/crazyrouter-sdk-guide"}]}],"global":{"anchors":[{"anchor":"Precios de los modelos","icon":"coins","href":"https://crazyrouter.com/es/pricing?utm_source=docs\u0026utm_medium=anchor"}]}}]},"title":"Generación de imágenes en Python - Crazyrouter","buildId":"dpl_HcHmUS6i3UwswnTHJUEdcTtwfdTQ","deploymentId":"dpl_HcHmUS6i3UwswnTHJUEdcTtwfdTQ","dynamics":[],"chunks":[]}