Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_llm_openai Discord

Swarmauri OpenAI LLM

swarmauri_llm_openai provides provider-specific Swarmauri imports for OpenAI chat, reasoning, tool-calling, audio transcription, and text-to-speech workflows. The package exposes OpenAIModel, OpenAIReasonModel, OpenAIToolModel, OpenAIAudio, and OpenAIAudioTTS as direct provider-package imports while preserving the shared runtime implementations in swarmauri_standard.

The repo currently tracks OpenAI chat model families including gpt-5.x, gpt-4.1, gpt-4o, gpt-4-turbo, gpt-oss, reasoning families including o1, o3, and o4-mini, audio transcription models including whisper-1 and gpt-4o-*transcribe, and text-to-speech models including tts-1, tts-1-hd, and gpt-4o-mini-tts.

Why Use This Package?

  • Keep OpenAI-specific imports explicit in Swarmauri applications.
  • Use separate adapters for standard chat, reasoning, tool-calling, transcription, and TTS workflows.
  • Reuse Swarmauri Conversation, toolkit, and component semantics across the OpenAI surface area.
  • Track current OpenAI model families through one provider package boundary.

FAQ

What does swarmauri_llm_openai install?

It installs OpenAIModel, OpenAIReasonModel, OpenAIToolModel, OpenAIAudio, and OpenAIAudioTTS.

Which OpenAI capabilities are wrapped today?

The package covers standard chat completions, reasoning-oriented chat models, tool-calling workflows, audio transcription, and text-to-speech generation.

What is the difference between OpenAIModel and OpenAIReasonModel?

OpenAIModel targets general chat model families such as gpt-5.x, gpt-4.1, and gpt-4o. OpenAIReasonModel targets the reasoning families tracked in the repo, including o1, o3, and o4-mini variants.

When should I use OpenAIToolModel?

Use it when the application needs OpenAI tool calling through a Swarmauri toolkit. It is the provider-specific surface for tool-backed agent workflows.

What do OpenAIAudio and OpenAIAudioTTS do?

OpenAIAudio wraps audio transcription workflows. OpenAIAudioTTS wraps text-to-speech generation workflows.

Where should I verify current models and pricing?

Use the OpenAI section in docs/LLM_PROVIDER_MODEL_PRICING_LINKS.md, which points to the current OpenAI models, function-calling, audio, TTS, and pricing documentation.

Features

  • OpenAIModel for sync, async, streaming, and batch chat completion workflows.
  • OpenAIReasonModel for reasoning-model workflows across the repo-tracked o* families.
  • OpenAIToolModel for toolkit-backed tool-calling and agent execution flows.
  • OpenAIAudio for speech-to-text workflows against the tracked OpenAI transcription models.
  • OpenAIAudioTTS for text-to-speech workflows against the tracked OpenAI TTS models.
  • Compatibility with Python 3.10, 3.11, 3.12, 3.13, and 3.14.

Installation

uv add swarmauri_llm_openai
pip install swarmauri_llm_openai

Usage

Set OPENAI_API_KEY in your environment before creating any of the OpenAI adapters.

Chat Completion

import os

from swarmauri_llm_openai import OpenAIModel
from swarmauri_standard.conversations.Conversation import Conversation
from swarmauri_standard.messages.HumanMessage import HumanMessage

conversation = Conversation()
conversation.add_message(HumanMessage(content="Summarize Swarmauri in two sentences."))

model = OpenAIModel(
    api_key=os.environ["OPENAI_API_KEY"],
    name="gpt-5.5",
)
result = model.predict(conversation=conversation)

print(result.get_last().content)

Reasoning Model

import os

from swarmauri_llm_openai import OpenAIReasonModel
from swarmauri_standard.conversations.Conversation import Conversation
from swarmauri_standard.messages.HumanMessage import HumanMessage

conversation = Conversation()
conversation.add_message(HumanMessage(content="Reason through a release rollback plan step by step."))

model = OpenAIReasonModel(
    api_key=os.environ["OPENAI_API_KEY"],
    name="o3",
)
result = model.predict(conversation=conversation)

print(result.get_last().content)

Tool Calling

import os

