Maton

Fish Audio

Access the Fish Audio API with managed authentication. Read the account's credit, voice models, agents, sessions, and dictionaries; generate speech and transcribe audio; and create or change models, agents, and phone numbers. Text to speech, speech to text, and voice design are billed per use, voice models clone a real person's voice, and agents can call real phone numbers. All access runs through the Maton gateway and the maton CLI.

Permissions

Suggested read access

In the Console, Read limits the connection to these 37 read-only endpoints, plus deny rules for any write endpoint a broader rule would otherwise match. Endpoints Maton has found to return credentials, start jobs, or spend credits are left out; a few reads that can change state or return a secret depending on their parameters stay in, and their descriptions say how. It is a suggestion: the saved rules are exactly the ones you see, and you can change them with Custom. See Access policy.

Reference

Account

Get API Credit

maton api '/fish-audio/wallet/self/api-credit'

Response:

{
  "_id": "65f1c2a8e4b0a1d2c3e4f5a6",
  "user_id": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6",
  "credit": "12.500000",
  "available_credit": "12.500000",
  "reserved_credit": "0.000000",
  "package_credit": "0.000000",
  "cumulative_top_up": "20.000000",
  "balance_status": "ok",
  "has_credit": true,
  "has_billing_history": true,
  "created_at": "2026-01-10T08:00:00Z",
  "updated_at": "2026-11-30T21:00:00Z"
}

Credit is in USD. This call is free, so it is the one to make first to check the connection.

Get Package

maton api '/fish-audio/wallet/self/package'

Returns the plan: type (free, or the subscription), total, balance, and extra_balance, billing_period, current_period_end, and subscription_status.

Voice Models

A voice model (also called a voice) is what reference_id names in text to speech. The library holds public voices from other users; self=true lists the workspace's own.

List Models

maton api '/fish-audio/model?page_size=10&sort_by=score&language=en'
maton api '/fish-audio/model?self=true&page_size=20'

Query parameters:

  • page_size (default 10), page_number (default 1)
  • title: Search term matching the title, description, and tags
  • tag, language, title_language: Filters (repeatable)
  • self: true for the workspace's own models; visibility filters those
  • author_id: Public models by one author
  • licensed: true for voices whose rights Fish Audio has secured from the voice owner
  • sort_by: score, task_count, or created_at

Response:

{
  "total": 1000,
  "has_more": true,
  "items": [
    {
      "_id": "802e3bc2b27e49c2995d23ef70e6ac89",
      "type": "tts",
      "title": "Energetic Narrator",
      "description": "A bright, upbeat voice for explainers.",
      "state": "trained",
      "train_mode": "fast",
      "visibility": "public",
      "languages": ["en"],
      "tags": ["male", "narration", "energetic"],
      "like_count": 1520,
      "task_count": 284310,
      "samples": [{"title": "Default", "text": "Welcome back to the show.", "audio": "https://..."}],
      "author": {"_id": "f0e1d2c3b4a5968778695a4b3c2d1e0f", "nickname": "voicelab", "avatar": "https://..."},
      "created_at": "2025-07-11T02:00:27.005Z"
    }
  ]
}

The library is paged up to max_offset; narrow with title, tag, or language rather than paging through it.

Get Model

maton api '/fish-audio/model/{model_id}'

Returns the same fields as a list item, including samples with audio URLs.

Create, Update, and Delete Models

maton api '/fish-audio/model/{model_id}' -X PATCH -H 'Content-Type: application/json' --input - <<'JSON'
{"title": "Support line voice", "visibility": "private"}
JSON
maton api '/fish-audio/model/{model_id}' -X DELETE

POST model creates a voice model from uploaded recordings (voices, with type: "tts", title, and train_mode: "fast", which makes it usable at once); it takes multipart/form-data or MessagePack with the audio files, which maton api does not send. visibility: "public" is downgraded to private; publishing happens in the Fish Audio web app. Deleting a model is permanent, and any text to speech naming its ID stops working.

Text to Speech

