# Building a speech-to-text transcription service



Learn how to deploy a scalable, cost-efficient speech-to-text service using OpenAI Whisper and Podstack’s serverless Python GPU functions.



Audio · 2026-10-30 · 3 min read



Building high-performance speech-to-text (STT) services is a common requirement for modern AI applications, ranging from automated meeting notes to real-time captioning. However, developers often face a dilemma: settle for high-latency API calls to generic providers or manage complex GPU infrastructure to run state-of-the-art models like OpenAI's Whisper.

Running these models on local hardware is rarely viable for production, and traditional cloud instances often lead to wasted spend during idle periods. In this guide, we will walk through building a scalable transcription service using Python and Podstack’s serverless GPU functions, allowing you to pay only for the seconds your model is actually processing audio.

## Choosing the Right Model

While there are many STT models available, OpenAI’s **Whisper** remains the industry standard for accuracy and multilingual support. For a production service, we recommend using the `faster-whisper` implementation. It utilizes CTranslate2, a fast inference engine for Transformer models, which can be up to 4x faster than the original implementation while using less memory.

When deploying on Podstack, you can leverage the `large-v3` model for maximum accuracy or `distil-large-v2` if your primary concern is inference speed and lower cost.

## Setting Up Your Environment

To get started, you’ll need the Podstack API installed and your API key configured. This allows you to deploy Python functions directly to high-end GPUs without worrying about Dockerfiles or Kubernetes manifests.

```text
Podstack does not ship a command-line interface. Use the console, the Python package `podstack-sdk`, or the API at https://podstack.ai/api/v1 with a `ps_live_` key.
```

Next, create a project directory and a `requirements.txt` file including `faster-whisper` and `torch`.

## Implementation: The Transcription Function

The core logic of our service involves loading the model into GPU memory and processing the audio buffer. Podstack allows you to define a "setup" phase to load the model weights once, ensuring that subsequent requests (warm hits) are processed near-instantaneously.

Here is a practical implementation of a Podstack GPU function:

```python
import podstack
from faster_whisper import WhisperModel

# The 'podstack.gpu' decorator tells the platform to 
# provision an NVIDIA GPU (e.g., A100 or L4) for this logic.
@podstack.gpu(model="large-v3", gpu_type="l4")
class TranscriptionService:
    def __init__(self):
        # This runs once when the container starts
        self.model = WhisperModel("large-v3", device="cuda", compute_type="float16")

    def transcribe(self, audio_url: str):
        # The transcribe method performs the actual inference
        segments, info = self.model.transcribe(audio_url, beam_size=5)
        
        results = []
        for segment in segments:
            results.append({
                "start": segment.start,
                "end": segment.end,
                "text": segment.text
            })
            
        return {
            "language": info.language,
            "duration": info.duration,
            "segments": results
        }

# Deploying the function to a live endpoint
if __name__ == "__main__":
    podstack.deploy(TranscriptionService)
```

## Scaling and Optimization

When building this for a production environment, consider these three technical optimizations:

1.  **VAD (Voice Activity Detection) Filter**: Whisper can sometimes "hallucinate" text during silent periods. Enabling the `vad_filter` in `faster-whisper` helps the model ignore non-speech audio, reducing processing time and improving accuracy.
2.  **Batching**: If you are processing thousands of short audio clips, batching them into a single inference call can significantly increase throughput.
3.  **Cold Start Management**: Podstack’s serverless nature means the GPU is de-provisioned when not in use. For latency-sensitive apps, you can set a `min_replicas` value in your configuration to keep one GPU "warm" while allowing the rest of the cluster to scale to zero.

## Deploying to Podstack

To deploy your service, you simply use the API. Podstack handles the provisioning of the GPU, the installation of CUDA drivers, and the creation of a secure HTTPS endpoint.

```text
Podstack does not ship a command-line interface. Use the console, the Python package `podstack-sdk`, or the API at https://podstack.ai/api/v1 with a `ps_live_` key.
```

Once deployed, you receive an endpoint URL. You can now send audio files via a simple POST request. Because Podstack bills per second, if a transcription takes 4.5 seconds, you are only charged for those 4.5 seconds of GPU time.

## Handling Long-Form Audio

For audio files longer than 30 minutes, it is best practice to treat the transcription as an asynchronous job rather than a synchronous API call. You can trigger the Podstack function and provide a webhook URL. Once the GPU finishes the transcription, Podstack will POST the JSON result back to your main application backend. This prevents timeout issues and allows your application to handle other tasks while the GPU works.

## Conclusion

Building a speech-to-text service doesn't require managing complex infrastructure. By combining the efficiency of `faster-whisper` with Podstack’s on-demand GPU architecture, you can deploy a production-grade STT engine in minutes. This approach gives you the best of both worlds: the performance of dedicated hardware and the cost-efficiency of serverless billing.

Ready to deploy your first model? Head over to your dashboard, grab your `PODSTACK_API_KEY`, and turn your Python functions into scalable GPU endpoints today.