from swarmauri_llm_openai import OpenAIToolModel
from swarmauri_standard.conversations.Conversation import Conversation
from swarmauri_standard.messages.HumanMessage import HumanMessage
from swarmauri_standard.toolkits.Toolkit import Toolkit
from swarmauri_standard.tools.AdditionTool import AdditionTool

conversation = Conversation()
conversation.add_message(HumanMessage(content="What is 19 + 23? Use the tool."))

toolkit = Toolkit(tools={"add": AdditionTool()})

model = OpenAIToolModel(
    api_key=os.environ["OPENAI_API_KEY"],
    name="gpt-5.5",
)
result = model.predict(
    conversation=conversation,
    toolkit=toolkit,
    tool_choice="auto",
)

print(result.get_last().content)

Audio Transcription

import os

from swarmauri_llm_openai import OpenAIAudio

audio_model = OpenAIAudio(
    api_key=os.environ["OPENAI_API_KEY"],
    name="whisper-1",
)

text = audio_model.predict("tests/static/test.mp3")
print(text)

Text To Speech

import os

from swarmauri_llm_openai import OpenAIAudioTTS

tts_model = OpenAIAudioTTS(
    api_key=os.environ["OPENAI_API_KEY"],
    name="tts-1",
)

audio_bytes = tts_model.predict("Swarmauri turns provider APIs into composable components.")
print(len(audio_bytes))

Examples

  • Use OpenAIModel for general-purpose chat completion workflows.
  • Use OpenAIReasonModel when you want the reasoning-model family explicitly.
  • Use OpenAIToolModel when an agent needs toolkit-backed tool invocation.
  • Use OpenAIAudio and OpenAIAudioTTS when the workflow crosses text, speech, and audio generation boundaries.

Foundational Swarmauri Packages

More Documentation

Best Practices

  • Keep OPENAI_API_KEY in environment variables or a secret manager.
  • Pick the adapter that matches the workflow: chat, reasoning, tool-calling, transcription, or TTS.
  • Validate model availability against current OpenAI docs before hard-coding a dated model variant in production.
  • Use reasoning models deliberately, since they should be chosen for workflows that actually benefit from deeper multi-step reasoning.

License

Apache-2.0

Resumable tool approvals

Pass the tool model to AgentRunner to pause before application tools run. This requires swarmauri_standard>=0.11.0.dev9.

Speech import migration

OpenAIAudioTTS is retained with a deprecation warning. For new speech code, install swarmauri_tts_openai and use from swarmauri_tts_openai import OpenaiTTS. The new provider remains alpha and live API verification is tracked in issue #6268.

OpenAIAudioTTS remains a deprecated compatibility import. The canonical swarmauri_tts_openai package also warns that OpenAI's Speech models shut down on 2027-01-06. The Realtime replacement uses a different API; see the migration guide.

Metadata

Release files for swarmauri_llm_openai 0.11.0.dev5

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

Source distribution (sdist)

Source distribution for swarmauri_llm_openai 0.11.0.dev5
File Size Uploaded Provenance Actions
swarmauri_llm_openai-0.11.0.dev5.tar.gz 9.7 kB Without provenance Details for swarmauri_llm_openai-0.11.0.dev5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for swarmauri_llm_openai 0.11.0.dev5
File Interpreter ABI Platform Actions
swarmauri_llm_openai-0.11.0.dev5-py3-none-any.whl Python 3 none any Details for swarmauri_llm_openai-0.11.0.dev5-py3-none-any.whl

Total release size: 21.3 kB

Release files / swarmauri_llm_openai-0.11.0.dev5.tar.gz

Download URL swarmauri_llm_openai-0.11.0.dev5.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
209e79a705f993b633fbf7e67ed5992d34bb29707064eebdd7af80aeca255771
BLAKE2b-256 checksum
How to use checksums
f2023bff0c42420128245d454e3a3c73ab5c51c6af4f2cef25ea3a9a71a0ee41
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 / swarmauri_llm_openai-0.11.0.dev5-py3-none-any.whl

Download URL swarmauri_llm_openai-0.11.0.dev5-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
841dfbe982f8d29c769c7001d499302423f00193b0c3dbdaf9218310fea71035
BLAKE2b-256 checksum
How to use checksums
aefa54000c2c4f280ea7ee6b5546018fc470a03969327a80e139cca0cf3e4910
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 swarmauri_llm_openai 0.11.0.dev5

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.

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