{"_id":"@unityclaw/sdk","_rev":"44-bda6f77cb6db1ebff66099a5d9439d14","name":"@unityclaw/sdk","dist-tags":{"latest":"1.2.4"},"versions":{"1.1.9":{"name":"@unityclaw/sdk","version":"1.1.9","keywords":["unityclaw","ai","api","sdk","image-generation","video-generation","media-analysis","jimeng","kling"],"author":{"name":"UnityClaw"},"license":"MIT","_id":"@unityclaw/sdk@1.1.9","maintainers":[{"name":"lloydzhou","email":"lloydzhou@qq.com"}],"bin":{"unityclaw-sdk":"dist/cli.js"},"dist":{"shasum":"5ef1c86889d1ec565743a85097d70c03cb3a907b","tarball":"https://registry.npmjs.org/@unityclaw/sdk/-/sdk-1.1.9.tgz","fileCount":12,"integrity":"sha512-756EpZ9jw9W/YKc6atbR3kT+qP3reFnIffe5hxfnXg++dzLFk1kYw4pUHvXqwBhCaSkad3+Yb0Oc3T4N+VA5Sg==","signatures":[{"sig":"MEYCIQCLNgcUyOemv8jzfUacr1WHhPvoDiRquvVxmh6L/5OfwAIhALSDpwRoYwI16qO3LbIpzlB2r3jE8DPUI8I2u+bhSdTh","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":190102},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"fcbe36e05ab3c0ea933c34514baeb92f849679f3","scripts":{"dev":"tsup src/index.ts src/cli.ts --format cjs,esm --dts --watch","build":"tsup src/index.ts src/cli.ts --format cjs,esm --dts --clean","typecheck":"tsc --noEmit","prepublishOnly":"npm run build","test:direct-api":"npm run build && node tests/direct-api-smoke.mjs","test:skill-apis":"npm run build && node --test tests/skill-api-wrappers.test.mjs"},"_npmUser":{"name":"lloydzhou","email":"lloydzhou@qq.com"},"_npmVersion":"11.6.2","description":"Node.js SDK for UnityClaw API - AI-powered image/video generation, media analysis, and more","directories":{},"_nodeVersion":"25.2.1","dependencies":{"uuid":"^9.0.0","axios":"^1.6.0","date-fns":"^3.0.0","fs-extra":"^11.2.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.1","typescript":"^5.3.0","@types/node":"^20.10.0","@types/uuid":"^9.0.7","@types/fs-extra":"^11.0.4"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.1.9_1773924414828_0.9178747718209996","host":"s3://npm-registry-packages-npm-production"}},"1.1.10":{"name":"@unityclaw/sdk","version":"1.1.10","keywords":["unityclaw","ai","api","sdk","image-generation","video-generation","media-analysis","jimeng","kling"],"author":{"name":"UnityClaw"},"license":"MIT","_id":"@unityclaw/sdk@1.1.10","maintainers":[{"name":"lloydzhou","email":"lloydzhou@qq.com"}],"bin":{"unityclaw-sdk":"dist/cli.js"},"dist":{"shasum":"d7b2505950ff8f57bfd83b621d1f2a6c9b6412fa","tarball":"https://registry.npmjs.org/@unityclaw/sdk/-/sdk-1.1.10.tgz","fileCount":12,"integrity":"sha512-lUxBRJK11lgXIBwksJuiqeWMgKks9nlhq176f0eQhPP//gajbjGuN42NiXNYRd2sSKasbFtbeGGfU9/zDpfNfA==","signatures":[{"sig":"MEUCIFKsFgg4N1bZpsP/a4x2/zBuR5PD/IQtaMoJoBPg7as6AiEAtofL+MVBLZntJWs1zhv0OahIIk+veoaU8pyXdzPXYjQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":192165},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"2979a5c442084ac1c62f0f3a77fc2a56db80c6b3","scripts":{"dev":"tsup src/index.ts src/cli.ts --format cjs,esm --dts --watch","build":"tsup src/index.ts src/cli.ts --format cjs,esm --dts --clean","typecheck":"tsc --noEmit","prepublishOnly":"npm run build","test:direct-api":"npm run build && node tests/direct-api-smoke.mjs","test:skill-apis":"npm run build && node --test tests/skill-api-wrappers.test.mjs"},"_npmUser":{"name":"lloydzhou","email":"lloydzhou@qq.com"},"_npmVersion":"11.6.2","description":"Node.js SDK for UnityClaw API - AI-powered image/video generation, media analysis, and more","directories":{},"_nodeVersion":"25.2.1","dependencies":{"uuid":"^9.0.0","axios":"^1.6.0","date-fns":"^3.0.0","fs-extra":"^11.2.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.1","typescript":"^5.3.0","@types/node":"^20.10.0","@types/uuid":"^9.0.7","@types/fs-extra":"^11.0.4"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.1.10_1773995452764_0.27476929588480137","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@unityclaw/sdk","version":"1.2.0","keywords":["unityclaw","ai","api","sdk","image-generation","video-generation","media-analysis","jimeng","kling"],"author":{"name":"UnityClaw"},"license":"MIT","_id":"@unityclaw/sdk@1.2.0","maintainers":[{"name":"lloydzhou","email":"lloydzhou@qq.com"}],"bin":{"unityclaw-sdk":"dist/cli.js"},"dist":{"shasum":"c7d511aa408af588748ee73f905f0d4a26066eed","tarball":"https://registry.npmjs.org/@unityclaw/sdk/-/sdk-1.2.0.tgz","fileCount":12,"integrity":"sha512-dW+C5lVrpGJZB7j5cz/BTZuc5L0QSNujyrEqDcb1CNeTKCXGQi4MYlYJGAeaCOLnOmXw3WHD7BShYoC5h9IKmw==","signatures":[{"sig":"MEUCICii+v0UkBGb9KnvYHJW+Fp6YqXnc9pB2msQo/mRFmicAiEAkgmI9g+VffuNOQqaLNi3dY+L4Y2C1BbhK7WdxSnCyAc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":190850},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"34f89ada5be41c03b461f007cd6f49cb89ae3942","scripts":{"dev":"tsup src/index.ts src/cli.ts --format cjs,esm --dts --watch","build":"tsup src/index.ts src/cli.ts --format cjs,esm --dts --clean","typecheck":"tsc --noEmit","prepublishOnly":"npm run build","test:direct-api":"npm run build && node tests/direct-api-smoke.mjs","test:skill-apis":"npm run build && node --test tests/skill-api-wrappers.test.mjs"},"_npmUser":{"name":"lloydzhou","email":"lloydzhou@qq.com"},"_npmVersion":"11.6.2","description":"Node.js SDK for UnityClaw API - AI-powered image/video generation, media analysis, and more","directories":{},"_nodeVersion":"25.2.1","dependencies":{"uuid":"^9.0.0","axios":"^1.6.0","date-fns":"^3.0.0","fs-extra":"^11.2.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.1","typescript":"^5.3.0","@types/node":"^20.10.0","@types/uuid":"^9.0.7","@types/fs-extra":"^11.0.4"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.2.0_1774002646908_0.4568261438858914","host":"s3://npm-registry-packages-npm-production"}},"1.2.1":{"name":"@unityclaw/sdk","version":"1.2.1","keywords":["unityclaw","ai","api","sdk","image-generation","video-generation","media-analysis","jimeng","kling"],"author":{"name":"UnityClaw"},"license":"MIT","_id":"@unityclaw/sdk@1.2.1","maintainers":[{"name":"lloydzhou","email":"lloydzhou@qq.com"}],"bin":{"unityclaw-sdk":"dist/cli.js"},"dist":{"shasum":"a3537639e7ec8b6a970ccd4fbe981ea210f71d27","tarball":"https://registry.npmjs.org/@unityclaw/sdk/-/sdk-1.2.1.tgz","fileCount":12,"integrity":"sha512-aXh/Yf/5TBtdklPiKde/srONadIzIyF/p8slNi6f+7bTBUmH3AzVQltX3YJBWd7qOc7FoJA+lj3WTYGjuy5ASA==","signatures":[{"sig":"MEQCIG/88+j0Ir8Bz7r4EHWsm6ckRLFwWWYxPmfzLdzQuJ4RAiBmuJIvoJEYD509scY3ePd02AoX5JRwAiennyqlAahiyg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":196607},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"a009a87f90441554ee30b7c807fcd9b9d583a197","scripts":{"dev":"tsup src/index.ts src/cli.ts --format cjs,esm --dts --watch","build":"tsup src/index.ts src/cli.ts --format cjs,esm --dts --clean","typecheck":"tsc --noEmit","prepublishOnly":"npm run build","test:direct-api":"npm run build && node tests/direct-api-smoke.mjs","test:skill-apis":"npm run build && node --test tests/skill-api-wrappers.test.mjs"},"_npmUser":{"name":"lloydzhou","email":"lloydzhou@qq.com"},"_npmVersion":"11.6.2","description":"Node.js SDK for UnityClaw API - AI-powered image/video generation, media analysis, and more","directories":{},"_nodeVersion":"25.2.1","dependencies":{"uuid":"^9.0.0","axios":"^1.6.0","date-fns":"^3.0.0","fs-extra":"^11.2.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.1","typescript":"^5.3.0","@types/node":"^20.10.0","@types/uuid":"^9.0.7","@types/fs-extra":"^11.0.4"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.2.1_1774007672876_0.13845119299448383","host":"s3://npm-registry-packages-npm-production"}},"1.2.2":{"name":"@unityclaw/sdk","version":"1.2.2","keywords":["unityclaw","ai","api","sdk","image-generation","video-generation","media-analysis","jimeng","kling"],"author":{"name":"UnityClaw"},"license":"MIT","_id":"@unityclaw/sdk@1.2.2","maintainers":[{"name":"lloydzhou","email":"lloydzhou@qq.com"}],"bin":{"unityclaw-sdk":"dist/cli.js"},"dist":{"shasum":"81918206de5e19ba6344e19e9e536bb78951b9d7","tarball":"https://registry.npmjs.org/@unityclaw/sdk/-/sdk-1.2.2.tgz","fileCount":12,"integrity":"sha512-h48Fk9wkbEJwKKv6mRMuSOCcDkacmVrQZdFllxHukYS+kQLetb4E0evudvKN1sXpoWGvghENYDwkuOI8HW7yZA==","signatures":[{"sig":"MEYCIQCrBP7Jh90xJ+I308LlxezwSNMZuPJiMMMkZbLHerivwQIhANbQUifdNWBFZMCbLAp/auF36kKe0aEEpdtRAsTMC6kJ","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":202345},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"8c3b0a9ea2250b37d209dfbb89b0fca6acf14eef","scripts":{"dev":"tsup src/index.ts src/cli.ts --format cjs,esm --dts --watch","build":"tsup src/index.ts src/cli.ts --format cjs,esm --dts --clean","typecheck":"tsc --noEmit","prepublishOnly":"npm run build","test:direct-api":"npm run build && node tests/direct-api-smoke.mjs","test:skill-apis":"npm run build && node --test tests/skill-api-wrappers.test.mjs"},"_npmUser":{"name":"lloydzhou","email":"lloydzhou@qq.com"},"_npmVersion":"11.6.2","description":"Node.js SDK for UnityClaw API - AI-powered image/video generation, media analysis, and more","directories":{},"_nodeVersion":"25.2.1","dependencies":{"uuid":"^9.0.0","axios":"^1.6.0","date-fns":"^3.0.0","fs-extra":"^11.2.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.1","typescript":"^5.3.0","@types/node":"^20.10.0","@types/uuid":"^9.0.7","@types/fs-extra":"^11.0.4"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.2.2_1776170424793_0.9666705788953411","host":"s3://npm-registry-packages-npm-production"}},"1.2.3":{"name":"@unityclaw/sdk","version":"1.2.3","keywords":["unityclaw","ai","api","sdk","image-generation","video-generation","media-analysis","jimeng","kling"],"author":{"name":"UnityClaw"},"license":"MIT","_id":"@unityclaw/sdk@1.2.3","maintainers":[{"name":"lloydzhou","email":"lloydzhou@qq.com"}],"bin":{"unityclaw-sdk":"dist/cli.js"},"dist":{"shasum":"9e8326cbaa61ba4949764c0cc9daeb3202c624ba","tarball":"https://registry.npmjs.org/@unityclaw/sdk/-/sdk-1.2.3.tgz","fileCount":12,"integrity":"sha512-SCd4bdDlVSXsYVoDgAsuP6UIr6J0+vco1yWJoDLLf5Omo1mr765dDHqjheHx8+uXy9tFc+Mw496BQBE32mcugg==","signatures":[{"sig":"MEQCIBxxtE0Tpo4i1x5Cr0CnJ/DgMhwj3AsHz/nA7aukm0gLAiAE8x0MWX1FYrLsq0Uj936dYfIk446147GakWWpuF5aKA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":204909},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"5ebc71dbec96c4200939360724e2a38928307159","scripts":{"dev":"tsup src/index.ts src/cli.ts --format cjs,esm --dts --watch","build":"tsup src/index.ts src/cli.ts --format cjs,esm --dts --clean","typecheck":"tsc --noEmit","prepublishOnly":"npm run build","test:direct-api":"npm run build && node tests/direct-api-smoke.mjs","test:skill-apis":"npm run build && node --test tests/skill-api-wrappers.test.mjs"},"_npmUser":{"name":"lloydzhou","email":"lloydzhou@qq.com"},"_npmVersion":"11.6.2","description":"Node.js SDK for UnityClaw API - AI-powered image/video generation, media analysis, and more","directories":{},"_nodeVersion":"25.2.1","dependencies":{"uuid":"^9.0.0","axios":"^1.6.0","date-fns":"^3.0.0","fs-extra":"^11.2.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.1","typescript":"^5.3.0","@types/node":"^20.10.0","@types/uuid":"^9.0.7","@types/fs-extra":"^11.0.4"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.2.3_1779712065875_0.6853273568384455","host":"s3://npm-registry-packages-npm-production"}},"1.2.4":{"name":"@unityclaw/sdk","version":"1.2.4","description":"Node.js SDK for UnityClaw API - AI-powered image/video generation, media analysis, and more","type":"module","bin":{"unityclaw-sdk":"dist/cli.js"},"main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"build":"tsup src/index.ts src/cli.ts --format cjs,esm --dts --clean","dev":"tsup src/index.ts src/cli.ts --format cjs,esm --dts --watch","typecheck":"tsc --noEmit","test:oauth":"npm run build && node --test tests/oauth-sdk.test.mjs","test:openapi-video":"npm run build && node --test tests/openapi-video.test.mjs","test:skill-apis":"npm run build && node --test tests/skill-api-wrappers.test.mjs","test:direct-api":"npm run build && node tests/direct-api-smoke.mjs","prepublishOnly":"npm run build"},"keywords":["unityclaw","ai","api","sdk","image-generation","video-generation","media-analysis","jimeng","kling"],"author":{"name":"UnityClaw"},"license":"MIT","dependencies":{"axios":"^1.6.0","date-fns":"^3.0.0","fs-extra":"^11.2.0","uuid":"^9.0.0"},"devDependencies":{"@types/fs-extra":"^11.0.4","@types/node":"^20.10.0","@types/uuid":"^9.0.7","tsup":"^8.0.1","typescript":"^5.3.0"},"engines":{"node":">=18.0.0"},"gitHead":"960bedc1aaff26d694b1985ceefebec929fc1676","_id":"@unityclaw/sdk@1.2.4","_nodeVersion":"24.16.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-zT1DunQITyiy8vOiqysLZJHWN0+N6f0L6Khp8b+RLf0vjjjXRsx5Y5W7/AiO8nBWroyGHqhiq/baAUG1imsF8g==","shasum":"b4b3076d4a92d1d2588facedb91f5d36f8e37009","tarball":"https://registry.npmjs.org/@unityclaw/sdk/-/sdk-1.2.4.tgz","fileCount":12,"unpackedSize":269209,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGG0ToRY3toHFbP9t7UZqPEQ5S/rAp8hvmnpaqeOFS82AiEAqpzL9bBJl+UUdy9UrTkDQYS34YbLiSEntZAB40y7ZTA="}]},"_npmUser":{"name":"lloydzhou","email":"lloydzhou@qq.com"},"directories":{},"maintainers":[{"name":"lloydzhou","email":"lloydzhou@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_1.2.4_1789627347344_0.6481522907076385"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-12T05:28:55.839Z","modified":"2026-09-17T06:42:27.647Z","1.0.0":"2026-03-12T05:28:56.078Z","1.0.1":"2026-03-12T06:15:23.325Z","1.0.2":"2026-03-12T06:42:32.167Z","1.0.3":"2026-03-12T08:16:02.761Z","1.0.4":"2026-03-12T12:23:42.813Z","1.0.5":"2026-03-12T12:52:56.723Z","1.0.6":"2026-03-13T10:00:43.937Z","1.0.8":"2026-03-16T12:15:01.426Z","1.0.9":"2026-03-16T13:07:50.468Z","1.1.0":"2026-03-16T13:17:40.824Z","1.1.1":"2026-03-16T13:24:25.611Z","1.1.2":"2026-03-16T13:41:36.878Z","1.1.3":"2026-03-16T13:54:16.972Z","1.1.4":"2026-03-16T13:58:13.600Z","1.1.5":"2026-03-17T06:23:20.186Z","1.1.6":"2026-03-17T09:10:32.492Z","1.1.7":"2026-03-18T03:45:04.589Z","1.1.8":"2026-03-19T10:04:46.543Z","1.1.9":"2026-03-19T12:46:54.976Z","1.1.10":"2026-03-20T08:30:52.904Z","1.2.0":"2026-03-20T10:30:47.044Z","1.2.1":"2026-03-20T11:54:33.059Z","1.2.2":"2026-04-14T12:40:24.972Z","1.2.3":"2026-05-25T12:27:46.085Z","1.2.4":"2026-09-17T06:42:27.484Z"},"author":{"name":"UnityClaw"},"license":"MIT","keywords":["unityclaw","ai","api","sdk","image-generation","video-generation","media-analysis","jimeng","kling"],"description":"Node.js SDK for UnityClaw API - AI-powered image/video generation, media analysis, and more","maintainers":[{"name":"lloydzhou","email":"lloydzhou@qq.com"}],"readme":"# @unityclaw/sdk\n\nNode.js SDK for UnityClaw API - AI-powered image/video generation, media analysis, document processing, and more.\n\n## Installation\n\n```bash\nnpm install @unityclaw/sdk\n```\n\n## Quick Start\n\n```typescript\nimport { UnityClawClient } from '@unityclaw/sdk';\n\n// Reads UNITYCLAW_API_KEY from environment variable\nconst client = new UnityClawClient();\n\n// Or with explicit config\nconst client = new UnityClawClient({\n  apiKey: 'your-api-key',\n  baseUrl: 'https://unityclaw.com',\n  taskDir: './tasks',\n  timeout: 900000 // 15 minutes\n});\n\n// Generate image\nconst imageResult = await client.image.jimeng({\n  prompt: 'A beautiful sunset over mountains',\n  size: '2048x2048'\n});\n\n// Generate video (Kling)\nconst videoResult = await client.video.kling({\n  prompt: 'A cat playing piano',\n  model: 'kling-v2-6',\n  aspect_ratio: '16:9',\n  duration: '5'\n});\n\n// Translate document (local file will be auto-uploaded to get tmp_url)\nconst docResult = await client.document.translate({\n  attachment: [{ path: './files/doc.pdf' }],\n  source_language: { value: 'en', label: 'English' },\n  target_language: { value: 'zh', label: 'Chinese' }\n});\n\n// Analyze media\nconst mediaResult = await client.media.analyze({\n  url: [{ link: 'https://youtube.com/watch?v=...' }]\n});\n```\n\n## Configuration\n\n### Environment Variables\n\n- `UNITYCLAW_API_KEY` - Your UnityClaw API key\n- `UNITYCLAW_BASE_URL` - API base URL (optional, defaults to https://unityclaw.com)\n- `UNITYCLAW_OPENAPI_BASE_URL` - Open API origin if it differs from the legacy API origin\n- `UNITYCLAW_OPENAPI_PREFIX` - Open API route prefix (default: `/openapi/v1`)\n\n### CLI Configuration\n\nUse the CLI to persist configuration:\n\n```bash\n# Install globally\nnpm install -g @unityclaw/sdk\n\n# Set API key (stored in ~/.unityclaw/config.json)\nunityclaw-sdk config set apiKey your-api-key\n\n# Set custom base URL\nunityclaw-sdk config set baseUrl https://custom.example.com\n\n# View current configuration\nunityclaw-sdk config\n\n# Get a specific value\nunityclaw-sdk config get apiKey\n```\n\n### Configuration Priority\n\n1. Constructor parameters (highest priority)\n2. Environment variables\n3. Config file (~/.unityclaw/config.json)\n4. Default values (lowest priority)\n\n## OAuth Authorization\n\nWhen no API key is configured, the SDK throws an\n`AuthenticationRequiredError` with the stable code `AUTH_REQUIRED`. An\ninteractive caller should ask for the user's consent before starting OAuth.\n\nAfter the user agrees, call `loginWithOAuth()`. It runs Authorization Code +\nPKCE with a loopback callback, exchanges the OAuth access token for an API key,\nand writes the API key to the existing `~/.unityclaw/config.json` file. Business\nAPI requests continue to use `X-Api-Key`.\n\n```typescript\nimport {\n  AuthenticationRequiredError,\n  UnityClawClient,\n  loginWithOAuth,\n} from '@unityclaw/sdk';\n\ntry {\n  const client = new UnityClawClient();\n  // Use the client normally.\n} catch (error) {\n  if (error instanceof AuthenticationRequiredError) {\n    // Ask the user for explicit consent in the calling UI first.\n    await loginWithOAuth();\n    const client = new UnityClawClient();\n    // Retry the user's original operation once.\n  }\n}\n```\n\n`loginWithOAuth()` never runs automatically. Do not call it until the user has\nexplicitly agreed to open the browser authorization flow.\n\n## Task Folders\n\nEach SDK execution creates a task folder with:\n\n- `logs/request.json` - Request details\n- `logs/response.json` - API response\n- `logs/execution.log` - Execution log\n- `attachments/` - Downloaded attachments (to avoid link expiration)\n\n### Default Task Directory\n\nTasks are stored in `~/Documents/tasks/` by default. You can override this:\n\n```typescript\nconst client = new UnityClawClient({\n  taskDir: '/path/to/custom/tasks'\n});\n```\n\n## API Reference\n\n### Image Generation\n\n```typescript\n// JiMeng\nawait client.image.jimeng({\n  prompt: 'A sunset over mountains',\n  size: '2048x2048'\n});\n\n// JiMeng (Doubao)\nawait client.image.jimeng({\n  prompt: 'A futuristic city',\n  model: 'v6.0'\n});\n```\n\n### Video Generation\n\n```typescript\n// Kling\nawait client.video.kling({\n  prompt: 'A dancing robot',\n  model: 'kling-v1-5'\n});\n\n// Agent-safe pattern: one short submission, then separate one-shot status checks.\nconst submitted = await client.video.submitWan3({ prompt: 'A running horse', resolution: '1080P' });\nconsole.log(submitted.taskId); // persist this ID before exiting the process\n\n// In a later invocation, query once using the same API key and task ID.\nconst snapshot = await client.video.getVideoTask(submitted.taskId);\nconsole.log(snapshot.status, snapshot.result, snapshot.error);\n```\n\nNonblocking submit methods are `submitHappyhorse`, `submitMiniMaxH3`, `submitWan3`, `submitSeedance25`, `submitSeedanceMini`, and `submitSeedance2` (fast and standard). An Agent should query the same ID every 5 seconds with a **new short-lived command**, stopping on `succeeded` or `failed`; a query error is never a reason to submit again. The older `happyhorse`, `minimaxH3`, `wan3`, `seedance25`, `seedanceMini`, and `seedance2` methods wait internally and remain for non-Agent compatibility. Local `attachments: [{ path: './reference.mp4' }]` are uploaded before submission when auto-upload is enabled.\n\n### Document Processing\n\n```typescript\n// Translate document\nawait client.document.translate({\n  attachment: [{ tmp_url: 'https://...', name: 'doc.pdf' }],\n  source_language: { value: 'en', label: 'English' },\n  target_language: { value: 'zh', label: 'Chinese' }\n});\n\n// Convert document\nawait client.document.convert({\n  attachment: [{ path: './files/doc.pdf' }],\n  input_format: 'pdf',\n  output_format: 'docx'\n});\n```\n\n### Media Analysis\n\n```typescript\nconst result = await client.media.analyze({\n  url: [{ link: 'https://youtube.com/watch?v=...' }]\n});\n\nconsole.log(result.response.data?.summary);\nconsole.log(result.response.data?.subtitle);\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}