{"_id":"@ai-mage/sdk","_rev":"3-8b7f35b7a85e1a93eb36fde0d60ddf45","name":"@ai-mage/sdk","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"@ai-mage/sdk","version":"0.1.0","keywords":["ai-mage","anime","video-search","sdk"],"license":"MIT","_id":"@ai-mage/sdk@0.1.0","maintainers":[{"name":"pseudoyu","email":"pseudoyu@connect.hku.hk"}],"homepage":"https://api.search.ai-mage.jp/docs","bugs":{"url":"https://github.com/aimagexyz/aimage-monorepo/issues"},"dist":{"shasum":"265fe38399d0820ba672e0d59c3d00487535864e","tarball":"https://registry.npmjs.org/@ai-mage/sdk/-/sdk-0.1.0.tgz","fileCount":8,"integrity":"sha512-CjXgjxpmr415rGyAUHlvmGHh1hP6QkiVsyU98dTAHLj2ydl0v08Ax6079lMCWW5HpGdi3Cpcqxv2Ju15Mv91dg==","signatures":[{"sig":"MEQCIC/y9p1Y1a91ajB5jbhOndSOEqdHsnzMvAOjpFEoyGdsAiAgIeB5YmZgTuTnypmmKAbdagQwJsll7pJ0ie+A/GLrqg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16530},"main":"./dist/index.js","type":"module","_from":"file:ai-mage-sdk-0.1.0.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"test":"vitest run","build":"tsup && tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"pseudoyu","email":"pseudoyu@connect.hku.hk"},"_resolved":"/tmp/a903f56971d1951427af97dafa78cc8a/ai-mage-sdk-0.1.0.tgz","_integrity":"sha512-CjXgjxpmr415rGyAUHlvmGHh1hP6QkiVsyU98dTAHLj2ydl0v08Ax6079lMCWW5HpGdi3Cpcqxv2Ju15Mv91dg==","repository":{"url":"git+https://github.com/aimagexyz/aimage-monorepo.git","type":"git","directory":"packages/sdk"},"_npmVersion":"10.9.8","description":"TypeScript SDK for the AI-Mage Search public API","directories":{},"_nodeVersion":"22.22.3","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"zod":"4.4.3","tsup":"8.5.1","vitest":"4.1.6","typescript":"6.0.3","@types/node":"25.8.0","@aimage/api-contract":"0.0.0","@aimage/typescript-config":"0.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.0_1781200394146_0.2206033208438829","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@ai-mage/sdk","version":"0.1.1","keywords":["ai-mage","anime","video-search","sdk"],"license":"MIT","_id":"@ai-mage/sdk@0.1.1","maintainers":[{"name":"pseudoyu","email":"pseudoyu@connect.hku.hk"}],"homepage":"https://api.search.ai-mage.jp/docs","bugs":{"url":"https://github.com/aimagexyz/aimage-monorepo/issues"},"dist":{"shasum":"295f6719dccee9e28c3b756668a38b88b4dad932","tarball":"https://registry.npmjs.org/@ai-mage/sdk/-/sdk-0.1.1.tgz","fileCount":8,"integrity":"sha512-/Yru/hVJd6o5J6UH9K489oIgYy0b9Ot6QmjP27wqP/X3apKmG1R77QRpUdWE9zEUOsKQIXaIPiveZpUrDmTt9A==","signatures":[{"sig":"MEYCIQCFXQMnjJfK0g65ux4qZyGz44mBmnpZyawndvWE/UPJiwIhAKBH6UJNxxNYLF/5EMQHTZS1bcioKhd3dfZOzcCy2/g3","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16556},"main":"./dist/index.js","type":"module","_from":"file:ai-mage-sdk-0.1.1.tgz","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"test":"vitest run","build":"tsup && tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"pseudoyu","email":"pseudoyu@connect.hku.hk"},"_resolved":"/tmp/c5639db06708e127b202a8587b7ca86d/ai-mage-sdk-0.1.1.tgz","_integrity":"sha512-/Yru/hVJd6o5J6UH9K489oIgYy0b9Ot6QmjP27wqP/X3apKmG1R77QRpUdWE9zEUOsKQIXaIPiveZpUrDmTt9A==","repository":{"url":"git+https://github.com/aimagexyz/aimage-monorepo.git","type":"git","directory":"packages/sdk"},"_npmVersion":"10.9.8","description":"TypeScript SDK for the AI-Mage Search public API","directories":{},"sideEffects":false,"_nodeVersion":"22.22.3","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"zod":"4.4.3","tsup":"8.5.1","vitest":"4.1.6","typescript":"6.0.3","@types/node":"25.8.0","@aimage/api-contract":"0.0.0","@aimage/typescript-config":"0.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.1_1781201713257_0.7123717376070908","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"_id":"@ai-mage/sdk@0.3.0","bugs":{"url":"https://github.com/aimagexyz/aimage-monorepo/issues"},"dist":{"shasum":"8f4c545b38ba8145b608a6747c324b8012ded881","tarball":"https://registry.npmjs.org/@ai-mage/sdk/-/sdk-0.3.0.tgz","fileCount":8,"integrity":"sha512-JE8g+XrDV7GvOcBdlyYvsPYBBxpnq+2PurA/HO2c90znCiQRkejVneyoMEJ8nZgwOCb5sUV+yPNTLrACdlFq8A==","signatures":[{"sig":"MEUCIHBM3c52SQ3MafQIMI1/povAGrl4uceGMNBenfjkXLB+AiEAxarkuVJkL1IUZtC7qPHOKP2M1QVL46m+Dwyv+gukijw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICp1nFSIGATYCOEuavZNR3D+PMxOJOHa6eXZOULqmjnlAiEA6gW0fh4T5e1rSxjRgip6FvfoHunJVFuAlOLDTB3RhT4="}],"unpackedSize":41823},"main":"./dist/index.js","name":"@ai-mage/sdk","type":"module","_from":"file:ai-mage-sdk-0.3.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"license":"MIT","scripts":{"test":"vitest run","build":"tsup && tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"version":"0.3.0","_npmUser":{"name":"pseudoyu","email":"pseudoyu@connect.hku.hk"},"homepage":"https://api.search.ai-mage.jp/docs","keywords":["ai-mage","anime","video-search","sdk"],"_resolved":"/tmp/9c0ebe6ab0055d6d91e212788831d9bc/ai-mage-sdk-0.3.0.tgz","_integrity":"sha512-JE8g+XrDV7GvOcBdlyYvsPYBBxpnq+2PurA/HO2c90znCiQRkejVneyoMEJ8nZgwOCb5sUV+yPNTLrACdlFq8A==","repository":{"url":"git+https://github.com/aimagexyz/aimage-monorepo.git","type":"git","directory":"packages/sdk"},"_npmVersion":"10.9.8","description":"TypeScript SDK for the AI-Mage Search public API","directories":{},"maintainers":[{"name":"pseudoyu","email":"pseudoyu@connect.hku.hk"}],"sideEffects":false,"_nodeVersion":"22.23.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"zod":"4.4.3","tsup":"8.5.1","vitest":"4.1.6","typescript":"6.0.3","@types/node":"25.8.0","@aimage/api-contract":"0.0.0","@aimage/typescript-config":"0.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_0.3.0_1788786124226_0.42577870919829586"}}},"time":{"created":"2026-06-11T17:53:13.979Z","modified":"2026-09-07T13:02:04.510Z","0.1.0":"2026-06-11T17:53:14.356Z","0.1.1":"2026-06-11T18:15:13.407Z","0.3.0":"2026-09-07T13:02:04.318Z"},"bugs":{"url":"https://github.com/aimagexyz/aimage-monorepo/issues"},"license":"MIT","homepage":"https://api.search.ai-mage.jp/docs","keywords":["ai-mage","anime","video-search","sdk"],"repository":{"url":"git+https://github.com/aimagexyz/aimage-monorepo.git","type":"git","directory":"packages/sdk"},"description":"TypeScript SDK for the AI-Mage Search public API","maintainers":[{"name":"pseudoyu","email":"pseudoyu@connect.hku.hk"}],"readme":"# @ai-mage/sdk\n\nTypeScript SDK for the AI-Mage Search public API (`/v0`). fetch-based, zero\nruntime dependencies, works in Node 20+ and modern browsers.\n\n## Install\n\n```sh\nnpm install @ai-mage/sdk\n# inside the monorepo: { \"dependencies\": { \"@ai-mage/sdk\": \"workspace:*\" } }\n```\n\n## Quickstart\n\n```ts\nimport { AimageClient } from '@ai-mage/sdk'\n\nconst client = new AimageClient({\n  apiKey: process.env.AIMAGE_API_KEY!, // \"aimage_api_...\"\n  baseUrl: 'https://api.search.ai-mage.jp', // API server origin; the client calls {baseUrl}/v0/...\n})\n\n// Discover accessible projects.\nconst me = await client.me()\nconst projectId = me.projects[0]!.id\n\n// Upload a video: mints a presigned URL, PUTs the bytes, registers the video.\nconst video = await client.uploadVideo({\n  projectId,\n  filePath: './episode-01.mp4',\n  name: 'Episode 1',\n  season: 1,\n  episode: 1,\n  onProgress: (stage) => console.log(stage),\n})\n\n// Wait until clip extraction and AI tagging finish.\nconst processed = await client.waitForProcessing(video.id, {\n  pollIntervalMs: 10_000,\n  timeoutMs: 30 * 60_000,\n})\nif (processed.processing_status === 'failed') {\n  throw new Error(processed.processing_error ?? 'processing failed')\n}\n\n// Search clips with a natural-language query.\nconst { clips, total_available } = await client.searchClips({\n  project_id: projectId,\n  query: 'two characters arguing in the rain',\n})\nconsole.log(total_available, clips[0]?.tags, clips[0]?.characters)\n```\n\n## API surface\n\n- `ping()` / `me()` / `listProjects()`\n- Videos:\n  - `mintUploadUrl({ project_id, file_name, content_type })`\n  - `registerVideo({ project_id, file_name | s3_key, name, season?, episode?, auto_process? })`\n  - `getVideo(id)` / `listVideos({ project_id, processing_status?, order?, page?, page_size? })` / `deleteVideo(id)`\n  - `uploadVideo({ projectId, filePath | blob, name, ... })` — full 3-step upload orchestration\n  - `waitForProcessing(videoId, { pollIntervalMs?, timeoutMs? })`\n- Reference images:\n  - `mintReferenceImageUploadUrl({ project_id, file_name, content_type })`\n  - `registerReferenceImage({ project_id, file_name | s3_key, name?, category?, tags?, purpose?, license?, is_searchable? })`\n  - `getReferenceImage(id)` / `listReferenceImages({ project_id, page?, page_size? })` / `deleteReferenceImage(id)`\n  - `uploadReferenceImage({ projectId, filePath | blob, ... })` — full 3-step upload orchestration\n- Materials:\n  - `mintMaterialUploadUrl({ project_id, file_name, content_type })`\n  - `registerMaterial({ project_id, file_name | s3_key, name?, auto_process? })`\n  - `getMaterial(id)` / `listMaterials({ project_id, file_type?, material_type?, page?, page_size? })` / `deleteMaterial(id)`\n  - `uploadMaterial({ projectId, filePath | blob, ... })` — full 3-step upload orchestration\n- Clips:\n  - `getClip(id)` / `updateClip({ id, subtitle?, description?, tags?, character_ids? })`\n- Characters and visual assets:\n  - `listCharacters({ project_id, page?, page_size? })` / `getCharacter(id)` — characters with their images (stable `visual_asset_id` + short-lived `download_url`)\n  - `listVisualAssets({ project_id, source_type?, character_id?, page?, page_size? })` / `resolveVisualAssets({ project_id, visual_asset_ids })`\n- Search:\n  - `searchClips({ project_id, query?, reference_image_ids?, image_importance?, page?, page_size? })`\n  - `searchMoments({ project_id, query, sources?, season?, video_ids?, limit?, offset? })` — Alaya moment index (projects whose `search_capabilities` include `moments`; 409 `MOMENT_INDEX_NOT_AVAILABLE` otherwise)\n\nFailed API calls throw `AimageApiError` with `code`, `message`, and HTTP\n`status` parsed from the `{\"error\": {\"code\", \"message\"}}` envelope.\n\n## Development\n\n```sh\npnpm --filter @ai-mage/sdk build      # tsup -> dist/\npnpm --filter @ai-mage/sdk test       # vitest (runtime + contract type parity)\npnpm --filter @ai-mage/sdk typecheck  # tsc --noEmit\n```\n","readmeFilename":"README.md"}