NexusAI API Documentation

Welcome to the official NexusAI API documentation. Our API provides fast, scalable, and secure access to our state-of-the-art LLM, audio transcription, and diarization models.

Introduction

The NexusAI API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

Authentication

The NexusAI API uses API keys to authenticate requests. You can view and manage your API keys in the Dashboard.

Authentication to the API is performed via HTTP Bearer Auth. Provide your API key as the bearer token value in the Authorization header.

Authorization: Bearer sk-live-xxxxxxxxxxxxxxxxxxxxxxxx

Base URL

The API is offered in two versions:

https://api.nexusai.com/v1
https://api.nexusai.com/v2

OpenAI-Compatible API (v2)

The v2 API mirrors the OpenAI API: endpoints, request parameters, response bodies, streaming events and error envelopes all match what official OpenAI SDKs expect. To migrate an existing OpenAI workflow, change only the base URL and the API key — everything else keeps working.

from openai import OpenAI

client = OpenAI(
    base_url="https://api.nexusai.com/v2",
    api_key="sk-live-xxxxxxxxxxxxxxxx",  # your NexusAI API key
)

completion = client.chat.completions.create(
    model="standard",
    messages=[{"role": "user", "content": "Hello!"}],
)

Endpoints

Endpoint Description
POST /v2/chat/completionsOpenAI Chat Completions. Supports stream: true (server-sent events, including the final usage chunk).
POST /v2/responsesOpenAI Responses API. Returns the standard OpenAI response object (or event stream with stream: true).
POST /v2/audio/speechOpenAI Text to Speech. Returns the raw audio file; set stream_format to "audio" or "sse" to stream chunks while the audio is generated.
POST /v2/audio/transcriptionsOpenAI Transcriptions. Upload an audio file (multipart file field, up to 25 MB) and receive the final text synchronously. response_format: json (default), text or verbose_json.
GET /v2/modelsLists the available model ids in the OpenAI list format. /v2/models/{id} retrieves a single model.

Models

The model parameter accepts our tier names — mini, standard and pro (see pricing). For drop-in compatibility, any other model id sent by an unmodified integration is accepted and billed at the closest tier, so requests never fail on the model name alone. The audio endpoints accept (and ignore) OpenAI audio model names such as tts-1 and whisper-1.

Example: streamed speech (server-sent events)

curl https://api.nexusai.com/v2/audio/speech \
  -H "Authorization: Bearer sk-live-xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "input": "Streaming speech, chunk by chunk!",
    "voice": "nova",
    "response_format": "mp3",
    "stream_format": "sse"
  }'

Each event carries a base64 audio chunk ({"type": "speech.audio.delta", "audio": "..."}) followed by a final speech.audio.done event with the token usage. With "stream_format": "audio" the raw audio bytes are streamed instead. Omit stream_format to receive the finished audio file in one response.

Example: transcription

curl https://api.nexusai.com/v2/audio/transcriptions \
  -H "Authorization: Bearer sk-live-xxxxxxxxxxxxxxxx" \
  -F file=@audio.mp3 \
  -F model=whisper-1
{ "text": "This is the transcribed audio..." }

Language Models

Create model response

Creates a model response for the given chat conversation.

POST /v1/responses

Example Request (cURL)

curl https://api.nexusai.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-live-xxxxxxxxxxxxxxxx" \
  -d '{
    "model": "standard",
    "input": [
      {
        "role": "system",
        "content": "You are a helpful coding assistant."
      },
      {
        "role": "user",
        "content": "Write a python function to fetch data."
      }
    ]
  }'

Request Body

Parameter Type Required Description
model string Yes ID of the model to use. Available models:
  • pro - Highest capability and accuracy.
  • standard - Balanced performance and speed.
  • mini - Fastest response time for simpler tasks.
View Pricing Details
input array Yes A list of messages comprising the conversation so far. Each message object should have a role (e.g. "user", "system", "assistant") and content.

Response Example

{
  "status": "completed",
  "max_output_tokens": 2048,
  "model": "standard",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "status": "completed",
      "content": [
        {
          "type": "text",
          "text": "Here is the python function you requested: ..."
        }
      ]
    }
  ],
  "usage": {
    "input_tokens": 45,
    "output_tokens": 120,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 165
  }
}

