codex-backend-sdk 0.3.4__tar.gz → 0.3.5__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.3.4 → codex_backend_sdk-0.3.5}/CHANGELOG.md +8 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/PKG-INFO +1 -1
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/codex_backend_sdk/__init__.py +1 -1
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/codex_backend_sdk/_models.py +1 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/codex_backend_sdk/resources/_responses_payloads.py +1 -7
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/codex_backend_sdk/resources/responses.py +7 -1
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/pyproject.toml +1 -1
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/tests/test_responses_resource.py +6 -1
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/.gitignore +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/LICENSE +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/README.md +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/codex_backend_sdk/_client.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/codex_backend_sdk/_streaming.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/codex_backend_sdk/_transport.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/codex_backend_sdk/_utils.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/codex_backend_sdk/codex_client.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/codex_backend_sdk/oauth.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/codex_backend_sdk/pkce.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/codex_backend_sdk/resources/__init__.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/codex_backend_sdk/resources/codex.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/codex_backend_sdk/resources/files.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/codex_backend_sdk/resources/models.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/codex_backend_sdk/resources/openai_oauth.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/codex_backend_sdk/resources/realtime.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/codex_backend_sdk/storage.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/docs/backend-api.md +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/examples/agent.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/tests/conftest.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/tests/test_account_info.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/tests/test_basic.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/tests/test_client_retry.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/tests/test_codex_resources.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/tests/test_conversation.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/tests/test_files_resource.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/tests/test_openai_oauth_resources.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/tests/test_realtime_resource.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/tests/test_reasoning.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/tests/test_structured_output.py +0 -0
- {codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/tests/test_tools.py +0 -0
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.3.5] - 2026-05-18
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- Preserved `usage` on `client.responses.compact(...)` results so `CompactedResponse` exposes backend token accounting.
|
|
9
|
+
|
|
10
|
+
### Tests
|
|
11
|
+
- Added coverage to verify compact responses retain `input_tokens`, `output_tokens`, and `total_tokens`.
|
|
12
|
+
|
|
5
13
|
## [0.3.4] - 2026-05-15
|
|
6
14
|
|
|
7
15
|
### Added
|
|
@@ -258,6 +258,7 @@ class CompactedResponse(CodexBaseModel):
|
|
|
258
258
|
id: str
|
|
259
259
|
object: str = "response.compacted"
|
|
260
260
|
output: list[dict[str, Any]] = Field(default_factory=list)
|
|
261
|
+
usage: Optional[ResponseUsage] = Field(default_factory=ResponseUsage)
|
|
261
262
|
|
|
262
263
|
|
|
263
264
|
class BinaryResponseContent:
|
|
@@ -175,13 +175,7 @@ def normalize_input_item(item: Any) -> dict[str, Any]:
|
|
|
175
175
|
def normalize_tools(tools: Any) -> list[dict[str, Any]]:
|
|
176
176
|
if not _is_given(tools) or tools is None:
|
|
177
177
|
return []
|
|
178
|
-
|
|
179
|
-
for tool in tools:
|
|
180
|
-
item = _as_dict(tool)
|
|
181
|
-
if item.get("type") == "web_search":
|
|
182
|
-
item["type"] = "web_search_preview"
|
|
183
|
-
normalized.append(item)
|
|
184
|
-
return normalized
|
|
178
|
+
return [_as_dict(tool) for tool in tools]
|
|
185
179
|
|
|
186
180
|
|
|
187
181
|
def normalize_reasoning(reasoning: Any) -> dict[str, Any]:
|
{codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/codex_backend_sdk/resources/responses.py
RENAMED
|
@@ -10,6 +10,7 @@ from .._streaming import stream_response_events
|
|
|
10
10
|
from .._utils import _UNSET, _default, _is_given, _reject_backend_unsupported
|
|
11
11
|
from ._responses_payloads import (
|
|
12
12
|
ResponsesCreateRequest,
|
|
13
|
+
_usage_from_backend,
|
|
13
14
|
collect_response,
|
|
14
15
|
merge_text_format,
|
|
15
16
|
normalize_input_item,
|
|
@@ -221,4 +222,9 @@ class Responses:
|
|
|
221
222
|
if _is_given(text) and text is not None:
|
|
222
223
|
payload["text"] = normalize_text(text)
|
|
223
224
|
data = self._client._post("/responses/compact", body=payload).json()
|
|
224
|
-
return CompactedResponse(
|
|
225
|
+
return CompactedResponse(
|
|
226
|
+
id=data.get("id", ""),
|
|
227
|
+
object=data.get("object", "response.compacted"),
|
|
228
|
+
output=data.get("output", []),
|
|
229
|
+
usage=_usage_from_backend(data.get("usage")),
|
|
230
|
+
)
|
|
@@ -39,6 +39,7 @@ class FakeClient(OpenAI):
|
|
|
39
39
|
return FakeJSONResponse({
|
|
40
40
|
"id": "resp_123",
|
|
41
41
|
"output": [{"type": "message", "content": []}],
|
|
42
|
+
"usage": {"input_tokens": 11, "output_tokens": 7, "total_tokens": 18},
|
|
42
43
|
})
|
|
43
44
|
return FakeSSE([
|
|
44
45
|
'data: {"type":"response.content_part.delta","delta":{"text":"hel"}}',
|
|
@@ -282,6 +283,10 @@ def test_responses_compact_sends_shared_request_fields():
|
|
|
282
283
|
)
|
|
283
284
|
|
|
284
285
|
assert compacted.id == "resp_123"
|
|
286
|
+
assert compacted.usage is not None
|
|
287
|
+
assert compacted.usage.input_tokens == 11
|
|
288
|
+
assert compacted.usage.output_tokens == 7
|
|
289
|
+
assert compacted.usage.total_tokens == 18
|
|
285
290
|
path, payload, stream = client.posts[0]
|
|
286
291
|
assert path == "/responses/compact"
|
|
287
292
|
assert stream is False
|
|
@@ -295,7 +300,7 @@ def test_responses_compact_sends_shared_request_fields():
|
|
|
295
300
|
"content": [{"type": "input_text", "text": "Long context"}],
|
|
296
301
|
}
|
|
297
302
|
],
|
|
298
|
-
"tools": [{"type": "
|
|
303
|
+
"tools": [{"type": "web_search"}],
|
|
299
304
|
"parallel_tool_calls": True,
|
|
300
305
|
"reasoning": {"effort": "medium"},
|
|
301
306
|
"service_tier": "priority",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{codex_backend_sdk-0.3.4 → codex_backend_sdk-0.3.5}/codex_backend_sdk/resources/openai_oauth.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|