11# Perplexity TypeScript API Library
22
3- [ ![ NPM version] ( < https://img.shields.io/npm/v/perplexity-node .svg?label=npm%20(stable) > )] ( https://npmjs.org/package/perplexity-node ) ![ npm bundle size] ( https://img.shields.io/bundlephobia/minzip/perplexity-node )
3+ [ ![ NPM version] ( < https://img.shields.io/npm/v/@ perplexity-ai/perplexity_ai .svg?label=npm%20(stable) > )] ( https://npmjs.org/package/@ perplexity-ai/perplexity_ai ) ![ npm bundle size] ( https://img.shields.io/bundlephobia/minzip/@ perplexity-ai/perplexity_ai )
44
55This library provides convenient access to the Perplexity REST API from server-side TypeScript or JavaScript.
66
@@ -11,7 +11,7 @@ It is generated with [Stainless](https://www.stainless.com/).
1111## Installation
1212
1313``` sh
14- npm install perplexity-node
14+ npm install @ perplexity-ai/perplexity_ai
1515```
1616
1717## Usage
@@ -20,7 +20,7 @@ The full API of this library can be found in [api.md](api.md).
2020
2121<!-- prettier-ignore -->
2222``` js
23- import Perplexity from ' perplexity-node ' ;
23+ import Perplexity from ' @ perplexity-ai/perplexity_ai ' ;
2424
2525const client = new Perplexity ({
2626 apiKey: process .env [' PERPLEXITY_API_KEY' ], // This is the default and can be omitted
@@ -40,7 +40,7 @@ This library includes TypeScript definitions for all request params and response
4040
4141<!-- prettier-ignore -->
4242``` ts
43- import Perplexity from ' perplexity-node ' ;
43+ import Perplexity from ' @ perplexity-ai/perplexity_ai ' ;
4444
4545const client = new Perplexity ({
4646 apiKey: process .env [' PERPLEXITY_API_KEY' ], // This is the default and can be omitted
@@ -172,7 +172,7 @@ The log level can be configured in two ways:
1721722 . Using the ` logLevel ` client option (overrides the environment variable if set)
173173
174174``` ts
175- import Perplexity from ' perplexity-node ' ;
175+ import Perplexity from ' @ perplexity-ai/perplexity_ai ' ;
176176
177177const client = new Perplexity ({
178178 logLevel: ' debug' , // Show all log messages
@@ -200,7 +200,7 @@ When providing a custom logger, the `logLevel` option still controls which messa
200200below the configured level will not be sent to your logger.
201201
202202``` ts
203- import Perplexity from ' perplexity-node ' ;
203+ import Perplexity from ' @ perplexity-ai/perplexity_ai ' ;
204204import pino from ' pino' ;
205205
206206const logger = pino ();
@@ -269,7 +269,7 @@ globalThis.fetch = fetch;
269269Or pass it to the client:
270270
271271``` ts
272- import Perplexity from ' perplexity-node ' ;
272+ import Perplexity from ' @ perplexity-ai/perplexity_ai ' ;
273273import fetch from ' my-fetch' ;
274274
275275const client = new Perplexity ({ fetch });
@@ -280,7 +280,7 @@ const client = new Perplexity({ fetch });
280280If you want to set custom ` fetch ` options without overriding the ` fetch ` function, you can provide a ` fetchOptions ` object when instantiating the client or making a request. (Request-specific options override client options.)
281281
282282``` ts
283- import Perplexity from ' perplexity-node ' ;
283+ import Perplexity from ' @ perplexity-ai/perplexity_ai ' ;
284284
285285const client = new Perplexity ({
286286 fetchOptions: {
@@ -297,7 +297,7 @@ options to requests:
297297<img src =" https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg " align =" top " width =" 18 " height =" 21 " > ** Node** <sup >[[ docs] ( https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch )] </sup >
298298
299299``` ts
300- import Perplexity from ' perplexity-node ' ;
300+ import Perplexity from ' @ perplexity-ai/perplexity_ai ' ;
301301import * as undici from ' undici' ;
302302
303303const proxyAgent = new undici .ProxyAgent (' http://localhost:8888' );
@@ -311,7 +311,7 @@ const client = new Perplexity({
311311<img src =" https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg " align =" top " width =" 18 " height =" 21 " > ** Bun** <sup >[[ docs] ( https://bun.sh/guides/http/proxy )] </sup >
312312
313313``` ts
314- import Perplexity from ' perplexity-node ' ;
314+ import Perplexity from ' @ perplexity-ai/perplexity_ai ' ;
315315
316316const client = new Perplexity ({
317317 fetchOptions: {
@@ -323,7 +323,7 @@ const client = new Perplexity({
323323<img src =" https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg " align =" top " width =" 18 " height =" 21 " > ** Deno** <sup >[[ docs] ( https://docs.deno.com/api/deno/~/Deno.createHttpClient )] </sup >
324324
325325``` ts
326- import Perplexity from ' npm:perplexity-node ' ;
326+ import Perplexity from ' npm:@ perplexity-ai/perplexity_ai ' ;
327327
328328const httpClient = Deno .createHttpClient ({ proxy: { url: ' http://localhost:8888' } });
329329const client = new Perplexity ({
0 commit comments