Upload examples/gptimage15_example.js with huggingface_hub
Browse files
examples/gptimage15_example.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// GPT Image 1.5 API Example via NexaAPI
|
| 2 |
+
// Get your free API key at: https://nexa-api.com
|
| 3 |
+
// Install: npm install nexaapi
|
| 4 |
+
|
| 5 |
+
import NexaAPI from 'nexaapi';
|
| 6 |
+
|
| 7 |
+
const client = new NexaAPI({ apiKey: 'YOUR_API_KEY' });
|
| 8 |
+
|
| 9 |
+
async function main() {
|
| 10 |
+
// Generate an image
|
| 11 |
+
const image = await client.images.generate({
|
| 12 |
+
model: 'gpt-image-1.5',
|
| 13 |
+
prompt: 'Minimalist logo design for a tech startup, white background',
|
| 14 |
+
size: '1024x1024'
|
| 15 |
+
});
|
| 16 |
+
console.log('GPT Image 1.5 - Generated Image URL:');
|
| 17 |
+
console.log(image.data[0].url);
|
| 18 |
+
|
| 19 |
+
// Product image
|
| 20 |
+
const productImage = await client.images.generate({
|
| 21 |
+
model: 'gpt-image-1.5',
|
| 22 |
+
prompt: 'Professional product photo of a sleek smartwatch, white background, studio lighting',
|
| 23 |
+
size: '1024x1024'
|
| 24 |
+
});
|
| 25 |
+
console.log('\nProduct Image URL:');
|
| 26 |
+
console.log(productImage.data[0].url);
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
main();
|