{"_id":"@apiframe-ai/sdk","_rev":"5-22d022c7e176841e6040bab116caa2b4","name":"@apiframe-ai/sdk","dist-tags":{"next":"2.0.0-beta.1","latest":"2.0.0-beta.1"},"versions":{"1.0.0":{"name":"@apiframe-ai/sdk","version":"1.0.0","keywords":["apiframe","midjourney","flux","ideogram","luma","suno","udio","runway","kling","ai","image-generation","video-generation"],"author":{"name":"Apiframe"},"license":"MIT","_id":"@apiframe-ai/sdk@1.0.0","maintainers":[{"name":"apiframe-ai","email":"renaud@apiframe.ai"}],"homepage":"https://github.com/apiframe-ai/apiframe-nodejs-sdk#readme","bugs":{"url":"https://github.com/apiframe-ai/apiframe-nodejs-sdk/issues"},"dist":{"shasum":"76bf5fc994bb15e501df91f0c36152824b12c817","tarball":"https://registry.npmjs.org/@apiframe-ai/sdk/-/sdk-1.0.0.tgz","fileCount":35,"integrity":"sha512-V4bFqAPM28pAgwZxbZOy9MPahtW0dz4pWgo1kPMlGkjFigZHgVnEGAIfdvNR6hlx1ZEBwY29Au6EOdV0IigJYQ==","signatures":[{"sig":"MEQCIG7z20bd89Z5eiKdcMGcGn1ZTiLVNjm5Ay4yAVKccYbcAiBOPsF3QKXpu8fGgfRHnIgTBl+86p0kWRCMKnvNHCz5yg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":95536},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=14.0.0"},"gitHead":"76dfcfb109a272a3ff3cce8997e8a01306724987","scripts":{"lint":"eslint src --ext .ts","test":"jest","build":"tsc","prepare":"npm run build"},"_npmUser":{"name":"apiframe-ai","email":"renaud@apiframe.ai"},"repository":{"url":"git+https://github.com/apiframe-ai/apiframe-nodejs-sdk.git","type":"git"},"_npmVersion":"11.6.1","description":"Official Node.js SDK for Apiframe - AI image and video generation APIs","directories":{},"_nodeVersion":"23.6.0","dependencies":{"axios":"^1.6.0","form-data":"^4.0.4"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","eslint":"^8.54.0","typescript":"^5.3.0","@types/node":"^20.10.0","@typescript-eslint/parser":"^6.13.0","@typescript-eslint/eslint-plugin":"^6.13.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.0.0_1760093124911_0.9136974723878641","host":"s3://npm-registry-packages-npm-production"}},"2.0.0-beta.0":{"name":"@apiframe-ai/sdk","version":"2.0.0-beta.0","keywords":["apiframe","ai","image-generation","video-generation","music-generation","midjourney","flux","kling","veo","sora","suno","sdk","api","client"],"author":{"url":"https://apiframe.ai","name":"Apiframe","email":"support@apiframe.ai"},"license":"MIT","_id":"@apiframe-ai/sdk@2.0.0-beta.0","maintainers":[{"name":"apiframe-ai","email":"renaud@apiframe.ai"}],"homepage":"https://github.com/apiframe-ai/apiframe-nodejs-sdk#readme","bugs":{"url":"https://github.com/apiframe-ai/apiframe-nodejs-sdk/issues"},"dist":{"shasum":"7f5bf7f972194c96037aea600a834349d0ff0cb8","tarball":"https://registry.npmjs.org/@apiframe-ai/sdk/-/sdk-2.0.0-beta.0.tgz","fileCount":18,"integrity":"sha512-qkNcFt7R6uHbJEyKo7Ah1A2syY0fac6gJE5rRsjt/TAI4QWLjljT1ACguFoAZzDzum7Li0FfxF9BQ6eUEhJuog==","signatures":[{"sig":"MEQCICil46vmmrtgIhEuoZSMHCZXmcfbSMW90PjoeCukruZoAiBHjhBYQQrst9nGZ/Q+kYyfdPXEtgNuaIr0cYPwV73oBA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":891523},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./webhooks":{"types":"./dist/webhooks.d.ts","import":"./dist/webhooks.js","require":"./dist/webhooks.cjs"},"./package.json":"./package.json"},"gitHead":"4c7d6dbb789c64a1a2fbda5835e176474606839f","scripts":{"dev":"tsup --watch","lint":"eslint src test","sync":"tsx scripts/sync-openapi.ts","test":"vitest run","build":"tsup","format":"prettier --write \"src/**/*.ts\" \"test/**/*.ts\"","prebuild":"rm -rf dist","test:types":"tsc --noEmit","test:watch":"vitest","prepublishOnly":"npm run build && npm run test"},"_npmUser":{"name":"apiframe-ai","email":"renaud@apiframe.ai"},"repository":{"url":"git+https://github.com/apiframe-ai/apiframe-nodejs-sdk.git","type":"git"},"_npmVersion":"11.11.1","description":"Official Node.js SDK for the Apiframe v2 API — unified image, video and music generation across 60+ AI models.","directories":{},"_nodeVersion":"23.6.0","publishConfig":{"tag":"next","access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsx":"^4.19.2","tsup":"^8.3.5","eslint":"^9.18.0","undici":"^7.2.0","vitest":"^2.1.8","prettier":"^3.4.2","typescript":"^5.7.3","@types/node":"^22.10.5","openapi-typescript":"^7.5.2","@typescript-eslint/parser":"^8.20.0","@typescript-eslint/eslint-plugin":"^8.20.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_2.0.0-beta.0_1777715274805_0.40297603844831875","host":"s3://npm-registry-packages-npm-production"}},"2.0.0-beta.1":{"name":"@apiframe-ai/sdk","version":"2.0.0-beta.1","keywords":["apiframe","ai","image-generation","video-generation","music-generation","midjourney","flux","kling","veo","sora","suno","sdk","api","client"],"author":{"url":"https://apiframe.ai","name":"Apiframe","email":"support@apiframe.ai"},"license":"MIT","_id":"@apiframe-ai/sdk@2.0.0-beta.1","maintainers":[{"name":"apiframe-ai","email":"renaud@apiframe.ai"}],"homepage":"https://github.com/apiframe-ai/apiframe-nodejs-sdk#readme","bugs":{"url":"https://github.com/apiframe-ai/apiframe-nodejs-sdk/issues"},"dist":{"shasum":"cb8a138b35d35cb4bf3a98f2963b7461384fd474","tarball":"https://registry.npmjs.org/@apiframe-ai/sdk/-/sdk-2.0.0-beta.1.tgz","fileCount":18,"integrity":"sha512-jLI8I6rBb2YyyZxhYfKCGJfFx4RjxpgBMEyuzfwbvXAD/WuZcWl8V/uql1j2FFzRt80jGJHLA8OAiQGowolu0A==","signatures":[{"sig":"MEUCIAsYyUGck6LuhH3uxluh/vKj3TZWBohTFqP4WK8ShOuKAiEA2Ime3LA5vuP3jypDT8Oqp76J7roMCT0bdgyFA+dJPzk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":891822},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./webhooks":{"types":"./dist/webhooks.d.ts","import":"./dist/webhooks.js","require":"./dist/webhooks.cjs"},"./package.json":"./package.json"},"gitHead":"9ac2df1b95f58b0fdee2d0b16e240acd73f271c3","scripts":{"dev":"tsup --watch","lint":"eslint src test","sync":"tsx scripts/sync-openapi.ts","test":"vitest run","build":"tsup","format":"prettier --write \"src/**/*.ts\" \"test/**/*.ts\"","prebuild":"rm -rf dist","test:types":"tsc --noEmit","test:watch":"vitest","prepublishOnly":"npm run build && npm run test"},"_npmUser":{"name":"apiframe-ai","email":"renaud@apiframe.ai"},"repository":{"url":"git+https://github.com/apiframe-ai/apiframe-nodejs-sdk.git","type":"git"},"_npmVersion":"11.11.1","description":"Official Node.js SDK for the Apiframe v2 API — unified image, video and music generation across 60+ AI models.","directories":{},"_nodeVersion":"23.6.0","publishConfig":{"tag":"next","access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsx":"^4.19.2","tsup":"^8.3.5","eslint":"^9.18.0","undici":"^7.2.0","vitest":"^2.1.8","prettier":"^3.4.2","typescript":"^5.7.3","@types/node":"^22.10.5","openapi-typescript":"^7.5.2","@typescript-eslint/parser":"^8.20.0","@typescript-eslint/eslint-plugin":"^8.20.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_2.0.0-beta.1_1777716943867_0.11632337466398246","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@apiframe-ai/sdk","version":"1.0.1","keywords":["apiframe","midjourney","flux","ideogram","luma","suno","udio","runway","kling","ai","image-generation","video-generation"],"author":{"name":"Apiframe"},"license":"MIT","_id":"@apiframe-ai/sdk@1.0.1","maintainers":[{"name":"apiframe-ai","email":"renaud@apiframe.ai"}],"homepage":"https://github.com/apiframe-ai/apiframe-nodejs-sdk#readme","bugs":{"url":"https://github.com/apiframe-ai/apiframe-nodejs-sdk/issues"},"dist":{"shasum":"ef0d5bb7a17f770030c910aa132afa138192c2f6","tarball":"https://registry.npmjs.org/@apiframe-ai/sdk/-/sdk-1.0.1.tgz","fileCount":35,"integrity":"sha512-w9gtqTKyh7OKkyzdtjIIrG9ZTQnQyXxB5yDtq8n78oBpgcj2twi1mhjLhahG3+X7jXy1KN3p75Z2XSBCMolzhA==","signatures":[{"sig":"MEYCIQD7iL1OxEnShPzGa4PAK88WWd2MA31X+0Efyeqg4VePWgIhAMVpZ3gnvlcz5ihnovuk3dGQHl/Yjz3RVfBsJ5vHiLGk","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":96182},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=14.0.0"},"scripts":{"lint":"eslint src --ext .ts","test":"jest","build":"tsc","prepare":"npm run build"},"_npmUser":{"name":"apiframe-ai","email":"renaud@apiframe.ai"},"repository":{"url":"git+https://github.com/apiframe-ai/apiframe-nodejs-sdk.git","type":"git"},"_npmVersion":"11.11.1","description":"Apiframe v1 SDK — AI image and video generation for the legacy Apiframe v1 API. The default `@apiframe-ai/sdk` install resolves to the new Apiframe v2 SDK.","directories":{},"_nodeVersion":"23.6.0","dependencies":{"axios":"^1.6.0","form-data":"^4.0.4"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","eslint":"^8.54.0","typescript":"^5.3.0","@types/node":"^20.10.0","@typescript-eslint/parser":"^6.13.0","@typescript-eslint/eslint-plugin":"^6.13.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.0.1_1777718678033_0.9773265640086897","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2025-10-10T10:45:24.802Z","modified":"2026-05-02T10:45:20.433Z","1.0.0":"2025-10-10T10:45:25.096Z","2.0.0-beta.0":"2026-05-02T09:47:54.980Z","2.0.0-beta.1":"2026-05-02T10:15:44.014Z","1.0.1":"2026-05-02T10:44:38.204Z"},"bugs":{"url":"https://github.com/apiframe-ai/apiframe-nodejs-sdk/issues"},"author":{"name":"Apiframe"},"license":"MIT","homepage":"https://github.com/apiframe-ai/apiframe-nodejs-sdk#readme","keywords":["apiframe","midjourney","flux","ideogram","luma","suno","udio","runway","kling","ai","image-generation","video-generation"],"repository":{"url":"git+https://github.com/apiframe-ai/apiframe-nodejs-sdk.git","type":"git"},"description":"Apiframe v1 SDK — AI image and video generation for the legacy Apiframe v1 API. The default `@apiframe-ai/sdk` install resolves to the new Apiframe v2 SDK.","maintainers":[{"name":"apiframe-ai","email":"renaud@apiframe.ai"}],"readme":"# Apiframe Node.js SDK\n\n> **Heads up — `@apiframe-ai/sdk` defaults to the Apiframe v2 SDK.**\n> The `1.x` line on this page is the SDK for the **Apiframe v1 API**\n> and continues to work as before for existing v1 customers. If you're\n> starting a new project, just install `@apiframe-ai/sdk` (you'll get\n> the v2 SDK):\n>\n> ```bash\n> npm install @apiframe-ai/sdk\n> ```\n>\n> v2 reference: [apiframe.ai/docs](https://apiframe.ai/docs).\n> v2 source: [`main` branch](https://github.com/apiframe-ai/apiframe-nodejs-sdk).\n> Need to stay on v1 explicitly? `npm install @apiframe-ai/sdk@1`.\n\nOfficial Node.js SDK for [Apiframe](https://apiframe.ai) - The ultimate platform for AI image and video generation APIs.\n\n[![npm version](https://badge.fury.io/js/%40apiframe-ai%2Fsdk.svg)](https://www.npmjs.com/package/@apiframe-ai/sdk)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n## Features\n\n- 🎨 **Midjourney API** (Original) - Generate, upscale, vary, blend, inpaint, face swap\n- 🚀 **Midjourney Pro API** - Fast & Turbo modes, better stability\n- ⚡ **Flux AI** - Fast and high-quality image generation\n- 🎭 **Ideogram** - Creative image generation with text rendering\n- 🎬 **Luma AI** - Text and image to video generation\n- 🎵 **Suno AI** - AI music generation\n- 🎶 **Udio AI** - Advanced music creation\n- 🎥 **Runway ML** - Gen-3 video generation\n- 🎪 **Kling AI** - Video generation and manipulation\n- 📸 **AI Photos** - Headshots, face swap, and photo enhancement\n- 📤 **Media Upload** - Upload and manage media files\n\n## Installation\n\n```bash\nnpm install @apiframe-ai/sdk\n```\n\n## Quick Start\n\n```javascript\nconst { Apiframe } = require('@apiframe-ai/sdk');\n\nconst client = new Apiframe({\n  apiKey: 'your_api_key_here'\n});\n\nasync function generateImage() {\n  // Create an image generation task\n  const task = await client.midjourney.imagine({\n    prompt: 'a serene mountain landscape at sunset, photorealistic',\n    aspect_ratio: '16:9'\n  });\n\n  console.log('Task created:', task.id);\n\n  // Wait for completion with progress updates\n  const result = await client.tasks.waitFor(task.id, {\n    onProgress: (p) => console.log('Progress:', p)\n  });\n\n  console.log('Images ready:', result.image_urls); // imagine returns 4 images\n}\n\ngenerateImage();\n```\n\n## TypeScript Support\n\nThe SDK is written in TypeScript and includes type definitions:\n\n```typescript\nimport { Apiframe, MidjourneyImagineParams, TaskResponse } from '@apiframe-ai/sdk';\n\nconst client = new Apiframe({\n  apiKey: 'your_api_key_here'\n});\n\nconst params: MidjourneyImagineParams = {\n  prompt: 'a beautiful sunset',\n  aspect_ratio: '16:9'\n};\n\nconst task: TaskResponse = await client.midjourney.imagine(params);\n```\n\n## API Reference\n\n### Configuration\n\n```javascript\nconst client = new Apiframe({\n  apiKey: 'your_api_key',      // Required: Your Apiframe API key\n  baseURL: 'https://api.apiframe.ai', // Optional: Custom API endpoint\n  timeout: 30000                // Optional: Request timeout in ms (default: 30000)\n});\n```\n\n### Midjourney (Original API)\n\nThe original Midjourney API with comprehensive features.\n**Endpoint:** `/imagine`, `/imagine-video`, `/reroll`, `/variations`, `/faceswap`, etc.\n**Docs:** [https://docs.apiframe.ai/api-endpoints](https://docs.apiframe.ai/api-endpoints)\n\n#### imagine(params)\nCreate a new image generation task.\n\n```javascript\nconst task = await client.midjourney.imagine({\n  prompt: 'a serene mountain landscape',\n  aspect_ratio: '16:9',  // Optional: '1:1', '16:9', '9:16', etc.\n  webhook_url: 'https://your-domain.com/webhook',    // Optional\n  webhook_secret: 'your-secret'                       // Optional\n});\n```\n\n#### imagineVideo(params)\nGenerate videos using a text prompt and an image URL.\n\n```javascript\nconst task = await client.midjourney.imagineVideo({\n  prompt: 'cinematic mountain landscape',\n  image_url: 'https://example.com/start-frame.jpg',\n  motion: 'high',  // Optional: 'low' or 'high' (default: low by default)\n  webhook_url: 'https://your-domain.com/webhook',    // Optional\n  webhook_secret: 'your-secret'                       // Optional\n});\n```\n\n#### reroll(params)\nReroll to create new images from a previous Imagine task.\n\n```javascript\nconst task = await client.midjourney.reroll({\n  parent_task_id: 'original_task_id',\n  prompt: 'optional new prompt',  // Optional: uses original prompt if not provided\n  webhook_url: 'https://your-domain.com/webhook',    // Optional\n  webhook_secret: 'your-secret'                       // Optional\n});\n```\n\n#### variations(params)\nCreate 4 new variations of one of the 4 generated images.\n\n```javascript\nconst task = await client.midjourney.variations({\n  parent_task_id: 'original_task_id',\n  index: '1',  // '1', '2', '3', '4', or 'strong', 'subtle'\n  webhook_url: 'https://your-domain.com/webhook',    // Optional\n  webhook_secret: 'your-secret'                       // Optional\n});\n```\n\n#### faceSwap(params)\nSwap the face on a target image with the face on a provided image.\n\n```javascript\nconst task = await client.midjourney.faceSwap({\n  target_image_url: 'https://example.com/target.jpg',\n  swap_image_url: 'https://example.com/face.jpg',\n  webhook_url: 'https://your-domain.com/webhook',    // Optional\n  webhook_secret: 'your-secret'                       // Optional\n});\n```\n\n#### upscale1x(params)\nUpscale one of the 4 generated images by the Imagine endpoint to get a single image.\n\n```javascript\nconst task = await client.midjourney.upscale1x({\n  parent_task_id: 'original_task_id',\n  index: '1',  // '1', '2', '3', or '4'\n  webhook_url: 'https://your-domain.com/webhook',    // Optional\n  webhook_secret: 'your-secret'                       // Optional\n});\n```\n\n#### upscaleAlt(params)\nUpscale with Subtle or Creative mode. Subtle doubles the size keeping details similar to original, Creative adds details to the image. You need to first upscale using `upscale1x`.\n\n```javascript\nconst task = await client.midjourney.upscaleAlt({\n  parent_task_id: 'upscale1x_task_id',\n  type: 'subtle',  // 'subtle' or 'creative'\n  webhook_url: 'https://your-domain.com/webhook',    // Optional\n  webhook_secret: 'your-secret'                       // Optional\n});\n```\n\n#### upscaleHighres(params)\nUpscale any image to higher resolution (2x or 4x) - not from Midjourney. Image must not be larger than 2048×2048.\n\n```javascript\nconst task = await client.midjourney.upscaleHighres({\n  parent_task_id: 'task_id',  // Or use image_url instead\n  image_url: 'https://example.com/image.jpg',  // Or use parent_task_id instead\n  type: '2x',  // '2x' or '4x'\n  index: '1',  // Optional: '1', '2', '3', or '4' - only if it's a 4 generated images task\n  webhook_url: 'https://your-domain.com/webhook',    // Optional\n  webhook_secret: 'your-secret'                       // Optional\n});\n```\n\n#### inpaint(params)\nRedraw a selected area of an image (Vary Region). You first need to upscale using `upscale1x`.\n\n```javascript\nconst task = await client.midjourney.inpaint({\n  parent_task_id: 'upscale1x_task_id',\n  mask: 'base64_encoded_mask_image',  // Base64 encoding of the selected area\n  prompt: 'a red sports car',\n  webhook_url: 'https://your-domain.com/webhook',    // Optional\n  webhook_secret: 'your-secret'                       // Optional\n});\n```\n\n#### outpaint(params)\nEnlarges an image's canvas beyond its original size while keeping the contents unchanged. You first need to upscale using `upscale1x`.\n\n```javascript\nconst task = await client.midjourney.outpaint({\n  parent_task_id: 'upscale1x_task_id',\n  zoom_ratio: 1.5,  // Can be 1.5, 2, or 1 for custom zoom\n  aspect_ratio: '1:1',  // Optional\n  prompt: 'mountain landscape',  // Optional: drawing prompt for new areas\n  webhook_url: 'https://your-domain.com/webhook',    // Optional\n  webhook_secret: 'your-secret'                       // Optional\n});\n```\n\n#### pan(params)\nBroadens the image canvas in a specific direction, keeping the original content intact. You first need to upscale using `upscale1x`.\n\n```javascript\nconst task = await client.midjourney.pan({\n  parent_task_id: 'upscale1x_task_id',\n  direction: 'up',  // 'up', 'down', 'left', or 'right'\n  webhook_url: 'https://your-domain.com/webhook',    // Optional\n  webhook_secret: 'your-secret'                       // Optional\n});\n```\n\n#### describe(params)\nWrites four example prompts based on an image you upload.\n\n```javascript\nconst task = await client.midjourney.describe({\n  image_url: 'https://example.com/image.jpg',\n  webhook_url: 'https://your-domain.com/webhook',    // Optional\n  webhook_secret: 'your-secret'                       // Optional\n});\n```\n\n#### blend(params)\nBlend multiple images into one image (2-5 images).\n\n```javascript\nconst task = await client.midjourney.blend({\n  image_urls: [\n    'https://example.com/image1.jpg',\n    'https://example.com/image2.jpg'\n  ],\n  dimension: 'square',  // Optional: 'square', 'portrait', or 'landscape' (default: square)\n  webhook_url: 'https://your-domain.com/webhook',    // Optional\n  webhook_secret: 'your-secret'                       // Optional\n});\n```\n\n#### shorten(params)\nAnalyzes your prompt and suggests optimizations by focusing on essential terms.\n\n```javascript\nconst task = await client.midjourney.shorten({\n  prompt: 'a very beautiful and amazing sunset over the mountains with clouds',\n  webhook_url: 'https://your-domain.com/webhook',    // Optional\n  webhook_secret: 'your-secret'                       // Optional\n});\n```\n\n#### seed(params)\nGet the seed of a generated image.\n\n```javascript\nconst task = await client.midjourney.seed({\n  task_id: 'original_task_id',\n  webhook_url: 'https://your-domain.com/webhook',    // Optional\n  webhook_secret: 'your-secret'                       // Optional\n});\n```\n\n#### Other Original Midjourney Methods\n- `upscale(params)` - Upscale a specific image (legacy method)\n- `vary(params)` - Create variations of a specific image (legacy method)\n- `zoom(params)` - Zoom out from an image (legacy method, use `outpaint` instead)\n\n**Note:** For task management (fetch, fetchMany) and account info, use the `client.tasks` methods instead (see Tasks section below).\n\n### Midjourney Pro API (MidjourneyAlt)\n\nThe Pro Midjourney API with Fast & Turbo modes for better performance.\n**Endpoint:** `/pro/midjourney/*`\n**Docs:** [https://docs.apiframe.ai/pro-midjourney-api/api-endpoints](https://docs.apiframe.ai/pro-midjourney-api/api-endpoints)\n\n#### imagine(params)\nCreate a new image with Pro API (supports Fast and Turbo modes).\n\n```javascript\nconst task = await client.midjourneyAlt.imagine({\n  prompt: 'a serene mountain landscape',\n  mode: 'turbo'    // 'fast' or 'turbo' (Pro exclusive)\n});\n```\n\n#### upscale(params)\nUpscale a specific image from a Pro API generation.\n\n```javascript\nconst task = await client.midjourneyAlt.upscale({\n  parent_task_id: 'parent_task_id',\n  index: '1',       // '1', '2', '3', or '4'\n  type: 'subtle'    // 'subtle' or 'creative'\n});\n```\n\n#### vary(params)\nCreate variations with strong/subtle control.\n\n```javascript\nconst task = await client.midjourneyAlt.vary({\n  parent_task_id: 'parent_task_id',\n  index: '1',          // '1', '2', '3', or '4'\n  type: 'subtle'       // 'subtle' or 'strong'\n});\n```\n\n#### variations(params)\nGenerate 4 variations of an image.\n\n```javascript\nconst task = await client.midjourneyAlt.variations({\n  parent_task_id: 'parent_task_id',\n  index: '1'           // '1', '2', '3', or '4'\n});\n```\n\n#### pan(params)\nPan in a specific direction.\n\n```javascript\nconst task = await client.midjourneyAlt.pan({\n  parent_task_id: 'parent_task_id',\n  index: '1',          // '1', '2', '3', or '4'\n  type: 'up'           // 'up', 'down', 'left', or 'right'\n});\n```\n\n#### zoom(params)\nZoom out from an image.\n\n```javascript\nconst task = await client.midjourneyAlt.zoom({\n  parent_task_id: 'parent_task_id',\n  index: '1',          // '1', '2', '3', or '4'\n  type: '2'            // '1.5' (1.5x), '2' (2x), '{1, 2}' (custom), '1' (make square)\n});\n```\n\n#### Other Pro API Methods\n- `getGeneration(generationId)` - Get generation info\n- `getAccountInfo()` - Get Pro API account info\n\n**Key Differences:**\n- ✨ Pro API uses `generationId` instead of `taskId`\n- ⚡ Pro API supports `mode: 'fast' | 'turbo'` for speed control\n- 🚀 Pro API has better stability and faster processing\n\n### Flux\n\n```javascript\n// Generate with Flux (specify model)\nconst task = await client.flux.generate({\n  model: 'flux-pro',  // 'flux-schnell', 'flux-pro', 'flux-dev', 'flux-pro-1.1', 'flux-pro-1.1-ultra'\n  prompt: 'a futuristic cityscape',\n  width: 1024,\n  height: 1024,\n  steps: 50,          // only for flux-pro and flux-dev\n  guidance: 7.5,      // only for flux-pro and flux-dev\n  seed: 42,\n  safety_tolerance: 2\n});\n\n// Convenience methods (automatically set model)\nconst task = await client.flux.generatePro({\n  prompt: 'a futuristic cityscape',\n  width: 1024,\n  height: 1024\n});\n\nconst task = await client.flux.generateDev({\n  prompt: 'a landscape',\n  aspect_ratio: '16:9'\n});\n\nconst task = await client.flux.generateSchnell({\n  prompt: 'quick sketch',\n  width: 512,\n  height: 512\n});\n\n// Image-to-image with Flux Pro 1.1 Ultra\nconst task = await client.flux.generate({\n  model: 'flux-pro-1.1-ultra',\n  prompt: 'enhance this image',\n  image_prompt: 'base64_encoded_image_here',\n  image_prompt_strength: 0.8,\n  raw: true\n});\n```\n\n### Ideogram\n\n```javascript\n// Generate image\nconst task = await client.ideogram.generate({\n  prompt: 'a logo design',\n  aspect_ratio: 'ASPECT_1_1',\n  style_type: 'DESIGN',\n  magic_prompt_option: 'AUTO',\n  seed: 12345,\n  resolution: 'RESOLUTION_1024_1024'\n});\n\n// Upscale image\nconst task = await client.ideogram.upscale({\n  image_url: 'https://...',\n  prompt: 'enhance this image',\n  resemblance: 80,  // 1-100\n  detail: 50,       // 1-100\n  seed: 12345\n});\n\n// Describe image\nconst task = await client.ideogram.describe({\n  image_url: 'https://...'\n});\n\n// Remix (image-to-image)\nconst task = await client.ideogram.remix({\n  image_url: 'https://...',\n  prompt: 'transform this image...',\n  image_weight: 70,  // 1-100\n  style_type: 'REALISTIC'\n});\n```\n\n### Luma AI (Video)\n\n```javascript\n// Generate video from text prompt\nconst task = await client.luma.generate({\n  prompt: 'a serene beach with waves',\n  aspect_ratio: '16:9',\n  loop: false,\n  enhance_prompt: true\n});\n\n// Generate video with start and end images\nconst task = await client.luma.generate({\n  prompt: 'a smooth transition',\n  image_url: 'https://start-image.jpg',\n  end_image_url: 'https://end-image.jpg',\n  aspect_ratio: '1:1'\n});\n\n// Extend a previously generated video\nconst task = await client.luma.extend({\n  parent_task_id: 'previous_task_id',\n  prompt: 'continue the scene with more action'\n});\n```\n\n### Suno AI (Music)\n\n```javascript\n// Generate song with lyrics (creates TWO songs)\nconst task = await client.suno.generate({\n  prompt: 'an upbeat electronic track',\n  lyrics: 'Verse 1: Dancing through the night...',\n  model: 'chirp-v3-5',\n  tags: 'electronic, dance, upbeat',\n  title: 'Digital Dreams',\n  make_instrumental: false\n});\n\n// Result will contain TWO songs with same lyrics\n// Use tasks.waitFor() or webhooks to get the result\nconst result = await client.tasks.waitFor(task.id);\n// result.songs will contain array of 2 songs\n\n// Upload audio and turn it into extendable song\nconst uploadTask = await client.suno.upload({\n  audio_url: 'https://your-audio-url.mp3'\n});\nconst uploadResult = await client.tasks.waitFor(uploadTask.id);\n// uploadResult will contain song_id\n\n// Extend a song\nconst extendTask = await client.suno.extend({\n  song_id: uploadResult.song_id,\n  continue_at: 30,\n  from_upload: true,\n  prompt: 'continue with more energy'\n});\n\n// Generate lyrics only\nconst lyricsTask = await client.suno.generateLyrics({\n  prompt: 'a song about summer adventures'\n});\nconst lyricsResult = await client.tasks.waitFor(lyricsTask.id);\n// lyricsResult.lyrics will contain generated lyrics\n```\n\n### Udio AI (Music)\n\n```javascript\n// Generate music (creates TWO songs with lyrics)\nconst task = await client.udio.generate({\n  prompt: 'a calm ambient soundtrack',\n  lyrics: 'Verse 1: Under the stars...',\n  model: 'udio32-v1.5',\n  tags: 'ambient, calm, instrumental',\n  prompt_strength: 0.8,\n  clarity_strength: 0.7,\n  lyrics_strength: 0.6,\n  generation_quality: 0.9,\n  lyrics_placement_start: 4,\n  lyrics_placement_end: 20,\n  bypass_prompt_optimization: false\n});\n\n// Result will contain TWO songs\n// Use tasks.waitFor() or webhooks to get the final result\nconst result = await client.tasks.waitFor(task.id);\n// result.songs will contain array of 2 songs with lyrics, audio_url, image_url\n```\n\n### Runway ML (Video)\n\n```javascript\n// Generate video (text2video, image2video, or video2video)\nconst task = await client.runway.generate({\n  prompt: 'a drone shot flying over mountains',\n  generation_type: 'text2video',\n  model: 'gen3',\n  aspect_ratio: '16:9',\n  duration: 10,\n  flip: false\n});\n\n// Convenience method: Text to video\nconst task = await client.runway.textToVideo(\n  'a drone shot flying over mountains',\n  { model: 'gen3a_turbo', duration: 5 }\n);\n\n// Convenience method: Image to video\nconst task = await client.runway.imageToVideo(\n  'https://image-url.jpg',\n  'add cinematic motion to this scene',\n  { duration: 10 }\n);\n\n// Convenience method: Video to video\nconst task = await client.runway.videoToVideo(\n  'https://video-url.mp4',\n  'transform this video with a sunset atmosphere',\n  { model: 'gen3', duration: 5 }\n);\n```\n\n### Kling AI (Video)\n\n```javascript\n// Generate video (text2video or image2video)\nconst task = await client.kling.generate({\n  prompt: 'a time-lapse of a flower blooming',\n  generation_type: 'text2video',\n  model: 'kling-v1-5',\n  mode: 'pro',\n  aspect_ratio: '16:9',\n  duration: 10,\n  cfg_scale: 0.5\n});\n\n// Convenience method: Text to video\nconst task = await client.kling.textToVideo(\n  'a time-lapse of a flower blooming',\n  { duration: 10, aspect_ratio: '16:9' }\n);\n\n// Convenience method: Image to video\nconst task = await client.kling.imageToVideo(\n  'https://image-url.jpg',\n  'animate this image with smooth motion',\n  { mode: 'pro', duration: 5 }\n);\n\n// Virtual Try On\nconst task = await client.kling.tryon({\n  human_image_url: 'https://person-image.jpg',\n  cloth_image_url: 'https://clothing-image.jpg',\n  model: 'kolors-virtual-try-on-v1-5'\n});\n```\n\n### AI Photos\n\n```javascript\n// Step 1: Upload and prepare 10-30 images for training\nconst uploadTask = await client.aiPhotos.upload({\n  images: ['base64_image_1', 'base64_image_2', '...'], // 10-30 images\n  ethnicity: 'white',\n  gender: 'male',\n  age: 30\n});\n\nconst uploadResult = await client.tasks.waitFor(uploadTask.id);\nconsole.log('Images ready for training');\n\n// Step 2: Train AI on the subject\nconst trainTask = await client.aiPhotos.train({\n  training_images_id: uploadTask.id,\n  trigger_word: 'TOKMSN' // Default trigger word\n});\n\nconst trainResult = await client.tasks.waitFor(trainTask.id);\nconsole.log('Training finished, trigger_word:', trainResult.trigger_word);\n\n// Step 3: Generate photos using the trained model\nconst generateTask = await client.aiPhotos.generate({\n  training_id: trainTask.id,\n  prompt: 'a realistic portrait of TOKMSN black man wearing a suit',\n  aspect_ratio: '1:1',\n  number_of_images: '4',\n  seed: 12345\n});\n\nconst result = await client.tasks.waitFor(generateTask.id);\nconsole.log('Generated photos:', result.image_urls);\n```\n\n### Media Upload\n\n```javascript\n// Upload image from file (max 2MB)\nconst upload = await client.media.upload({\n  filename: './path/to/image.jpg'\n});\n\nconsole.log('Uploaded:', upload.imageURL);\n\n// Upload audio from file (max 2MB, 60 seconds)\nconst audioUpload = await client.media.uploadAudio({\n  filename: './path/to/audio.mp3'\n});\n\nconsole.log('Uploaded audio:', audioUpload.audioURL);\n\n// Use uploaded media\nconst task = await client.midjourney.blend({\n  image_urls: [upload.imageURL, another_url]\n});\n```\n\n### Tasks\n\nGeneral task management endpoints.\n\n#### get(taskId)\nGet the result/status of a submitted task.\n\n```javascript\nconst task = await client.tasks.get(taskId);\nconsole.log(task.status); // 'pending', 'processing', 'completed', 'failed'\nconsole.log(task); // The data depends on the type of the original request\n```\n\n#### getMany(taskIds)\nGet the results/statuses of multiple tasks (min 2, max 20).\n\n```javascript\nconst result = await client.tasks.getMany(['task_id_1', 'task_id_2', 'task_id_3']);\nconsole.log(result.tasks); // Array of task results/statuses\n```\n\n#### waitFor(taskId, options)\nWait for a task to complete with progress tracking.\n\n```javascript\nconst result = await client.tasks.waitFor(taskId, {\n  onProgress: (progress) => {\n    console.log(`Progress: ${progress}%`);\n  },\n  interval: 3000,    // Polling interval in ms (default: 3000)\n  timeout: 300000    // Max wait time in ms (default: 300000 / 5 min)\n});\n```\n\n#### getAccountInfo()\nGet account details including credits, usage, plan, etc.\n\n```javascript\nconst account = await client.tasks.getAccountInfo();\nconsole.log(`Email: ${account.email}`);\nconsole.log(`Credits: ${account.credits}`);\nconsole.log(`Total Images: ${account.total_images}`);\nconsole.log(`Plan: ${account.plan}`);\n```\n\n## Error Handling\n\n```javascript\nconst { \n  ApiframeError, \n  AuthenticationError, \n  RateLimitError, \n  TimeoutError \n} = require('@apiframe-ai/sdk');\n\ntry {\n  const task = await client.midjourney.imagine({ prompt: '...' });\n  const result = await client.tasks.waitFor(task.id);\n} catch (error) {\n  if (error instanceof AuthenticationError) {\n    console.error('Invalid API key');\n  } else if (error instanceof RateLimitError) {\n    console.error('Rate limit exceeded');\n  } else if (error instanceof TimeoutError) {\n    console.error('Request timed out');\n  } else if (error instanceof ApiframeError) {\n    console.error('API error:', error.message);\n    console.error('Status:', error.status);\n  }\n}\n```\n\n## Environment Variables\n\nYou can set your API key using an environment variable:\n\n```bash\nexport APIFRAME_API_KEY=your_api_key_here\n```\n\nThen in your code:\n\n```javascript\nconst client = new Apiframe({\n  apiKey: process.env.APIFRAME_API_KEY\n});\n```\n\n## Examples\n\nCheck the `/examples` directory for complete examples:\n\n- `midjourney-example.js` - Midjourney Original API usage\n- `midjourney-alt-example.js` - Midjourney Pro API usage\n- `midjourney-comparison.js` - Compare both Midjourney APIs\n- `flux-example.js` - Flux AI image generation\n- `luma-video-example.js` - Luma video generation\n- `suno-music-example.js` - Suno music generation\n- `media-upload-example.js` - Media upload and usage\n- `comprehensive-example.js` - All features demo\n\n## Requirements\n\n- Node.js >= 14.0.0\n- An Apiframe API key (get one at [apiframe.ai](https://apiframe.ai))\n\n## Documentation\n\nFor detailed API documentation, visit [docs.apiframe.ai](https://docs.apiframe.ai)\n\n## Support\n\n- Documentation: [docs.apiframe.ai](https://docs.apiframe.ai)\n- GitHub Issues: [github.com/apiframe/apiframe-nodejs-sdk/issues](https://github.com/apiframe/apiframe-nodejs-sdk/issues)\n\n## License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n","readmeFilename":"README.md"}