@patternzones/koine-sdk 2.0.3 → 2.1.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/README.md +22 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -7,7 +7,7 @@ TypeScript SDK for [Koine](https://github.com/pattern-zones-co/koine) — the HT
7
7
  ```bash
8
8
  docker run -d -p 3100:3100 \
9
9
  -e CLAUDE_CODE_GATEWAY_API_KEY=your-key \
10
- -e CLAUDE_CODE_OAUTH_TOKEN=your-token \
10
+ -e ANTHROPIC_API_KEY=your-anthropic-api-key \
11
11
  ghcr.io/pattern-zones-co/koine:latest
12
12
  ```
13
13
 
@@ -76,6 +76,27 @@ Creates a client instance with the given configuration. The config is validated
76
76
  | `KoineError` | Error class with typed `code` property |
77
77
  | `KoineErrorCode` | Union type of all possible error codes |
78
78
 
79
+ ## Error Handling & Retries
80
+
81
+ The SDK does not automatically retry failed requests. When the gateway returns `429 Too Many Requests` (concurrency limit exceeded), your application should implement retry logic:
82
+
83
+ ```typescript
84
+ async function generateWithRetry(prompt: string, maxRetries = 3) {
85
+ for (let i = 0; i < maxRetries; i++) {
86
+ try {
87
+ return await koine.generateText({ prompt });
88
+ } catch (error) {
89
+ if (error instanceof KoineError && error.code === 'CONCURRENCY_LIMIT_ERROR') {
90
+ await new Promise(r => setTimeout(r, 1000 * (i + 1))); // Exponential backoff
91
+ continue;
92
+ }
93
+ throw error;
94
+ }
95
+ }
96
+ throw new Error('Max retries exceeded');
97
+ }
98
+ ```
99
+
79
100
  ## Documentation
80
101
 
81
102
  See the [SDK Guide](https://github.com/pattern-zones-co/koine/blob/main/docs/sdk-guide.md) for:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternzones/koine-sdk",
3
- "version": "2.0.3",
3
+ "version": "2.1.0",
4
4
  "description": "TypeScript SDK for Koine gateway",
5
5
  "repository": {
6
6
  "type": "git",