purra-openai · Python
English | 简体中文
OpenAI model gateways for PurrA using the official Python SDK. Supports text, function tools, streaming, cancellation, and token usage. Requires Python 3.11+.
Install
From the repository root:
python -m pip install . ./integrations/openai/python
Choose an API
| Gateway | API |
|---|---|
OpenAIResponsesGateway |
Responses |
OpenAIChatCompletionsGateway |
Chat Completions |
from openai import AsyncOpenAI
from purra_openai import OpenAIResponsesGateway
client = AsyncOpenAI()
gateway = OpenAIResponsesGateway(client, timeout_seconds=60)
For Chat Completions, replace the gateway:
from purra_openai import OpenAIChatCompletionsGateway
gateway = OpenAIChatCompletionsGateway(client, timeout_seconds=60)
Pass gateway to AgentCore(model_gateway=gateway, ...). In the Run's
ModelRequest, set provider="openai", the model ID, and its capability snapshot.
The application supplies credentials and verified model limits.
Options and behavior
ModelRequest.options accepts max_tokens, temperature, top_p, and
reasoning_effort. Choose options supported by the selected model.
Core resolves the output limit; the gateway applies it to the selected API.
SDK retries are disabled so Core controls retry and budget accounting. Server-side response storage is disabled. Responses reasoning continuation is kept in private message data; preserve it with the conversation when resuming.
These gateways support native OpenAI text and function-tool APIs. Images, audio, and hosted tools are not supported. Other vendors require application adapters.
Close a supplied SDK client in the application. await gateway.close() closes
only a client created by the gateway itself.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file purra_openai-0.5.1.tar.gz.
File metadata
- Download URL: purra_openai-0.5.1.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
366d0b06ec17c6e772925f947e903ec0a5bb4868cf3f59ba6c14b762ebcc2a66
|
|
| MD5 |
d979c8f1a47beeb1b1669b9ff43d21b3
|
|
| BLAKE2b-256 |
5f9e0fed22fbb468c4aee490669e2e0d8a4544c3b1d0406003dc18bf34df1842
|
Provenance
The following attestation bundles were made for purra_openai-0.5.1.tar.gz:
Publisher:
release.yml on Lybrands/purra
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
purra_openai-0.5.1.tar.gz -
Subject digest:
366d0b06ec17c6e772925f947e903ec0a5bb4868cf3f59ba6c14b762ebcc2a66 - Sigstore transparency entry: 2750452606
- Sigstore integration time:
-
Permalink:
Lybrands/purra@39aa1843a30c5cb5aa955e35fe93a155dbd330d8 -
Branch / Tag:
refs/tags/v0.5.1 - Owner: https://github.com/Lybrands
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@39aa1843a30c5cb5aa955e35fe93a155dbd330d8 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file purra_openai-0.5.1-py3-none-any.whl.
File metadata
- Download URL: purra_openai-0.5.1-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c20ce166224107c2fe9c788343d59de36c922b7aefdd5600e31f6a9b2db5d04
|
|
| MD5 |
89d697348a4ac78abb072051b45acb98
|
|
| BLAKE2b-256 |
49c1f8d834d5630a4c2c2c897fd885c5e8e2c5940d410c84f7bca181f90c258d
|
Provenance
The following attestation bundles were made for purra_openai-0.5.1-py3-none-any.whl:
Publisher:
release.yml on Lybrands/purra
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
purra_openai-0.5.1-py3-none-any.whl -
Subject digest:
3c20ce166224107c2fe9c788343d59de36c922b7aefdd5600e31f6a9b2db5d04 - Sigstore transparency entry: 2750452668
- Sigstore integration time:
-
Permalink:
Lybrands/purra@39aa1843a30c5cb5aa955e35fe93a155dbd330d8 -
Branch / Tag:
refs/tags/v0.5.1 - Owner: https://github.com/Lybrands
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@39aa1843a30c5cb5aa955e35fe93a155dbd330d8 -
Trigger Event:
workflow_dispatch
-
Statement type: