You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17Lines changed: 17 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,23 @@
22
22
23
23
The AI21 API Client is a TypeScript library that provides a convenient interface for interacting with the AI21 API. It abstracts away the low-level details of making API requests and handling responses, allowing developers to focus on building their applications.
24
24
25
+
## Environment Support
26
+
27
+
This client supports both Node.js and browser environments:
28
+
29
+
-**Node.js**: Works out of the box with Node.js >=18.0.0
30
+
-**Browser**: Requires explicit opt-in by setting `dangerouslyAllowBrowser: true` in the client options
31
+
32
+
```typescript
33
+
// Browser usage example
34
+
const client =newAI21({
35
+
apiKey: process.env.AI21_API_KEY, // or pass it in directly
36
+
dangerouslyAllowBrowser: true// Required for browser environments
37
+
});
38
+
```
39
+
40
+
> ⚠️ **Security Notice**: Using this client in the browser could expose your API key to end users. Only enable `dangerouslyAllowBrowser` if you understand the security implications and have implemented appropriate security measures.
41
+
25
42
## Installation
26
43
27
44
You can install the AI21 API Client using npm or yarn:
0 commit comments