@core-ai/anthropic 0.23.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +7 -0
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -19,6 +19,7 @@ import {
19
19
  ContextLengthExceededError,
20
20
  ModelOverloadedError,
21
21
  ProviderError,
22
+ ProviderQuotaExceededError,
22
23
  RateLimitError,
23
24
  ServiceUnavailableError,
24
25
  asRecord,
@@ -56,6 +57,9 @@ function wrapAnthropicError(error, provider = "anthropic") {
56
57
  if (isAnthropicOverloaded(errorType, providerMessage, message, statusCode)) {
57
58
  return new ModelOverloadedError(message, provider, options);
58
59
  }
60
+ if (isAnthropicQuotaExceeded(errorType, statusCode)) {
61
+ return new ProviderQuotaExceededError(message, provider, options);
62
+ }
59
63
  if (isAnthropicRateLimit(error, statusCode, errorType)) {
60
64
  return new RateLimitError(message, provider, {
61
65
  ...options,
@@ -79,6 +83,9 @@ function isAnthropicOverloaded(errorType, providerMessage, message, statusCode)
79
83
  statusCode
80
84
  );
81
85
  }
86
+ function isAnthropicQuotaExceeded(errorType, statusCode) {
87
+ return statusCode === 402 || errorType === "billing_error";
88
+ }
82
89
  function indicatesAnthropicOverload(text, statusCode) {
83
90
  if (statusCode !== void 0 && !OVERLOAD_MESSAGE_ELIGIBLE_STATUS_CODES.has(statusCode)) {
84
91
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@core-ai/anthropic",
3
- "version": "0.23.0",
3
+ "version": "0.24.0",
4
4
  "description": "Anthropic provider package for @core-ai/core-ai",
5
5
  "license": "MIT",
6
6
  "author": "Omnifact (https://omnifact.ai)",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@anthropic-ai/sdk": "^0.110.0",
48
- "@core-ai/core-ai": "^0.23.0"
48
+ "@core-ai/core-ai": "^0.24.0"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "zod": "^4.0.0"