|
116 | 116 | "x-codeSamples": [ |
117 | 117 | { |
118 | 118 | "lang": "JavaScript", |
119 | | - "source": "async function main() {\n const response = await fetch('https://api.aimlapi.com/v1/images/generations', {\n method: 'POST',\n headers: {\n 'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n \"model\": \"google/gemini-2.5-flash-image-edit\",\n \"prompt\": \"Combine the images so the T-Rex is wearing a business suit, sitting in a cozy small café, drinking from the mug. Blur the background slightly to create a bokeh effect.\",\n \"image_urls\": [\n \"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png\",\n \"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/blue-mug.jpg\"\n ]\n }),\n });\n\n const data = await response.json();\n console.log(JSON.stringify(data, null, 2));\n}\n\nmain();" |
| 119 | + "source": "async function main() {\n const response = await fetch('https://api.aimlapi.com/v1/images/generations', {\n method: 'POST',\n headers: {\n 'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n \"model\": \"bytedance/uso\",\n \"prompt\": \"Combine the images so the T-Rex is wearing a business suit, sitting in a cozy small café, drinking from the mug. Blur the background slightly to create a bokeh effect.\",\n \"image_urls\": [\n \"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png\",\n \"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/blue-mug.jpg\"\n ]\n }),\n });\n\n const data = await response.json();\n console.log(JSON.stringify(data, null, 2));\n}\n\nmain();" |
120 | 120 | }, |
121 | 121 | { |
122 | 122 | "lang": "Python", |
123 | | - "source": "import requests\n\nresponse = requests.post(\n \"https://api.aimlapi.com/v1/images/generations\",\n headers={\n \"Content-Type\":\"application/json\", \n \"Authorization\":\"Bearer <YOUR_AIMLAPI_KEY>\",\n },\n json={\n \"model\": \"google/gemini-2.5-flash-image-edit\",\n \"prompt\": \"Combine the images so the T-Rex is wearing a business suit, sitting in a cozy small café, drinking from the mug. Blur the background slightly to create a bokeh effect.\",\n \"image_urls\": [\n \"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png\",\n \"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/blue-mug.jpg\"\n ]\n }\n)\n\ndata = response.json()\nprint(data)" |
| 123 | + "source": "import requests\n\nresponse = requests.post(\n \"https://api.aimlapi.com/v1/images/generations\",\n headers={\n \"Content-Type\": \"application/json\",\n \"Authorization\": \"Bearer <YOUR_AIMLAPI_KEY>\",\n },\n json={\n \"model\": \"bytedance/uso\",\n \"prompt\": \"Combine the images so the T-Rex is wearing a business suit, sitting in a cozy small café, drinking from the mug. Blur the background slightly to create a bokeh effect.\",\n \"image_urls\": [\n \"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png\",\n \"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/blue-mug.jpg\"\n ]\n }\n)\n\ndata = response.json()\nprint(data)" |
124 | 124 | }, |
125 | 125 | { |
126 | 126 | "lang": "cURL", |
127 | | - "source": "curl -L \\\n --request POST \\\n --url 'https://api.aimlapi.com/v1/images/generations' \\\n --header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"model\": \"google/gemini-2.5-flash-image-edit\",\n \"prompt\": \"Combine the images so the T-Rex is wearing a business suit, sitting in a cozy small café, drinking from the mug. Blur the background slightly to create a bokeh effect.\",\n \"image_urls\": [\n \"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png\",\n \"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/blue-mug.jpg\"\n ]\n }'" |
| 127 | + "source": "curl -L \\\n --request POST \\\n --url 'https://api.aimlapi.com/v1/images/generations' \\\n --header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"model\": \"bytedance/uso\",\n \"prompt\": \"Combine the images so the T-Rex is wearing a business suit, sitting in a cozy small café, drinking from the mug. Blur the background slightly to create a bokeh effect.\",\n \"image_urls\": [\n \"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png\",\n \"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/blue-mug.jpg\"\n ]\n }'" |
128 | 128 | }, |
129 | 129 | { |
130 | 130 | "lang": "HTTP", |
131 | | - "source": "POST /v1/images/generations HTTP/1.1\nHost: api.aimlapi.com\nAuthorization: Bearer <YOUR_AIMLAPI_KEY>\nContent-Type: application/json\nAccept: */*\n\n{\n \"model\": \"google/gemini-2.5-flash-image-edit\",\n \"prompt\": \"Combine the images so the T-Rex is wearing a business suit, sitting in a cozy small café, drinking from the mug. Blur the background slightly to create a bokeh effect.\",\n \"image_urls\": [\n \"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png\",\n \"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/blue-mug.jpg\"\n ]\n}" |
| 131 | + "source": "POST / HTTP/1.1\nHost: test.com\nAuthorization: Bearer <YOUR_AIMLAPI_KEY>\nContent-Type: application/json\nAccept: */*\n\n{\n \"model\": \"bytedance/uso\",\n \"prompt\": \"Combine the images so the T-Rex is wearing a business suit, sitting in a cozy small café, drinking from the mug. Blur the background slightly to create a bokeh effect.\",\n \"image_urls\": [\n \"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png\",\n \"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/blue-mug.jpg\"\n ]\n}" |
132 | 132 | } |
133 | 133 | ] |
134 | 134 | } |
|
0 commit comments