Skip to content

Automatic speech recognition

POST /api/v5/audio/transcriptions

Provides automatic speech recognition. It accepts an audio file (mp3, wav, m4a, flac, and webm are supported) and returns the corresponding text after the model recognizes it.

Supported access tokens

  • AtomGit user access tokens

Anonymous access allowed

This endpoint allows anonymous access.

Request parameters

Parameter Location Type Required Description
Authorization header string No User personal token (can be omitted for anonymous access)

Request Body:

The request body uses multipart/form-data and contains the audio file and the recognition parameters.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "file": {
      "description": "Audio file (mp3, wav, m4a, flac, and webm are supported)",
      "type": "string",
      "format": "binary"
    },
    "model": {
      "description": "Model name; defaults to openai/whisper-large-v3",
      "type": "string",
      "default": "openai/whisper-large-v3"
    },
    "temperature": {
      "description": "Sampling temperature (0.0-1.0); defaults to 0.6",
      "type": "string",
      "default": "0.6"
    }
  },
  "required": ["file", "model"]
}

Response parameters

Field Type Always returned Nullable Description
text string Yes No Recognized text

Error response

A 200/success response alone is not enough: callers need to know what a failure looks like in order to write error handling.

400 Invalid parameters

{
  "error": "invalid_request",
  "message": "The audio file is missing or its format is not supported"
}

401 Unauthenticated

{
  "error": "unauthorized",
  "message": "Missing or invalid access token"
}

429 Too many requests

{
  "error": "rate_limit_exceeded",
  "message": "Too many requests; please retry later"
}

Error field names follow what the backend actually returns.

HTTP status codes

Status code Description
200 Success (OK)
400 Invalid parameters (Bad request)
401 Authentication required (Requires authentication)
429 Too many requests (Rate limited)
500 Internal system error (Internal server error)

Request example

Parameter notes

The example uploads the audio file with multipart/form-data. You can omit the Authorization header for anonymous access; with a token, the recognition runs as that user.

Replace <token> with your AtomGit user access token (optional), and <path/to/audio.mp3> with the local path of the audio file. mp3, wav, m4a, flac, and webm are supported.

cURL

curl -X POST 'https://api.atomgit.com/api/v5/audio/transcriptions' \
  -H 'Authorization: Bearer <token>' \
  -F 'file=@<path/to/audio.mp3>' \
  -F 'model=openai/whisper-large-v3' \
  -F 'temperature=0.6'

JavaScript

// Native fetch (Node.js 18+ / browsers)
const form = new FormData();
form.append("file", new Blob([audioBuffer], { type: "audio/mpeg" }), "audio.mp3");
form.append("model", "openai/whisper-large-v3");
form.append("temperature", "0.6");

const response = await fetch("https://api.atomgit.com/api/v5/audio/transcriptions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR-TOKEN>",
  },
  body: form,
});

if (!response.ok) {
  throw new Error(`Request failed: ${response.status}`);
}

const data = await response.json();
console.log(data);

Python

import requests

resp = requests.post(
    "https://api.atomgit.com/api/v5/audio/transcriptions",
    headers={
        "Authorization": "Bearer <YOUR-TOKEN>",
    },
    files={"file": open("<path/to/audio.mp3>", "rb")},
    data={
        "model": "openai/whisper-large-v3",
        "temperature": "0.6",
    },
    timeout=60,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{
  "text": "Good morning. The weather is lovely today and the sun is shining. I plan to take a walk in the park, grab a cup of coffee, and start my day's work."
}

Error codes

Error code Description
400 Invalid parameters or the request cannot be parsed
401 Unauthenticated or invalid credentials (missing or invalid access credentials)
404 Request path does not exist
429 Too many requests; rate limit triggered
500 Internal system error

Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc