|
| 1 | +# reve/create-image |
| 2 | + |
| 3 | +{% columns %} |
| 4 | +{% column width="75%" %} |
| 5 | +{% hint style="info" %} |
| 6 | +This documentation is valid for the following list of our models: |
| 7 | + |
| 8 | +* `reve/create-image` |
| 9 | +{% endhint %} |
| 10 | +{% endcolumn %} |
| 11 | + |
| 12 | +{% column width="25%" %} |
| 13 | +<a href="https://aimlapi.com/app/?model=reve/create-image&mode=image" class="button primary">Try in Playground</a> |
| 14 | +{% endcolumn %} |
| 15 | +{% endcolumns %} |
| 16 | + |
| 17 | +## Model Overview |
| 18 | + |
| 19 | +A model trained from the ground up for strong prompt adherence, refined aesthetics, and typography. |
| 20 | + |
| 21 | +## Setup your API Key |
| 22 | + |
| 23 | +If you don’t have an API key for the AI/ML API yet, feel free to use our [Quickstart guide](https://docs.aimlapi.com/quickstart/setting-up). |
| 24 | + |
| 25 | +## API Schema |
| 26 | + |
| 27 | +{% openapi-operation spec="reve-create-image" path="/v1/images/generations" method="post" %} |
| 28 | +[OpenAPI reve-create-image](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/image-models/Reve/reve-create-image.json) |
| 29 | +{% endopenapi-operation %} |
| 30 | + |
| 31 | +## Quick Example |
| 32 | + |
| 33 | +Let's generate an image of the specified size using a simple prompt. |
| 34 | + |
| 35 | +{% tabs %} |
| 36 | +{% tab title="Python" %} |
| 37 | +{% code overflow="wrap" %} |
| 38 | +```python |
| 39 | +import requests |
| 40 | +import json # for getting a structured output with indentation |
| 41 | + |
| 42 | +def main(): |
| 43 | + response = requests.post( |
| 44 | + "https://api.aimlapi.com/v1/images/generations", |
| 45 | + headers={ |
| 46 | + # Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>: |
| 47 | + "Authorization": "Bearer <YOUR_AIMLAPI_KEY>", |
| 48 | + "Content-Type": "application/json" |
| 49 | + }, |
| 50 | + json={ |
| 51 | + "model": "reve/create-image", |
| 52 | + "prompt": "A T-Rex relaxing on a beach, lying on a sun lounger and wearing sunglasses.", |
| 53 | + "aspect_ratio": "16:9" |
| 54 | + } |
| 55 | + ) |
| 56 | + |
| 57 | + data = response.json() |
| 58 | + print(json.dumps(data, indent=2, ensure_ascii=False)) |
| 59 | + |
| 60 | +if __name__ == "__main__": |
| 61 | + main() |
| 62 | +``` |
| 63 | +{% endcode %} |
| 64 | +{% endtab %} |
| 65 | + |
| 66 | +{% tab title="JS" %} |
| 67 | +{% code overflow="wrap" %} |
| 68 | +```javascript |
| 69 | +async function main() { |
| 70 | + const response = await fetch('https://api.aimlapi.com/v1/images/generations', { |
| 71 | + method: 'POST', |
| 72 | + headers: { |
| 73 | + // Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>: |
| 74 | + 'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>', |
| 75 | + 'Content-Type': 'application/json', |
| 76 | + }, |
| 77 | + body: JSON.stringify({ |
| 78 | + model: 'reve/create-image', |
| 79 | + prompt: 'A T-Rex relaxing on a beach, lying on a sun lounger and wearing sunglasses.', |
| 80 | + aspect_ratio: '16:9' |
| 81 | + }), |
| 82 | + }); |
| 83 | + |
| 84 | + const data = await response.json(); |
| 85 | + console.log('Generation:', data); |
| 86 | +} |
| 87 | + |
| 88 | +main(); |
| 89 | +``` |
| 90 | +{% endcode %} |
| 91 | +{% endtab %} |
| 92 | +{% endtabs %} |
| 93 | + |
| 94 | +<details> |
| 95 | + |
| 96 | +<summary>Response</summary> |
| 97 | + |
| 98 | +{% code overflow="wrap" %} |
| 99 | +```json |
| 100 | +{ |
| 101 | + "data": [ |
| 102 | + { |
| 103 | + "url": "https://cdn.aimlapi.com/generations/phoenix/1759280291545-6280787e-7e4a-44c9-addf-608314a3cb58.png", |
| 104 | + "b64_json": null, |
| 105 | + "request_id": "rsid-f08b8f47354d688d6de93c400fdaf31c", |
| 106 | + "content_violation": false |
| 107 | + } |
| 108 | + ], |
| 109 | + "meta": { |
| 110 | + "usage": { |
| 111 | + "tokens_used": 126000 |
| 112 | + } |
| 113 | + } |
| 114 | +} |
| 115 | +``` |
| 116 | +{% endcode %} |
| 117 | + |
| 118 | +</details> |
| 119 | + |
| 120 | +We obtained the following nice 1360x768 image by running this code example: |
| 121 | + |
| 122 | +<div align="left"><figure><img src="../../../.gitbook/assets/reve-image-generate_output.png" alt=""><figcaption><p><code>"A T-Rex relaxing on a beach, lying on a sun lounger and wearing sunglasses."</code></p></figcaption></figure></div> |
0 commit comments