Skip to content

Commit ed70ab7

Browse files
feat(api): rename environment variables
To match the ui and DO ecosystem
1 parent b370349 commit ed70ab7

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 170
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/digitalocean%2Fgradient-9aca3802735e1375125412aa28ac36bf2175144b8218610a73d2e7f775694dff.yml
33
openapi_spec_hash: e29d14e3e4679fcf22b3e760e49931b1
4-
config_hash: de89a9c8fde0120577d2aca8be4ae027
4+
config_hash: 136e1973eb6297e6308a165594bd00a3

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import os
4242
from gradient import Gradient
4343

4444
client = Gradient(
45-
api_key=os.environ.get("GRADIENT_API_KEY"), # This is the default and can be omitted
45+
api_key=os.environ.get("DIGITALOCEAN_ACCESS_TOKEN"), # This is the default and can be omitted
4646
)
4747
inference_client = Gradient(
4848
inference_key=os.environ.get(
@@ -105,7 +105,7 @@ import asyncio
105105
from gradient import AsyncGradient
106106

107107
client = AsyncGradient(
108-
api_key=os.environ.get("GRADIENT_API_KEY"), # This is the default and can be omitted
108+
api_key=os.environ.get("DIGITALOCEAN_ACCESS_TOKEN"), # This is the default and can be omitted
109109
)
110110

111111

src/gradient/_client.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,20 +96,20 @@ def __init__(
9696
"""Construct a new synchronous Gradient client instance.
9797
9898
This automatically infers the following arguments from their corresponding environment variables if they are not provided:
99-
- `api_key` from `GRADIENT_API_KEY`
100-
- `inference_key` from `GRADIENT_INFERENCE_KEY`
101-
- `agent_key` from `GRADIENT_AGENT_KEY`
99+
- `api_key` from `DIGITALOCEAN_ACCESS_TOKEN`
100+
- `inference_key` from `GRADIENT_MODEL_ACCESS_KEY`
101+
- `agent_key` from `GRADIENT_AGENT_ACCESS_KEY`
102102
"""
103103
if api_key is None:
104-
api_key = os.environ.get("GRADIENT_API_KEY")
104+
api_key = os.environ.get("DIGITALOCEAN_ACCESS_TOKEN")
105105
self.api_key = api_key
106106

107107
if inference_key is None:
108-
inference_key = os.environ.get("GRADIENT_INFERENCE_KEY")
108+
inference_key = os.environ.get("GRADIENT_MODEL_ACCESS_KEY")
109109
self.inference_key = inference_key
110110

111111
if agent_key is None:
112-
agent_key = os.environ.get("GRADIENT_AGENT_KEY")
112+
agent_key = os.environ.get("GRADIENT_AGENT_ACCESS_KEY")
113113
self.agent_key = agent_key
114114

115115
self._agent_endpoint = agent_endpoint
@@ -364,20 +364,20 @@ def __init__(
364364
"""Construct a new async AsyncGradient client instance.
365365
366366
This automatically infers the following arguments from their corresponding environment variables if they are not provided:
367-
- `api_key` from `GRADIENT_API_KEY`
368-
- `inference_key` from `GRADIENT_INFERENCE_KEY`
369-
- `agent_key` from `GRADIENT_AGENT_KEY`
367+
- `api_key` from `DIGITALOCEAN_ACCESS_TOKEN`
368+
- `inference_key` from `GRADIENT_MODEL_ACCESS_KEY`
369+
- `agent_key` from `GRADIENT_AGENT_ACCESS_KEY`
370370
"""
371371
if api_key is None:
372-
api_key = os.environ.get("GRADIENT_API_KEY")
372+
api_key = os.environ.get("DIGITALOCEAN_ACCESS_TOKEN")
373373
self.api_key = api_key
374374

375375
if inference_key is None:
376-
inference_key = os.environ.get("GRADIENT_INFERENCE_KEY")
376+
inference_key = os.environ.get("GRADIENT_MODEL_ACCESS_KEY")
377377
self.inference_key = inference_key
378378

379379
if agent_key is None:
380-
agent_key = os.environ.get("GRADIENT_AGENT_KEY")
380+
agent_key = os.environ.get("GRADIENT_AGENT_ACCESS_KEY")
381381
self.agent_key = agent_key
382382

383383
self._agent_endpoint = agent_endpoint

tests/test_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def test_validate_headers(self) -> None:
403403
request = client._build_request(FinalRequestOptions(method="get", url="/foo"))
404404
assert request.headers.get("Authorization") == f"Bearer {api_key}"
405405

406-
with update_env(**{"GRADIENT_API_KEY": Omit()}):
406+
with update_env(**{"DIGITALOCEAN_ACCESS_TOKEN": Omit()}):
407407
client2 = Gradient(
408408
base_url=base_url,
409409
api_key=None,
@@ -1405,7 +1405,7 @@ def test_validate_headers(self) -> None:
14051405
request = client._build_request(FinalRequestOptions(method="get", url="/foo"))
14061406
assert request.headers.get("Authorization") == f"Bearer {api_key}"
14071407

1408-
with update_env(**{"GRADIENT_API_KEY": Omit()}):
1408+
with update_env(**{"DIGITALOCEAN_ACCESS_TOKEN": Omit()}):
14091409
client2 = AsyncGradient(
14101410
base_url=base_url,
14111411
api_key=None,

0 commit comments

Comments
 (0)