{"_id":"@avataar.ai/varya","_rev":"4-1cdd1a1e87817c996bf20f5cac67e6f2","name":"@avataar.ai/varya","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.0":{"name":"@avataar.ai/varya","version":"0.1.0","keywords":["varya","video","generation","ai","text-to-video","api","sdk"],"license":"MIT","_id":"@avataar.ai/varya@0.1.0","maintainers":[{"name":"rakeshv_avataar","email":"rakeshv@avataar.ai"}],"homepage":"https://varya.avataar.ai","bugs":{"url":"https://github.com/SoulVisionCreations/varya-js/issues"},"bin":{"varya":"src/cli.js"},"dist":{"shasum":"338ef03237535cc3077a2f21b2c329d3b89db2e5","tarball":"https://registry.npmjs.org/@avataar.ai/varya/-/varya-0.1.0.tgz","fileCount":7,"integrity":"sha512-yeBaUYDKNWpnZOw29qU58W7TN5QrfxYQhl3PZxk0gXqW3JBzMt2eG8k229b0dd1m7NeGi/PSwKJ1o+kvcryFgg==","signatures":[{"sig":"MEQCIFs0hA/ynkO/XHF48ueFL4SBrWLD80uLd6o5Q5YsMzibAiBX9xPtXaX4bIuLEaAtN3iGc40vld1+iR82jmQbEi7lHw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":32079},"main":"./src/index.js","type":"module","types":"./index.d.ts","module":"./src/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./index.d.ts","import":"./src/index.js"}},"gitHead":"e4826f4c04a42072075ca1c185810fbb71b9457b","scripts":{"test":"node --test test/*.test.js"},"_npmUser":{"name":"rakeshv_avataar","email":"rakeshv@avataar.ai"},"repository":{"url":"git+https://github.com/SoulVisionCreations/varya-js.git","type":"git"},"_npmVersion":"10.9.2","description":"JavaScript/Node client for the Varya video generation API","directories":{},"_nodeVersion":"22.16.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/varya_0.1.0_1781709956694_0.545019165209842","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@avataar.ai/varya","version":"0.1.1","keywords":["varya","video","generation","ai","text-to-video","api","sdk"],"license":"MIT","_id":"@avataar.ai/varya@0.1.1","maintainers":[{"name":"rakeshv_avataar","email":"rakeshv@avataar.ai"}],"homepage":"https://varya.avataar.ai","bugs":{"url":"https://github.com/SoulVisionCreations/varya-js/issues"},"bin":{"varya":"src/cli.js"},"dist":{"shasum":"6ec47f03b11977ff82b93368176ab6737454ca4d","tarball":"https://registry.npmjs.org/@avataar.ai/varya/-/varya-0.1.1.tgz","fileCount":7,"integrity":"sha512-93ylSTaUrbg3/CeyzSFGufLDCc0JMjwGJ6e+gAKoSZiJlD64FTl7qaUywNn2MCnUxFHRumLCgNX+tSFliWNt7Q==","signatures":[{"sig":"MEYCIQDq71oLXac7h4fTXy13mvYWPk2ztvNLt4ii3ikTk6pfUQIhAMaTi22aQYNOa6zV/4qjcFESqiAfxkQUfAD8soFZzKpt","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":32103},"main":"./src/index.js","type":"module","types":"./index.d.ts","module":"./src/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./index.d.ts","import":"./src/index.js"}},"gitHead":"e4826f4c04a42072075ca1c185810fbb71b9457b","scripts":{"test":"node --test test/*.test.js"},"_npmUser":{"name":"rakeshv_avataar","email":"rakeshv@avataar.ai"},"repository":{"url":"git+https://github.com/SoulVisionCreations/varya-js.git","type":"git"},"_npmVersion":"10.9.2","description":"JavaScript/Node client for the Varya video generation API","directories":{},"_nodeVersion":"22.16.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/varya_0.1.1_1781710172413_0.3233615668101699","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@avataar.ai/varya","version":"0.1.2","keywords":["varya","video","generation","ai","text-to-video","api","sdk"],"license":"MIT","_id":"@avataar.ai/varya@0.1.2","maintainers":[{"name":"rakeshv_avataar","email":"rakeshv@avataar.ai"}],"homepage":"https://varya.avataar.ai","bugs":{"url":"https://github.com/SoulVisionCreations/varya-js/issues"},"bin":{"varya":"src/cli.js"},"dist":{"shasum":"2ff39e2bb743878d7b61ffa7000e8812da199c1b","tarball":"https://registry.npmjs.org/@avataar.ai/varya/-/varya-0.1.2.tgz","fileCount":7,"integrity":"sha512-DSwhGlFgdoxVwkM1SrQqTqv5WYpyJhOT9NPM1IMwO7KlF8vG4spFCtYPH4tgg4RR4tYPhpV8lcxNit9A0eiPFg==","signatures":[{"sig":"MEUCIG96gOLoZB9K0qxXCyZ1xSBMw50xSUgVTnazMOaK+DsqAiEAu5EnwCkOZRVIYoj9ew0X47OMTgv/CC8sbrToq9TaH8Q=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31414},"main":"./src/index.js","type":"module","types":"./index.d.ts","module":"./src/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./index.d.ts","import":"./src/index.js"}},"gitHead":"a841767cc2dd9b08ee0096d35bb1afcb853ecf89","scripts":{"test":"node --test test/*.test.js"},"_npmUser":{"name":"rakeshv_avataar","email":"rakeshv@avataar.ai"},"repository":{"url":"git+https://github.com/SoulVisionCreations/varya-js.git","type":"git"},"_npmVersion":"10.9.2","description":"JavaScript/Node client for the Varya video generation API","directories":{},"_nodeVersion":"22.16.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/varya_0.1.2_1781717235990_0.33668747782081265","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@avataar.ai/varya","version":"0.1.3","description":"JavaScript/Node client for the Varya video generation API","type":"module","main":"./src/index.js","module":"./src/index.js","types":"./index.d.ts","exports":{".":{"types":"./index.d.ts","import":"./src/index.js"}},"bin":{"varya":"src/cli.js"},"engines":{"node":">=18"},"publishConfig":{"access":"public"},"scripts":{"test":"node --test test/*.test.js"},"keywords":["varya","video","generation","ai","text-to-video","api","sdk"],"license":"MIT","homepage":"https://varya.avataar.ai","repository":{"type":"git","url":"git+https://github.com/SoulVisionCreations/varya-js.git"},"_id":"@avataar.ai/varya@0.1.3","gitHead":"43c805c57afd7c75bf52f86164cff447191b33e2","bugs":{"url":"https://github.com/SoulVisionCreations/varya-js/issues"},"_nodeVersion":"22.16.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-jypQ5DgH+siM3BUKhZ/mnvWCrxcGMohVT2ZIXJVkMksw7H/P+A7k0slmbUYX54xej8roeh4FmhHJCApx8YHEvQ==","shasum":"141633c15e9306acfa195c7a40dd4274128a582b","tarball":"https://registry.npmjs.org/@avataar.ai/varya/-/varya-0.1.3.tgz","fileCount":7,"unpackedSize":32712,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAlqR0pB46m9J7WVWBZhK73lk8ti9oBJQlx77peHPJbeAiEA0kNgJvPJY+/kQXk/s4AeaMZr1RH37ppfLWW6Zo3EprU="}]},"_npmUser":{"name":"rakeshv_avataar","email":"rakeshv@avataar.ai"},"directories":{},"maintainers":[{"name":"rakeshv_avataar","email":"rakeshv@avataar.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/varya_0.1.3_1783667684935_0.8276650983342768"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-17T15:25:56.493Z","modified":"2026-07-10T07:14:45.212Z","0.1.0":"2026-06-17T15:25:56.856Z","0.1.1":"2026-06-17T15:29:32.556Z","0.1.2":"2026-06-17T17:27:16.150Z","0.1.3":"2026-07-10T07:14:45.074Z"},"bugs":{"url":"https://github.com/SoulVisionCreations/varya-js/issues"},"license":"MIT","homepage":"https://varya.avataar.ai","keywords":["varya","video","generation","ai","text-to-video","api","sdk"],"repository":{"type":"git","url":"git+https://github.com/SoulVisionCreations/varya-js.git"},"description":"JavaScript/Node client for the Varya video generation API","maintainers":[{"name":"rakeshv_avataar","email":"rakeshv@avataar.ai"}],"readme":"# @avataar.ai/varya (JavaScript / Node)\n\nJavaScript/Node client for the **Varya** video generation API. Submit a text\n(or image) prompt; the client handles the async job lifecycle — submit, poll,\nand download.\n\n**Zero runtime dependencies** — uses the built-in `fetch` and `FormData`\n(Node 18+, modern browsers, and edge runtimes).\n\n## Install\n\n```bash\nnpm install @avataar.ai/varya\n```\n\nLocal development (from this folder):\n\n```bash\nnpm link\n```\n\n## Authentication\n\nCreate a key in the Varya web app (**Account menu → API key**). It looks like\n`sk_live_…`. Keep it secret; it draws down your account's credit balance.\n\n```bash\nexport VARYA_API_KEY=sk_live_xxxxx\n```\n\n## Quick start\n\n```js\nimport { VaryaClient } from '@avataar.ai/varya';\n\nconst client = new VaryaClient({ apiKey: process.env.VARYA_API_KEY });\n\nconst result = await client.generateVideo('A snow leopard prowling the Himalayan slopes at dawn', {\n  resolution: '480p',   // '480p' | '720p'\n  duration: 5,        // seconds, 1–5\n  style: 'none',        // 'none' | 'cinematic' | 'anime' | …\n  aspectRatio: '16:9',  // '4:3' | '3:4' | '16:9' (default) | '9:16'\n  onStatus: (s) => console.log(s),\n});\n\nconsole.log(result.video_url);\n```\n\n> For a full end-to-end walkthrough (text-to-video **and** image-to-video,\n> saving the output, error handling), see **[USAGE.md](./USAGE.md)**.\n\nDownload in Node:\n\n```js\nimport { writeFile } from 'node:fs/promises';\nconst bytes = await client.fetchVideo(result.video_url);\nawait writeFile('out.mp4', Buffer.from(bytes));\n```\n\nImage-to-video — just pass a local `imagePath`; the client reads the file and\nderives the filename + content-type for you:\n\n```js\nawait client.generateVideo('make it move', { imagePath: 'ref.png' });\n```\n\n> In a browser (no filesystem) pass a `Blob`/`File` instead via `image`, and\n> `imageFilename` to name a bare `Blob`.\n\n## CLI\n\nInstalling the package provides a `varya` command:\n\n```bash\n# create a new video and download it\nvarya \"a cat surfing a wave\" --resolution 720p --output out.mp4\n\n# resume / fetch an existing generation (no prompt, nothing re-charged)\nvarya --get gen_xxxxxxxx --output out.mp4\n\nvarya --help\n```\n\nThe key comes from `--key` or `$VARYA_API_KEY`; the base URL from `--base-url`\nor `$VARYA_BASE_URL`.\n\n## API\n\n### `new VaryaClient({ apiKey, baseUrl?, authScheme?, timeoutMs? })`\n\n\n| Method                         | Description                                                                                           |\n| ------------------------------ | ----------------------------------------------------------------------------------------------------- |\n| `generateVideo(prompt, opts?)` | Submit **and** wait. Resolves to the final result. The 90% path.                                      |\n| `submit(prompt, opts?)`        | `POST /api/generations`; resolves to `{ generation_id, status, credits_charged, … }` without waiting. |\n| `status(generationId)`         | `GET /generations/{id}`; current status/result.                                                       |\n| `wait(generationId, opts?)`    | Poll until `completed`/`failed`.                                                                      |\n| `fetchVideo(url)`              | Fetch a finished video as an `ArrayBuffer`.                                                           |\n\n\n**Generation options** (`generateVideo` / `submit`): `resolution`\n(`'480p'` / `'720p'`), `duration` (1–5), `style`, `aspectRatio`\n(`'4:3'` / `'3:4'` / `'16:9'` / `'9:16'`, default `'16:9'`), `seed`, `enhance`, and for\nimage-to-video `imagePath` (a local file path, Node) or `image` (`Blob`/`File`,\nbrowser) with optional `imageFilename`. Plus polling options `pollIntervalMs`,\n`timeoutMs`, `onStatus`.\n\n> Single-clip only: the client targets the streamlined `POST /api/generations`\n> endpoint, so there is no compare / long-form / continuation mode and `fps` is\n> fixed server-side. `duration` must be 1–5 (out-of-range throws\n> `LONG_FORM_NOT_SUPPORTED` before any request is sent). The output is always\n> watermarked.\n\n### Result shape\n\n- **completed**: `{ status: 'completed', video_url: '…' }`\n- **failed**: `{ status: 'failed', error: '…', error_code: '…' }`\n\n### Errors\n\nAPI/business failures reject with `VaryaError` (`.code`, `.status`):\n\n```js\nimport { VaryaError } from '@avataar.ai/varya';\n\ntry {\n  await client.generateVideo('…');\n} catch (err) {\n  if (err instanceof VaryaError && err.code === 'INSUFFICIENT_CREDITS') {\n    // prompt the user to top up\n  } else {\n    throw err;\n  }\n}\n```\n\nTypeScript types ship in `index.d.ts`.\n\n## Notes\n\n- **Seed.** A `seed` is always sent. When you don't pass one it's randomized\nclient-side (in `[100, 1_000_000)`, matching the web app) and returned on the\nresult as `seed`, so you can reproduce a run by passing that same `seed` back.\n- **Async by design.** Jobs are queued; the client polls every ~2s — raise\n`timeoutMs` if a job needs longer.\n- **Resilient polling.** Idempotent `GET`s are retried with backoff and\ntransient network blips don't abort a run. `POST /api/generations` is retried\nonly on connection-phase errors (e.g. connect timeout), where the request\nnever reached the server — so a job is never double-charged. Note: Node's\nbuilt-in `fetch` also enforces its own ~10s connect timeout; the retries\nrecover from a stalled connect.\n- **Auth header.** Defaults to `X-API-Key`. If your deployment expects\n`Authorization: Bearer`, pass `authScheme: 'bearer'`.\n- **Cost.** 1 credit (480p) / 2 (720p). The exact charge is returned as\n`credits_charged`.\n\n## Development\n\n```bash\nnpm test     # runs node --test (no network; fetch is stubbed)\n```\n\n## License\n\nMIT","readmeFilename":"README.md"}