AI Voice Agent API Cost: STT, LLM and TTS on One Ofox Bill
Transcription of a 7.64-second recording billed as eight seconds, a two-sentence answer and 9.32 seconds of synthesized speech added up to $0.0102885 for one support turn.
Transcription of a 7.64-second recording billed as eight seconds, a two-sentence answer and 9.32 seconds of synthesized speech added up to $0.0102885 for one support turn. The text model accounted for 73.6% of the bill and took 41.5 seconds to return its answer. For this pipeline, start latency tuning at the text step.
The pipeline at a glance
| Step | Ofox endpoint | Model | Billed by | Our measured result |
|---|---|---|---|---|
| 1. Transcribe the caller | POST /v1/audio/transcriptions | openai/gpt-transcribe | Seconds of input audio | 8 s billed, $0.0006, 3.6 s |
| 2. Answer | POST /v1/chat/completions | google/gemini-4-neon | Input and output tokens (thinking counts as output) | 74 in / 490 out, $0.0076, 41.5 s |
| 3. Speak the answer | POST /v1/audio/speech | google/gemini-3.8-flash-tts | Text input tokens and audio output tokens | 39 in / 233 out, $0.0021, 4.7 s |
Step 1: Transcribe the caller
from openai import OpenAI
client = OpenAI(base_url="https://api.ofox.ai/v1", api_key="YOUR_OFOX_API_KEY")
with open("question.wav", "rb") as f:
transcript = client.audio.transcriptions.create(model="openai/gpt-transcribe", file=f)
question = transcript.text
The 7.64-second question was billed as 8 seconds for $0.0006. The request took 3.6 seconds. See the transcription cost guide for budgeting.
The transcript was accurate, with one detail worth planning for: the order number came back spelled out as “A dash one zero four two”. Neon still read it as A-1042, but if your code extracts IDs with a pattern such as A-\d+, normalise spelled-out characters and digits first, or ask the model to return the ID in a structured field.
Step 2: Answer with a chat model
reply = client.chat.completions.create(
model="google/gemini-4-neon",
messages=[
{"role": "system", "content": "You are a concise support agent. Answer in two short sentences."},
{"role": "user", "content": question},
],
max_tokens=1024,
)
answer = reply.choices[0].message.content
Of 490 output tokens, 447 were reasoning tokens (91.2%). The reply offered a refund although the request had no refund tool. Route that action through the order system and confirm success before announcing it to the caller.
Step 3: Speak the answer
with client.audio.speech.with_streaming_response.create(
model="google/gemini-3.8-flash-tts",
voice="Kore",
input=answer,
response_format="wav",
) as resp:
resp.stream_to_file("answer.wav")
The speech endpoint returned a 9.32-second, 24 kHz mono WAV in 4.7 seconds. The November 20 log lists 39 text input tokens, 233 audio output tokens and a charge of $0.0021165.
What one turn costs

| Step | Billed | Share | Wall-clock time |
|---|---|---|---|
| Transcribe 8 s question | $0.0006 | 5.8% | 3.6 s |
| Gemini 4 Neon answer | $0.0076 | 73.6% | 41.5 s |
| Speak 9.3 s answer | $0.0021 | 20.6% | 4.7 s |
| Turn total | $0.0103 | 49.8 s |
Test a faster text model without changing the voice
Keep the transcript, system message, output limit and TTS voice fixed. In the Step 2 request, replace only the model ID with a low-latency chat model enabled for your Ofox account. Alternate the two models on the same questions. Record time to the complete answer, total billed cost and whether the reply preserves the order ID. Reject any answer that claims a refund without a successful transaction.
Test streaming separately. Time from the end of the question to the first audible reply in the client. A faster first text token helps only if your application starts synthesis and playback before the full reply arrives.
Errors you may hit
| Symptom | Likely cause | Fix |
|---|---|---|
401 Invalid or expired API key | In this test the key was copied from the masked list in the dashboard; the full key is shown only once, in the creation dialog | Create a new key and use the copy button in the creation dialog; see our AI API error handling guide |
| Slow response | The text step took 41.5 s in the recorded turn | Time each stage and record first audible playback |
| IDs come back as “A dash one zero four two” | Transcription spells out characters and digits | Normalise before pattern matching, or extract IDs with the model into a structured field |
| The agent promises refunds or changes it never made | No tool, or no rule tying promises to tool results | Add real tools and only speak confirmed actions |
Related Docs
- Ofox speech endpoint: request parameters and formats for TTS
- Ofox API overview: base URL, authentication and error codes
- Ofox Gemini model docs: model IDs and thinking parameters
Method
One sequential Ofox turn on November 20, 2026. The setup call that synthesized the caller’s question is excluded. Stage durations measure completed requests; the client did not record first audible playback.
Frequently Asked Questions
- How much did each stage cost?
- Transcription cost $0.0006, text generation $0.007572 and speech synthesis $0.0021165, for a total of $0.0102885 for this turn.
- How many audio tokens represented one second?
- The TTS response recorded 233 output tokens for 9.32 seconds of audio, or about 25 per second in this sample.