Generate Speech

maton api '/fish-audio/v1/tts' -X POST -H 'Content-Type: application/json' -H 'model: s2.1-pro-free' \
  --input - > speech.mp3 <<'JSON'
{"text": "Hello from Maton.", "format": "mp3"}
JSON

The model is chosen with the model header: s2.1-pro-free (free), s2.1-pro, s2-pro, drama-3, or s1 (retiring on 2026-12-31). The response is the audio itself, so write it to a file rather than printing it.

Body fields:

  • text (string, required): The text to speak.
  • reference_id (string or array): A voice model ID from the library or the workspace; omit for the default voice.
  • format: mp3 (default bitrate 128, set with mp3_bitrate), wav, pcm, or opus; sample_rate overrides the format's default.
  • language: A BCP-47 tag such as en or es-MX.
  • prosody: {"speed": 1.0, "volume": 0, "normalize_loudness": true}.
  • latency: normal (best quality), balanced, or low.
  • temperature and top_p (default 0.7): Expressiveness and variety.
  • normalize (default true): Speaks numbers, dates, and units as words.
  • pronunciation_dictionary: Up to 3 dictionaries to apply.

Inline references (cloning from audio in the request, without a saved model) need a MessagePack body, which maton api does not send; save a voice model and use reference_id instead.

Generate Speech with Word Timestamps

maton api '/fish-audio/v1/tts/stream/with-timestamp' -X POST -H 'Content-Type: application/json' -H 'model: s2.1-pro-free' \
  --input - <<'JSON'
{"text": "Hello from Maton.", "format": "mp3"}
JSON

Takes the same body as v1/tts and streams server-sent events carrying base64 audio chunks and word-level timestamps. Billed like v1/tts.

The live WebSocket endpoints (v1/tts/live and v1/asr/realtime) are not reachable through the gateway.

Speech to Text

POST v1/asr transcribes an audio file sent as multipart/form-data (field audio, optional language and ignore_timestamps) with the model header set to transcribe-1 or transcribe-1-pro. maton api sends JSON or a raw body, not multipart forms, so transcription isn't available through it; JSON with base64 audio is not accepted. Each call is billed per audio hour, rounded up to the second; failed requests are not billed.

Voice Design

Design a Voice

maton api '/fish-audio/v1/voice-design' -X POST -H 'Content-Type: application/json' -H 'model: voice-design-1' \
  --input - <<'JSON'
{"instruction": "A calm, warm female voice in her thirties with a slight British accent.", "language": "en", "n": 2}
JSON

Generates n (default 2) candidate voices from a description. Each candidate in candidates has an id, the sample text, and its audio as audio_base64. Costs $0.01 per successful request. Saving a candidate as a voice goes through POST model and its voice_design_signatures field.

Agents

Fish Audio agents hold voice conversations on the web or by phone.

List and Get Agents

maton api '/fish-audio/v1/agent/agents?page_size=20&search=desk'
maton api '/fish-audio/v1/agent/agents/{agent_id}'
maton api '/fish-audio/v1/agent/agents/{agent_id}/versions'

Response:

{
  "agents": [
    {"agent_id": "agt_01jd8x2k3m4n5p6q7r8s9t0v", "name": "Front desk", "status": "active", "publication_state": "live", "created_at": "2026-10-01T12:00:00Z"}
  ],
  "has_more": false,
  "next_cursor": null
}

search matches agent names and include_archived=true adds archived agents. Lists page with cursor set to the previous next_cursor.

v1/agent/agents/{agent_id}/config (the draft configuration) and v1/agent/agents/{agent_id}/versions/{version_number} return the agent's full configuration, including the custom headers sent to a custom LLM endpoint or a transfer destination. Fish Audio nulls only headers whose names look like credentials, so other values (such as x-vercel-protection-bypass) come back. Both are kept out of the read-only policy.

Sessions

maton api '/fish-audio/v1/agent/sessions?agent_id={agent_id}&status=completed&page_size=30'
maton api '/fish-audio/v1/agent/sessions/{session_id}'
maton api '/fish-audio/v1/agent/sessions/{session_id}/recording' > session.mp3

