Skip to content

Commit f087f36

Browse files
committed
docs: Added env text
1 parent 3b8a073 commit f087f36

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,23 @@
2222

2323
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.
2424

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 = new AI21({
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+
2542
## Installation
2643

2744
You can install the AI21 API Client using npm or yarn:

0 commit comments

Comments
 (0)