Response Fields

Field Type Description
status string The overall status of the response generation (e.g. completed).
max_output_tokens integer The maximum number of tokens allowed to be generated in this request.
model string The requested tier name (mini, standard, pro).
output array Contains the response message(s). Each message includes its role, status, and content (an array containing the actual text response).
usage object Contains token usage statistics, including input_tokens, output_tokens, total_tokens, and detailed breakdown like reasoning_tokens.

Text to Speech

Generate natural-sounding speech from text. The v1 flow is a two-step asynchronous process, like transcriptions: submit the generation job, then poll it until the audio is ready. For a synchronous, OpenAI-compatible call (including streaming), use /v2/audio/speech instead — both accept the same parameters.

1. Create speech job

POST /v1/audio/speech

Submit text and a voice; the endpoint charges the estimated cost, starts the generation and returns a job id to poll. The generated audio is also stored in your account and listed under Text to Speech in your dashboard.

Example Request (cURL)

curl https://api.nexusai.com/v1/audio/speech \
  -H "Authorization: Bearer sk-live-xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "input": "Today is a wonderful day to build something people love!",
    "voice": "nova",
    "instructions": "Speak in a cheerful and positive tone.",
    "response_format": "mp3"
  }'

Request Body

Parameter Type Required Description
input string Yes The text to generate audio for. Maximum 4,096 characters.
voice string Yes The voice to use. One of: alloy, ash, ballad, coral, echo, fable, onyx, nova, sage, shimmer.
instructions string No Free-text guidance to control how the voice should sound (tone, pace, emotion, accent).
response_format string No Audio format of the response. One of mp3 (default), opus, aac, flac, wav, pcm.
speed number No Speed of the generated audio, from 0.25 to 4.0. Defaults to 1.0.

Response Example

{
  "id": "tts-1a2b3c4d5e6f7a8b9c0d1e2f",
  "status": "queued",
  "voice": "nova",
  "response_format": "mp3",
  "speed": 1.0,
  "created_at": 1754500000
}

The estimated cost is charged when the job is accepted and refunded automatically if the generation fails.

2. Poll the job / download the audio

GET /v1/audio/speech/{id}

Poll this endpoint every second or two. While the job is still running it returns a JSON status object; as soon as the audio is ready the same call returns the binary audio file instead — check the response Content-Type to tell the two apart.

curl https://api.nexusai.com/v1/audio/speech/tts-1a2b3c4d5e6f7a8b9c0d1e2f \
  -H "Authorization: Bearer sk-live-xxxxxxxxxxxxxxxx" \
  --output speech.mp3

Pending Response

{
  "id": "tts-1a2b3c4d5e6f7a8b9c0d1e2f",
  "status": "processing",
  "voice": "nova",
  "response_format": "mp3",
  "speed": 1.0
}

Possible status values are queued, processing and error (failed jobs include an error field and are fully refunded). On success the response body is the audio file, served with the Content-Type matching the requested response_format (e.g. audio/mpeg for MP3), plus the X-Tts-Job-Id, X-Tts-Cost and X-Tts-Format headers. The audio stays stored in your account, so the call can be repeated at any time.

Audio Transcriptions

Transcribing audio is a two-step asynchronous process: Request a transcription (via URL or direct file upload), and poll until the job completes.

1. Request Transcription

POST /v1/transcript

Submit an audio file or an audio URL to begin the asynchronous transcription job.

Request Example (JSON)

Note: We currently only support remote audio URLs. The target URL must be publicly accessible and return a valid Content-Length or Content-Range header. Only WAV and MP3 file formats are supported.

curl -X POST https://api.nexusai.com/v1/transcript \
  -H "Authorization: Bearer sk-live-xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "audio_url": "https://...",
    "speaker_labels": true
  }'

Parameters

