Skip to main content
OpenAI models are the most common default for Swarms agents. The full GPT and o-series lineup — GPT-5.4, GPT-4.1, GPT-4o, o3, and o3-mini — works through the same Agent interface with no extra setup.

Installation

Environment Setup

Or in a .env file:

Quick Start

The minimum needed to run a GPT agent:

Model Names

GPT-4.1 — The Workhorse

The right default for most production agents. Strong quality, full tool/vision/streaming support, predictable cost.

GPT-5.4 — Frontier Reasoning

For your hardest reasoning, planning, and coding tasks. GPT-5.4 supports the full Agent feature set including tools and streaming.

o3 — Reasoning Models

The o-series models (o3, o3-mini, o1) are optimized for chain-of-thought reasoning. They’re slower and pricier per token but deliver dramatically better results on math, code, and multi-step planning.
For reasoning models, set reasoning_effort and leave temperature at its default. The model’s internal chain-of-thought is not exposed in the response — only the final answer.

GPT-4o — Vision & Multimodal

GPT-4o is OpenAI’s multimodal model. Pass an image path, URL, or base64 string:

Streaming

Stream tokens straight to stdout:
Or pipe tokens through your own callback:

Tool Use

GPT-4.1 and GPT-5.4 handle long, parallel tool-call sequences extremely well:

Structured Outputs

GPT models support structured JSON outputs via Pydantic schemas:

Mixing Models in a Workflow

Different OpenAI models for different jobs:

Production Defaults

For GPT agents in production:

Next Steps