OpenAI connector for Python
Install with pip install dex-connector-openai==0.2.1. The package requires
dex-connectors-sdk==0.12.0 and dex-python-sdk>=1.28.0, and implements the
manifest operations createResponse (Mutation) and retrieveResponse (Query)
with the same branches, defaults, and failure classification as the Go module.
Operations
| Operation | Factory | Happy branch | Optional branches |
|---|---|---|---|
createResponse |
new_create_response_step |
completed |
failed, providerRejected, uncertain, defect |
retrieveResponse |
new_retrieve_response_step |
found |
notFound, providerRejected, invalidResponse, defect |
createResponse retries
The Responses API does not deduplicate create requests, so createResponse
fences every retry with its own Dex heartbeat checkpoint. Keep the Step's
manifest sync Execute durability, and record no other heartbeats in that Step.
- An attempt that observed a response ID reads that response back instead of
creating another one, polling
queuedandin_progressuntil five seconds before the Execute deadline. - Each checkpoint carries
sendCount, the possibly billed creates so far. 503, 429, a connection refused before sending, and a definite refusal add none; acancelledresponse counts, since it may be billed. - Every other unconfirmed outcome without a response ID (408, 409, a 3xx,
another 4xx, a 5xx other than 503, or an ambiguous transport failure)
retries and resends while possible creates stay below the send cap of 3,
and selects
uncertainat the cap. A read-back that cannot confirm a known response selectsuncertain. - A 2xx answer created a response: when it yields no readable response ID (an
unreadable, oversized, or cut-off body, or a stream that ends before naming
the response), the operation selects
uncertainat once and never resends.
The manifest retry policy allows eight attempts within fifteen minutes; the send cap still allows at most three billed creates.
Streaming and structured output
Passing progress_stream or text_stream to new_create_response_step makes
OpenAI stream the response. Lifecycle events become progress, text deltas are
appended to the text Stream best effort, and the terminal event selects the
branch. maxResponseBytes bounds the whole stream and maxSseEventBytes one
event; after either limit the connector drains the stream and reads the stored
response back when its ID was observed.
StructuredOutput sends a JSON Schema text.format; the completed
output_text is then the JSON value.
Authorization and configuration
Create a Dex Web connection as described in the
connector README. The API key travels only in the
Authorization header. The modelPicker configuration UI unit
(UI_UNIT_MODEL_PICKER, port UI_MODEL_PICKER_PORT_MODEL) lets Dex Web store
a per-Step model; a blank model uses the connection's model.
Example
examples/summarize_text records the
request, creates a summary with streamed text and a model picker, and records
the outcome. Run the Worker with
uv run python -m examples.summarize_text.worker after dexcli dev has loaded
a project containing the openai-api connection.
Tests
openaimock.Mock scripts both operations and defaults to the manifest's
default answers. Run uv run pytest tests for fencing, streaming, read-back,
and manifest contract checks. With dexcli dev running, run
DEX_FLOW_SERVICE_ADDRESS=127.0.0.1:34701 uv run pytest integration to drive the
example through a real Dex Worker with a scripted provider transport. The
Python mock checks create requests and strict structured answers with the SDK
text generation validator, matching the Go connector's mock contract.
uv run pytest tests/test_conformance.py replays the Go-recorded provider
scenarios for both operations. Live OpenAI authorization and provider behavior
have not been verified.
Metadata
Release files for dex-connector-openai 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dex_connector_openai-0.2.1.tar.gz | 93.4 kB | Without provenance | Details for dex_connector_openai-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dex_connector_openai-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for dex_connector_openai-0.2.1-py3-none-any.whl |
Total release size: 123.5 kB
Release files / dex_connector_openai-0.2.1.tar.gz
| Download URL | dex_connector_openai-0.2.1.tar.gz |
|---|---|
| Size | 93.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0ef2c33ee5efa8d92f045302af9ceeec45a32fdb3cc02df82069f81ba5e58369
|
|
BLAKE2b-256 checksum How to use checksums |
156d531c79757341e98f3b280b4f529d60ba1fede5614e7f7178160a5c427197
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / dex_connector_openai-0.2.1-py3-none-any.whl
| Download URL | dex_connector_openai-0.2.1-py3-none-any.whl |
|---|---|
| Size | 30.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dd2495296eb924e1c84b8f3e06ab2ae2ba1e34c9b07ad17a90368fe7c00af278
|
|
BLAKE2b-256 checksum How to use checksums |
f65ef4b4d4a178a2725c4f1d3e78c794facf06017354c79f7da74e11fe54abb7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for dex-connector-openai 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.