{"_id":"@astrapi69/ai-key-vault","_rev":"3-c2ae22c8f812ed1bdb5ef740d842955b","name":"@astrapi69/ai-key-vault","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@astrapi69/ai-key-vault","version":"0.1.0","keywords":["ai","byok","api-key","vault","anthropic","openai","gemini","streaming"],"author":{"name":"Asterios Raptis"},"license":"MIT","_id":"@astrapi69/ai-key-vault@0.1.0","maintainers":[{"name":"astrapi69","email":"asterios.raptis@gmx.net"}],"homepage":"https://github.com/astrapi69/ai-key-vault#readme","bugs":{"url":"https://github.com/astrapi69/ai-key-vault/issues"},"dist":{"shasum":"ca40621ac8c82d4dcbdcf0ce79e2d051a66d9c59","tarball":"https://registry.npmjs.org/@astrapi69/ai-key-vault/-/ai-key-vault-0.1.0.tgz","fileCount":8,"integrity":"sha512-NtRfVFximuixsnVouAcqkAENkGNvt+t+y7KodceYcRbLkY0ejDCUr++KUfdQJ6yfSVBK6yb10A1VIuMC5xp0LA==","signatures":[{"sig":"MEQCIEeOkcVouEc/2GQ3gAohOW8LkH0vgj3s0utk29/yv3iYAiB4osK4Y6OdIb6u39mdJ6WewUW0kgS+Loj4k7zWc1E5jQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":275196},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"8b697dd8f34d2c08c8d32e0745d06a0788f33d8e","scripts":{"build":"tsup"},"_npmUser":{"name":"astrapi69","email":"asterios.raptis@gmx.net"},"repository":{"url":"git+https://github.com/astrapi69/ai-key-vault.git","type":"git","directory":"packages/core"},"_npmVersion":"11.16.0","description":"Storage-agnostic BYOK AI provider settings core: provider registry, key store adapter interface, passphrase-encrypted key vault, browser-direct chat clients with SSE streaming, and model discovery","directories":{},"sideEffects":false,"_nodeVersion":"24.15.0","dependencies":{"@astrapi69/passphrase-vault":"0.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/ai-key-vault_0.1.0_1784545583579_0.5418340318141319","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@astrapi69/ai-key-vault","version":"0.1.1","keywords":["ai","byok","api-key","vault","anthropic","openai","gemini","streaming"],"author":{"name":"Asterios Raptis"},"license":"MIT","_id":"@astrapi69/ai-key-vault@0.1.1","maintainers":[{"name":"astrapi69","email":"asterios.raptis@gmx.net"}],"homepage":"https://github.com/astrapi69/ai-key-vault#readme","bugs":{"url":"https://github.com/astrapi69/ai-key-vault/issues"},"dist":{"shasum":"9ec907eef2cfd7e398ca92b11a0f6c5bbd081f3e","tarball":"https://registry.npmjs.org/@astrapi69/ai-key-vault/-/ai-key-vault-0.1.1.tgz","fileCount":8,"integrity":"sha512-FIQh0hWWs2b5vixsXvb8gXfVkVYAGETTeRApDxBFr5BwJX9ZdOA1bghrKgRzcu0Iaz3lMWrb6qiCCWvZPhtXXA==","signatures":[{"sig":"MEYCIQCIi/lAni5ZN1JNTJHDsTvM4mDrwqllFLWRpwQS8mywrQIhAPRJ/95gotNJhmIwwEovQgAvZR2qMxMNJZacpd+eKFJj","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":275196},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"ba91c13872030084ba2bff73290c1838550532be","scripts":{"build":"tsup"},"_npmUser":{"name":"astrapi69","email":"asterios.raptis@gmx.net"},"repository":{"url":"git+https://github.com/astrapi69/ai-key-vault.git","type":"git","directory":"packages/core"},"_npmVersion":"11.16.0","description":"Storage-agnostic BYOK AI provider settings core: provider registry, key store adapter interface, passphrase-encrypted key vault, browser-direct chat clients with SSE streaming, and model discovery","directories":{},"sideEffects":false,"_nodeVersion":"24.15.0","dependencies":{"@astrapi69/passphrase-vault":"0.1.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/ai-key-vault_0.1.1_1784567021660_0.48442863380113144","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@astrapi69/ai-key-vault","version":"0.2.0","description":"Storage-agnostic BYOK AI provider settings core: provider registry, key store adapter interface, passphrase-encrypted key vault, browser-direct chat clients with SSE streaming, and model discovery","license":"MIT","author":{"name":"Asterios Raptis"},"repository":{"type":"git","url":"git+https://github.com/astrapi69/ai-key-vault.git","directory":"packages/core"},"keywords":["ai","byok","api-key","vault","anthropic","openai","gemini","streaming"],"type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"sideEffects":false,"scripts":{"build":"tsup"},"dependencies":{"@astrapi69/passphrase-vault":"0.1.1"},"publishConfig":{"access":"public"},"engines":{"node":">=20"},"gitHead":"a33c6e09449a1a659f665119648ec6123fab5bb2","_id":"@astrapi69/ai-key-vault@0.2.0","bugs":{"url":"https://github.com/astrapi69/ai-key-vault/issues"},"homepage":"https://github.com/astrapi69/ai-key-vault#readme","_nodeVersion":"24.15.0","_npmVersion":"12.0.1","dist":{"integrity":"sha512-WfLnwUnB1dVZAmkh5GZqxMaOYqwYgFBwUpiIoGgcgeGtcYPf94NaBKggUd0WO4ZcFY2/goUoPA5G9pKh+NJGnQ==","shasum":"4b86ef0fa95905e6154866fc25b90e9d4d453d43","tarball":"https://registry.npmjs.org/@astrapi69/ai-key-vault/-/ai-key-vault-0.2.0.tgz","fileCount":8,"unpackedSize":290822,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDPb05hH+1lVTBk6yQnXgEGz/dKwPTARO8iXA+ROXKSbgIhAImbzssWsEi3yuncCF7OaRHU7dXUWDwFk9mt0rTR2J2m"}]},"_npmUser":{"name":"astrapi69","email":"asterios.raptis@gmx.net"},"directories":{},"maintainers":[{"name":"astrapi69","email":"asterios.raptis@gmx.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ai-key-vault_0.2.0_1786194657851_0.09435840360071013"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-20T11:06:23.439Z","modified":"2026-08-08T13:10:58.149Z","0.1.0":"2026-07-20T11:06:23.713Z","0.1.1":"2026-07-20T17:03:41.807Z","0.2.0":"2026-08-08T13:10:58.000Z"},"bugs":{"url":"https://github.com/astrapi69/ai-key-vault/issues"},"author":{"name":"Asterios Raptis"},"license":"MIT","homepage":"https://github.com/astrapi69/ai-key-vault#readme","keywords":["ai","byok","api-key","vault","anthropic","openai","gemini","streaming"],"repository":{"type":"git","url":"git+https://github.com/astrapi69/ai-key-vault.git","directory":"packages/core"},"description":"Storage-agnostic BYOK AI provider settings core: provider registry, key store adapter interface, passphrase-encrypted key vault, browser-direct chat clients with SSE streaming, and model discovery","maintainers":[{"name":"astrapi69","email":"asterios.raptis@gmx.net"}],"readme":"# @astrapi69/ai-key-vault\n\nStorage-agnostic core for **bring-your-own-key (BYOK) AI provider\nsettings**: a generic provider registry, a storage adapter contract, a\npassphrase-encrypted key vault, browser-direct chat clients with SSE\nstreaming, and model discovery. Extracted from\n[adaptive-learner](https://github.com/astrapi69/adaptive-learner).\n\nNo React, no i18n framework, no storage engine — those are seams the\nconsuming app fills.\n\n## Concepts\n\n### Provider registry\n\nProviders are data, not a hardcoded union:\n\n```ts\nimport { BUILTIN_PROVIDERS, createProviderRegistry } from \"@astrapi69/ai-key-vault\";\n\nconst registry = createProviderRegistry([\n    ...BUILTIN_PROVIDERS, // anthropic, openai, gemini incl. key format rules\n    {\n        id: \"lmstudio\",\n        label: \"LM Studio\",\n        keyFormat: { minLength: 0 },\n        defaultModel: \"local-model\",\n        baseUrl: \"http://localhost:1234/v1\",\n        requiresApiKey: false,\n        desktopOnly: true,\n    },\n]);\n```\n\n### Storage adapter\n\nThe kit never touches persistence. Implement `AiKeyStoreAdapter` over your\napp's storage and pass it in. Optional methods (`testApiKey`,\n`backupApiKey`, ...) are capabilities, reported via `capabilities` so a UI\ncan hide affordances your storage cannot serve.\n\n### Encrypted key vault\n\n```ts\nimport { buildEncryptedKeyVault, importEncryptedKeyVault } from \"@astrapi69/ai-key-vault\";\n\nconst envelope = await buildEncryptedKeyVault(adapter, userId, passphrase, {\n    providerIds: registry.ids,\n});\n// ... user stores the file; later, possibly on another device:\nawait importEncryptedKeyVault(adapter, userId, fileText, passphrase, {\n    providerIds: registry.ids,\n});\n```\n\nCrypto lives in [`@astrapi69/passphrase-vault`](../passphrase-vault)\n(PBKDF2 + AES-GCM, WebCrypto only) and is re-exported here. Legacy\nadaptive-learner `.alk` payloads import unchanged.\n\n### Browser-direct clients\n\n```ts\nimport { aiComplete, aiStream } from \"@astrapi69/ai-key-vault\";\n\nconst text = await aiComplete({\n    provider: \"anthropic\",\n    model: \"claude-haiku-4-5-20251001\",\n    apiKey, // always a parameter — the clients never read storage\n    messages: [{ role: \"user\", content: \"Hi\" }],\n});\n```\n\n`aiStream` delivers SSE deltas via an `onChunk` callback; all three\nbuilt-in providers are normalized to one wire-reading path. Failures throw\n`AiProviderError` (status + provider id + detail).\n\n### i18n\n\nUI-facing helpers take a `t(key, fallback)` function\n(`Translate`). English fallbacks are built in; catalogs stay in the app.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}