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

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

purra_openai-0.5.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

purra_openai-0.5.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file purra_openai-0.5.0.tar.gz.

File metadata

  • Download URL: purra_openai-0.5.0.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

Hashes for purra_openai-0.5.0.tar.gz
Algorithm Hash digest
SHA256 b7d5deb9a89c691f3136e27df07ee008413daea9700863a97676bb4c4a8d5255
MD5 5134c572c6da95b41183de38ffa0baf6
BLAKE2b-256 69063f244b5c2644afa837a30800fdaabe724decc60704da05213627aa3f9da4

See more details on using hashes here.

Provenance

The following attestation bundles were made for purra_openai-0.5.0.tar.gz:

Publisher: release.yml on Lybrands/purra

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file purra_openai-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: purra_openai-0.5.0-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

Hashes for purra_openai-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7f6de2d54a778e0be1c7386554effcc2a355f2bf4864fec26e62c81ecbd3ddf1
MD5 eca84fae38903e492d4e3061d908f088
BLAKE2b-256 280d9a86638605392fbc1036eff11a9dc9d39a5abde242fa374acef1abacc67a

See more details on using hashes here.

Provenance

The following attestation bundles were made for purra_openai-0.5.0-py3-none-any.whl:

Publisher: release.yml on Lybrands/purra

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.5.1

2 files

This release

0.5.0 This release

2 files

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