# Microsoft AI: MAI-Voice-2.1-Flash on AICredits

Guide for calling `microsoft/mai-voice-2.1-flash` through the AICredits API. Paste it into a coding agent to add this model to a project.

MAI-Voice-2.1-Flash is a low-latency text-to-speech model from Microsoft AI, optimized for real-time responsiveness. It produces natural, expressive speech across 23 languages, with human-like intonation, rhythm, and emotional nuance. It is...

## Model

- Model ID: `microsoft/mai-voice-2.1-flash`
- Type: tts
- Input: text
- Output: speech

## Pricing

- ₹1.464 per 1K chars

Prices are in Indian rupees and are deducted from your prepaid wallet. They follow the live USD/INR rate, so read the current figure from `GET https://api.aicredits.in/v1/models` or https://aicredits.in/models/microsoft/mai-voice-2.1-flash.

## Authentication

Create an API key (it starts with `sk-`) in Dashboard → API Keys, then send it as a bearer token:

```text
Authorization: Bearer $AICREDITS_API_KEY
```

## API

### Speech API (text to speech)

POST https://api.aicredits.in/v1/audio/speech

The response is raw audio bytes, not JSON. Voice names depend on the model; the example uses `alloy`. If the request returns a 400 about the voice, pick a voice that this model supports.

```bash
curl https://api.aicredits.in/v1/audio/speech \
  -H "Authorization: Bearer $AICREDITS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "microsoft/mai-voice-2.1-flash",
    "input": "Hello from AICredits!",
    "voice": "alloy"
  }' \
  --output speech.mp3
```

## Errors

| Status | Message contains | What to do |
|---|---|---|
| 401 | `Invalid API Key` | The key is wrong, revoked or from another provider. Use an AICredits key (it starts with sk-) from Dashboard → API Keys. |
| 402 | `API Key Budget Exceeded` | This key has used its budget. Raise the budget in Dashboard → API Keys, or use another key. |
| 402 | `Insufficient Balance` | The wallet cannot cover the request. Top up in Dashboard → Billing. |
| 404 | `Unknown endpoint: POST /v1/v1/…` | The base URL is wrong, most often /v1 typed twice. OpenAI-format clients use https://api.aicredits.in/v1; Anthropic-format clients use https://api.aicredits.in. |
| 404 | `Model '…' is not available` | The model ID is not in the catalog. IDs are written provider/model; copy one from the models page or GET /v1/models. |

Provider errors, timeouts and empty replies are not billed. Which failed or cancelled calls are billed: https://aicredits.in/docs/troubleshooting/failed-calls-and-billing

## More

- Model page: https://aicredits.in/models/microsoft/mai-voice-2.1-flash
- All docs: https://aicredits.in/docs
- Index for agents: https://aicredits.in/llms.txt
