Skip to content

Commit 45e225c

Browse files
feat(api): remove env var auth (#50)
1 parent f6ca515 commit 45e225c

File tree

2 files changed

+2
-25
lines changed

2 files changed

+2
-25
lines changed

README.md

-5
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ project_return_schema = client.projects.create(
3939
print(project_return_schema.id)
4040
```
4141

42-
While you can provide an `api_key` keyword argument,
43-
we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
44-
to add `CODEX_API_KEY="My API Key"` to your `.env` file
45-
so that your API Key is not stored in source control.
46-
4742
## Async usage
4843

4944
Simply import `AsyncCodex` instead of `Codex` and use `await` with each API call:

src/codex/_client.py

+2-20
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,9 @@ def __init__(
9595
# part of our public interface in the future.
9696
_strict_response_validation: bool = False,
9797
) -> None:
98-
"""Construct a new synchronous Codex client instance.
99-
100-
This automatically infers the following arguments from their corresponding environment variables if they are not provided:
101-
- `api_key` from `CODEX_API_KEY`
102-
- `access_key` from `CODEX_ACCESS_KEY`
103-
"""
104-
if api_key is None:
105-
api_key = os.environ.get("CODEX_API_KEY")
98+
"""Construct a new synchronous Codex client instance."""
10699
self.api_key = api_key
107100

108-
if access_key is None:
109-
access_key = os.environ.get("CODEX_ACCESS_KEY")
110101
self.access_key = access_key
111102

112103
self._environment = environment
@@ -334,18 +325,9 @@ def __init__(
334325
# part of our public interface in the future.
335326
_strict_response_validation: bool = False,
336327
) -> None:
337-
"""Construct a new async Codex client instance.
338-
339-
This automatically infers the following arguments from their corresponding environment variables if they are not provided:
340-
- `api_key` from `CODEX_API_KEY`
341-
- `access_key` from `CODEX_ACCESS_KEY`
342-
"""
343-
if api_key is None:
344-
api_key = os.environ.get("CODEX_API_KEY")
328+
"""Construct a new async Codex client instance."""
345329
self.api_key = api_key
346330

347-
if access_key is None:
348-
access_key = os.environ.get("CODEX_ACCESS_KEY")
349331
self.access_key = access_key
350332

351333
self._environment = environment

0 commit comments

Comments
 (0)