{"_id":"@aipowergrid/ai-sdk-provider","name":"@aipowergrid/ai-sdk-provider","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@aipowergrid/ai-sdk-provider","version":"0.1.0","description":"Vercel AI SDK provider for AI Power Grid text, image, video, and music generation","type":"module","sideEffects":false,"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{"./package.json":"./package.json",".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit -p tsconfig.json","lint":"biome check src/ tests/","lint:fix":"biome check --write src/ tests/","test":"vitest run --config ./vitest.config.ts","test:e2e:live":"AIPG_LIVE_E2E=1 vitest run --config ./vitest.config.ts tests/live.e2e.test.ts"},"keywords":["ai-sdk","vercel-ai-sdk","aipg","ai-power-grid","openai-compatible","image-generation","video-generation","music-generation"],"license":"MIT","author":{"name":"AI Power Grid"},"homepage":"https://aipowergrid.io","repository":{"type":"git","url":"git+https://github.com/AIPowerGrid/grid-provider-integrations.git","directory":"ai-sdk-aipg"},"bugs":{"url":"https://github.com/AIPowerGrid/grid-provider-integrations/issues"},"dependencies":{"@ai-sdk/openai-compatible":"^3.0.40","@ai-sdk/provider":"^4.0.8"},"devDependencies":{"@biomejs/biome":"2.5.8","@types/node":"^24.0.0","ai":"^7.0.84","typescript":"^6.0.0","vitest":"^4.0.0"},"engines":{"node":">=20"},"peerDependencies":{"ai":">=7 <8"},"peerDependenciesMeta":{"ai":{"optional":true}},"publishConfig":{"access":"public"},"gitHead":"e1dc8f4e2bf55926701f501a8471016b2d263556","_id":"@aipowergrid/ai-sdk-provider@0.1.0","_nodeVersion":"24.19.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-6uybT5PPXXSxcKFFdIBhXWvCVrMLZnkG57/xeva4wiJu52EjdOMGavFgLokofi6VQPHOaZ93ijnHkDSOeudGGw==","shasum":"66ee3f00f73857f3d98e47427a5026df4bebf9e5","tarball":"https://registry.npmjs.org/@aipowergrid/ai-sdk-provider/-/ai-sdk-provider-0.1.0.tgz","fileCount":27,"unpackedSize":53381,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@aipowergrid%2fai-sdk-provider@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCFltsBdl8C4n/N6srFQRr9csjWGxf6ADi1Ke0P0udNCwIhAP0VYBItHBpmwMBz8ssYoG3nSz32164PgoYV+Lw+kGhj"}]},"_npmUser":{"name":"halfaipg","email":"half@aipowergrid.io"},"directories":{},"maintainers":[{"name":"halfaipg","email":"half@aipowergrid.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ai-sdk-provider_0.1.0_1788038480322_0.5442116914964952"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-29T21:21:20.082Z","0.1.0":"2026-08-29T21:21:20.460Z","modified":"2026-08-29T21:21:20.863Z"},"maintainers":[{"name":"halfaipg","email":"half@aipowergrid.io"}],"description":"Vercel AI SDK provider for AI Power Grid text, image, video, and music generation","homepage":"https://aipowergrid.io","keywords":["ai-sdk","vercel-ai-sdk","aipg","ai-power-grid","openai-compatible","image-generation","video-generation","music-generation"],"repository":{"type":"git","url":"git+https://github.com/AIPowerGrid/grid-provider-integrations.git","directory":"ai-sdk-aipg"},"author":{"name":"AI Power Grid"},"bugs":{"url":"https://github.com/AIPowerGrid/grid-provider-integrations/issues"},"license":"MIT","readme":"# AI Power Grid Provider for the Vercel AI SDK\n\nUse AI Power Grid through the standard AI SDK interfaces for streamed text,\nimage generation, and experimental video generation. The package also exposes\na typed music-generation helper for the Grid's ACE-Step models.\n\n## Install\n\n```bash\nnpm install ai @aipowergrid/ai-sdk-provider\n```\n\nCreate a scoped API key in the [Grid Console](https://console.aipowergrid.io/)\nwith `inference.submit` for generation and `account.read` if your application\nshows balances. Keep it server-side:\n\n```bash\nAIPG_API_KEY=grid_...\n```\n\nDo not expose the key through `NEXT_PUBLIC_*`, `VITE_*`, client components, or\nbrowser JavaScript. A server key identifies one Grid account and spends that\naccount's credits. For a multi-user product, mint user-scoped credentials or\nuse the Grid's delegated-user flow instead of sharing a privileged service key.\nLong media jobs can run for several minutes; pass `timeoutMs` to `createAipg`\nonly when your deployment needs a tighter deadline, and use request abort\nsignals for user cancellation.\n\nThe `AIPG_API_KEY` environment fallback is used only with the canonical\n`https://api.aipowergrid.io/v1` origin. A custom `baseURL` is a local testing\nseam and requires an explicit `apiKey`; remote plaintext HTTP and redirects are\nrejected so a production credential cannot silently move to another host.\n\n## Text\n\n```ts\nimport { generateText, streamText } from \"ai\";\nimport { aipg } from \"@aipowergrid/ai-sdk-provider\";\n\nconst result = await generateText({\n  model: aipg(\"auto\"),\n  prompt: \"Explain verifiable inference in two sentences.\",\n});\n\nconst stream = streamText({\n  model: aipg(\"auto\"),\n  prompt: \"Give me three names for a decentralized image app.\",\n});\n\nfor await (const chunk of stream.textStream) process.stdout.write(chunk);\n```\n\n`auto` lets the Grid route to an available text model. You may also pass a\npublic text model ID returned by `await aipg.listTextModels()`.\n\n## Images\n\n```ts\nimport { generateImage } from \"ai\";\nimport { aipg } from \"@aipowergrid/ai-sdk-provider\";\n\nconst result = await generateImage({\n  model: aipg.imageModel(\"Krea 2 Turbo\"),\n  prompt: \"A solar-powered compute cooperative, editorial photography\",\n  size: \"1024x1024\",\n  providerOptions: {\n    aipg: { negativePrompt: \"text, watermark\", outputFormat: \"webp\" },\n  },\n});\n```\n\nImage-to-image accepts one inline AI SDK file. Remote source URLs and masks are\nrejected because the current Grid contract does not support them. Supported\nadvanced `aipg` options are `negativePrompt`, `steps`, `cfgScale`, `sampler`,\n`scheduler`, `strength`, and `outputFormat`.\n\n## Video\n\nAI SDK v7 marks its video interface experimental:\n\n```ts\nimport { experimental_generateVideo as generateVideo } from \"ai\";\nimport { aipg } from \"@aipowergrid/ai-sdk-provider\";\n\nconst result = await generateVideo({\n  model: aipg.videoModel(\"LTX Director 2.0\"),\n  prompt: \"Slow camera push through a luminous server hall\",\n  resolution: \"768x512\",\n  duration: 4,\n  fps: 24,\n});\n```\n\nImage-to-video models such as `LTX-2.3` require one inline start-frame file.\nAI SDK `frameImages`, `inputReferences`, and remote URL inputs are rejected\nrather than ignored.\n\n## Music\n\nMusic generation is deliberately not presented as text-to-speech:\n\n```ts\nconst song = await aipg.generateMusic({\n  prompt: \"Upbeat synth-rock, confident, clean harmony\",\n  lyrics: \"Power moves across the grid\",\n  seconds: 30,\n  bpm: 112,\n  keyScale: \"A minor\",\n  timeSignature: \"4/4\",\n  vocalLanguage: \"en\",\n});\n```\n\n## Discovery and credits\n\n```ts\nconst textModels = await aipg.listTextModels();\nconst onlineCapacity = await aipg.listOnlineModels();\nconst credits = await aipg.credits();\nconst estimate = await aipg.quote({\n  model: \"Krea 2 Turbo\",\n  modality: \"image\",\n  n: 1,\n});\n```\n\nMedia calls preflight the live model/modality list before submitting paid work.\nAvailability can still change between the preflight and dispatch, so callers\nmust handle API errors.\n\n## Trust and privacy\n\nAIPG routes jobs to remote, community-operated workers. Inputs and outputs are\nnot end-to-end encrypted from the worker executing the job, so operators may be\nable to inspect plaintext content. Do not send secrets, credentials, personal\ndata, or regulated content unless a separately documented confidential tier\nmeets your requirements. On-chain settlement and public payout records improve\neconomic transparency; they do not make inference private or fully trustless.\n\nThis package does not imply a partnership with Vercel. It is a community\nprovider maintained by AI Power Grid.\n\n## Release verification\n\nDefault tests use local protocol fixtures and never spend credits. Before a\nrelease, run one bounded streamed request through the real AI SDK runtime with\na disposable scoped key:\n\n```bash\nAIPG_API_KEY=\"...\" npm run test:e2e:live\n```\n\nThe live test records only assertions and timing through the test runner. It\nmust never print the key, prompt, generated text, or account balance.\n\nAfter that gate passes, publish only through the root `publish-packages.yml`\nworkflow using a tag that exactly matches the package version, such as\n`ai-sdk-provider-v0.1.0`. Configure npm Trusted Publishing for the\n`AIPowerGrid/grid-provider-integrations` repository and that workflow; use a\npackage-scoped `NPM_TOKEN` only if npm requires one for the first publication.\n","readmeFilename":"README.md","_rev":"1-0a517401f3fc57619df293d09e2414b3"}