Skip to navigation

Standalone Voice Tracking

Track STT, TTS, and STS usage individually when they are not part of an integrated voice session. Use these methods to send granular usage data directly to Paygent.

Standalone STT

Track Speech-to-Text usage by providing the audio duration in minutes. This is ideal for modular systems where STT is handled independently.

standalone_stt.py
import paygent_sdk
client = paygent_sdk.init(api_key="your-paygent-api-key")
client.track_stt(
agent_id="agent-123", # your external-agent-id
customer_id="customer-456",
indicator="stt-service-call",
stt_usage_data={
"serviceProvider": "Deepgram",
"model": "nova-3",
"plan": "default",
"audioDuration": 0.45, # Duration in minutes
}
)

Standalone TTS

Track Text-to-Speech usage by providing the character count. Use this for standalone voice synthesis tasks.

standalone_tts.py
import paygent_sdk
client = paygent_sdk.init(api_key="your-paygent-api-key")
client.track_tts(
agent_id="agent-123", # your external-agent-id
customer_id="customer-456",
indicator="tts-service-call",
tts_usage_data={
"serviceProvider": "Elevenlabs",
"model": "eleven-v3",
"plan": "default",
"characterCount": 420, # total characters
}
)

Standalone STS

Track Speech-to-Speech usage with detailed input and output token counts for both text and audio modalities.

standalone_sts.py
import paygent_sdk
from paygent_sdk.models import SpeechToSpeechUsageMetadata, StsInputSide, StsOutputSide, StsModalityUsage
client = paygent_sdk.init(api_key="your-paygent-api-key")
# Define detailed usage metadata
usage = SpeechToSpeechUsageMetadata(
input=StsInputSide(
audio=StsModalityUsage(tokens=2000),
text=StsModalityUsage(tokens=150)
),
output=StsOutputSide(
audio=StsModalityUsage(tokens=2000),
text=StsModalityUsage(tokens=400)
),
)
client.track_sts(
agent_id="agent-123", # your external-agent-id
customer_id="customer-456",
indicator="sts-service-call",
usage_metadata=usage,
service_provider="Google",
model="gemini-3.1-flash-live-preview",
plan="default",
)

Fire and Forget. All standalone tracking methods are asynchronous and follow a “fire-and-forget” pattern, ensuring minimal latency impact on your primary application flow.