{"_id":"@cogito.ai/minimax","name":"@cogito.ai/minimax","dist-tags":{"latest":"0.2.0"},"versions":{"0.2.0":{"name":"@cogito.ai/minimax","version":"0.2.0","type":"module","description":"Typed, testable MiniMax media-generation client (image / music / video) with byte-only outputs and a duck-typed error classifier","publishConfig":{"access":"public"},"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"engines":{"node":">=18"},"dependencies":{"mmx-cli":"1.0.22"},"devDependencies":{"@types/node":"^22.0.0","typescript":"5.9.2","vitest":"^4.1.8","@cogito.ai/tsconfig":"0.3.0"},"scripts":{"build":"tsc -p tsconfig.build.json","dev":"tsc -p tsconfig.build.json --watch","check-types":"tsc --noEmit","test":"vitest run"},"_id":"@cogito.ai/minimax@0.2.0","_integrity":"sha512-VpSyeQ/SdiCcJ9Hy6Us5hM3YxoXAitzgnvIg82Cj5/0svmid8ekV3OMS6xtc9+83fjQmIeitELSpT4YwrCIF7Q==","_resolved":"/tmp/a898a6cda7ee74444686ab643e2e5892/cogito.ai-minimax-0.2.0.tgz","_from":"file:cogito.ai-minimax-0.2.0.tgz","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-VpSyeQ/SdiCcJ9Hy6Us5hM3YxoXAitzgnvIg82Cj5/0svmid8ekV3OMS6xtc9+83fjQmIeitELSpT4YwrCIF7Q==","shasum":"5e4804a07dde4dbb6e93efdfed2d84ee46ffc814","tarball":"https://registry.npmjs.org/@cogito.ai/minimax/-/minimax-0.2.0.tgz","fileCount":35,"unpackedSize":55630,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHTuS7kLqXX5PBwNWVfbA9lpZMdpbmmrQ1xM8V+6pE1TAiBZr1EhtGzd7g4cdN5hTgyW5ms/tHJQ3fKJmpImCfFnYg=="}]},"_npmUser":{"name":"sunnyfu","email":"fujia.site@outlook.com"},"directories":{},"maintainers":[{"name":"sunnyfu","email":"fujia.site@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/minimax_0.2.0_1787367250824_0.5829198256340253"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-22T02:54:10.706Z","0.2.0":"2026-08-22T02:54:10.967Z","modified":"2026-08-22T02:54:11.152Z"},"maintainers":[{"name":"sunnyfu","email":"fujia.site@outlook.com"}],"description":"Typed, testable MiniMax media-generation client (image / music / video) with byte-only outputs and a duck-typed error classifier","readme":"# @cogito.ai/minimax\n\nA typed, testable wrapper around MiniMax's media-generation capabilities\n(image, music, video), built on top of `mmx-cli`'s undocumented SDK export\n(`mmx-cli/sdk`).\n\n## Why this exists\n\n`mmx-cli` (`github.com/MiniMax-AI/cli`) is the only MiniMax SDK on npm, but:\n\n- It has no README and no doc comments on its public surface.\n- Its capability set is **not stable across patch releases** — `music` was\n  removed from the SDK between `1.0.19` and `1.0.21` without a major\n  version bump, even though MiniMax's `music_generation` HTTP endpoint is\n  still live.\n- Its media-generation methods hand back MiniMax's own CDN URLs, which\n  expire quickly (image/music: 24h; video: as little as 1h).\n\nThis package wraps `mmx-cli/sdk` behind a narrow, hand-declared interface\n(`MinimaxClient`) instead of trusting the SDK's own types as a contract, so\nthat a future capability removal fails loudly at `tsc` time instead of\nsilently at runtime — see `src/client.ts`'s doc comment and\n`src/client.test.ts`'s type-level sentinel test. Every generation function\ndownloads or decodes bytes itself and returns a `Buffer`; none of them ever\nhand a MiniMax URL back to the caller.\n\n`mmx-cli` is pinned to an **exact** version (no `^`) for the reason above.\n\n## API\n\n- `createMinimaxClient(opts)` — wraps `new MiniMaxSDK(...)` for image,\n  video, file, and quota calls.\n- `generateImage(client, params)` — always requests `response_format:\n  \"base64\"`; returns one `GeneratedAsset` per candidate, with content-type\n  sniffed from the bytes' magic numbers (MiniMax's API has no output-format\n  parameter).\n- `createMinimaxMusicClient(opts)` / `generateMusic(client, params)` — music\n  generation bypasses `mmx-cli/sdk` entirely (removed as of `1.0.21`) and\n  calls MiniMax's `music_generation` endpoint directly. Always forces\n  `is_instrumental: true` — this package has no `lyrics` parameter, and\n  MiniMax's API requires one of `lyrics` / `is_instrumental` /\n  `lyrics_optimizer`.\n- `generateVideoScarce(client, params, options?)` — named for its scarcity:\n  MiniMax caps video at **3 requests/day** and excludes it from the Token\n  Plan. This function **never retries automatically** on any failure\n  (generation, polling, or download). It polls `video.getTask` until the\n  task leaves `Queueing`/`Processing`, then downloads the result to a\n  `Buffer` immediately after resolving a short-lived `download_url`.\n- `classifyError(err)` — duck-types `.exitCode` (mirroring `mmx-cli`'s own\n  unexported `ExitCode` enum) into a stable category string. Works for\n  errors from both the SDK-backed and the raw-HTTP-backed (`music`) paths.\n- `getQuota(client)` / `isQuotaExhausted(quota, modelName)` /\n  `msUntilReset(quota, modelName)` — quota helpers for deciding whether to\n  wait out a rate limit instead of guessing.\n\n## Configuration\n\nThis package never reads environment variables. Every function takes its\nconfiguration (API key, base URL) as an explicit argument, injected by the\ncaller.\n","readmeFilename":"README.md","_rev":"1-0b15e9be835471d743383f3b86f7c6aa"}