Skip to content

Commit 52c373c

Browse files
aronphilandstuff
authored andcommitted
Document alternative authentication
1 parent ab9982f commit 52c373c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@ export REPLICATE_API_TOKEN=<your token>
4343

4444
We recommend not adding the token directly to your source code, because you don't want to put your credentials in source control. If anyone used your API key, their usage would be charged to your account.
4545

46+
<details>
47+
48+
<summary>Alternative authentication</summary>
49+
50+
As of [replicate 1.0.5](https://github.com/replicate/replicate-python/releases/tag/1.0.5) and [cog 0.14.11](https://github.com/replicate/cog/releases/tag/v0.14.11) it is possible to pass a `REPLICATE_API_TOKEN` via the `context` as part of a prediction request.
51+
52+
The `Replicate()` constructor will now use this context when available. This grants cog models the ability to use the Replicate client libraries, scoped to a user on a per request basis.
53+
54+
</details>
55+
4656
## Run a model
4757

4858
Create a new Python file and add the following code, replacing the model identifier and input with your own:

0 commit comments

Comments
 (0)