"""Async client for the baseline's released vLLM endpoint. The request and response handling mirror the released clients (stepaudior1vllm.py in stepfun-ai/Step-Audio-R1, stepaudio2vllm.py in stepfun-ai/Step-Audio2): role "human", audio as `input_audio` wav parts of at most 25 s, skip_special_tokens false, the assistant prefix sent as an unfinished last message, text read from tts_content.tts_text or content, audio tokens read from tts_content.tts_audio. Nothing here is guessed; where the released code is silent (how R1.1 is asked to speak), serving/probe_baseline.py tries the released prefixes and records what comes back. """ import base64 import io import json import re import wave import numpy as np from duplex.spec import SR AUDIO_TOKEN = re.compile(r"") SPEECH_MARKUP = re.compile(r"|") MAX_CLIP_S = 25.0 # the released client splits longer audio into 25 s parts def wav_bytes(pcm16, sr=SR): buf = io.BytesIO() with wave.open(buf, "wb") as w: w.setnchannels(1) w.setsampwidth(2) w.setframerate(sr) w.writeframes(np.asarray(pcm16, dtype=" and markers). So audio is read from both places. audio = [int(i) for i in AUDIO_TOKEN.findall(tts.get("tts_audio") or content)] yield delta, SPEECH_MARKUP.sub("", text), audio