TurboWarp Voice Chat

Talk with an AI by voice in a TurboWarp project. Choose how your voice is heard and how replies are spoken, let the AI call your block functions, and take forced coffee breaks to keep sessions short and cheap.

Before you start

  1. Start @kubohiroya/capability-proxy on 127.0.0.1 with the openai provider. Note the eight-digit pairing code.
  2. Load turbowarp-voice-chat.js as a custom extension with Run without sandbox enabled.

Choose voice in and voice out

Hear my voice withSpeak replies withCost
realtimerealtimeHighest, most natural
realtimebrowser / textLower
browserbrowser / textLowest (text only to the AI)

First conversation

when green flag clicked
configure local relay [http://127.0.0.1:8787]
pair local relay with one-time code [12345678]
set AI model to [gpt-realtime-2.1-mini]
hear my voice with [browser]
speak replies with [browser]
force a coffee break every (10) minutes for (5) minutes, then [resume]
start conversation

when the AI replies
say (AI reply)

Good to know

Full block reference: README.

Voice Chat: complete block reference

All 33 blocks are documented below, including compatibility blocks and blocks available through optional features. Select a block to read its behavior, arguments, default values, and menu choices. Each block has a permanent link.

configure local relay [ENDPOINT]

Sets the loopback origin of the local capability-proxy relay.

Block type: COMMAND. Opcode: configureRelay. Permanent link

ArgumentTypeDefault valueMenu choices
ENDPOINTSTRINGhttp://127.0.0.1:8787

pair local relay with one-time code [CODE]

Exchanges the eight-digit code printed by the relay for a token kept only in memory.

Block type: COMMAND. Opcode: pairRelay. Permanent link

ArgumentTypeDefault valueMenu choices
CODESTRING00000000

local relay paired?

Reports whether an unexpired relay token is held in memory.

Block type: BOOLEAN. Opcode: isRelayPaired. Permanent link

This block has no arguments.

set AI model to [MODEL]

Chooses the model for the next conversation. mini is much cheaper.

Block type: COMMAND. Opcode: setModel. Permanent link

ArgumentTypeDefault valueMenu choices
MODELSTRINGgpt-realtime-2.1-mini
  • gpt-realtime-2.1-mini
  • gpt-realtime-2.1

set AI instructions to [TEXT]

Sets the system instructions for the next conversation.

Block type: COMMAND. Opcode: setInstructions. Permanent link

ArgumentTypeDefault valueMenu choices
TEXTSTRINGYou are a friendly character in a game. Answer in one or two short sentences.

hear my voice with [INPUT]

realtime sends microphone audio to the model; browser recognizes speech in the browser and sends text (cheaper).

Block type: COMMAND. Opcode: setSpeechInput. Permanent link

ArgumentTypeDefault valueMenu choices
INPUTSTRINGrealtime
  • realtime
  • browser

speak replies with [OUTPUT]

realtime plays the model's voice; browser reads the text with the browser's voice (cheaper); text does not speak.

Block type: COMMAND. Opcode: setSpeechOutput. Permanent link

ArgumentTypeDefault valueMenu choices
OUTPUTSTRINGrealtime
  • realtime
  • browser
  • text

set browser speech language to [LANG]

Sets the language of browser speech recognition and speech output.

Block type: COMMAND. Opcode: setLanguage. Permanent link

ArgumentTypeDefault valueMenu choices
LANGSTRINGja-JP
  • ja-JP
  • en-US
  • en-GB
  • zh-CN
  • ko-KR
  • fr-FR
  • de-DE
  • es-ES

set AI voice to [VOICE]

Sets the model's voice used with realtime speech output.

Block type: COMMAND. Opcode: setRealtimeVoice. Permanent link

ArgumentTypeDefault valueMenu choices
VOICESTRINGmarin
  • alloy
  • ash
  • ballad
  • cedar
  • coral
  • echo
  • marin
  • sage
  • shimmer
  • verse

allow interrupting the AI [ONOFF]

With browser input and output, on lets you talk over a reply to stop it (use a headset). off pauses listening while the AI speaks.

Block type: COMMAND. Opcode: setAllowInterruptions. Permanent link

ArgumentTypeDefault valueMenu choices
ONOFFSTRINGoff
  • off
  • on

force a coffee break every [TALK] minutes for [BREAK] minutes, then [AFTER]

Ends the conversation after TALK minutes, waits BREAK minutes, then resumes with a fresh session or stops. TALK 0 turns forced breaks off.

Block type: COMMAND. Opcode: setCoffeeBreak. Permanent link

ArgumentTypeDefault valueMenu choices
TALKNUMBER10
BREAKNUMBER5
AFTERSTRINGresume
  • resume
  • stop

take a coffee break now

Starts a coffee break immediately.

Block type: COMMAND. Opcode: takeBreakNow. Permanent link

This block has no arguments.

end the coffee break now

Ends the coffee break early.

Block type: COMMAND. Opcode: endBreakNow. Permanent link

This block has no arguments.

when coffee break starts

Starts when a coffee break begins.

Block type: HAT. Opcode: whenBreakStarts. Permanent link

This block has no arguments.

when coffee break ends

Starts when a coffee break ends.

Block type: HAT. Opcode: whenBreakEnds. Permanent link

This block has no arguments.

on coffee break?

Reports whether a coffee break is in progress.

Block type: BOOLEAN. Opcode: isOnBreak. Permanent link

This block has no arguments.

coffee break seconds left

Reports the seconds left in the current coffee break.

Block type: REPORTER. Opcode: breakSecondsLeft. Permanent link

This block has no arguments.

start conversation

Connects and starts listening with the current settings.

Block type: COMMAND. Opcode: startConversation. Permanent link

This block has no arguments.

end conversation

Disconnects, stops listening and speaking, and cancels any coffee break.

Block type: COMMAND. Opcode: endConversation. Permanent link

This block has no arguments.

in conversation?

Reports whether a conversation is running (including its coffee breaks).

Block type: BOOLEAN. Opcode: isActive. Permanent link

This block has no arguments.

conversation status

Reports idle, connecting, listening, thinking, speaking, or break.

Block type: REPORTER. Opcode: conversationStatus. Permanent link

This block has no arguments.

say [TEXT] to the AI

Sends typed text as if you had said it.

Block type: COMMAND. Opcode: sendText. Permanent link

ArgumentTypeDefault valueMenu choices
TEXTSTRINGHello!

when I say something

Starts when browser speech recognition hears you (browser input only).

Block type: HAT. Opcode: whenUserSays. Permanent link

This block has no arguments.

what I said

Reports your most recent recognized utterance.

Block type: REPORTER. Opcode: userSaid. Permanent link

This block has no arguments.

when the AI replies

Starts when a reply with text or a transcript arrives.

Block type: HAT. Opcode: whenAiReplies. Permanent link

This block has no arguments.

AI reply

Reports the most recent reply text or transcript.

Block type: REPORTER. Opcode: aiReply. Permanent link

This block has no arguments.

define function [NAME] description [DESCRIPTION] args schema [SCHEMA] export as [EXPORT]

Defines a function. With export as tool, the AI can call it. NAME, DESCRIPTION, and SCHEMA must be literal text.

Block type: HAT. Opcode: defineFunction. Permanent link

ArgumentTypeDefault valueMenu choices
NAMESTRINGget_score
DESCRIPTIONSTRINGReturns the player's current score.
SCHEMASTRING{"type":"object","properties":{}}
EXPORTSTRINGtool
  • tool
  • none

function argument [PATH]

Inside a function, reports the argument at a dotted path.

Block type: REPORTER. Opcode: functionArgument. Permanent link

ArgumentTypeDefault valueMenu choices
PATHSTRINGcity

function arguments JSON

Inside a function, reports all arguments as JSON text.

Block type: REPORTER. Opcode: functionArgumentsJson. Permanent link

This block has no arguments.

return [VALUE]

Inside a function, returns a value and ends the script.

Block type: COMMAND. Opcode: returnValue. Permanent link

ArgumentTypeDefault valueMenu choices
VALUESTRING{"score":10}

AI usage [FIELD]

Reports usage totals since the last reset. costUSD is an estimate; the OpenAI dashboard is authoritative.

Block type: REPORTER. Opcode: usageValue. Permanent link

ArgumentTypeDefault valueMenu choices
FIELDSTRINGcostUSD
  • costUSD
  • responses
  • inputTokens
  • outputTokens
  • cachedInputTokens
  • textInputTokens
  • audioInputTokens
  • textOutputTokens
  • audioOutputTokens

reset AI usage

Clears the usage totals.

Block type: COMMAND. Opcode: resetUsage. Permanent link

This block has no arguments.

last voice chat error

Reports the most recent error, or an empty string.

Block type: REPORTER. Opcode: lastError. Permanent link

This block has no arguments.

Repository guide and examples

Fixed input editing

With a compatible TurboWarp GUI, enable fixed-input forms to edit only standard literal fields. Numbers use complete finite JSON number tokens; menu fields use existing choices. Connected reporters and unavailable fields stay read-only and are never evaluated. Saving an unchanged form preserves exact existing raw values, including legacy spellings and unknown choices. Invalid drafts stay in the same editing session; cancel, project/target replacement, or block removal discards them. Disabling the GUI feature flag restores native field editing. This form does not run blocks, open network/audio/key/QR sessions, resolve names, or edit Schema arguments. Coffee-break minutes must be nonnegative and remain finite after multiplication by 60.