> For clean Markdown of any page, append `.md` to the page URL. > For a complete documentation index, see https://docs.sarvam.ai/llms.txt. > For full documentation content in one file, see https://docs.sarvam.ai/llms-full.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.sarvam.ai/_mcp/server. # Deploy Speech-to-Text (Saaras v3) > Deploy the Saaras v3 speech-to-text model on Amazon SageMaker — real-time and streaming endpoints — from your AWS Marketplace subscription using boto3. Deploy **Saaras v3** as a SageMaker endpoint in your own account. This guide covers a real-time endpoint end to end with `boto3`, then streaming for longer audio. The full, runnable notebook lives in [`sarvamai/amazon-sagemaker-examples`](https://github.com/sarvamai/amazon-sagemaker-examples/tree/main/speech-to-text/saaras-v3.1). > **Note** > > **Model identifier.** In API requests you pass **`model: saaras:v3`**. The Marketplace package is versioned **`saaras:v3.1`** — that's the package revision you subscribe to, *not* the value you send in a request. See the [API reference](/api/self-hosted/sagemaker/api-saaras). > **Warning** > > Saaras v3 self-hosted supports **real-time** (audio up to 30 seconds) and **streaming** (WebSocket, for longer/continuous audio). **Batch transform is not currently supported** for Saaras v3 — use the streaming endpoint for long recordings. ## Prerequisites Complete [Get started on SageMaker](/api/self-hosted/sagemaker/get-started) first: subscribe to the listing, copy your **model package ARN**, and have an **execution role ARN** ready. Read the endpoint's [API reference](/api/self-hosted/sagemaker/api-saaras) carefully before you integrate — the request contract is enforced by the container. ## 1. Configure **`Configuration`** ```python Configuration import boto3 region = boto3.Session().region_name role = "arn:aws:iam:::role/" # Copy this from your Marketplace subscription, for your region: model_package_arn = "arn:aws:sagemaker:::model-package/" realtime_instance = "ml.g6e.xlarge" # 1x NVIDIA L40S endpoint_name = "saaras-stt" sm = boto3.client("sagemaker", region_name=region) runtime = boto3.client("sagemaker-runtime", region_name=region) ``` ## 2. Deploy a real-time endpoint #### Create the model Point a SageMaker model at the Marketplace package. Keep **network isolation on** so the container has no internet egress. ```python sm.create_model( ModelName=endpoint_name, PrimaryContainer={"ModelPackageName": model_package_arn}, ExecutionRoleArn=role, EnableNetworkIsolation=True, ) ``` #### Create the endpoint config ```python sm.create_endpoint_config( EndpointConfigName=endpoint_name, ProductionVariants=[{ "VariantName": "AllTraffic", "ModelName": endpoint_name, "InstanceType": realtime_instance, "InitialInstanceCount": 1, }], ) ``` #### Create the endpoint ```python sm.create_endpoint(EndpointName=endpoint_name, EndpointConfigName=endpoint_name) sm.get_waiter("endpoint_in_service").wait(EndpointName=endpoint_name) ``` Provisioning a GPU endpoint typically takes **10–15 minutes**. It's ready when its status is `InService`. ## 3. Invoke it Send audio as `multipart/form-data` (the only accepted content type — see the [API reference](/api/self-hosted/sagemaker/api-saaras)). Choose an output mode with the `mode` field (`transcribe`, `translate`, `verbatim`, `translit`, `codemix`). **`Invoke`** ```python Invoke # build_multipart() assembles the form fields + audio file into a multipart body; # see the reference notebook for the full helper. boundary = "----sarvam-boundary" with open("call.wav", "rb") as f: body = build_multipart( fields={"model": "saaras:v3", "mode": "transcribe", "with_timestamps": "true"}, file_bytes=f.read(), boundary=boundary, ) resp = runtime.invoke_endpoint( EndpointName=endpoint_name, ContentType=f"multipart/form-data; boundary={boundary}", Accept="application/json", Body=body, ) print(resp["Body"].read().decode()) ``` See the full request and response schema in the [Speech-to-Text API reference](/api/self-hosted/sagemaker/api-saaras). > **Warning** > > The real-time REST path accepts audio up to **30 seconds**. For longer or continuous audio, use the **streaming** endpoint below — batch transform is not supported for Saaras v3. ## Streaming (live audio) For continuous, low-latency transcription, deploy the model and invoke the **bidirectional streaming** operation `InvokeEndpointWithBidirectionalStream` — a two-way SigV4 HTTP/2 stream on port 8443. The message protocol and parameters (`language-code`, `sample_rate`, `vad_signals`) are documented in the [API reference](/api/self-hosted/sagemaker/api-saaras#streaming-invokeendpointwithbidirectionalstream). ## Clean up GPU endpoints bill by the hour. Delete resources you're not using: **`Cleanup`** ```python Cleanup sm.delete_endpoint(EndpointName=endpoint_name) sm.delete_endpoint_config(EndpointConfigName=endpoint_name) sm.delete_model(ModelName=endpoint_name) ``` #### [Prefer infrastructure-as-code?](/api/self-hosted/sagemaker/terraform) Deploy the same endpoint with Terraform — IAM role, model, endpoint config, and endpoint in one `apply`. > Deploy the Saaras v3 speech-to-text model on Amazon SageMaker — real-time and streaming endpoints — from your AWS Marketplace subscription using boto3.