Routing

Cost Controls

Overview

(Beta)

slng.ai now supports Cost Caps, allowing developers to control the maximum amount they spend per TTS or STT transaction. This feature is ideal for teams managing budget-sensitive applications, pay-as-you-go systems, or building on behalf of customers with tiered usage.

You can set a pricing_limit_per_request value in your API call, and our Smart Routing engine will automatically select the best available model within your defined cost ceiling.

Key Features

  • Per-Request Cost Control
  • Org-Level Defaults Coming Soon
  • Smart Routing + Cost Filtering
  • Works with All Supported Models
  • Protects Against Unexpected Overages

How It Works

When you include a pricing_limit_per_request value in your request, slng.ai will:

  1. Filter out all models whose estimated per-request cost exceeds your limit.
  2. Score the remaining models based on quality, latency, and regional fit.
  3. Execute using the best model that fits within the cap.
  4. If no models qualify, return a graceful error.

Example Request

Code(json)
POST /tts Content-Type: application/json { "text": "This should cost less than 0.002 USD.", "language": "en-US", "pricing_limit_per_request": 0.002 }

Sample cURL

Code(bash)
curl -X POST https://api.slng.ai/tts \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "text": "Cost capped request", "language": "en-US", "pricing_limit_per_request": 0.002 }'

Request Parameters (Cost Caps)

FieldTypeDescription
pricing_limit_per_requestfloatThe maximum amount (in USD) you're willing to spend for this request.

Use Cases

  • 💸 Budget-Constrained Apps: Stay under a predictable spend per user or transaction
  • 🧪 Experimentation: Test cheaper models without sacrificing user experience
  • 💼 Reseller Mode: Offer tiered pricing to your own users based on request limits

Behavior

  • If your cost cap is too low, your request will return:
Code(json)
{ "error": "No models available within your pricing limit." }
  • If Smart Routing is used with a cost cap, it will rank models within the cap only.

  • If combined with regional routing, both filters apply.


Limitations (Beta)

  • Costs are estimated and may vary slightly based on response length
  • Cloning may increase cost and reduce availability under strict caps
  • No support yet for monthly or org-level spend caps (coming soon)


Last updated: June 2025

Last modified on