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.1.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.1-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

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

Hashes for purra_openai-0.5.1.tar.gz
Algorithm Hash digest
SHA256 366d0b06ec17c6e772925f947e903ec0a5bb4868cf3f59ba6c14b762ebcc2a66
MD5 d979c8f1a47beeb1b1669b9ff43d21b3
BLAKE2b-256 5f9e0fed22fbb468c4aee490669e2e0d8a4544c3b1d0406003dc18bf34df1842

See more details on using hashes here.

Provenance

The following attestation bundles were made for purra_openai-0.5.1.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.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

Hashes for purra_openai-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3c20ce166224107c2fe9c788343d59de36c922b7aefdd5600e31f6a9b2db5d04
MD5 89d697348a4ac78abb072051b45acb98
BLAKE2b-256 49c1f8d834d5630a4c2c2c897fd885c5e8e2c5940d410c84f7bca181f90c258d

See more details on using hashes here.

Provenance

The following attestation bundles were made for purra_openai-0.5.1-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

This release

0.5.1 This release

2 files

0.5.0

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