RepoOpenAIOpenAIpublished Oct 5, 2026seen 1w

openai/openai-live-esp32

C

Open original ↗

Captured source

source ↗
published Oct 5, 2026seen 1wcaptured 1whttp 200method plain

openai/openai-live-esp32

Description: Experimental Live API SDK for ESP32-S3 with a Waveshare voice app. Not officially supported by OpenAI.

Language: C

License: Apache-2.0

Stars: 3

Forks: 0

Open issues: 0

Created: 2026-10-05T23:37:16Z

Pushed: 2026-11-19T01:34:04Z

Default branch: main

Fork: no

Archived: no

README:

OpenAI Live SDK for ESP32

> Experimental project. Not officially supported by OpenAI. This is a proof > of concept, with no stability guarantees or support commitment.

Build a voice assistant with the OpenAI Live API on supported ESP32 boards. The project has two parts.

1. Core SDK: a portable C protocol library and an ESP-IDF WebRTC/Opus adapter. 2. Device examples: a native Live Voice app for the Waveshare ESP32-S3-Touch-AMOLED-1.8 V2, integrated into its Brookesia launcher, standalone apps for the round Waveshare ESP32-S3-Touch-AMOLED-1.75 and M5Stack CoreS3 LITE, and a screenless Sonatino headset example, plus M5Stack StackChan with camera/servos and ESP-Mosaico with camera, interaction module, and sensors.

Watch: Running Voice Models on ESP32 — an 80-second demo on the Waveshare device.

https://github.com/user-attachments/assets/06a60f02-aeef-4a53-a377-453e5d0a028e

A separate [experimental portable WebRTC package](packages/peer) provides a libpeer-derived C transport, host interoperability tests, and a security review. It is independently buildable and supplies the device examples' WebRTC transport.

Core SDK

The core SDK handles Live sessions, WebRTC transport, and audio streaming. Your application supplies networking and microphone/speaker drivers; a display is optional. The device apps below show how to connect these pieces to real hardware.

| Component | Purpose | | --- | --- | | [components/live](components/live) | Portable C API for session creation, JSON offer/answer, events, mute, and graceful close. Depends on cJSON; has no board or credential storage. | | [components/live_esp32](components/live_esp32) | ESP-IDF adapter: HTTPS signaling, portable peer connection, Opus audio, transcript buffers, usage accounting, and startup timing. | | [components/live_peer](components/live_peer) | ESP-IDF build and platform integration for the source-built WebRTC transport in packages/peer. | | [examples/protocol_smoke](examples/protocol_smoke) | Hardware-independent ESP32-S3 protocol test firmware for QEMU and esp-emu. |

Start with the [core integration guide](docs/core.md) and [live_esp32.h](components/live_esp32/include/live_esp32.h). Initialize the adapter with your configuration and audio callbacks, then call live_esp32_start() after Wi-Fi has an IP address. Audio callbacks exchange 24 kHz, signed 16-bit mono PCM. The portable C library in [live.h](components/live/include/live.h) can also be used with another transport implementation.

The SDK uses the public Live WebRTC JSON offer/answer protocol at POST https://api.openai.com/v1/live/sessions. RTP carries audio; a reliable data channel carries JSON events. This is the Live API, whose signaling and event contract differs from the Realtime API.

Customize the system prompt and Live configuration

The example apps initialize live_esp32_config_t in [LiveVoice.cpp](examples/waveshare/LiveVoice.cpp) (Waveshare), [main.cpp](examples/waveshare_round/main/main.cpp) (round Waveshare), [main.cpp](examples/m5stack/main/main.cpp) (M5Stack), [main.cpp](examples/stackchan/main/main.cpp) (StackChan), [main.cpp](examples/mosaico/main/main.cpp) (Mosaico), or [main.cpp](examples/sonatino/main/main.cpp) (Sonatino). Set these fields before calling live_esp32_init():

| Setting | Configuration | Example configuration | | --- | --- | --- | | Frontend instructions | instructions | Your board-specific system prompt; NULL keeps the adapter default | | Startup greeting | greeting | Optional spoken welcome, up to 256 bytes; NULL keeps existing startup behavior | | Frontend voice model | model | LIVE_MODEL, generated from the environment; defaults to gpt-live-1 | | Delegated Responses model | responses_model | LIVE_RESPONSES_MODEL, generated from the environment; defaults to gpt-6-luna | | Backend instructions | responses_instructions | Instructions for the delegated backend, such as when to search and how to summarize findings | | Backend service tier | responses_service_tier | "priority" in the device examples | | Hosted web search | responses_web_search | true in the device examples; set false to omit the web-search tool | | API key | api_key | LIVE_API_KEY from the private preparation step below |

Set the frontend system prompt on your board's configuration:

config.instructions =
"You are a friendly voice assistant. Keep answers brief and conversational. "
"Delegate current-information questions to your backend and wait for its findings.";

NULL preserves the adapter's default prompt. responses_instructions controls the delegated backend and does not replace the frontend prompt. An optional greeting is submitted once after the session is active using session.commentary.append, without a delegated backend call. The model may paraphrase it, and the user can interrupt. A new connection gets a new greeting; an ambiguous send failure is not retried. The cinema example opts into this. The voice name remains a shared adapter setting (cfg.voice in [live_esp32.cpp](components/live_esp32/live_esp32.cpp)); when using the portable C library directly, set live_config_t.instructions and live_config_t.voice. Rebuild and flash after changing settings.

Boards can opt into capture_photo and/or declare function tools through live_esp32_config_t.tools_json with an execute_tool callback. The adapter combines these with hosted web search, executes board calls sequentially on a low-priority worker, and sends their results back to Responses. The callback validates arguments, polls cancellation during hardware actions, and returns bounded text. Existing voice-only apps need no changes. See the [StackChan example](examples/stackchan/README.md#tools-and-motion-behavior) and [callback contract](components/live_esp32/include/live_esp32.h).

Set the API key and model names

For the device examples, save your API key as a single line in a private file outside this checkout, such as $HOME/.config/openai-live-esp32/api-key, with...

Excerpt shown — open the source for the full document.