{"_id":"@bytebitlabs/nest-anthropic","_rev":"7-5be29e827b0bf2bf0d64e07c312a44dc","name":"@bytebitlabs/nest-anthropic","dist-tags":{"latest":"1.1.0"},"versions":{"0.1.0":{"name":"@bytebitlabs/nest-anthropic","version":"0.1.0","license":"MIT","_id":"@bytebitlabs/nest-anthropic@0.1.0","maintainers":[{"name":"bytebitlabs","email":"0xnairb@bytebitlabs.com"}],"dist":{"shasum":"383fe6d52201efaceeb4bfb3436494a509865770","tarball":"https://registry.npmjs.org/@bytebitlabs/nest-anthropic/-/nest-anthropic-0.1.0.tgz","fileCount":20,"integrity":"sha512-n2Fnbzfd89tjmY5tjMG1jke2F5hBwvpZ0qMnQF1tj3VOn249bBeRHnVn0I804Yt4Q0y3hLaZ8bWTXPDQ/j66rQ==","signatures":[{"sig":"MEUCIQDgmRSRTm69X2q0lSYmJaQrsnDqKVft+1l3THjiAhAHeQIgBMt38dpEovvhsE/KOUo7BWhjMP2vQHo1jcYIkaOHspM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11423},"main":"./src/index.js","type":"commonjs","types":"./src/index.d.ts","gitHead":"7ef6f8df4e9fdc0b5484ffb606791b86197af767","typings":"./src/index.d.ts","_npmUser":{"name":"bytebitlabs","email":"0xnairb@bytebitlabs.com"},"_npmVersion":"10.5.2","description":"<p align=\"center\">   <a href=\"https://bytebitlabs.com/\" target=\"_blank\"><img src=\"https://gravatar.com/avatar/61c80d73dfe4c4231e77940cf80fd410?size=256\" width=\"256\" alt=\"ByteBitLabs logo\" /></a> </p>","directories":{},"_nodeVersion":"20.13.1","dependencies":{"tslib":"^2.3.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/nest-anthropic_0.1.0_1723730102681_0.16407485342551253","host":"s3://npm-registry-packages"}},"0.1.1":{"name":"@bytebitlabs/nest-anthropic","version":"0.1.1","license":"MIT","_id":"@bytebitlabs/nest-anthropic@0.1.1","maintainers":[{"name":"bytebitlabs","email":"0xnairb@bytebitlabs.com"}],"dist":{"shasum":"5b479ae6add67432c9acad6f2cd5009bb032f10d","tarball":"https://registry.npmjs.org/@bytebitlabs/nest-anthropic/-/nest-anthropic-0.1.1.tgz","fileCount":20,"integrity":"sha512-lLwA3QHiuE6uV+1Z4EXDVPPhcHu2fPtH7T5QP/tmIihlmHY0M1d3sX/GJeLvxnfzr2qoRtGka7xEEFMiWOI+mQ==","signatures":[{"sig":"MEQCIA7W47P4TfxVSFHasNwTinHVixg8tcGVGThLbN3zIlW5AiA86yYIoMMpCFus6xR6pUzU4mTX6XKTun2UKZL4r7hgZg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11423},"main":"./src/index.js","type":"commonjs","types":"./src/index.d.ts","gitHead":"9ac581ff68f03d00df4a88865f2f1744a9ed2656","typings":"./src/index.d.ts","_npmUser":{"name":"bytebitlabs","email":"0xnairb@bytebitlabs.com"},"_npmVersion":"10.5.2","description":"<p align=\"center\">   <a href=\"https://bytebitlabs.com/\" target=\"_blank\"><img src=\"https://gravatar.com/avatar/61c80d73dfe4c4231e77940cf80fd410?size=256\" width=\"256\" alt=\"ByteBitLabs logo\" /></a> </p>","directories":{},"_nodeVersion":"20.13.1","dependencies":{"tslib":"^2.3.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/nest-anthropic_0.1.1_1723745041222_0.511347566531354","host":"s3://npm-registry-packages"}},"0.1.3":{"name":"@bytebitlabs/nest-anthropic","version":"0.1.3","license":"MIT","_id":"@bytebitlabs/nest-anthropic@0.1.3","maintainers":[{"name":"bytebitlabs","email":"0xnairb@bytebitlabs.com"}],"dist":{"shasum":"f0b959817edc992d3e7c5b68cdb7d120cc7ea5cc","tarball":"https://registry.npmjs.org/@bytebitlabs/nest-anthropic/-/nest-anthropic-0.1.3.tgz","fileCount":20,"integrity":"sha512-TeCFsX582lBw/wwmGGC0UOqrWnN6D+RJvnB4Vm3D2aEjXKkTsu3WDEfIZVIRzuwxjpHpuecDr/lyVm0qyC9bJw==","signatures":[{"sig":"MEQCIErgtA57Bie9EvrFEF/NwZucqfT/eU7xs+ah2eIih9URAiBuvPCiJRUoxwP18NaRITRfZz89iUMQXv8BEzw+UjkE+g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11423},"main":"./src/index.js","type":"commonjs","types":"./src/index.d.ts","gitHead":"bd1b5bf77c1e81013bb06d56f6d802aea7440d43","typings":"./src/index.d.ts","_npmUser":{"name":"bytebitlabs","email":"0xnairb@bytebitlabs.com"},"_npmVersion":"10.5.2","description":"<p align=\"center\">   <a href=\"https://bytebitlabs.com/\" target=\"_blank\"><img src=\"https://gravatar.com/avatar/61c80d73dfe4c4231e77940cf80fd410?size=256\" width=\"256\" alt=\"ByteBitLabs logo\" /></a> </p>","directories":{},"_nodeVersion":"20.13.1","dependencies":{"tslib":"^2.3.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/nest-anthropic_0.1.3_1727159150419_0.4397902372165443","host":"s3://npm-registry-packages"}},"1.0.0-0":{"name":"@bytebitlabs/nest-anthropic","version":"1.0.0-0","license":"MIT","_id":"@bytebitlabs/nest-anthropic@1.0.0-0","maintainers":[{"name":"bytebitlabs","email":"0xnairb@bytebitlabs.com"}],"dist":{"shasum":"c3ea17c6a28e28dbc25903e09aa1919eb31847e3","tarball":"https://registry.npmjs.org/@bytebitlabs/nest-anthropic/-/nest-anthropic-1.0.0-0.tgz","fileCount":20,"integrity":"sha512-VZnepdTL6xtfNohFXcHaXOk5lSLJu2mHzuuuJ4nrXjng3EX4TUlK81Id3RzWsykurXXZF8JQQNuiEmUWDB83Jg==","signatures":[{"sig":"MEUCIQD0ZDzQ6JQrX5XbNXQxnslkcaQMaARFt6pmIsgr5YCl9AIgcz3imofhB+RkJKj0m33tpLsAKTen7oaAHDlzEdr5RpE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11425},"main":"./src/index.js","type":"commonjs","types":"./src/index.d.ts","gitHead":"ba9fcdf8beb2775837215e03b516a4157388989a","typings":"./src/index.d.ts","_npmUser":{"name":"bytebitlabs","email":"0xnairb@bytebitlabs.com"},"_npmVersion":"10.5.2","description":"<p align=\"center\">   <a href=\"https://bytebitlabs.com/\" target=\"_blank\"><img src=\"https://gravatar.com/avatar/61c80d73dfe4c4231e77940cf80fd410?size=256\" width=\"256\" alt=\"ByteBitLabs logo\" /></a> </p>","directories":{},"_nodeVersion":"20.13.1","dependencies":{"tslib":"^2.3.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/nest-anthropic_1.0.0-0_1731382848217_0.9137097290176759","host":"s3://npm-registry-packages"}},"1.0.0":{"name":"@bytebitlabs/nest-anthropic","version":"1.0.0","license":"MIT","_id":"@bytebitlabs/nest-anthropic@1.0.0","maintainers":[{"name":"bytebitlabs","email":"0xnairb@bytebitlabs.com"}],"dist":{"shasum":"cf453c375c7ee4a23e28d160fcf68d0ef047803d","tarball":"https://registry.npmjs.org/@bytebitlabs/nest-anthropic/-/nest-anthropic-1.0.0.tgz","fileCount":20,"integrity":"sha512-t97HsP+qu92/uF0T8MK6nIySDS0nsE3vDWfdoo9Uxb2eY4kB6T1+WbLayHEeh3r0cQ7f3SoEhgsiu5FqLk0crA==","signatures":[{"sig":"MEQCIBXFzTorWkz5uXsngYlG0BoiS1rvQ5dgl+xEn18/e9IpAiBUvRZ3favKXy94RO6zZCiNBTBXGaXs2Oa/6Vkg92XMcA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11423},"main":"./src/index.js","type":"commonjs","types":"./src/index.d.ts","gitHead":"b2be2b59aa13ee02489dfa1745f08fe31fe3b14f","typings":"./src/index.d.ts","_npmUser":{"name":"bytebitlabs","email":"0xnairb@bytebitlabs.com"},"_npmVersion":"10.5.2","description":"<p align=\"center\">   <a href=\"https://bytebitlabs.com/\" target=\"_blank\"><img src=\"https://gravatar.com/avatar/61c80d73dfe4c4231e77940cf80fd410?size=256\" width=\"256\" alt=\"ByteBitLabs logo\" /></a> </p>","directories":{},"_nodeVersion":"20.13.1","dependencies":{"tslib":"^2.3.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/nest-anthropic_1.0.0_1735549387330_0.6719388316414499","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@bytebitlabs/nest-anthropic","version":"1.0.1","license":"MIT","_id":"@bytebitlabs/nest-anthropic@1.0.1","maintainers":[{"name":"bytebitlabs","email":"0xnairb@bytebitlabs.com"}],"dist":{"shasum":"e6b56c682932be30002da8f52f0d0552a0767f91","tarball":"https://registry.npmjs.org/@bytebitlabs/nest-anthropic/-/nest-anthropic-1.0.1.tgz","fileCount":20,"integrity":"sha512-htwQmHGbZNIUkNQU4sRyyuHHfxZiXTmAtU5hQmbFuYJIa89bGOZD1AXU2MpczFsjjYSqN6LRYJEVHNZl+3Ok7w==","signatures":[{"sig":"MEYCIQCGvwFYMlKTLYD+uySYLiXiJwlN/7MIJnfA81l0mQC4CgIhALBCHxZq002nykIgRYrz+MF4AjoaqMJDKEIlsJs14SOk","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11423},"main":"./src/index.js","type":"commonjs","types":"./src/index.d.ts","gitHead":"e3e3e03a508e6b132b6a366cd0bd02e9d01594cb","typings":"./src/index.d.ts","_npmUser":{"name":"bytebitlabs","email":"0xnairb@bytebitlabs.com"},"_npmVersion":"10.5.2","description":"<p align=\"center\">   <a href=\"https://bytebitlabs.com/\" target=\"_blank\"><img src=\"https://gravatar.com/avatar/61c80d73dfe4c4231e77940cf80fd410?size=256\" width=\"256\" alt=\"ByteBitLabs logo\" /></a> </p>","directories":{},"_nodeVersion":"20.13.1","dependencies":{"tslib":"^2.3.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/nest-anthropic_1.0.1_1737347961843_0.4277339265108959","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@bytebitlabs/nest-anthropic","version":"1.1.0","license":"MIT","dependencies":{"tslib":"^2.3.0"},"type":"commonjs","main":"./src/index.js","typings":"./src/index.d.ts","publishConfig":{"access":"public"},"types":"./src/index.d.ts","_id":"@bytebitlabs/nest-anthropic@1.1.0","gitHead":"e82f08bce74eb7b91dfd7fd7ffc0423f08ccaec5","description":"<p align=\"center\">   <a href=\"https://bytebitlabs.com/\" target=\"_blank\"><img src=\"https://gravatar.com/avatar/61c80d73dfe4c4231e77940cf80fd410?size=256\" width=\"256\" alt=\"ByteBitLabs logo\" /></a> </p>","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-nYTXQMo5HKMQMjTXTvLe+h+vK1YZFuzPbPY/NzblP7D1KK9rTyo3LG55A+2S05BEtVUGT/DylPzES2Ft9Q6NnQ==","shasum":"89b3e18de606d62ddaec91d08b971542d878c9a2","tarball":"https://registry.npmjs.org/@bytebitlabs/nest-anthropic/-/nest-anthropic-1.1.0.tgz","fileCount":20,"unpackedSize":11423,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCMw/Y28nN0gTxMIWCjdEBfX9hn5DxBASxwqa8uBhLGFAIhANSSkzF4MznObx0jSW0rqxsdgLEMoZjZiMahNs90EIRp"}]},"_npmUser":{"name":"bytebitlabs","email":"0xnairb@bytebitlabs.com"},"directories":{},"maintainers":[{"name":"bytebitlabs","email":"0xnairb@bytebitlabs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nest-anthropic_1.1.0_1741581822681_0.33721376641757916"},"_hasShrinkwrap":false}},"time":{"created":"2024-08-15T13:55:02.557Z","modified":"2025-03-10T04:43:43.034Z","0.1.0":"2024-08-15T13:55:02.863Z","0.1.1":"2024-08-15T18:04:01.453Z","0.1.3":"2024-09-24T06:25:50.613Z","1.0.0-0":"2024-11-12T03:40:48.415Z","1.0.0":"2024-12-30T09:03:07.520Z","1.0.1":"2025-01-20T04:39:22.049Z","1.1.0":"2025-03-10T04:43:42.858Z"},"license":"MIT","description":"<p align=\"center\">   <a href=\"https://bytebitlabs.com/\" target=\"_blank\"><img src=\"https://gravatar.com/avatar/61c80d73dfe4c4231e77940cf80fd410?size=256\" width=\"256\" alt=\"ByteBitLabs logo\" /></a> </p>","maintainers":[{"name":"bytebitlabs","email":"0xnairb@bytebitlabs.com"}],"readme":"# nest-anthropic\n\n<p align=\"center\">\n  <a href=\"https://bytebitlabs.com/\" target=\"_blank\"><img src=\"https://gravatar.com/avatar/61c80d73dfe4c4231e77940cf80fd410?size=256\" width=\"256\" alt=\"ByteBitLabs logo\" /></a>\n</p>\n\n<p align=\"center\">Anthropic module for nestjs</p>\n    <p align=\"center\">\n<a href=\"https://www.npmjs.com/package/@bytebitlabs/nest-anthropic\"><img src=\"https://img.shields.io/npm/v/@bytebitlabs/nest-anthropic\" alt=\"NPM Version\" /></a>\n<a href=\"https://www.npmjs.com/package/@bytebitlabs/nest-anthropic\"><img src=\"https://img.shields.io/npm/l/@bytebitlabs/nest-anthropic\" alt=\"Package License\" /></a>\n<a href=\"https://www.npmjs.com/package/@bytebitlabs/nest-anthropic\"><img src=\"https://img.shields.io/npm/dm/@bytebitlabs/nest-anthropic\" alt=\"NPM Downloads\" /></a>\n</p>\n\n## Description\n\nAnthropic module for [Nest](https://github.com/nestjs/nest) based on the official [@anthropic-ai/sdk](https://www.npmjs.com/package/@anthropic-ai/sdk) package.\n\n## Installation\n\n```bash\n$ npm i --save @bytebitlabs/nest-anthropic @anthropic-ai/sdk\n```\n\n## Usage\n\nImport `AnthropicModule`:\n\n```typescript\n@Module({\n  imports: [AnthropicModule.register({\n    apiKey: 'Abc...',\n  })],\n  providers: [...],\n})\nexport class AiModule {}\n```\n\nInject `AnthropicService`:\n\n```typescript\n@Injectable()\nexport class AiService {\n  constructor(private readonly anthropicService: AnthropicService) {}\n}\n```\n\n## Async options\n\nQuite often you might want to asynchronously pass your module options instead of passing them beforehand. In such case, use `registerAsync()` method, that provides a couple of various ways to deal with async data.\n\n**1. Use factory**\n\n```typescript\nAnthropicModule.registerAsync({\n  useFactory: () => ({\n    apiKey: 'Abc...'\n  })\n});\n```\n\nObviously, our factory behaves like every other one (might be `async` and is able to inject dependencies through `inject`).\n\n```typescript\nAnthropicModule.registerAsync({\n  imports: [ConfigModule],\n  useFactory: async (configService: ConfigService) => ({\n    apiKey: configService.get('ANTHROPIC_API_KEY'),\n  }),\n  inject: [ConfigService],\n}),\n```\n\n**2. Use class**\n\n```typescript\nAnthropicModule.registerAsync({\n  useClass: AnthropicConfigService\n});\n```\n\nAbove construction will instantiate `AnthropicConfigService` inside `AnthropicModule` and will leverage it to create options object.\n\n```typescript\nclass AnthropicConfigService implements AnthropicOptionsFactory {\n  createAnthropicOptions(): AnthropicModuleOptions {\n    return {\n      apiKey: 'Abc...'\n    };\n  }\n}\n```\n\n**3. Use existing**\n\n```typescript\nAnthropicModule.registerAsync({\n  imports: [ConfigModule],\n  useExisting: ConfigService,\n}),\n```\n\nIt works the same as `useClass` with one critical difference - `AnthropicModule` will lookup imported modules to reuse already created `ConfigService`, instead of instantiating it on its own.\n\n## API Spec\n\nThe `AnthropicService` wraps the `Client` from the official [@anthropic-ai/sdk](https://www.npmjs.com/package/@anthropic-ai/sdk) methods. The `AnthropicModule.register()` takes `options` object as an argument, [read more](https://docs.anthropic.com/en/api/getting-started).\n","readmeFilename":"README.md"}