[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-111345":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":13,"contributorsCount":13,"subscribersCount":13,"size":13,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":13,"forks30d":13,"starsTrendScore":18,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":10,"pushedAt":35,"updatedAt":36,"readmeContent":37,"aiSummary":38,"trendingCount":13,"starSnapshotCount":13,"syncStatus":39,"lastSyncTime":40,"discoverSource":41},111345,"revana-js","Aribk7\u002Frevana-js","Aribk7","Official JavaScript\u002FTypeScript SDK and CLI for Revana: one API key for Seedance, Veo, Kling, Nano Banana and 200+ AI video, image and chat models","https:\u002F\u002Frevana.si",null,"TypeScript",128,0,51,4,49,71,29,75.1,"MIT License",false,"main",true,[25,26,27,28,29,30,31,32,33,34],"ai-video","image-generation","kling","nano-banana","revana","sdk","seedance","text-to-video","typescript","veo","2026-11-23 03:33:43","2026-11-23 19:20:36","# Revana for JavaScript and TypeScript\n\nThe official Node.js \u002F TypeScript SDK and CLI for [Revana](https:\u002F\u002Frevana.si): one API key for 200+ AI image, video, music and chat models, including Seedance 2.5, Veo 3.1, Kling, Hailuo, Wan, Nano Banana Pro, GPT Image and Flux.\n\nEach request goes to the cheapest working provider first and falls back automatically when one fails. You're charged once for the result, and failed generations cost $0. Prices for every model are listed at [revana.si\u002Fpricing](https:\u002F\u002Frevana.si\u002Fpricing).\n\n```bash\nnpm install revana\n```\n\nCreate a key at [revana.si\u002Fdashboard](https:\u002F\u002Frevana.si\u002Fdashboard), then:\n\n```bash\nexport REVANA_API_KEY=sr_live_...\n```\n\n## Generate a video\n\n```ts\nimport Revana from \"revana\";\n\nconst revana = new Revana(); \u002F\u002F reads REVANA_API_KEY\n\nconst video = await revana.generate({\n  model: \"seedance-2.5\",\n  input: { prompt: \"a corgi surfing a wave at sunset, cinematic\", duration: 5, resolution: \"720p\", aspect_ratio: \"16:9\" },\n  max_cost_usd: 2, \u002F\u002F never charge more than this\n});\n\nconsole.log(video.output?.urls[0], `$${video.cost_usd}`);\n```\n\n`generate()` submits the job and polls until it finishes. If you'd rather manage the polling yourself, use `generations.create()` and then `generations.wait(id)`.\n\n## Price it first\n\n```ts\nimport { EndpointNotAvailableError } from \"revana\";\n\nconst body = { model: \"seedance-2.5\", input: { prompt: \"a corgi surfing at sunset\", duration: 5, resolution: \"720p\" } };\nconst quote = await revana.generations.quote(body); \u002F\u002F free: nothing is created or held\nconsole.log(`$${quote.quoted_usd}`, quote.enough_credit);\nconst clip = await revana.generate({ ...body, max_cost_usd: quote.quoted_usd });\n```\n\n`generations.quote()` prices the exact request the way the create will, including what a start image adds on some models, which `models.list()` does not show. **It requires an API version deployed after 2026-10-31**; an older server throws `EndpointNotAvailableError` (a `RevanaError` with status 404 and code `endpoint_not_available`), and then you price from `models.list()`.\n\n## Generate an image\n\n```ts\nconst image = await revana.generate({\n  model: \"nano-banana-pro\",\n  input: { prompt: \"a product photo of a matte black water bottle on marble\", resolution: \"2K\" },\n  max_cost_usd: 0.5,\n});\n```\n\n## Image to video, from a local file\n\n```ts\nimport { readFile } from \"node:fs\u002Fpromises\";\n\nconst upload = await revana.uploads.upload(await readFile(\"product.png\"), \"image\u002Fpng\", \"product.png\");\n\nconst clip = await revana.generate({\n  model: \"seedance-2.5\",\n  input: { prompt: \"slow orbit around the product\", image_url: upload.url, duration: 5 },\n  max_cost_usd: 2,\n});\n\nconst bytes = await revana.generations.download(clip.id);\n```\n\nUploads are free, and the returned URL works for 14 days.\n\n## Models and prices\n\n```ts\nconst models = await revana.models.list();\nfor (const m of models) console.log(m.id, m.kind, m.price);\n```\n\nNo key is needed. When the client has one, it is sent, so the prices are your account's own price book.\n\n## Your generations\n\n```ts\nconst page = await revana.generations.list({ limit: 20, status: \"succeeded\" }); \u002F\u002F one page, newest first\nfor await (const g of revana.generations.listAll({ model: \"seedance-2.5\" })) console.log(g.id, g.cost_usd);\n```\n\n`list()` answers `{ data, has_more, next_before }`; pass `next_before` as `before` for the next page, or let `listAll()` do it. **It requires an API version deployed after 2026-10-31**; an older server throws `EndpointNotAvailableError`.\n\n## Chat (OpenAI-compatible)\n\n```ts\nconst res = await revana.chat.completions.create({\n  model: \"gpt-5-mini\",\n  messages: [{ role: \"user\", content: \"Write a 10-word ad hook for a water bottle\" }],\n});\n```\n\nStreamed, as server-sent events:\n\n```ts\nconst stream = await revana.chat.completions.create({ model: \"gpt-5-mini\", messages, stream: true });\nfor await (const chunk of stream) process.stdout.write(chunk.choices[0]?.delta?.content ?? \"\");\n```\n\n`chat.completions.stream(body)` does the same. The client's `timeoutMs` covers the wait for the stream to start, not the whole answer; pass a `signal` to bound that. Chat is billed per token and is never retried automatically.\n\nThe endpoint is OpenAI-compatible, so the `openai` package also works with `baseURL: \"https:\u002F\u002Fapi.revana.si\u002Fv1\"`. Run `npx revana models` to see the available chat model ids.\n\n## Errors\n\n```ts\nimport { RevanaError, GenerationFailedError, WaitTimeoutError } from \"revana\";\n\ntry {\n  await revana.generate({ model: \"seedance-2.5\", input: { prompt: \"...\" }, max_cost_usd: 2 });\n} catch (err) {\n  if (err instanceof GenerationFailedError) {\n    \u002F\u002F Nothing was charged. err.retryable says whether the same request may work later.\n  } else if (err instanceof RevanaError) {\n    \u002F\u002F err.status \u002F err.code, e.g. 402 insufficient_credits, 422 invalid_input, 403 card_required.\n    \u002F\u002F err.requestId: quote it when asking for help. err.retryAfter: seconds, on 429 and 503. err.headers: all of them.\n    \u002F\u002F Network failures come back as status 0, code \"network_error\" or \"timeout\".\n  } else if (err instanceof WaitTimeoutError) {\n    \u002F\u002F Still running: wait again later with revana.generations.wait(err.generation.id).\n  }\n}\n```\n\n`requestId` and `Retry-After` are sent by API versions deployed after 2026-10-31; on an older server they are `undefined` (the legacy `{error, code}` shape is read too).\n\n### Retrying\n\n- 429 and 5xx responses and network errors are retried with backoff, never sooner than the answer's `Retry-After`. A `Retry-After` longer than `maxRetryAfterS` (60 s), or a 429 `concurrency_limit` without one, is thrown to you instead: a slot frees only when one of your generations finishes.\n- A POST is retried only when it carries an idempotency key. `generations.create()` and `generate()` make one per call and reuse it on those retries, so they return the generation already started instead of charging twice. To resend a create yourself after a timeout, pass the same `idempotencyKey`.\n- After a generation has **failed** (`GenerationFailedError`), call again **without** the old key: the old key keeps answering the failed generation. Each `generate()` call makes a new key.\n\n## CLI\n\n```bash\nnpx revana models seedance\nnpx revana generate seedance-2.5 \"a corgi surfing at sunset\" --duration 5 --resolution 720p --max-cost 2 -o corgi.mp4\nnpx revana generate seedance-2.5 \"slow orbit\" --image .\u002Fproduct.png -o orbit.mp4   # local files are uploaded\nnpx revana generate nano-banana-pro \"matte black bottle on marble\" -o bottle.png\nnpx revana quote seedance-2.5 \"slow orbit\" --image .\u002Fproduct.png --duration 5   # free\nnpx revana list --status succeeded --limit 10\nnpx revana balance\n```\n\n`quote` and `list` require an API version deployed after 2026-10-31. `download` names files by the model's kind (`.png`, `.mp3`, `.mp4`).\n\nRun `npx revana --help` for every option.\n\n## Options\n\n```ts\nnew Revana({\n  apiKey: \"sr_live_...\",          \u002F\u002F default: REVANA_API_KEY\n  baseURL: \"https:\u002F\u002Fapi.revana.si\", \u002F\u002F default: REVANA_BASE_URL or this\n  maxRetries: 3,\n  timeoutMs: 60_000,               \u002F\u002F per request; for downloads and chat streams, the wait for the answer only\n  maxRetryAfterS: 60,              \u002F\u002F a longer Retry-After is thrown, not waited out\n  fetch,                           \u002F\u002F bring your own fetch\n});\n```\n\nThe SDK needs Node 18.17+, and works in Bun, Deno and edge runtimes that have `fetch`. It ships ESM, CommonJS and TypeScript types.\n\n## Links\n\n- Docs: https:\u002F\u002Frevana.si\u002Fdocs\n- API reference (OpenAPI): https:\u002F\u002Frevana.si\u002Fopenapi.json\n- Prices: https:\u002F\u002Frevana.si\u002Fpricing\n- MCP server for Claude, Cursor and ChatGPT: https:\u002F\u002Frevana.si\u002Fmcp\n- Python SDK: `pip install revana`\n\nMIT licensed.\n","Revana JS 是一个面向 AI 多模态生成服务的官方 TypeScript SDK 与 CLI 工具，统一接入 Seedance、Veo、Kling、Nano Banana 等 200+ 图像、视频、音频及对话模型。其核心特性包括：单 API Key 全模型调用、自动按成本最优路由与故障降级、请求前精准报价（quote）、异步任务管理及文件上传支持；所有失败请求零计费，费用按实际成功结果结算。适用于需要快速集成多供应商 AI 生成能力、关注成本可控性与服务稳定性的开发者和 SaaS 应用场景。",2,"2026-11-24 04:40:53","CREATED_QUERY"]