Skip to main content

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+.

In 1.0.0 development, Chat Completions also accepts the optional static image contract with image_input=True. Responses image input is not implemented in this slice.

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.

Metadata

Release files for purra-openai 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for purra-openai 1.0.2
File Size Uploaded Provenance Actions
purra_openai-1.0.2.tar.gz 14.6 kB With provenance Details for purra_openai-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for purra-openai 1.0.2
File Interpreter ABI Platform Actions
purra_openai-1.0.2-py3-none-any.whl Python 3 none any Details for purra_openai-1.0.2-py3-none-any.whl

Total release size: 24.8 kB

Release files / purra_openai-1.0.2.tar.gz

Download URL purra_openai-1.0.2.tar.gz
Size 14.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c4d92d6527921665d70f2ceceb5d0f65c07b4f6e76a4d07e3cba0923c5bd93ae
BLAKE2b-256 checksum
How to use checksums
964b427aa118eaa2a751147e4f894adbae52b6bf9ed3d00cb0fcae6bf6a9341d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

Release files / purra_openai-1.0.2-py3-none-any.whl

Download URL purra_openai-1.0.2-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b0a6e9219f3de148e424cce55bdd52b03f71fa94ac5c2efcc1d4b52ffa91c757
BLAKE2b-256 checksum
How to use checksums
b773af41910c92976b4b3c63775396c44816d643d573a0fda5981a2c6027d589
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

Security for purra-openai 1.0.2

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for purra_openai-1.0.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page