File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed
Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,7 @@ Create the client:
2626import Replicate from " replicate" ;
2727
2828const replicate = new Replicate ({
29- // get your token from https://replicate.com/account
30- auth: process .env .REPLICATE_API_TOKEN ,
29+ auth: " my api token" , // defaults to process.env.REPLICATE_API_TOKEN
3130});
3231```
3332
@@ -124,18 +123,14 @@ and pass it to the `fetch` option in the constructor.
124123import Replicate from " replicate" ;
125124import fetch from " cross-fetch" ;
126125
127- const replicate = new Replicate ({
128- // get your token from https://replicate.com/account
129- auth: process .env .REPLICATE_API_TOKEN ,
130- fetch: fetch,
131- });
126+ const replicate = new Replicate ({ fetch });
132127```
133128
134129You can override the ` fetch ` property to add custom behavior to client requests,
135130such as injecting headers or adding log statements.
136131
137132``` js
138- client .fetch = (url , options ) => {
133+ replicate .fetch = (url , options ) => {
139134 const headers = new Headers (options && options .headers );
140135 headers .append (" X-Custom-Header" , " some value" );
141136
You can’t perform that action at this time.
0 commit comments