n4nAI

Audio input APIs: GPT-4o vs Gemini native audio

Compare the audio input API GPT-4o vs Gemini native audio across latency, cost, ergonomics, and limits to pick the right multimodal model for your app.

n4n Team4 min read943 words

Audio narration

Coming soon — every post will get a voice note here.

The audio input API GPT-4o vs Gemini native audio decision shapes your entire voice pipeline. OpenAI ships audio as a first-class input to a speech-native model with a dedicated realtime transport, while Gemini treats audio as another blob in a million-token multimodal context. The right call depends on whether you need interactive latency or bulk comprehension.

Capabilities

GPT-4o audio input

GPT-4o exposes audio through two distinct surfaces. The Realtime API (gpt-4o-realtime-preview) streams audio over a WebSocket, maintaining session state for interruption handling and low-latency turn-taking. The REST surface (gpt-4o-audio-preview) accepts base64-encoded audio inside a input_audio content block and returns text or synthesized speech.

The model hears raw audio—not a transcript. It picks up prosody, speaker overlaps, and non-verbal cues. You can prompt it to reason about how something was said, not just the words.

Gemini native audio

Gemini 1.5 Pro and Flash ingest audio as inline data parts or GCS URIs in the standard generateContent call. There is no separate realtime audio socket; you upload the clip (or reference a stored file) and stream the text response. The model processes the waveform directly inside its multimodal transformer, so it can attend to specific seconds across a long recording without external segmentation.

Gemini’s differentiator is context length. A 1M-token window holds roughly an hour of compressed audio, letting you ask cross-referenced questions over an entire podcast or shift log in one request.

Price and cost model

OpenAI meters audio input as discrete audio tokens, priced at a premium over text tokens for the same model. Output audio (speech synthesis) is billed separately per audio token. You pay for the model’s internal representation, not wall-clock duration.

Gemini folds audio into its unified multimodal token accounting. Google does not charge a separate ASR line item—there is no transcription step to bill. For long clips, the token count scales with audio length and sample rate, but the absence of a pre-processing tax makes bulk analysis cheaper at the margin.

Neither provider publishes a simple per-second rate; both expect you to estimate token counts from their encoding specs. If you route through a gateway, per-token usage metering becomes your reconciliation layer.

Latency and throughput

GPT-4o Realtime targets sub-second assistant response after user speech ends. The WebSocket keeps the connection warm, so you avoid per-call setup. The REST audio preview adds cold-start overhead: encode, upload, server-side decode, then generation—typically multi-second for anything beyond a few seconds of audio.

Gemini streaming begins emitting tokens after the full audio payload is received and preflighted. For a 10-minute file, you wait for upload plus prefill before the first token. Throughput is high once generation starts, but it is not a conversational loop. Batch a queue of clips and you’ll saturate a project quota fast; watch the 60 RPM default on the free tier.

Ergonomics and SDKs

OpenAI’s Python SDK mirrors the chat completion shape with a typed input_audio block:

from openai import OpenAI
client = OpenAI()
resp = client.chat.completions.create(
    model="gpt-4o-audio-preview",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "Extract action items"},
            {"type": "input_audio", "input_audio": {"data": wav_b64, "format": "wav"}}
        ]
    }]
)
print(resp.choices[0].message.content)

Gemini’s SDK is equally flat, but audio is just another part:

import google.generativeai as genai
genai.configure(api_key="KEY")
model = genai.GenerativeModel("gemini-1.5-flash")
resp = model.generate_content([
    "Extract action items",
    {"mime_type": "audio/wav", "data": wav_bytes}
])
print(resp.text)

OpenAI’s Realtime API demands a state machine for session updates, while Gemini’s declarative prompt fits existing REST patterns. If you already run a chat backend, Gemini drops in with less new code.

Ecosystem and routing

OpenAI’s audio models pair with its speech synthesis and a growing Realtime agent toolchain. Gemini sits inside Vertex AI, with IAM, bucket URIs, and batch prediction. For teams on GCP, native audio avoids egress and keeps data in-region.

If you need to abstract these differences behind one OpenAI-compatible endpoint, n4n.ai routes to 240+ models and applies automatic fallback when a provider is rate-limited, while metering per-token usage and forwarding cache-control hints. That matters when you want to flip a voice app from GPT-4o to Gemini without rewriting the client.

Limits and constraints

GPT-4o audio preview caps single inputs at 20 MB and ~2 hours of audio; the Realtime API enforces 25 MB message size and session timeouts. Gemini accepts files up to 2 GB via GCS or 20 MB inline, but the 1M-token context is the real ceiling—exceed it and the request fails before inference.

Both reject unsupported codecs; WAV and MP3 are safe. OpenAI requires base64 in JSON; Gemini accepts raw bytes in the SDK but base64 in REST. Neither streams partial audio transcripts—you get the model’s text output, not a word-by-word caption.

Head-to-head comparison

Dimension GPT-4o audio Gemini native audio
Input transport WebSocket (realtime) or REST input_audio REST/grpc inline or GCS URI
Real-time interaction Yes, sub-second turns No, batch after upload
Context window 128K tokens 1M+ tokens
Billing Separate audio token rate Unified multimodal tokens
Max inline size 20 MB (REST) 20 MB (inline), 2 GB via GCS
SDK complexity Higher for realtime state Low, declarative
Non-verbal cues Preserved natively Preserved natively
Cloud lock-in OpenAI only GCP/Vertex friendly

Which to choose

Build a voice agent with interruptions. Use GPT-4o Realtime. The WebSocket session and turn-taking primitives save you from building your own VAD-and-backoff loop. Latency is the only thing that feels natural in a phone call.

Analyze long meetings or media archives. Gemini wins. Upload the file to GCS, point generateContent at the URI, and ask questions that span the full recording. You skip chunking and stitching transcripts.

Prototype fast on existing chat infra. Gemini’s drop-in part array means you change one message block. No new connection lifecycle.

Need speech output too. GPT-4o audio preview returns synthesized speech in the same call; Gemini needs a separate TTS step (or Vertex Speech).

Cost-sensitive bulk labeling. Gemini’s lack of a separate ASR charge keeps the bill predictable when you process thousands of clips nightly.

Multi-provider redundancy. Put an OpenAI-compatible gateway in front and keep both wired. When one provider degrades, fallback preserves the user experience without client changes.

Tagsaudiomultimodalgpt-4ogemini

Written by

n4n Team

The team building n4n — a single OpenAI-compatible API in front of 240+ models, with automatic fallback, load balancing and pay-per-token metering.

More from n4n Team →

All multimodal routing comparison posts →