Skip to main content
TL;DR
  • Orq.ai has no single voice endpoint: voice in and voice out are two dedicated calls composed around a normal chat completion, not a chat mode.
  • This walkthrough builds that loop with four calls: get a clip, transcribe it, get an answer, speak the answer back.

What you’ll build

A four-call voice loop: a spoken question goes in, gets transcribed to text, gets answered by a model, and the answer comes back out as audio. Every call is a plain request against the AI Gateway, shown in cURL, TypeScript, and Python.

What you’ll learn

  • How to call the dedicated transcription and text-to-speech endpoints
  • Why there is no single “voice mode” call, and how to compose the two endpoints around a normal chat completion instead

Prerequisites

  • An Orq.ai workspace and API key, available as $ORQ_API_KEY
  • curl, or the openai package for TypeScript (npm install openai) or Python (pip install openai)
No Orq.ai SDK or UI step is required. The AI Gateway is OpenAI-compatible, so the standard openai client works against it with just a different baseURL. The cURL blocks below are independent, standalone commands. Copy each one’s output into the next by hand. The TypeScript and Python blocks build one continuous script instead. Add each block to the same file in order.

Step 1: Get a clip to work with

Generate a short spoken clip with the same text-to-speech endpoint used again in Step 4, so nothing outside this page is needed to follow along. Skip this step if starting from an existing audio file instead.
question.mp3 now holds the spoken question.

Step 2: Transcribe it to text

Send the clip to the transcription endpoint.

Step 3: Get a response

Pass the transcript straight into a normal chat completion. This is the same AI Gateway call used anywhere else. Nothing audio-specific about it.
Chat completions are not deterministic. Wording varies slightly between runs. The content above is one real captured response, not a fixed value to match exactly. Internal bookkeeping fields (id, created, system_fingerprint, token detail breakdowns) are omitted here since they don’t affect how to use the response.

Step 4: Speak the response back

Send the model’s answer to the text-to-speech endpoint, this time with an ElevenLabs voice.
answer.mp3 is a spoken version of the model’s answer. The loop is complete: spoken question in, spoken answer out, with no single endpoint doing both.
For the full model, voice, and parameter reference across every supported provider, see Audio on the Multimodal page. This walkthrough only covers what is needed to compose the loop above.
This pattern generalizes past a single question and answer. Any voice interface on Orq.ai composes the same way: transcribe the input, run it through a model, speak the response back. Swap Step 3 for a different model, a system prompt, or a full agent. The surrounding transcription and text-to-speech calls stay the same.

Next steps

  • Traces, inspect each call in this loop after it runs
  • Build Agents, replace the bare chat completion in Step 3 with a full Agent
  • Receipt Extraction, the same non-text-input pattern applied to images instead of audio