Query parameters: agent_id, status (pending, active, completed, failed), end_reason, conversation_status, direction (inbound or outbound), caller_number (E.164), created_after, created_before, cursor or page, and page_size. A session holds the transcript; the recording is audio.

Tools, Knowledge, and Tests

maton api '/fish-audio/v1/agent/tools'
maton api '/fish-audio/v1/agent/knowledge-sources'
maton api '/fish-audio/v1/agent/knowledge-folders'
maton api '/fish-audio/v1/agent/tests'
maton api '/fish-audio/v1/agent/test-runs'
maton api '/fish-audio/v1/agent/llm-models'
maton api '/fish-audio/v1/agent/background-sounds'

llm-models lists the LLMs an agent can use with their usd_per_million_tokens. A single tool (v1/agent/tools/{tool_id}) returns its custom header values, so like agent configs it is kept out of the read-only policy. POST v1/agent/agents/{agent_id}/tests/run runs an agent's tests, which are billed when each run ends.

Phone Numbers

maton api '/fish-audio/v1/agent/phone-numbers'
maton api '/fish-audio/v1/agent/available-phone-numbers?country_code=US&area_code=415'

POST v1/agent/phone-numbers purchases or imports a number and DELETE v1/agent/phone-numbers/{phone_number_id} releases it; both change what the team pays for.

Place a Phone Call

maton api '/fish-audio/v1/agent/phone-calls' -X POST -H 'Content-Type: application/json' \
  -H 'idempotency-key: {unique_key}' --input - <<'JSON'
{"agent_id": "{agent_id}", "phone_number_id": "{phone_number_id}", "to_number": "+14155550123"}
JSON

Dials to_number (E.164) from a team-owned number with the agent. The idempotency-key header makes a retry return the call already placed instead of dialing again. dynamic_variables fills the agent's variables for this call.

Pronunciation Dictionaries

maton api '/fish-audio/v1/pronunciation-dictionaries'
maton api '/fish-audio/v1/pronunciation-dictionaries/{dictionary_id}'
maton api '/fish-audio/v1/pronunciation-dictionaries/{dictionary_id}/versions'

A dictionary maps words to how they should be spoken; text to speech applies up to 3 through pronunciation_dictionary. Changes are published as versions with POST .../versions.

Audit Logs

maton api '/fish-audio/v1/audit-logs?since=2026-11-01T00:00:00Z&limit=100&category=auth,api_key'

Lists the team's audit events (sign-ins, key changes, billing) for up to the last 90 days. Needs a key with the audit_log:read scope. Page with cursor set to the previous next_cursor.

Notes

  • Connection. The connection holds a Fish Audio API key, created at https://fish.audio/app/api-keys/ and shown only once. Some endpoints need a key with a matching scope (the audit log needs audit_log:read); a key without it answers 403. Fish Audio has no account endpoint, so the connection's metadata carries only the key owner's user_id, from the credit balance.
  • New accounts start with no credit: paid models answer 402 until credit is added, and s2.1-pro-free works on every account. Requests are limited by concurrency, not per minute: 5 at once on pay as you go, 10 on Starter, 15 on Growth, 50 on Scale. Topping up credit does not raise the limit; upgrading the plan does.
  • A paid model with no credit answers 402; use s2.1-pro-free or add credit. A 429 means the plan's concurrency limit is reached and comes without Retry-After: back off exponentially. Speech to text holds its slot until the transcript returns.
  • Errors are JSON {"status": ..., "message": ...}. 401 means the key was deleted or revoked; reauthorize the connection with a new one.
  • Audio responses (v1/tts, session recordings) are binary; redirect them to a file.
  • Agent session recordings, transcripts, and caller numbers belong to the people on the call.
  • Deleting or revoking the key in Fish Audio breaks the connection. A key that was exposed can be revoked without signing in through POST apikey/revoke.

Resources

On this page