From 0c1c6c5cc1e6708e2b263129a36ad9a948d9bd8d Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Fri, 24 May 2024 09:27:10 -0700 Subject: [PATCH 1/2] document how to set a custom token Signed-off-by: Zeke Sikelianos --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index a547292f..e392a419 100644 --- a/README.md +++ b/README.md @@ -360,6 +360,20 @@ training = replicate.trainings.create( ) ``` + +## Use a custom token + +The `REPLICATE_API_TOKEN` environment variable is used by default. If you want to specify a different token, use the `Client` factory method to create a custom client: + +```python +import os +from replicate.client import Client + +replicate = Client( + api_token=os.environ["SOME_OTHER_REPLICATE_API_TOKEN"] +) +``` + ## Development See [CONTRIBUTING.md](CONTRIBUTING.md) From 80ce79d806c764d89fd2cae31e567048ab9bdd62 Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Fri, 24 May 2024 09:27:28 -0700 Subject: [PATCH 2/2] fix link to API tokens page it used to be account, but now it's not Signed-off-by: Zeke Sikelianos --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e392a419..9023ec33 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ pip install replicate Before running any Python scripts that use the API, you need to set your Replicate API token in your environment. -Grab your token from [replicate.com/account](https://replicate.com/account) and set it as an environment variable: +Grab your token from [replicate.com/account/api-tokens](https://replicate.com/account/api-tokens) and set it as an environment variable: ``` export REPLICATE_API_TOKEN=