|
| 1 | +--- |
| 2 | +title: Ideogram |
| 3 | +pcx_content_type: get-started |
| 4 | +--- |
| 5 | + |
| 6 | +import { Tabs, TabItem } from "~/components"; |
| 7 | + |
| 8 | +[Ideogram](https://ideogram.ai/) provides advanced text-to-image generation models with exceptional text rendering capabilities and visual quality. |
| 9 | + |
| 10 | +## Endpoint |
| 11 | + |
| 12 | +```txt |
| 13 | +https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/ideogram |
| 14 | +``` |
| 15 | + |
| 16 | +## Prerequisites |
| 17 | + |
| 18 | +When making requests to Ideogram, ensure you have the following: |
| 19 | + |
| 20 | +- Your AI Gateway Account ID. |
| 21 | +- Your AI Gateway gateway name. |
| 22 | +- An active Ideogram API key. |
| 23 | +- The name of the Ideogram model you want to use (e.g., `V_3`). |
| 24 | + |
| 25 | +## Examples |
| 26 | + |
| 27 | +### cURL |
| 28 | + |
| 29 | +```bash title="Example fetch request" |
| 30 | +curl https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/ideogram/v1/ideogram-v3/generate \ |
| 31 | + --header 'Api-Key: {ideogram_api_key}' \ |
| 32 | + --header 'Content-Type: application/json' \ |
| 33 | + --data '{ |
| 34 | + "prompt": "A serene landscape with mountains and a lake at sunset", |
| 35 | + "model": "V_3" |
| 36 | + }' |
| 37 | +``` |
| 38 | + |
| 39 | +### Use with JavaScript |
| 40 | + |
| 41 | +```js title="JavaScript" |
| 42 | +const accountId = "{account_id}"; |
| 43 | +const gatewayId = "{gateway_id}"; |
| 44 | +const ideogramApiKey = "{ideogram_api_key}"; |
| 45 | +const baseURL = `https://gateway.ai.cloudflare.com/v1/${accountId}/${gatewayId}/ideogram`; |
| 46 | + |
| 47 | +const response = await fetch(`${baseURL}/v1/ideogram-v3/generate`, { |
| 48 | + method: "POST", |
| 49 | + headers: { |
| 50 | + "Api-Key": ideogramApiKey, |
| 51 | + "Content-Type": "application/json", |
| 52 | + }, |
| 53 | + body: JSON.stringify({ |
| 54 | + prompt: "A serene landscape with mountains and a lake at sunset", |
| 55 | + model: "V_3", |
| 56 | + }), |
| 57 | +}); |
| 58 | + |
| 59 | +const result = await response.json(); |
| 60 | +console.log(result); |
| 61 | +``` |
0 commit comments