codex-backend-sdk 0.5.8__tar.gz → 0.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/CHANGELOG.md +27 -0
- codex_backend_sdk-0.5.8/README.md → codex_backend_sdk-0.6.0/PKG-INFO +85 -9
- codex_backend_sdk-0.5.8/PKG-INFO → codex_backend_sdk-0.6.0/README.md +52 -38
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/__init__.py +24 -1
- codex_backend_sdk-0.6.0/codex_backend_sdk/_async_client.py +445 -0
- codex_backend_sdk-0.6.0/codex_backend_sdk/_async_streaming.py +70 -0
- codex_backend_sdk-0.6.0/codex_backend_sdk/_async_transport.py +109 -0
- codex_backend_sdk-0.6.0/codex_backend_sdk/async_oauth.py +292 -0
- codex_backend_sdk-0.6.0/codex_backend_sdk/async_resources/__init__.py +1 -0
- codex_backend_sdk-0.6.0/codex_backend_sdk/async_resources/chatgpt.py +789 -0
- codex_backend_sdk-0.6.0/codex_backend_sdk/async_resources/chatgpt_apps.py +315 -0
- codex_backend_sdk-0.6.0/codex_backend_sdk/async_resources/chatgpt_connectors.py +350 -0
- codex_backend_sdk-0.6.0/codex_backend_sdk/async_resources/chatgpt_plugin_bundles.py +330 -0
- codex_backend_sdk-0.6.0/codex_backend_sdk/async_resources/chatgpt_plugin_shares.py +338 -0
- codex_backend_sdk-0.6.0/codex_backend_sdk/async_resources/chatgpt_plugins.py +361 -0
- codex_backend_sdk-0.6.0/codex_backend_sdk/async_resources/chatgpt_writing_blocks.py +82 -0
- codex_backend_sdk-0.6.0/codex_backend_sdk/async_resources/codex.py +634 -0
- codex_backend_sdk-0.6.0/codex_backend_sdk/async_resources/codex_web_search.py +104 -0
- codex_backend_sdk-0.6.0/codex_backend_sdk/async_resources/files.py +134 -0
- codex_backend_sdk-0.6.0/codex_backend_sdk/async_resources/images.py +316 -0
- codex_backend_sdk-0.6.0/codex_backend_sdk/async_resources/models.py +99 -0
- codex_backend_sdk-0.6.0/codex_backend_sdk/async_resources/openai_oauth.py +177 -0
- codex_backend_sdk-0.6.0/codex_backend_sdk/async_resources/realtime.py +459 -0
- codex_backend_sdk-0.6.0/codex_backend_sdk/async_resources/remote_control.py +514 -0
- codex_backend_sdk-0.6.0/codex_backend_sdk/async_resources/responses.py +440 -0
- codex_backend_sdk-0.6.0/codex_backend_sdk/async_resources/responses_websocket.py +195 -0
- codex_backend_sdk-0.6.0/codex_backend_sdk/async_resources/worktree_snapshots.py +107 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/codex_client.py +3 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/resources/images.py +42 -8
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/resources/realtime.py +43 -6
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/resources/responses.py +14 -2
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/docs/api-reference.md +29 -5
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/docs/backend-api.md +20 -4
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/docs/openai-compatibility.md +2 -1
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/pyproject.toml +5 -1
- codex_backend_sdk-0.6.0/scripts/generate_async_resources.py +447 -0
- codex_backend_sdk-0.6.0/tests/general/test_async_runtime.py +251 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_images.py +18 -1
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_realtime_resource.py +34 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_responses_resource.py +15 -1
- codex_backend_sdk-0.5.8/uv.lock +0 -883
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/.gitignore +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/LICENSE +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/_client.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/_codex_version.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/_models.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/_streaming.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/_transport.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/_utils.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/oauth.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/pkce.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/resources/__init__.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/resources/_responses_payloads.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/resources/_responses_routing.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/resources/chatgpt.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/resources/chatgpt_apps.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/resources/chatgpt_connectors.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/resources/chatgpt_plugin_bundles.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/resources/chatgpt_plugin_shares.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/resources/chatgpt_plugins.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/resources/chatgpt_writing_blocks.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/resources/codex.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/resources/codex_web_search.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/resources/files.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/resources/models.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/resources/openai_oauth.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/resources/remote_control.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/resources/responses_websocket.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/resources/worktree_snapshots.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/codex_backend_sdk/storage.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/docs/codex-source-audit.md +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/docs/desktop-endpoint-inventory.md +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/docs/endpoint-coverage.md +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/examples/agent.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/conftest.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/general/test_codex_source_contracts.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_account_info.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_basic.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_chatgpt_apps.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_chatgpt_connectors.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_chatgpt_plugin_bundles.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_chatgpt_plugin_shares.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_chatgpt_plugins.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_chatgpt_projects_gizmos.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_chatgpt_resources.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_chatgpt_search_files.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_chatgpt_writing_blocks.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_client_retry.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_codex_resources.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_codex_version.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_codex_web_search.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_conversation.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_files_resource.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_hosted_mcp.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_oauth.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_openai_compatibility.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_openai_oauth_resources.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_prompt_cache_usage.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_reasoning.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_remote_control_resource.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_responses_routing.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_responses_websocket.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_structured_output.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_tools.py +0 -0
- {codex_backend_sdk-0.5.8 → codex_backend_sdk-0.6.0}/tests/test_worktree_snapshots.py +0 -0
|
@@ -2,6 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.6.0] - 2026-11-14
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- First-class `AsyncOpenAI` / `AsyncCodexClient` resource tree with native
|
|
9
|
+
async HTTP, SSE, OAuth, Responses WebSocket, Realtime, Live, Remote Control,
|
|
10
|
+
file streaming, retry, cancellation, and cleanup behavior.
|
|
11
|
+
- Deterministic generation and drift checking for async resource mirrors.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
- Track the current `openai-python` response and image method signatures while
|
|
15
|
+
continuing to reject backend-unsupported options explicitly.
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- Accept repeated WebSocket handshake headers such as multiple `Set-Cookie`
|
|
19
|
+
fields without failing connection setup.
|
|
20
|
+
|
|
21
|
+
## [0.5.9] - 2026-10-24
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
- OAuth transcription-only primary Realtime WebSocket with JSON events,
|
|
25
|
+
context-managed cleanup, bounded socket timeout, and no automatic audio replay.
|
|
26
|
+
Verified with synthetic PCM16LE mono 24 kHz speech, no developer API key.
|
|
27
|
+
|
|
28
|
+
### Documentation
|
|
29
|
+
- Distinguish verified Realtime transcription from the legacy batch route's
|
|
30
|
+
current HTTP 403 responses; OAuth success does not establish quota coverage.
|
|
31
|
+
|
|
5
32
|
## [0.5.8] - 2026-10-22
|
|
6
33
|
|
|
7
34
|
### Added
|
|
@@ -1,3 +1,36 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: codex-backend-sdk
|
|
3
|
+
Version: 0.6.0
|
|
4
|
+
Summary: Unofficial Python SDK for the ChatGPT Codex backend API
|
|
5
|
+
License: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: chatgpt,codex,llm,openai,sdk
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Requires-Python: >=3.9
|
|
18
|
+
Requires-Dist: httpx<1,>=0.27
|
|
19
|
+
Requires-Dist: pydantic>=2.0
|
|
20
|
+
Requires-Dist: requests>=2.28
|
|
21
|
+
Requires-Dist: websocket-client>=1.8
|
|
22
|
+
Requires-Dist: websockets<17,>=13
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: libcst>=1.4; extra == 'dev'
|
|
25
|
+
Requires-Dist: openai<3.0,>=1.0; (python_version < '3.10') and extra == 'dev'
|
|
26
|
+
Requires-Dist: openai>=3.16.1; (python_version >= '3.10') and extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
29
|
+
Provides-Extra: openai
|
|
30
|
+
Requires-Dist: openai<3.0,>=1.0; (python_version < '3.10') and extra == 'openai'
|
|
31
|
+
Requires-Dist: openai>=3.16.1; (python_version >= '3.10') and extra == 'openai'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
1
34
|
# codex-backend-sdk
|
|
2
35
|
|
|
3
36
|
Unofficial Python SDK for building independent harnesses and integrations on
|
|
@@ -26,10 +59,12 @@ The package intentionally separates three kinds of API:
|
|
|
26
59
|
pip install --upgrade codex-backend-sdk
|
|
27
60
|
```
|
|
28
61
|
|
|
29
|
-
Version **0.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
62
|
+
Version **0.6.0** adds the native async client and full async resource tree. It
|
|
63
|
+
retains the 0.5.9 OAuth Realtime transcription transport and the 0.5.8 alignment
|
|
64
|
+
with Codex source commit `0eb98b4617`: WebSocket interruption, message replay
|
|
65
|
+
fields, numeric reasoning efforts, and scoped installed-plugin pagination. See
|
|
66
|
+
the [changelog](CHANGELOG.md) and [source audit](docs/codex-source-audit.md) for
|
|
67
|
+
verified contracts and the separately inventoried, unsupported cloud gRPC
|
|
33
68
|
transport.
|
|
34
69
|
|
|
35
70
|
For an editable checkout:
|
|
@@ -59,6 +94,39 @@ print(response.output_text)
|
|
|
59
94
|
opens the browser OAuth flow. Most examples below assume an authenticated
|
|
60
95
|
`client` created this way.
|
|
61
96
|
|
|
97
|
+
### Async quickstart
|
|
98
|
+
|
|
99
|
+
`AsyncOpenAI` exposes the same resource tree with native `httpx` HTTP/SSE and
|
|
100
|
+
`websockets` transports. Network operations, stream iteration, authentication,
|
|
101
|
+
and cleanup are awaitable; no network call is delegated to a worker thread.
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
from codex_backend_sdk import AsyncOpenAI
|
|
105
|
+
|
|
106
|
+
async with AsyncOpenAI() as client:
|
|
107
|
+
await client.authenticate()
|
|
108
|
+
response = await client.responses.create(input="Explain quicksort briefly.")
|
|
109
|
+
print(response.output_text)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Streaming and reusable Responses WebSockets are async iterators:
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
stream = await client.responses.create(input="Say hello.", stream=True)
|
|
116
|
+
async with stream:
|
|
117
|
+
async for event in stream:
|
|
118
|
+
if event.type == "response.output_text.delta":
|
|
119
|
+
print(event.delta, end="")
|
|
120
|
+
|
|
121
|
+
async with await client.responses.websocket.connect() as ws:
|
|
122
|
+
async for event in ws.create({
|
|
123
|
+
"input": [{"role": "user", "content": [
|
|
124
|
+
{"type": "input_text", "text": "Say hello again."}
|
|
125
|
+
]}]
|
|
126
|
+
}):
|
|
127
|
+
print(event["type"])
|
|
128
|
+
```
|
|
129
|
+
|
|
62
130
|
## Choose the right surface
|
|
63
131
|
|
|
64
132
|
### Direct client: inference and reusable primitives
|
|
@@ -157,7 +225,12 @@ connection reusable across sequential turns:
|
|
|
157
225
|
|
|
158
226
|
```python
|
|
159
227
|
with client.responses.websocket.connect() as ws:
|
|
160
|
-
for event in ws.create({
|
|
228
|
+
for event in ws.create({
|
|
229
|
+
"model": "gpt-5.5",
|
|
230
|
+
"input": [{"role": "user", "content": [
|
|
231
|
+
{"type": "input_text", "text": "Say hello."}
|
|
232
|
+
]}],
|
|
233
|
+
}):
|
|
161
234
|
if event.get("type") == "response.output_text.delta":
|
|
162
235
|
print(event.get("delta", ""), end="")
|
|
163
236
|
```
|
|
@@ -654,11 +727,14 @@ explicit network mutation and clears local credentials only after success.
|
|
|
654
727
|
|
|
655
728
|
## Development
|
|
656
729
|
|
|
730
|
+
In the shared suite, activate `../.venv` and use the workspace installer instead
|
|
731
|
+
of reinstalling this member alone. Standalone development can use any environment.
|
|
732
|
+
|
|
657
733
|
```bash
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
734
|
+
python -m pip install -e ".[dev]"
|
|
735
|
+
python -m pytest -q
|
|
736
|
+
python -m compileall -q codex_backend_sdk
|
|
737
|
+
python -m build
|
|
662
738
|
```
|
|
663
739
|
|
|
664
740
|
Live probes are intentionally kept separate from the deterministic test suite:
|
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.5
|
|
2
|
-
Name: codex-backend-sdk
|
|
3
|
-
Version: 0.5.8
|
|
4
|
-
Summary: Unofficial Python SDK for the ChatGPT Codex backend API
|
|
5
|
-
License: MIT
|
|
6
|
-
License-File: LICENSE
|
|
7
|
-
Keywords: chatgpt,codex,llm,openai,sdk
|
|
8
|
-
Classifier: Development Status :: 3 - Alpha
|
|
9
|
-
Classifier: Intended Audience :: Developers
|
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
-
Classifier: Programming Language :: Python :: 3
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
-
Requires-Python: >=3.9
|
|
18
|
-
Requires-Dist: pydantic>=2.0
|
|
19
|
-
Requires-Dist: requests>=2.28
|
|
20
|
-
Requires-Dist: websocket-client>=1.8
|
|
21
|
-
Provides-Extra: dev
|
|
22
|
-
Requires-Dist: openai<3.0,>=1.0; (python_version < '3.10') and extra == 'dev'
|
|
23
|
-
Requires-Dist: openai>=3.16.1; (python_version >= '3.10') and extra == 'dev'
|
|
24
|
-
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
25
|
-
Provides-Extra: openai
|
|
26
|
-
Requires-Dist: openai<3.0,>=1.0; (python_version < '3.10') and extra == 'openai'
|
|
27
|
-
Requires-Dist: openai>=3.16.1; (python_version >= '3.10') and extra == 'openai'
|
|
28
|
-
Description-Content-Type: text/markdown
|
|
29
|
-
|
|
30
1
|
# codex-backend-sdk
|
|
31
2
|
|
|
32
3
|
Unofficial Python SDK for building independent harnesses and integrations on
|
|
@@ -55,10 +26,12 @@ The package intentionally separates three kinds of API:
|
|
|
55
26
|
pip install --upgrade codex-backend-sdk
|
|
56
27
|
```
|
|
57
28
|
|
|
58
|
-
Version **0.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
29
|
+
Version **0.6.0** adds the native async client and full async resource tree. It
|
|
30
|
+
retains the 0.5.9 OAuth Realtime transcription transport and the 0.5.8 alignment
|
|
31
|
+
with Codex source commit `0eb98b4617`: WebSocket interruption, message replay
|
|
32
|
+
fields, numeric reasoning efforts, and scoped installed-plugin pagination. See
|
|
33
|
+
the [changelog](CHANGELOG.md) and [source audit](docs/codex-source-audit.md) for
|
|
34
|
+
verified contracts and the separately inventoried, unsupported cloud gRPC
|
|
62
35
|
transport.
|
|
63
36
|
|
|
64
37
|
For an editable checkout:
|
|
@@ -88,6 +61,39 @@ print(response.output_text)
|
|
|
88
61
|
opens the browser OAuth flow. Most examples below assume an authenticated
|
|
89
62
|
`client` created this way.
|
|
90
63
|
|
|
64
|
+
### Async quickstart
|
|
65
|
+
|
|
66
|
+
`AsyncOpenAI` exposes the same resource tree with native `httpx` HTTP/SSE and
|
|
67
|
+
`websockets` transports. Network operations, stream iteration, authentication,
|
|
68
|
+
and cleanup are awaitable; no network call is delegated to a worker thread.
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from codex_backend_sdk import AsyncOpenAI
|
|
72
|
+
|
|
73
|
+
async with AsyncOpenAI() as client:
|
|
74
|
+
await client.authenticate()
|
|
75
|
+
response = await client.responses.create(input="Explain quicksort briefly.")
|
|
76
|
+
print(response.output_text)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Streaming and reusable Responses WebSockets are async iterators:
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
stream = await client.responses.create(input="Say hello.", stream=True)
|
|
83
|
+
async with stream:
|
|
84
|
+
async for event in stream:
|
|
85
|
+
if event.type == "response.output_text.delta":
|
|
86
|
+
print(event.delta, end="")
|
|
87
|
+
|
|
88
|
+
async with await client.responses.websocket.connect() as ws:
|
|
89
|
+
async for event in ws.create({
|
|
90
|
+
"input": [{"role": "user", "content": [
|
|
91
|
+
{"type": "input_text", "text": "Say hello again."}
|
|
92
|
+
]}]
|
|
93
|
+
}):
|
|
94
|
+
print(event["type"])
|
|
95
|
+
```
|
|
96
|
+
|
|
91
97
|
## Choose the right surface
|
|
92
98
|
|
|
93
99
|
### Direct client: inference and reusable primitives
|
|
@@ -186,7 +192,12 @@ connection reusable across sequential turns:
|
|
|
186
192
|
|
|
187
193
|
```python
|
|
188
194
|
with client.responses.websocket.connect() as ws:
|
|
189
|
-
for event in ws.create({
|
|
195
|
+
for event in ws.create({
|
|
196
|
+
"model": "gpt-5.5",
|
|
197
|
+
"input": [{"role": "user", "content": [
|
|
198
|
+
{"type": "input_text", "text": "Say hello."}
|
|
199
|
+
]}],
|
|
200
|
+
}):
|
|
190
201
|
if event.get("type") == "response.output_text.delta":
|
|
191
202
|
print(event.get("delta", ""), end="")
|
|
192
203
|
```
|
|
@@ -683,11 +694,14 @@ explicit network mutation and clears local credentials only after success.
|
|
|
683
694
|
|
|
684
695
|
## Development
|
|
685
696
|
|
|
697
|
+
In the shared suite, activate `../.venv` and use the workspace installer instead
|
|
698
|
+
of reinstalling this member alone. Standalone development can use any environment.
|
|
699
|
+
|
|
686
700
|
```bash
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
701
|
+
python -m pip install -e ".[dev]"
|
|
702
|
+
python -m pytest -q
|
|
703
|
+
python -m compileall -q codex_backend_sdk
|
|
704
|
+
python -m build
|
|
691
705
|
```
|
|
692
706
|
|
|
693
707
|
Live probes are intentionally kept separate from the deterministic test suite:
|
|
@@ -17,7 +17,7 @@ Quickstart:
|
|
|
17
17
|
print(response.output_text)
|
|
18
18
|
"""
|
|
19
19
|
|
|
20
|
-
__version__ = "0.
|
|
20
|
+
__version__ = "0.6.0"
|
|
21
21
|
|
|
22
22
|
from .oauth import (
|
|
23
23
|
DeviceCode,
|
|
@@ -28,6 +28,19 @@ from .oauth import (
|
|
|
28
28
|
run_oauth_flow,
|
|
29
29
|
)
|
|
30
30
|
from .storage import load_tokens, save_tokens, TokenStore
|
|
31
|
+
from ._async_client import AsyncCodexClient, AsyncOpenAI
|
|
32
|
+
from ._async_streaming import AsyncResponseEventStream
|
|
33
|
+
from .async_resources.responses_websocket import AsyncResponsesWebSocketConnection
|
|
34
|
+
from .async_resources.realtime import (
|
|
35
|
+
AsyncLiveSidebandConnection,
|
|
36
|
+
AsyncLiveSidebandConnectionManager,
|
|
37
|
+
AsyncRealtimeConnection,
|
|
38
|
+
AsyncRealtimeSidebandConnection,
|
|
39
|
+
)
|
|
40
|
+
from .async_resources.remote_control import (
|
|
41
|
+
AsyncRemoteControlConnection,
|
|
42
|
+
AsyncRemoteControlDesktop,
|
|
43
|
+
)
|
|
31
44
|
from .resources.remote_control import (
|
|
32
45
|
RemoteControlClient,
|
|
33
46
|
RemoteControlClientPage,
|
|
@@ -90,6 +103,16 @@ from .codex_client import (
|
|
|
90
103
|
)
|
|
91
104
|
|
|
92
105
|
__all__ = [
|
|
106
|
+
"AsyncCodexClient",
|
|
107
|
+
"AsyncOpenAI",
|
|
108
|
+
"AsyncResponseEventStream",
|
|
109
|
+
"AsyncResponsesWebSocketConnection",
|
|
110
|
+
"AsyncLiveSidebandConnection",
|
|
111
|
+
"AsyncLiveSidebandConnectionManager",
|
|
112
|
+
"AsyncRealtimeConnection",
|
|
113
|
+
"AsyncRealtimeSidebandConnection",
|
|
114
|
+
"AsyncRemoteControlConnection",
|
|
115
|
+
"AsyncRemoteControlDesktop",
|
|
93
116
|
"CodexClient",
|
|
94
117
|
"OpenAI",
|
|
95
118
|
"CodexBackendUnsupportedParameterError",
|