Parameter Type Description
audio_url
Required
string The publicly accessible URL of the audio file to transcribe. Must be an MP3 or WAV file.
speaker_labels
Optional
boolean Enable Speaker Diarization to identify "who spoke when". Default is false. Note: Enabling this feature incurs additional costs. Please view the Pricing Table for details.
language_code
Optional
string The language of your audio file. See Supported Languages below. If not specified, the system will attempt to auto-detect the language.

Supported Languages

Global English en
Australian English en_au
British English en_uk
US English en_us
Spanish es
French fr
German de
Italian it
Portuguese pt
Dutch nl
Hindi hi
Japanese ja
Chinese zh
Finnish fi
Korean ko
Polish pl
Russian ru
Turkish tr
Ukrainian uk
Vietnamese vi
Afrikaans af
Albanian sq
Amharic am
Arabic ar
Armenian hy
Assamese as
Azerbaijani az
Bashkir ba
Basque eu
Belarusian be
Bengali bn
Bosnian bs
Breton br
Bulgarian bg
Burmese my
Catalan ca
Croatian hr
Czech cs
Danish da
Estonian et
Faroese fo
Galician gl
Georgian ka
Greek el
Gujarati gu
Haitian ht
Hausa ha
Hawaiian haw
Hebrew he
Hungarian hu
Icelandic is
Indonesian id
Javanese jw
Kannada kn
Kazakh kk
Khmer km
Lao lo
Latin la
Latvian lv
Lingala ln
Lithuanian lt
Luxembourgish lb
Macedonian mk
Malagasy mg
Malay ms
Malayalam ml
Maltese mt
Maori mi
Marathi mr
Mongolian mn
Nepali ne
Norwegian no
Norwegian Nynorsk nn
Occitan oc
Panjabi pa
Pashto ps
Persian fa
Romanian ro
Sanskrit sa
Serbian sr
Shona sn
Sindhi sd
Sinhala si
Slovak sk
Slovenian sl
Somali so
Sundanese su
Swahili sw
Swedish sv
Tagalog tl
Tajik tg
Tamil ta
Tatar tt
Telugu te
Thai th
Tibetan bo
Turkmen tk
Urdu ur
Uzbek uz
Welsh cy
Yiddish yi
Yoruba yo

Response Example

{
  "id": "abc123def"
}

Response Fields

Field Type Description
id string The unique identifier for the transcription job. Use this ID to poll for the result.

2. Poll Status

GET /v1/transcript/{id}

Retrieve the status of your transcription job. You should poll this endpoint every few seconds until the status becomes completed.

curl -X GET https://api.nexusai.com/v1/transcript/abc123def \
  -H "Authorization: Bearer sk-live-xxxxxxxxxxxxxxxx"

Completed Response (with speaker_labels)

{
  "id": "abc123def",
  "language_code": "en_us",
  "status": "completed",
  "audio_url": "https://...",
  "text": "This is a mocked transcription from NexusAI. Hello, how are you doing today?",
  "words": [
    { "text": "This", "start": 100, "end": 500, "confidence": 0.98 }
  ],
  "utterances": [
    {
      "confidence": 0.95,
      "start": 100,
      "end": 3500,
      "speaker": "A",
      "text": "This is a mocked transcription from NexusAI. Hello, how are you doing today?"
    }
  ],
  "confidence": 0.97,
  "audio_duration": 345,
  "punctuate": true,
  "format_text": true,
  "speaker_labels": true,
  "language_detection": false
}

Response Fields

Field Description
idUnique identifier for the transcription job.
language_codeThe language code of the transcription.
statusCurrent status (e.g. queued, processing, completed, error).
audio_urlThe URL of the processed audio file.
textThe final transcribed text.
wordsArray of objects containing individual words, their timestamps, and confidence scores.
utterancesArray of objects containing sentences, their timestamps, confidence, and speaker (if diarization is enabled).
confidenceOverall confidence score for the transcription.
audio_durationTotal duration of the audio in seconds.
punctuateWhether automatic punctuation was applied.
format_textWhether casing and text formatting was applied.
speaker_labelsWhether speaker diarization was enabled.
language_detectionWhether automatic language detection was used.
language_detection_resultsConfidence scores for different language candidates.
language_confidence_thresholdThe required confidence to automatically select a language.
language_confidenceThe confidence score of the final detected language.