{"_id":"@ai-setu/client","_rev":"11-68dee261a3323d03e3894bf1664f27c4","name":"@ai-setu/client","dist-tags":{"latest":"0.20.2"},"versions":{"0.9.0":{"name":"@ai-setu/client","version":"0.9.0","keywords":["ai-setu","ai-gateway","llm","openai","anthropic","bedrock","embeddings","sdk"],"license":"MIT","_id":"@ai-setu/client@0.9.0","maintainers":[{"name":"ashish-agrawal-23","email":"thunder.ashish@gmail.com"}],"homepage":"https://github.com/aisetu-ai/ai-setu/tree/main/packages/client#readme","bugs":{"url":"https://github.com/aisetu-ai/ai-setu/issues"},"dist":{"shasum":"46c3335fb2798aea0b8840ed85a047e883446036","tarball":"https://registry.npmjs.org/@ai-setu/client/-/client-0.9.0.tgz","fileCount":35,"integrity":"sha512-wMcWeL2aevSOIchfj4+QY96YfB+z1qJK2Ai0ROqhAHEPd4z68m6/3NX80BsFITMoqifbKwE7ORKjaOEyNZrA2w==","signatures":[{"sig":"MEUCIQDGGjKH0krSTOF0jIcC9+y1U4Q7SqD6mfO8nDeGqmxhjgIgaY0MnHh1n0vMV0VBVeFPsUzlR51JOhMwRmUPaftGmAM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":61598},"main":"./dist/index.js","type":"module","_from":"file:ai-setu-client-0.9.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"lint":"eslint src","test":"vitest run","build":"tsc -p tsconfig.json","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"ashish-agrawal-23","email":"thunder.ashish@gmail.com"},"_resolved":"/tmp/15eb686e8ac4d4f2b39828625369906c/ai-setu-client-0.9.0.tgz","_integrity":"sha512-wMcWeL2aevSOIchfj4+QY96YfB+z1qJK2Ai0ROqhAHEPd4z68m6/3NX80BsFITMoqifbKwE7ORKjaOEyNZrA2w==","repository":{"url":"git+https://github.com/aisetu-ai/ai-setu.git","type":"git","directory":"packages/client"},"_npmVersion":"11.13.0","description":"AI Setu client — drop-in OpenAI SDK with workspace credit accounting and multi-provider routing.","directories":{},"sideEffects":false,"_nodeVersion":"24.16.0","dependencies":{"openai":"^6.42.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"msw":"latest","vitest":"latest","typescript":"latest","@types/node":"latest"},"optionalDependencies":{"undici":"^7.16.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.9.0_1781733308607_0.7718004334459223","host":"s3://npm-registry-packages-npm-production"}},"0.9.1":{"name":"@ai-setu/client","version":"0.9.1","keywords":["ai-setu","ai-gateway","llm","openai","anthropic","bedrock","embeddings","sdk"],"license":"MIT","_id":"@ai-setu/client@0.9.1","maintainers":[{"name":"ashish-agrawal-23","email":"thunder.ashish@gmail.com"}],"homepage":"https://github.com/aisetu-ai/ai-setu/tree/main/packages/client#readme","bugs":{"url":"https://github.com/aisetu-ai/ai-setu/issues"},"dist":{"shasum":"53d70ea2efe3c25f138041bad19737ffdc6fd2bd","tarball":"https://registry.npmjs.org/@ai-setu/client/-/client-0.9.1.tgz","fileCount":35,"integrity":"sha512-CeNvW8pzF7l5N9W1fwUKC6ChTC6nntJQa87KU0Jie5E1qMRYERZAeD7eS2IhLd64ZHcPtuD/iNSvTrNOct4s2A==","signatures":[{"sig":"MEUCIQCnkgjL+EcRIY7TywKUp+n1A/73NoNflhKykb54UP9yggIgPrbak7AmkXh8646WkG7uW16zVX1mKe0pmFxHnpiW43M=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":61598},"main":"./dist/index.js","type":"module","_from":"file:ai-setu-client-0.9.1.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"lint":"eslint src","test":"vitest run","build":"tsc -p tsconfig.json","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"ashish-agrawal-23","email":"thunder.ashish@gmail.com"},"_resolved":"/tmp/863a4bdbd64485ed4b5fbefdd3e057a4/ai-setu-client-0.9.1.tgz","_integrity":"sha512-CeNvW8pzF7l5N9W1fwUKC6ChTC6nntJQa87KU0Jie5E1qMRYERZAeD7eS2IhLd64ZHcPtuD/iNSvTrNOct4s2A==","repository":{"url":"git+https://github.com/aisetu-ai/ai-setu.git","type":"git","directory":"packages/client"},"_npmVersion":"11.13.0","description":"AI Setu client — drop-in OpenAI SDK with workspace credit accounting and multi-provider routing.","directories":{},"sideEffects":false,"_nodeVersion":"24.16.0","dependencies":{"openai":"^6.42.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"msw":"latest","vitest":"latest","typescript":"latest","@types/node":"latest"},"optionalDependencies":{"undici":"^7.16.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.9.1_1781775537322_0.23406825351267413","host":"s3://npm-registry-packages-npm-production"}},"0.11.0":{"name":"@ai-setu/client","version":"0.11.0","keywords":["ai-setu","ai-gateway","llm","openai","anthropic","bedrock","embeddings","sdk"],"license":"MIT","_id":"@ai-setu/client@0.11.0","maintainers":[{"name":"ashish-agrawal-23","email":"thunder.ashish@gmail.com"}],"homepage":"https://github.com/aisetu-ai/ai-setu/tree/main/packages/client#readme","bugs":{"url":"https://github.com/aisetu-ai/ai-setu/issues"},"dist":{"shasum":"6df22c0cb3490f4483bfa348e0cbf2d8ee2cf8fe","tarball":"https://registry.npmjs.org/@ai-setu/client/-/client-0.11.0.tgz","fileCount":36,"integrity":"sha512-2ViuLd1kA3xGsX9Lcmw4eeGGIsfOn7jHDCU3gQt3S0bSDFJlwh9m6FYbhJEZFGPuDm6E+ENm2nSXIljyL/0bFA==","signatures":[{"sig":"MEYCIQDEG8AM5QO+4tVg4oKsJU/dmKAOKsTmXj+Gk8lrYPkUuAIhAPwwJOgb+R43Ls1K4OQ59JygnFlpPuNxhqryewXa5Cya","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":144596},"main":"./dist/index.js","type":"module","_from":"file:ai-setu-client-0.11.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"lint":"eslint src","test":"vitest run","build":"tsc -p tsconfig.json","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"ashish-agrawal-23","email":"thunder.ashish@gmail.com"},"_resolved":"/tmp/04b158754838a78af13ca4ac110c5fff/ai-setu-client-0.11.0.tgz","_integrity":"sha512-2ViuLd1kA3xGsX9Lcmw4eeGGIsfOn7jHDCU3gQt3S0bSDFJlwh9m6FYbhJEZFGPuDm6E+ENm2nSXIljyL/0bFA==","repository":{"url":"git+https://github.com/aisetu-ai/ai-setu.git","type":"git","directory":"packages/client"},"_npmVersion":"11.6.2","description":"AI Setu client — drop-in OpenAI SDK with workspace credit accounting and multi-provider routing.","directories":{},"sideEffects":false,"_nodeVersion":"24.13.0","dependencies":{"openai":"^6.42.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"msw":"2.14.6","vitest":"4.1.8","typescript":"6.0.3","@types/node":"25.9.2"},"optionalDependencies":{"undici":"^7.28.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.11.0_1782055537874_0.6123759239036957","host":"s3://npm-registry-packages-npm-production"}},"0.15.0":{"name":"@ai-setu/client","version":"0.15.0","keywords":["ai-setu","ai-gateway","llm","openai","anthropic","bedrock","embeddings","sdk"],"license":"MIT","_id":"@ai-setu/client@0.15.0","maintainers":[{"name":"ashish-agrawal-23","email":"thunder.ashish@gmail.com"}],"homepage":"https://github.com/aisetu-ai/ai-setu/tree/main/packages/client#readme","bugs":{"url":"https://github.com/aisetu-ai/ai-setu/issues"},"dist":{"shasum":"4828b594f6675214d153757ffb5babc3ce69770a","tarball":"https://registry.npmjs.org/@ai-setu/client/-/client-0.15.0.tgz","fileCount":40,"integrity":"sha512-F7YKUJb4dCbELTzYQHjw1eKFBENJObojagmwwklm9C8KADNlf/J/ImeZ8BrJjHLihZ3skKZI33pOZNqnsiK44A==","signatures":[{"sig":"MEYCIQCaIdhbaUhIdBAokViuIIP53EXD9aSaVoaNxCx/1KNzXQIhAPGyjdQGK07QQmXqircNzyMr8fDUFi+D9hcdfFPMBtoi","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":158366},"main":"./dist/index.js","type":"module","_from":"file:ai-setu-client-0.15.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"lint":"eslint src","test":"vitest run","build":"tsc -p tsconfig.json","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"ashish-agrawal-23","email":"thunder.ashish@gmail.com"},"_resolved":"/tmp/7b1f4cceb5d1e93d0efe03ca11c87a5b/ai-setu-client-0.15.0.tgz","_integrity":"sha512-F7YKUJb4dCbELTzYQHjw1eKFBENJObojagmwwklm9C8KADNlf/J/ImeZ8BrJjHLihZ3skKZI33pOZNqnsiK44A==","repository":{"url":"git+https://github.com/aisetu-ai/ai-setu.git","type":"git","directory":"packages/client"},"_npmVersion":"11.6.2","description":"AI Setu client — drop-in OpenAI SDK with workspace credit accounting and multi-provider routing.","directories":{},"sideEffects":false,"_nodeVersion":"24.13.0","dependencies":{"openai":"^6.42.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"msw":"2.14.6","vitest":"4.1.8","typescript":"6.0.3","@types/node":"25.9.2"},"optionalDependencies":{"undici":"^7.28.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.15.0_1782322746228_0.6931912590536271","host":"s3://npm-registry-packages-npm-production"}},"0.16.0":{"name":"@ai-setu/client","version":"0.16.0","keywords":["ai-setu","ai-gateway","llm","openai","anthropic","bedrock","embeddings","sdk"],"license":"MIT","_id":"@ai-setu/client@0.16.0","maintainers":[{"name":"ashish-agrawal-23","email":"thunder.ashish@gmail.com"}],"homepage":"https://github.com/aisetu-ai/ai-setu/tree/main/packages/client#readme","bugs":{"url":"https://github.com/aisetu-ai/ai-setu/issues"},"dist":{"shasum":"abdc38c39edad6a9b0173cfbbe4d9c491d2ddae3","tarball":"https://registry.npmjs.org/@ai-setu/client/-/client-0.16.0.tgz","fileCount":40,"integrity":"sha512-SB5gidjB9RJ2sMBXblIEbAJcnX39sblK+NZ/kB8tF0bWy+4rNav5yNi9yXsYsJ1GQoxRYIDiI1371TOSHSkwhQ==","signatures":[{"sig":"MEUCICbIBjgvZEVJbsg09O9GEKt4+YJd31p5feDuF4S5F1l2AiEA8BvD9FIACA5P5S1VSn+Rw3dAq9FJ7nMprKC1vorWCkI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":160722},"main":"./dist/index.js","type":"module","_from":"file:ai-setu-client-0.16.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"lint":"eslint src","test":"vitest run","build":"tsc -p tsconfig.json","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"ashish-agrawal-23","email":"thunder.ashish@gmail.com"},"_resolved":"/tmp/a1763a909ec588b065511d034e20c49b/ai-setu-client-0.16.0.tgz","_integrity":"sha512-SB5gidjB9RJ2sMBXblIEbAJcnX39sblK+NZ/kB8tF0bWy+4rNav5yNi9yXsYsJ1GQoxRYIDiI1371TOSHSkwhQ==","repository":{"url":"git+https://github.com/aisetu-ai/ai-setu.git","type":"git","directory":"packages/client"},"_npmVersion":"11.6.2","description":"AI Setu client — drop-in OpenAI SDK with workspace credit accounting and multi-provider routing.","directories":{},"sideEffects":false,"_nodeVersion":"24.13.0","dependencies":{"openai":"^6.42.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"msw":"2.14.6","vitest":"4.1.8","typescript":"6.0.3","@types/node":"25.9.2"},"optionalDependencies":{"undici":"^7.28.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.16.0_1782358712951_0.7067265525251234","host":"s3://npm-registry-packages-npm-production"}},"0.16.1":{"name":"@ai-setu/client","version":"0.16.1","keywords":["ai-setu","ai-gateway","llm","openai","anthropic","bedrock","embeddings","sdk"],"license":"MIT","_id":"@ai-setu/client@0.16.1","maintainers":[{"name":"ashish-agrawal-23","email":"thunder.ashish@gmail.com"}],"homepage":"https://github.com/aisetu-ai/ai-setu/tree/main/packages/client#readme","bugs":{"url":"https://github.com/aisetu-ai/ai-setu/issues"},"dist":{"shasum":"815be3f9428d96f157958cd218cf00a9115ea271","tarball":"https://registry.npmjs.org/@ai-setu/client/-/client-0.16.1.tgz","fileCount":40,"integrity":"sha512-Rd1r8l/uotOQDUqwwTUVbwFZbxolUiP/42OxHTNx1/8FceRGdFycsi5N5wDQSuWD0qI0cwYQFmKqeRtcVURgew==","signatures":[{"sig":"MEUCICbgR4natvcp9kt3ucAwTrnc437Ux7qYONS4CO7p1s8lAiEAyYMNP+q3sbZQEqztq8tcIccfJlKkaDdjcnm20wabOKY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":161911},"main":"./dist/index.js","type":"module","_from":"file:ai-setu-client-0.16.1.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"lint":"eslint src","test":"vitest run","build":"tsc -p tsconfig.json","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"ashish-agrawal-23","email":"thunder.ashish@gmail.com"},"_resolved":"/tmp/519f21b7b6f884d4617c3b597f762286/ai-setu-client-0.16.1.tgz","_integrity":"sha512-Rd1r8l/uotOQDUqwwTUVbwFZbxolUiP/42OxHTNx1/8FceRGdFycsi5N5wDQSuWD0qI0cwYQFmKqeRtcVURgew==","repository":{"url":"git+https://github.com/aisetu-ai/ai-setu.git","type":"git","directory":"packages/client"},"_npmVersion":"11.6.2","description":"AI Setu client — drop-in OpenAI SDK with workspace credit accounting and multi-provider routing.","directories":{},"sideEffects":false,"_nodeVersion":"24.13.0","dependencies":{"openai":"^6.42.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"msw":"2.14.6","vitest":"4.1.8","typescript":"6.0.3","@types/node":"25.9.2"},"optionalDependencies":{"undici":"^7.28.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.16.1_1782363997021_0.11345535602978707","host":"s3://npm-registry-packages-npm-production"}},"0.17.0":{"name":"@ai-setu/client","version":"0.17.0","keywords":["ai-setu","ai-gateway","llm","openai","anthropic","bedrock","embeddings","sdk"],"license":"MIT","_id":"@ai-setu/client@0.17.0","maintainers":[{"name":"ashish-agrawal-23","email":"thunder.ashish@gmail.com"}],"homepage":"https://github.com/aisetu-ai/ai-setu/tree/main/packages/client#readme","bugs":{"url":"https://github.com/aisetu-ai/ai-setu/issues"},"dist":{"shasum":"517669b5ba6ee226ee02be9065cc6fdfc0185e62","tarball":"https://registry.npmjs.org/@ai-setu/client/-/client-0.17.0.tgz","fileCount":44,"integrity":"sha512-/G7QgXYPeIKWzYJFs7oz8U/P6aGOu9ZEnsPDNRKOCsvJ8LC0XHSBc/9KBwYvIr4oM7xqXtHbjt5dHHcX4jJPSg==","signatures":[{"sig":"MEQCIEjdfEKkoH9b16XU9aZGgDYXkEgSS9qmhTvusvRHV8QGAiBKMrj5In6UzkIIXFLpcoMQkQUzP3FRtmJcf3dfC6j1Tg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":218256},"main":"./dist/index.js","type":"module","_from":"file:ai-setu-client-0.17.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"lint":"eslint src","test":"vitest run","build":"tsc -p tsconfig.json","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"ashish-agrawal-23","email":"thunder.ashish@gmail.com"},"_resolved":"/tmp/d6cb4cf04a954d9c039338e60183ccfe/ai-setu-client-0.17.0.tgz","_integrity":"sha512-/G7QgXYPeIKWzYJFs7oz8U/P6aGOu9ZEnsPDNRKOCsvJ8LC0XHSBc/9KBwYvIr4oM7xqXtHbjt5dHHcX4jJPSg==","repository":{"url":"git+https://github.com/aisetu-ai/ai-setu.git","type":"git","directory":"packages/client"},"_npmVersion":"11.16.0","description":"AI Setu client — drop-in OpenAI SDK with workspace credit accounting and multi-provider routing.","directories":{},"sideEffects":false,"_nodeVersion":"24.18.0","dependencies":{"openai":"^6.42.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"msw":"2.14.6","vitest":"4.1.8","typescript":"7.0.2","@types/node":"25.9.2"},"optionalDependencies":{"undici":"^7.28.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.17.0_1786420338096_0.9452314060542797","host":"s3://npm-registry-packages-npm-production"}},"0.19.0":{"name":"@ai-setu/client","version":"0.19.0","keywords":["ai-setu","ai-gateway","llm","openai","anthropic","bedrock","embeddings","sdk"],"license":"MIT","_id":"@ai-setu/client@0.19.0","maintainers":[{"name":"ashish-agrawal-23","email":"thunder.ashish@gmail.com"}],"homepage":"https://github.com/aisetu-ai/ai-setu/tree/main/packages/client#readme","bugs":{"url":"https://github.com/aisetu-ai/ai-setu/issues"},"dist":{"shasum":"7f89cd3c6ac619925f86177026e86d8e0f03e518","tarball":"https://registry.npmjs.org/@ai-setu/client/-/client-0.19.0.tgz","fileCount":48,"integrity":"sha512-vHXBi+3p7FxMUzOhvYHbVEm03BhuO4oe4bjnWzDsoKwsGnvnUUlfTbsHqxsndj2w6h+TjiP8YbY+/748Y4l3pA==","signatures":[{"sig":"MEYCIQCmgzEeoX79NjfWbqymHC7ArmW552fm7BufIEKXOOcTdQIhALGbLhh1T4P9ucIWRAR/kftSAkbfIdNc1GJArJP5wjE+","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":272832},"main":"./dist/index.js","type":"module","_from":"file:ai-setu-client-0.19.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"lint":"eslint src","test":"vitest run","build":"tsc -p tsconfig.json","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"ashish-agrawal-23","email":"thunder.ashish@gmail.com"},"_resolved":"/tmp/a603d78b1f066609bb4bb467503ad1b0/ai-setu-client-0.19.0.tgz","_integrity":"sha512-vHXBi+3p7FxMUzOhvYHbVEm03BhuO4oe4bjnWzDsoKwsGnvnUUlfTbsHqxsndj2w6h+TjiP8YbY+/748Y4l3pA==","repository":{"url":"git+https://github.com/aisetu-ai/ai-setu.git","type":"git","directory":"packages/client"},"_npmVersion":"11.17.0","description":"AI Setu client — drop-in OpenAI SDK with workspace credit accounting and multi-provider routing.","directories":{},"sideEffects":false,"_nodeVersion":"24.19.0","dependencies":{"openai":"^6.42.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"msw":"2.14.6","vitest":"4.1.8","typescript":"7.0.2","@types/node":"25.9.2"},"optionalDependencies":{"undici":"^7.28.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.19.0_1787464161573_0.5309725272095962","host":"s3://npm-registry-packages-npm-production"}},"0.20.0":{"name":"@ai-setu/client","version":"0.20.0","keywords":["ai-setu","ai-gateway","llm","openai","anthropic","bedrock","embeddings","sdk"],"license":"MIT","_id":"@ai-setu/client@0.20.0","maintainers":[{"name":"ashish-agrawal-23","email":"thunder.ashish@gmail.com"}],"homepage":"https://github.com/aisetu-ai/ai-setu/tree/main/packages/client#readme","bugs":{"url":"https://github.com/aisetu-ai/ai-setu/issues"},"dist":{"shasum":"25c92f97890076dfbb8d2a0c56d58e3d0d3f8fff","tarball":"https://registry.npmjs.org/@ai-setu/client/-/client-0.20.0.tgz","fileCount":52,"integrity":"sha512-E/o7WtHuprpQjpe9kRbvpqla4uYFVjYn4kfAij3cX6wanSbl8GrkqA3OLpmNd8fA7S9Rvgv05dKJs3bD/f45aQ==","signatures":[{"sig":"MEYCIQDT+O5V1NccNBrRaUGKnG5hWrAFdABrgMyZmWP+8hdT4AIhAIVBng5b1yPBs75JKMWTMDxkKol0YWcvuukCDJpv2XPb","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":290236},"main":"./dist/index.js","type":"module","_from":"file:ai-setu-client-0.20.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"lint":"eslint src","test":"vitest run","build":"tsc -p tsconfig.json","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"ashish-agrawal-23","email":"thunder.ashish@gmail.com"},"_resolved":"/tmp/6f338e52468c467c01271db4c49467fa/ai-setu-client-0.20.0.tgz","_integrity":"sha512-E/o7WtHuprpQjpe9kRbvpqla4uYFVjYn4kfAij3cX6wanSbl8GrkqA3OLpmNd8fA7S9Rvgv05dKJs3bD/f45aQ==","repository":{"url":"git+https://github.com/aisetu-ai/ai-setu.git","type":"git","directory":"packages/client"},"_npmVersion":"11.17.0","description":"AI Setu client — drop-in OpenAI SDK with workspace credit accounting and multi-provider routing.","directories":{},"sideEffects":false,"_nodeVersion":"24.19.0","dependencies":{"openai":"^6.42.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"msw":"2.14.6","vitest":"4.1.8","typescript":"7.0.2","@types/node":"25.9.2"},"optionalDependencies":{"undici":"^7.28.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.20.0_1787858076271_0.170685878547997","host":"s3://npm-registry-packages-npm-production"}},"0.20.1":{"name":"@ai-setu/client","version":"0.20.1","keywords":["ai-setu","ai-gateway","llm","openai","anthropic","bedrock","embeddings","sdk"],"license":"MIT","_id":"@ai-setu/client@0.20.1","maintainers":[{"name":"ashish-agrawal-23","email":"thunder.ashish@gmail.com"}],"homepage":"https://github.com/aisetu-ai/ai-setu/tree/main/packages/client#readme","bugs":{"url":"https://github.com/aisetu-ai/ai-setu/issues"},"dist":{"shasum":"1f9997cd2a5035c9be98c7d513e6bb17903074eb","tarball":"https://registry.npmjs.org/@ai-setu/client/-/client-0.20.1.tgz","fileCount":52,"integrity":"sha512-l72cg2ina8ZlVjtWcpMea5J1g0AS7/kX0tqNlpNueNS9J1SdLCsjZrCu9NO5YN/z+8WJG2y9Z0WXUqkMVVVsMw==","signatures":[{"sig":"MEUCIQCfuzZ/+PJbmV4L5uUdD/7qDVmGOapOsvsKRTwsgwh1uQIgeK9tW0fTh6+h3HFHY+6PligRykAkBLDl8ho8tLtu0Jw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":290282},"main":"./dist/index.js","type":"module","_from":"file:ai-setu-client-0.20.1.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"lint":"eslint src","test":"vitest run","build":"tsc -p tsconfig.json","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"ashish-agrawal-23","email":"thunder.ashish@gmail.com"},"_resolved":"/tmp/d4c2af38a5df006d0f92c27ae3b5dbbe/ai-setu-client-0.20.1.tgz","_integrity":"sha512-l72cg2ina8ZlVjtWcpMea5J1g0AS7/kX0tqNlpNueNS9J1SdLCsjZrCu9NO5YN/z+8WJG2y9Z0WXUqkMVVVsMw==","repository":{"url":"git+https://github.com/aisetu-ai/ai-setu.git","type":"git","directory":"packages/client"},"_npmVersion":"11.17.0","description":"AI Setu client — drop-in OpenAI SDK with workspace credit accounting and multi-provider routing.","directories":{},"sideEffects":false,"_nodeVersion":"24.19.0","dependencies":{"openai":"^6.42.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"msw":"2.14.6","vitest":"4.1.8","typescript":"7.0.2","@types/node":"25.9.2"},"optionalDependencies":{"undici":"^7.28.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.20.1_1787946772140_0.9606513764100244","host":"s3://npm-registry-packages-npm-production"}},"0.20.2":{"name":"@ai-setu/client","version":"0.20.2","description":"AI Setu client — drop-in OpenAI SDK with workspace credit accounting and multi-provider routing.","type":"module","sideEffects":false,"main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"engines":{"node":">=20"},"license":"MIT","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/aisetu-ai/ai-setu.git","directory":"packages/client"},"dependencies":{"openai":"^6.42.0"},"optionalDependencies":{"undici":"^7.28.0"},"devDependencies":{"@types/node":"25.9.2","msw":"2.14.6","typescript":"7.0.2","vitest":"4.1.8"},"homepage":"https://github.com/aisetu-ai/ai-setu/tree/main/packages/client#readme","bugs":{"url":"https://github.com/aisetu-ai/ai-setu/issues"},"keywords":["ai-setu","ai-gateway","llm","openai","anthropic","bedrock","embeddings","sdk"],"scripts":{"build":"tsc -p tsconfig.json","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit","lint":"eslint src","test":"vitest run"},"_id":"@ai-setu/client@0.20.2","_integrity":"sha512-wtLeg/oH10dm4h7qIQtYnUTpy0HJIVWWObGlyYUyP9MV0Tf5FIjtCn6aIEIHgtN5FEdWx9f11voNLypCs6Mvsw==","_resolved":"/tmp/6d8f5ebb0a5e8113d880ea6f3a72df5a/ai-setu-client-0.20.2.tgz","_from":"file:ai-setu-client-0.20.2.tgz","_nodeVersion":"24.19.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-wtLeg/oH10dm4h7qIQtYnUTpy0HJIVWWObGlyYUyP9MV0Tf5FIjtCn6aIEIHgtN5FEdWx9f11voNLypCs6Mvsw==","shasum":"3675692309e14c745ff670c1be35fae45b98e245","tarball":"https://registry.npmjs.org/@ai-setu/client/-/client-0.20.2.tgz","fileCount":52,"unpackedSize":291968,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIATZZOxsEZrH4S6SBpoZnXUR9U+BbFpOeAtlSqSwpVb8AiB9Qf5Fb4FGeC62+/xOsi2CUa2qwJioVCaa96dOHFymFg=="}]},"_npmUser":{"name":"ashish-agrawal-23","email":"thunder.ashish@gmail.com"},"directories":{},"maintainers":[{"name":"ashish-agrawal-23","email":"thunder.ashish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/client_0.20.2_1788079214751_0.15095243166690975"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-17T21:55:08.475Z","modified":"2026-08-30T08:40:15.081Z","0.9.0":"2026-06-17T21:55:08.759Z","0.9.1":"2026-06-18T09:38:57.465Z","0.11.0":"2026-06-21T15:25:38.008Z","0.15.0":"2026-06-24T17:39:06.374Z","0.16.0":"2026-06-25T03:38:33.092Z","0.16.1":"2026-06-25T05:06:37.190Z","0.17.0":"2026-08-11T03:52:18.239Z","0.19.0":"2026-08-23T05:49:21.714Z","0.20.0":"2026-08-27T19:14:36.415Z","0.20.1":"2026-08-28T19:52:52.290Z","0.20.2":"2026-08-30T08:40:14.881Z"},"bugs":{"url":"https://github.com/aisetu-ai/ai-setu/issues"},"license":"MIT","homepage":"https://github.com/aisetu-ai/ai-setu/tree/main/packages/client#readme","keywords":["ai-setu","ai-gateway","llm","openai","anthropic","bedrock","embeddings","sdk"],"repository":{"type":"git","url":"git+https://github.com/aisetu-ai/ai-setu.git","directory":"packages/client"},"description":"AI Setu client — drop-in OpenAI SDK with workspace credit accounting and multi-provider routing.","maintainers":[{"name":"ashish-agrawal-23","email":"thunder.ashish@gmail.com"}],"readme":"# @ai-setu/client\n\n> **Read this first, agent.** This package = drop-in for the official\n> `openai` SDK, pointed at the [AI Setu](https://aisetu.ai) gateway. If you\n> know OpenAI SDK, you know this. Same methods, same shapes, same streaming.\n> Only thing change: one workspace key, and `model` carry a `provider/`\n> prefix. Everything below is copy-paste safe.\n\n## TL;DR (the only three lines you need)\n\n```bash\nnpm i @ai-setu/client\nexport AI_SETU_API_KEY=tt_live_…\n```\n\n```ts\nimport { AiSetu } from '@ai-setu/client';\nconst client = new AiSetu();\nconst res = await client.chat.completions.create({\n  model: 'openai/gpt-4o-mini',\n  messages: [{ role: 'user', content: 'hi' }],\n});\nconsole.log(res.choices[0].message.content);\n```\n\nDone. `new AiSetu()` with no args read `AI_SETU_API_KEY` from env. No\n`baseURL`, no `createClient`, no factory. One import, one symbol.\n\n## Rules for agent (follow these, no guess)\n\n1. **Model string `provider/model`** (platform key) **or `@<slug>/<model>`**\n   (your BYOK Connection — see below). Good: `openai/gpt-4o-mini`,\n   `anthropic/claude-sonnet-4-5`, `@azure-qdc/gpt-4o-mini`. A bare name with no\n   prefix routes by catalog.\n2. **No pick endpoint.** Client talk to gateway only. You no set URLs for\n   normal use. Provider chosen by the `model` prefix, not by base URL.\n3. **Method names = OpenAI SDK exactly.** `chat.completions.create`,\n   `embeddings.create`, streaming by `stream: true` + `for await`. Whatever\n   you learned on `openai`, it transfer here unchanged.\n4. **Key go in env `AI_SETU_API_KEY`** (shape `tt_live_…`). Or pass\n   `new AiSetu({ apiKey })`. Never hardcode key in source you commit.\n5. **Need balance / usage / keys?** That NOT this package. Use\n   [`@ai-setu/admin`](https://www.npmjs.com/package/@ai-setu/admin). This one\n   stay pure inference.\n6. **Node ≥ 20** or edge runtime (Vercel, Cloudflare Workers).\n\n## Models — pick by prefix\n\n```\nopenai/gpt-4o            openai/gpt-4o-mini       openai/text-embedding-3-small\nanthropic/claude-sonnet-4-5                       anthropic/claude-haiku-4-5\nbedrock/us.anthropic.claude-haiku-4-5-20251001-v1:0   (BYOK — your AWS account)\n```\n\n## Streaming (same as OpenAI)\n\n```ts\nconst stream = await client.chat.completions.create({\n  model: 'anthropic/claude-sonnet-4-5',\n  messages: [{ role: 'user', content: 'Write me a haiku.' }],\n  stream: true,\n});\nfor await (const chunk of stream) {\n  process.stdout.write(chunk.choices[0]?.delta?.content ?? '');\n}\n```\n\n## Responses API (`client.responses`)\n\nSame SDK method you already know — it now reach the gateway on `/v1/responses`.\n\n```ts\nconst r = await client.responses.create({\n  model: 'openai/gpt-4o-mini',\n  instructions: 'You are a concise support assistant.',\n  input: [{ role: 'user', content: 'do you have anything in a darker fabric' }],\n  max_output_tokens: 400,\n});\n```\n\nTwo rules, both easy to trip:\n\n1. **OpenAI-family models only.** `openai`, `bedrock-mantle`, `groq`, `xai`,\n   `deepseek`, `mistral`. Anthropic, Gemini, Bedrock and Vertex have no Responses\n   surface — they fail closed with a clear error, no silent fallback.\n2. **Reasoning spell different per surface.** Here it `reasoning: { effort: 'none' }`.\n   On `chat.completions` it `reasoning_effort: 'none'`. Each reject the other.\n\nUsage come back in the Responses shape — `usage.input_tokens` /\n`output_tokens`, cache counters under `usage.input_tokens_details` — not the\nchat shape. `promptCacheStats` read both, so no branch needed.\n\n**Semantic caching no apply on this route.** It and per-tool cache policies read\n`messages`, which a Responses body no carry. Exact caching, prompt caching,\nbudgets, rate limits all work normal. Need semantic? Use `chat.completions`.\n\n## What the gateway actually route\n\n`AiSetu` extend the `openai` SDK, so your editor show every OpenAI method.\nInherited is not the same as routed:\n\n| Method             | Status                 |\n| ------------------ | ---------------------- |\n| `chat.completions` | served                 |\n| `responses`        | served (OpenAI-family) |\n| `embeddings`       | served                 |\n| `files`, `batches` | **404** — no route     |\n\n## Embeddings\n\n```ts\nconst e = await client.embeddings.create({\n  model: 'openai/text-embedding-3-small',\n  input: 'hello world',\n});\n```\n\n## Errors — catch logic from OpenAI SDK transfer straight\n\nUse type guards, no `instanceof` on subclasses. Reason: the `openai` SDK make\n`APIError` itself from inside its pipeline, so subclass drift every release.\nGuard narrow the type back to `APIError` — you still get `err.code`,\n`err.status`, `err.requestID`.\n\n```ts\nimport {\n  AuthenticationError,\n  RateLimitError,\n  isInsufficientCreditsError,\n  getInsufficientCreditsDetails,\n  isProviderError,\n} from '@ai-setu/client';\n\ntry {\n  await client.chat.completions.create({\n    /* … */\n  });\n} catch (err) {\n  if (err instanceof AuthenticationError) {\n    /* bad key */\n  } else if (err instanceof RateLimitError) {\n    /* slow down */\n  } else if (isInsufficientCreditsError(err)) {\n    const { balanceMicros, topupUrl } = getInsufficientCreditsDetails(err);\n    console.error(`Out of credits (balance ${balanceMicros} micros). Top up: ${topupUrl}`);\n  } else if (isProviderError(err)) {\n    /* upstream provider broke */\n  }\n}\n```\n\n## Environments — one switch move whole app\n\nDefault = production (`gateway.aisetu.ai`). Point at a different gateway (e.g. a\nself-hosted deployment) with a full URL override:\n\n```bash\nexport AI_SETU_BASE_URL=https://gateway.your-deployment.example.com\n```\n\nPrecedence (first match win):\n\n1. `new AiSetu({ baseUrl })` — explicit per-instance\n2. `AI_SETU_BASE_URL` — full URL override (self-host / on-prem)\n3. production default\n\n(Base always normalise to end in `/v1`.)\n\n## Runtime + connection pooling (you usually no touch this)\n\n- **Node ≥ 20** — one process-wide keep-alive `undici.Agent` back every\n  `AiSetu`. Sequential calls reuse the TCP connection (~5ms p50 vs ~30ms cold).\n- **Edge (Cloudflare Workers / Vercel)** — fall back to platform fetch, which\n  already pool. `undici` is optional dep, edge bundlers skip it.\n\nPool defaults: `connections 32`, `allowH2 true`, `keepAliveTimeout 30s`,\n`keepAliveMaxTimeout 90s` (match gateway idle), `bodyTimeout 0` (no cap —\nlong thinking-model streams can run for minutes; cancel with `AbortSignal`).\n\nOverride the pool only if you must:\n\n```ts\nimport { Agent, ProxyAgent } from 'undici';\nimport { AiSetu } from '@ai-setu/client';\n\n// Corporate proxy:\nconst proxied = new AiSetu({ dispatcher: new ProxyAgent({ uri: 'http://proxy:8080' }) });\n\n// Self-signed CA (baseUrl normalise to …/v1):\nconst onPrem = new AiSetu({\n  baseUrl: 'https://gateway.internal.example',\n  dispatcher: new Agent({ connect: { ca: fs.readFileSync('ca.pem') } }),\n});\n\n// No pooling at all (platform fetch on Node):\nconst unpooled = new AiSetu({ dispatcher: null });\n```\n\nProcess-wide swap (before any `AiSetu` construct), or share the singleton with\nsibling SDKs:\n\n```ts\nimport { setSharedDispatcher, getSharedDispatcher } from '@ai-setu/client';\nimport { Agent } from 'undici';\nimport { AiSetuAdmin } from '@ai-setu/admin';\n\nsetSharedDispatcher(new Agent({ connections: 64, allowH2: true }));\nconst admin = new AiSetuAdmin({ dispatcher: getSharedDispatcher() });\n```\n\n## BYOK: route per request with `@<slug>/<model>`\n\nYour provider keys live in **Connections** (each has a `slug`). Pick one **per\nrequest** inside the model string — `@<slug>/<model>` — and the gateway routes\nthrough that Connection's key. One client, mix Connections freely, no re-init.\nA leading `@` marks a slug (so a slug can equal a provider name); an unknown or\nout-of-scope slug **fails closed** (4xx), never a silent platform-key fallback.\n\n```ts\nconst c = new AiSetu();\n\nawait c.chat.completions.create({\n  model: '@azure-qdc/gpt-5.4-mini', // route via the Connection slug \"azure-qdc\"\n  messages: [{ role: 'user', content: 'hi' }],\n});\n\nawait c.chat.completions.create({\n  model: 'openai/gpt-4o-mini', // platform key (no @slug)\n  messages: [{ role: 'user', content: 'hi' }],\n});\n```\n\nPin one Connection for the whole client with the `connection` option (a leading\n`@` is optional):\n\n```ts\nconst c = new AiSetu({ connection: '@azure-qdc' });\n```\n\n## Caching — turn it on in the SDK, not in headers\n\nCheapest saving first, in the order worth adopting.\n\n### 1. Prompt caching — already on, costs you nothing\n\nThe provider skips re-prefilling the unchanged prefix of your prompt (system\nprompt, tool definitions, settled conversation) and discounts those tokens.\nThe model **still runs**, the output is **still fresh** — no staleness risk at\nall. Nothing to switch on. Most agent workloads get half their prompt\ndiscounted this way without noticing:\n\n```ts\nimport { promptCacheStats } from '@ai-setu/client';\n\nconst res = await c.chat.completions.create({ model, messages });\npromptCacheStats(res);\n// { inputTokens: 1000, cachedTokens: 3000, writeTokens: 0, ratio: 0.75 }\n```\n\n`ratio` is the share of the prompt that avoided a full-price prefill. Reads\nboth the OpenAI and Anthropic usage shapes, so you don't branch on provider.\nKeep the stable part of your prompt **first and unchanged** — a timestamp or a\nsession id at the top of the system prompt destroys the prefix for every call.\n\n### 2. Response caching — a hit costs $0 and returns in ~3ms\n\nDefault: the gateway caches when `temperature` is unset or `0`, keyed on the\nexact request body, for 600 seconds. Set client-wide defaults, then override\nper request:\n\n```ts\nconst c = new AiSetu({\n  cache: {\n    policy: 'support-faq', // TTL + stale window live in the console, not in code\n    namespace: 'tenant-42', // keep one end-user's entries off another's\n  },\n});\n\nawait c.chat.completions.create(\n  { model: '@mantle/zai.glm-4.7-flash', messages },\n  c.withCache({ ttl: '2h', tags: ['sku:123'] }),\n);\n```\n\n| option      | what it fixes                                                                                        |\n| ----------- | ---------------------------------------------------------------------------------------------------- |\n| `policy`    | bursty traffic expiring between bursts — sets TTL + stale-while-revalidate once, for every call site |\n| `ttl`       | one-off duration: `3600`, `'30s'`, `'10m'`, `'2h'`, `'1d'`. Capped by the policy ceiling             |\n| `namespace` | per-end-user / per-environment partition                                                             |\n| `tags`      | `['sku:123']` — revalidate when the data changes instead of waiting out the TTL                      |\n| `force`     | cache a `temperature > 0` call anyway (classification, extraction, routing)                          |\n| `mode`      | `off` (bypass) \\| `no-store` (read, never write) \\| `force-refresh` (overwrite) \\| `semantic`        |\n\nA **policy plus tags** beats a long bare TTL: tags let you hold an answer for\nhours and still drop it the moment the underlying data changes.\n\nBad values **throw** — a typo'd policy name would otherwise be dropped by the\ngateway and leave you with caching that silently does nothing.\n\n### 3. Caching inside agent loops — policy per tool\n\nAgent turns are the most expensive traffic and the least cacheable, because a\ntool result embeds live data. You can't decide that per request — incoming text\nis arbitrary. But you _do_ know what each tool does when you add it, so the\npolicy rides with the tool:\n\n```ts\nimport { withToolCache } from '@ai-setu/client';\n\nconst tools = [\n  withToolCache(getCatalog, { policy: 'catalog', tags: ['catalog', 'sku:{sku}'] }),\n  withToolCache(getBrandStory, { policy: 'brand-voice' }),\n  withToolCache(addToCart, { cache: false }),\n  withToolCache(checkout, { cache: false }),\n];\n```\n\n| declaration                  | meaning                                             |\n| ---------------------------- | --------------------------------------------------- |\n| `{ cache: false }`           | never cache a turn that invoked this tool           |\n| `{ policy: 'catalog' }`      | that workspace policy's numbers — **preferred**     |\n| `{ ttl: '60s', swr: '10m' }` | inline, if no policies configured yet               |\n| `{ tags: ['sku:{sku}'] }`    | interpolated from that call's arguments → `sku:9f2` |\n\nThe turn's cacheability is derived from the tools it actually invoked. Any tool\nsaying `cache: false` bypasses the whole turn; TTL and SWR take the **minimum**\nacross participating tools, so a turn touching the catalogue (60s) and the brand\nstory (24h) is only as fresh as the catalogue. Undeclared tools block nothing.\n\nBypass is visible rather than silent:\n\n```ts\nclient.lastCache;\n// { status: 'bypass', hit: false, semantic: false, bypassedByTool: 'addToCart' }\n```\n\n### 4. Semantic caching — opt-in, and not the first thing to reach for\n\n`mode: 'semantic'` matches paraphrases, not just byte-identical bodies. Real\nvalue for FAQ-shaped traffic — but it is **not** free and it is **not** the\ndefault fix for a low hit rate:\n\n- Every exact-**miss** pays an embedding round trip (~342ms today) before the\n  provider is even called. On a workload whose misses already take ~600ms, that\n  is a large latency add on the common path.\n- Match quality is English-leaning. Hindi and Arabic-family paraphrase matching\n  is currently weak, Hinglish middling — code-switching traffic may miss real\n  paraphrases and match across intents.\n\nUse it where answers are short, repetitive, English, and latency-tolerant.\nRaise `threshold` (`0`–`1`, default `0.8`) if near-misses are being served.\nExhaust prompt caching, a policy, and tags first.\n\n### 5. Conversational AI — split the turn, or nothing hits\n\nIf you build a voice or chat agent, this is the section that decides your hit rate.\n\nOne user utterance normally fans out into several provider calls, and they are not\nequally cacheable. The reply is personalised and unique per customer per turn. The\nintent classification behind it depends on nothing but the words the customer said.\nAsk one prompt to do both and the whole turn inherits the cacheability of the reply —\nwhich is zero. That reads as a threshold to tune; it is a decomposition to do.\n\nIssue the shareable parts as their own calls:\n\n```ts\nimport { AiSetu, normalizeUtterance, sharedCacheOptions } from '@ai-setu/client';\n\n// Intent classification — shared by every customer who ever says it.\nconst classifier = new AiSetu().withCache(sharedCacheOptions({ policy: 'intent' }));\nawait classifier.chat.completions.create({\n  model,\n  temperature: 0,\n  messages: [\n    { role: 'system', content: INTENT_LABELS }, // frozen — interpolate nothing\n    { role: 'user', content: normalizeUtterance(transcript) },\n  ],\n});\n\n// FAQ answer — paraphrase-matched, dropped when the article changes.\nconst faq = new AiSetu().withCache(\n  sharedCacheOptions({ mode: 'semantic', policy: 'faq', tags: ['kb:returns-policy'] }),\n);\n```\n\n`normalizeUtterance` matters more than it looks: the exact cache canonicalises JSON\nbut never rewrites message text, so `\"Cancel my order\"` and `\"cancel my order\"` are\ntwo entries.\n\n`sharedCacheOptions` sets `force` (classifiers usually run at `temperature > 0`) and\n**throws if you pass a `namespace`**. That is deliberate — a namespace partitions the\nkeyspace, so a per-customer one on a shareable call gives you a zero hit rate with no\nerror anywhere. It is the most expensive mistake on this surface.\n\nThe highest-leverage trick needs no SDK at all: **cache the impersonal body, splice\nthe name in afterwards.** If the model does not need to reason _over_ a personal\nfield, keep it out of the prompt.\n\nFull patterns, including the prompt shape that keeps prompt caching working across\nturns:\n[docs.aisetu.ai/concepts/conversational-caching](https://docs.aisetu.ai/concepts/conversational-caching).\n\n### Prove it hit\n\n```ts\nconst c = new AiSetu({\n  onCache: (info) => metrics.increment(info.hit ? 'cache.hit' : 'cache.miss'),\n});\n\nawait c.chat.completions.create({ model, messages });\nc.lastCache;\n// { status: 'hit', hit: true, semantic: false, ageSeconds: 42 }\n```\n\n`CacheInfo`:\n\n| field            | meaning                                                                |\n| ---------------- | ---------------------------------------------------------------------- |\n| `status`         | `hit` \\| `semantic-hit` \\| `stale` \\| `miss` \\| `refresh`              |\n| `hit`            | `true` when no provider call happened (`hit`, `semantic-hit`, `stale`) |\n| `semantic`       | a similarity match served it                                           |\n| `ageSeconds`     | age of the served entry                                                |\n| `similarity`     | cosine similarity, semantic hits only                                  |\n| `bypassedByTool` | the tool whose declaration blocked the turn, on `bypass` only          |\n\n`lastCache` stays `undefined` when the request was not cacheable at all — a\n`temperature > 0` call without `force`, or `mode: 'off'`. That is the signal\nthat nothing was even looked up, distinct from a `miss`.\n\nOne hit-rate killer the SDK can't fix for you: **spell the model the same way\nevery time.** `zai.glm-4.7-flash` and `@mantle/zai.glm-4.7-flash` are different\ncache partitions.\n\n## Verify your BYOK Connection served (not the platform key)\n\nThe gateway stamps attribution headers on every response; the SDK parses them\nso you can confirm — per request — that your own key served:\n\n```ts\nconst c = new AiSetu({\n  onRouting: (r) => {\n    if (!r.byok) throw new Error('expected BYOK, got platform key — bad slug?');\n  },\n});\n\nawait c.chat.completions.create({\n  model: '@azure-qdc/gpt-5.4-mini',\n  messages: [{ role: 'user', content: 'hi' }],\n});\n\n// Or read synchronously after any call:\nc.lastRouting;\n// { provider: 'openai', byok: true,\n//   credentialId: '…uuid…', connectionSlug: 'azure-qdc' }\n```\n\n`RoutingInfo`:\n\n| field             | meaning                                                            |\n| ----------------- | ------------------------------------------------------------------ |\n| `provider`        | provider that served (`openai`, `anthropic`, …)                    |\n| `byok`            | `true` = your key served; `false` = platform key (or unknown slug) |\n| `credentialId`    | the Credential that served (BYOK only)                             |\n| `connectionSlug`  | the Connection slug that served (BYOK only)                        |\n| `credentialLabel` | **deprecated** alias of `connectionSlug` (same value)              |\n\nCallback is best-effort — an exception inside `onRouting` is swallowed so a\nfaulty listener can't break inference. Headers absent (gateway older than this\nfeature) → no callback, `lastRouting` stays `undefined`. Credential id / slug\nare not secrets — you own the Connection.\n\n> **Legacy:** the `workspaceCredential` option + the `label/model` model string\n> are deprecated. `workspaceCredential` still works (alias of `connection`); the\n> bare `label/model` form does **not** — use `@<slug>/<model>`.\n\n## Why not raw OpenAI SDK with custom baseURL?\n\nYou can. `AiSetu` just do it for you and add: env-var-first construct\n(`new AiSetu()` no args), keep-alive pool tuned to the gateway, and per-request\nBYOK routing (`@<slug>/<model>` / the `connection` option). No care about those?\nPoint `openai` at the gateway yourself.\n\n## The four AI Setu packages — which one you grab\n\n| Package                                                            | Use it when                                                                      |\n| ------------------------------------------------------------------ | -------------------------------------------------------------------------------- |\n| [`@ai-setu/client`](https://www.npmjs.com/package/@ai-setu/client) | **Runtime agent / app** call inference. Drop-in for `openai`.                    |\n| [`@ai-setu/admin`](https://www.npmjs.com/package/@ai-setu/admin)   | **Scripts / CI / builder agent** run control-plane ops in TypeScript.            |\n| [`@ai-setu/cli`](https://www.npmjs.com/package/@ai-setu/cli)       | Same control-plane ops from the **shell**.                                       |\n| [`@ai-setu/mcp`](https://www.npmjs.com/package/@ai-setu/mcp)       | **Builder agent** (Claude Code, Cursor) drive onboarding + ops conversationally. |\n\nFull agent runbook = [llms.txt](https://github.com/aisetu-ai/ai-setu/blob/main/llms.txt).\n\n## License\n\nMIT.\n","readmeFilename":"README.md"}