### Text Transcription Response Example Source: https://github.com/pfrankov/whisper-server/blob/main/README.md This example shows the plain text response format for audio transcriptions. It provides only the transcribed text. ```text And so, my fellow Americans, ask not what your country can do for you, ask what you can do for your country. ``` -------------------------------- ### VTT Transcription Response Example Source: https://github.com/pfrankov/whisper-server/blob/main/README.md This example shows the WebVTT (VTT) format for audio transcriptions, commonly used for web video subtitles. ```text WEBVTT 00:00:00.240 --> 00:00:07.839 And so, my fellow Americans, ask not what your country can do for you 00:00:07.839 --> 00:00:10.640 ask what you can do for your country. ``` -------------------------------- ### SRT Transcription Response Example Source: https://github.com/pfrankov/whisper-server/blob/main/README.md This example demonstrates the SubRip Text (SRT) format for audio transcriptions, suitable for subtitle files. ```text 1 00:00:00,240 --> 00:00:07,839 And so, my fellow Americans, ask not what your country can do for you 2 00:00:07,839 --> 00:00:10,640 ask what you can do for your country. ``` -------------------------------- ### JSON Transcription Response Example Source: https://github.com/pfrankov/whisper-server/blob/main/README.md This is an example of the default JSON response format for audio transcriptions. It contains the transcribed text. ```json { "text": "Transcription text." } ``` -------------------------------- ### Test Whisper Server API with Curl Source: https://github.com/pfrankov/whisper-server/blob/main/AGENTS.md Execute the API test suite using this script. Ensure the application is running before execution. This example demonstrates a POST request for audio transcription. ```bash ./test_api.sh ``` ```bash curl -X POST http://localhost:12017/v1/audio/transcriptions -F file=@jfk.wav -F response_format=json ``` -------------------------------- ### Verbose JSON Transcription Response Example Source: https://github.com/pfrankov/whisper-server/blob/main/README.md This example shows the verbose JSON response format, which includes detailed information such as segments, timestamps, and probabilities. ```json { "task": "transcribe", "language": "en", "duration": 10.5, "text": "Full transcription text.", "segments": [ { "id": 0, "seek": 0, "start": 0.0, "end": 5.0, "text": "First segment.", "tokens": [50364, 13, 11, 263, 6116], "temperature": 0.0, "avg_logprob": -0.45, "compression_ratio": 1.275, "no_speech_prob": 0.1 } ] } ``` -------------------------------- ### List Available Models Source: https://github.com/pfrankov/whisper-server/blob/main/TESTING.md Retrieve a list of all available transcription models from both Whisper and Fluid providers. This GET request helps identify model IDs and defaults. ```bash GET /v1/models ``` -------------------------------- ### Diarization JSON Response Example Source: https://github.com/pfrankov/whisper-server/blob/main/README.md Example of a JSON response when diarization is enabled and 'response_format' is set to 'json'. It includes a 'speaker_segments' array detailing who spoke when. ```json { "text": "Good morning everyone...", "speaker_segments": [ { "speaker": "Speaker_1", "start": 0.0, "end": 4.2, "text": "Good morning everyone" }, { "speaker": "Speaker_2", "start": 4.2, "end": 7.8, "text": "Morning! Shall we begin?" } ] } ``` -------------------------------- ### Build Whisper Server Application Source: https://github.com/pfrankov/whisper-server/blob/main/AGENTS.md Use this command to build the Whisper Server application from the command line. ```bash xcodebuild build -project WhisperServer.xcodeproj -scheme WhisperServer ``` -------------------------------- ### Cloning WhisperServer Repository Source: https://github.com/pfrankov/whisper-server/blob/main/README.md Commands to clone the WhisperServer repository from GitHub and navigate into the project directory. This is the first step to building from source. ```bash git clone https://github.com/pfrankov/whisper-server.git cd whisper-server ``` -------------------------------- ### Generate App Icon Source: https://github.com/pfrankov/whisper-server/blob/main/AGENTS.md Run this script to generate the application icon using a source image. ```bash ./GenerateAppIcon.sh ``` -------------------------------- ### Run All API Tests Source: https://github.com/pfrankov/whisper-server/blob/main/TESTING.md Execute all automated API tests for WhisperServer. Ensure the server is running and a test audio file is present. ```bash ./test_api.sh ``` -------------------------------- ### Basic Transcription (JSON) Source: https://github.com/pfrankov/whisper-server/blob/main/TESTING.md Perform a basic audio transcription using the default JSON response format. Ensure the audio file is in the project root. ```bash curl -X POST http://localhost:12017/v1/audio/transcriptions \ -F file=@jfk.wav ``` -------------------------------- ### List Available Models Source: https://github.com/pfrankov/whisper-server/blob/main/TESTING.md Retrieves a list of available audio models supported by WhisperServer. This is useful for checking model IDs and default configurations. ```APIDOC ## GET /v1/models ### Description Lists available models from both Whisper and Fluid providers. Useful to check IDs and defaults. ### Method GET ### Endpoint /v1/models ``` -------------------------------- ### Transcribe Audio via HTTP POST Source: https://github.com/pfrankov/whisper-server/blob/main/README.md Use this cURL command to send an audio file for transcription to the local WhisperServer. Ensure the file path is correct. ```bash curl -X POST http://localhost:12017/v1/audio/transcriptions \ -F file=@/path/to/audio.mp3 ``` -------------------------------- ### API Key Authentication Request Source: https://github.com/pfrankov/whisper-server/blob/main/README.md This command demonstrates how to authenticate API requests using a bearer token when 'Require API Key' is enabled. Replace '' with your actual generated API key. ```bash curl -X POST http://192.168.1.42:12017/v1/audio/transcriptions \ -H "Authorization: Bearer ws-" \ -F file=@audio.wav ``` -------------------------------- ### List Available Test Groups Source: https://github.com/pfrankov/whisper-server/blob/main/TESTING.md List the available test groups for targeted execution. Use this to understand the scope of different test categories. ```bash ./test_api.sh --list-groups ``` -------------------------------- ### Run Specific Test Groups: Models and Negative Source: https://github.com/pfrankov/whisper-server/blob/main/TESTING.md Execute tests for both the 'models' and 'negative' test groups. This allows for combined testing of model listing and error handling. ```bash ./test_api.sh --only=models,negative ``` -------------------------------- ### Streaming Transcription (SSE, JSON) Source: https://github.com/pfrankov/whisper-server/blob/main/TESTING.md Enable streaming transcription with Server-Sent Events (SSE) and receive JSON chunks. Requires 'Accept: text/event-stream' header and 'stream=true'. ```bash curl -X POST http://localhost:12017/v1/audio/transcriptions \ -H "Accept: text/event-stream" \ -F file=@jfk.wav \ -F response_format=json \ -F stream=true \ --no-buffer ``` -------------------------------- ### Streaming Transcription with SSE Source: https://github.com/pfrankov/whisper-server/blob/main/README.md Use this command to stream audio transcriptions using Server-Sent Events (SSE). Ensure the client sends the 'Accept: text/event-stream' header. ```bash curl -X POST http://localhost:12017/v1/audio/transcriptions \ -H "Accept: text/event-stream" \ -F file=@audio.wav \ -F stream=true \ --no-buffer ``` -------------------------------- ### Streaming Transcription (Chunked, Text) Source: https://github.com/pfrankov/whisper-server/blob/main/TESTING.md Enable streaming transcription with HTTP chunked encoding and receive text chunks. Use 'stream=true' and 'response_format=text'. ```bash curl -X POST http://localhost:12017/v1/audio/transcriptions \ -F file=@jfk.wav \ -F response_format=text \ -F stream=true \ --no-buffer ``` -------------------------------- ### Streaming Transcription with Chunked Transfer Source: https://github.com/pfrankov/whisper-server/blob/main/README.md This command is used for streaming audio transcriptions when SSE is not supported, falling back to HTTP chunked transfer encoding. ```bash curl -X POST http://localhost:12017/v1/audio/transcriptions \ -F file=@audio.wav \ -F stream=true \ --no-buffer ``` -------------------------------- ### Transcription with VTT Format Source: https://github.com/pfrankov/whisper-server/blob/main/TESTING.md Perform an audio transcription and receive the output in VTT subtitle format. Use 'response_format=vtt' for this. ```bash curl -X POST http://localhost:12017/v1/audio/transcriptions \ -F file=@jfk.wav \ -F response_format=vtt ``` -------------------------------- ### Diarization with Fluid Provider Source: https://github.com/pfrankov/whisper-server/blob/main/TESTING.md Enable speaker diarization for transcriptions using the Fluid provider. This adds 'speaker_segments' to the JSON output. Requires a Fluid model and 'diarize=true'. ```bash curl -X POST http://localhost:12017/v1/audio/transcriptions \ -F file=@jfk.wav \ -F model=parakeet-tdt-0.6b-v3 \ -F response_format=json \ -F diarize=true ``` -------------------------------- ### Transcription with Text Format Source: https://github.com/pfrankov/whisper-server/blob/main/TESTING.md Perform an audio transcription and receive the output in plain text format. Specify 'response_format=text' to enable this. ```bash curl -X POST http://localhost:12017/v1/audio/transcriptions \ -F file=@jfk.wav \ -F response_format=text ``` -------------------------------- ### Audio Transcription with SSE Streaming Source: https://github.com/pfrankov/whisper-server/blob/main/README.md Transcribe audio in real-time using Server-Sent Events (SSE) for streaming. This method is preferred when the client supports SSE. ```APIDOC ## POST /v1/audio/transcriptions (SSE Streaming) ### Description Transcribes audio content in real-time using Server-Sent Events (SSE) for streaming. ### Method POST ### Endpoint /v1/audio/transcriptions ### Headers - **Accept**: `text/event-stream` ### Parameters #### Form Data - **file** (file) - Required - The audio file to transcribe. - **stream** (boolean) - Required - Set to `true` to enable streaming. ### Request Example ```bash curl -X POST http://localhost:12017/v1/audio/transcriptions \ -H "Accept: text/event-stream" \ -F file=@audio.wav \ -F stream=true \ --no-buffer ``` ### Response #### Success Response (200) Streaming response with `data:` lines for transcribed segments and an `event: end` for completion. #### Response Example ``` data: First transcribed segment data: data: Second transcribed segment data: event: end data: ``` ``` -------------------------------- ### Run Specific Test Group: Models Source: https://github.com/pfrankov/whisper-server/blob/main/TESTING.md Execute only the tests related to the /v1/models endpoint. Useful for isolating issues with model listing. ```bash ./test_api.sh --only=models ``` -------------------------------- ### Transcription with Verbose JSON Source: https://github.com/pfrankov/whisper-server/blob/main/TESTING.md Perform an audio transcription and receive detailed JSON output, including segment information. Use 'response_format=verbose_json'. ```bash curl -X POST http://localhost:12017/v1/audio/transcriptions \ -F file=@jfk.wav \ -F response_format=verbose_json ``` -------------------------------- ### API Key Authentication Source: https://github.com/pfrankov/whisper-server/blob/main/README.md Secure API access using an API key. Clients must include the key in the `Authorization` header. ```APIDOC ## API Key Authentication ### Description When 'Require API Key' is enabled, clients must authenticate requests by providing a bearer token in the `Authorization` header. ### Headers - **Authorization**: `Bearer ws-` ### Request Example ```bash curl -X POST http://192.168.1.42:12017/v1/audio/transcriptions \ -H "Authorization: Bearer ws-" \ -F file=@audio.wav ``` ### Key Management - **Copy API Key**: Copies the current API key to the clipboard. - **Regenerate API Key…**: Generates a new API key, invalidating the previous one. The new key is automatically copied to the clipboard. ``` -------------------------------- ### Audio Transcription with Chunked Transfer Encoding Source: https://github.com/pfrankov/whisper-server/blob/main/README.md Transcribe audio with streaming fallback using HTTP chunked transfer encoding when SSE is not supported. ```APIDOC ## POST /v1/audio/transcriptions (Chunked Encoding) ### Description Transcribes audio content with streaming fallback using HTTP chunked transfer encoding when Server-Sent Events (SSE) are not supported. ### Method POST ### Endpoint /v1/audio/transcriptions ### Parameters #### Form Data - **file** (file) - Required - The audio file to transcribe. - **stream** (boolean) - Required - Set to `true` to enable streaming. ### Request Example ```bash curl -X POST http://localhost:12017/v1/audio/transcriptions \ -F file=@audio.wav \ -F stream=true \ --no-buffer ``` ### Response #### Success Response (200) HTTP chunked transfer encoding response containing transcribed segments. ``` -------------------------------- ### Transcription with SRT Format Source: https://github.com/pfrankov/whisper-server/blob/main/TESTING.md Perform an audio transcription and receive the output in SRT subtitle format. Set 'response_format=srt' for this output. ```bash curl -X POST http://localhost:12017/v1/audio/transcriptions \ -F file=@jfk.wav \ -F response_format=srt ``` -------------------------------- ### Audio Transcription with Diarization Source: https://github.com/pfrankov/whisper-server/blob/main/README.md Transcribe audio and enable speaker diarization to identify different speakers. Requires the Fluid provider. ```APIDOC ## POST /v1/audio/transcriptions (Diarization) ### Description Transcribes audio content and enables speaker diarization to identify who is speaking. This feature requires the Fluid provider. ### Method POST ### Endpoint /v1/audio/transcriptions ### Parameters #### Form Data - **file** (file) - Required - The audio file to transcribe. - **model** (string) - Optional - The model ID to use (e.g., `parakeet-tdt-0.6b-v3`). - **response_format** (string) - Optional - The desired response format. Supported values include `json` and `verbose_json`. - **diarize** (boolean) - Required - Set to `true` to enable diarization. ### Request Example ```bash curl -X POST http://localhost:12017/v1/audio/transcriptions \ -F file=@meeting.wav \ -F model=parakeet-tdt-0.6b-v3 \ -F response_format=json \ -F diarize=true ``` ### Response #### Success Response (200) - **text** (string) - The transcribed text. - **speaker_segments** (array) - An array of objects, each representing a segment with speaker information. - **speaker** (string) - The identified speaker (e.g., `Speaker_1`). - **start** (number) - The start time of the segment in seconds. - **end** (number) - The end time of the segment in seconds. - **text** (string) - The transcribed text for this segment. #### Response Example (JSON) ```json { "text": "Good morning everyone...", "speaker_segments": [ { "speaker": "Speaker_1", "start": 0.0, "end": 4.2, "text": "Good morning everyone" }, { "speaker": "Speaker_2", "start": 4.2, "end": 7.8, "text": "Morning! Shall we begin?" } ] } ``` ### Streaming with Diarization When streaming is enabled with diarization, a single JSON chunk containing `speaker_segments` is sent upon completion, followed by the standard `end` event. ``` -------------------------------- ### Audio Transcription Endpoint Source: https://github.com/pfrankov/whisper-server/blob/main/README.md This endpoint accepts audio files for transcription and returns the transcribed text in various formats. ```APIDOC ## POST /v1/audio/transcriptions ### Description Transcribes an audio file. The server is compatible with the OpenAI Whisper API. ### Method POST ### Endpoint http://localhost:12017/v1/audio/transcriptions ### Parameters #### Path Parameters None #### Query Parameters - **model** (string) - Optional - Model to use. Accepts model IDs. - **prompt** (string) - Optional - Guides the style or tone of the transcription (Whisper specific). - **response_format** (string) - Optional - Specifies the output format. Values: json, text, srt, vtt, verbose_json. Defaults to json. - **language** (string) - Optional - The input language, specified as a 2-letter ISO 639-1 code. - **diarize** (boolean) - Optional - Enables Fluid speaker diarization. Defaults to false. - **stream** (boolean) - Optional - Enables streaming output via Server-Sent Events (SSE) or chunked transfer. Defaults to false. #### Request Body - **file** (file) - Required - The audio file to transcribe. Supported formats: wav, mp3, m4a. ### Request Example ```bash curl -X POST http://localhost:12017/v1/audio/transcriptions \ -F file=@/path/to/audio.mp3 \ -F response_format=json \ -F language=en ``` ### Response #### Success Response (200) - **text** (string) - The transcribed text (for json, text response formats). - **task** (string) - The type of task performed (e.g., "transcribe") (for verbose_json format). - **language** (string) - The detected language of the audio (for verbose_json format). - **duration** (number) - The duration of the audio in seconds (for verbose_json format). - **segments** (array) - An array of segment objects, each containing details like start time, end time, and text (for verbose_json format). #### Response Example (json) ```json { "text": "Transcription text." } ``` #### Response Example (verbose_json) ```json { "task": "transcribe", "language": "en", "duration": 10.5, "text": "Full transcription text.", "segments": [ { "id": 0, "seek": 0, "start": 0.0, "end": 5.0, "text": "First segment.", "tokens": [50364, 13, 11, 263, 6116], "temperature": 0.0, "avg_logprob": -0.45, "compression_ratio": 1.275, "no_speech_prob": 0.1 } ] } ``` #### Response Example (text) ``` And so, my fellow Americans, ask not what your country can do for you, ask what you can do for your country. ``` #### Response Example (srt) ``` 1 00:00:00,240 --> 00:00:07,839 And so, my fellow Americans, ask not what your country can do for you 2 00:00:07,839 --> 00:00:10,640 ask what you can do for your country. ``` #### Response Example (vtt) ``` WEBVTT 00:00:00.240 --> 00:00:07.839 And so, my fellow Americans, ask not what your country can do for you 00:00:07.839 --> 00:00:10.640 ask what you can do for your country. ``` ``` -------------------------------- ### Transcribe Audio with JSON Response Format Source: https://github.com/pfrankov/whisper-server/blob/main/README.md This cURL command demonstrates how to request transcription results in JSON format. The server defaults to JSON if no format is specified. ```bash curl -X POST http://localhost:12017/v1/audio/transcriptions \ -F file=@/path/to/audio.mp3 \ -F response_format=json ``` -------------------------------- ### Run Specific Test Group: Fluid Source: https://github.com/pfrankov/whisper-server/blob/main/TESTING.md Execute only the tests related to the Fluid transcription provider. This is useful for testing diarization and Fluid-specific features. ```bash ./test_api.sh --only=fluid ``` -------------------------------- ### Curl Request for Audio Transcription Source: https://github.com/pfrankov/whisper-server/blob/main/AGENTS.md Manually test audio transcription endpoints using curl. Supports various response formats like JSON, text, SRT, and VTT. ```bash curl -F file=@jfk.wav -F response_format=json http://localhost:12017/v1/audio/transcriptions ``` -------------------------------- ### Audio Transcriptions Source: https://github.com/pfrankov/whisper-server/blob/main/TESTING.md Transcribes an audio file using a specified model. Supports various response formats and streaming. ```APIDOC ## POST /v1/audio/transcriptions ### Description Transcribes an audio file. Supports multiple response formats and streaming. ### Method POST ### Endpoint /v1/audio/transcriptions ### Parameters #### Request Body - **file** (file) - Required - The audio file to transcribe (e.g., wav, mp3, m4a). - **model** (string) - Optional - The ID of the model to use for transcription. - **response_format** (string) - Optional - The desired format for the transcription response. Options include `json` (default), `text`, `srt`, `vtt`, `verbose_json`. - **language** (string) - Optional - The ISO-639-1 code for the language of the audio (e.g., `en`). - **prompt** (string) - Optional - A text prompt to guide the transcription. - **stream** (boolean) - Optional - Enables streaming of transcription results (`true`/`false`). - **diarize** (boolean) - Optional - Enables speaker diarization for the Fluid provider only (`true`/`false`). If true, `speaker_segments` will be included in JSON responses. ### Response Content-Type depends on `response_format`. SSE responses use `text/event-stream` and end with an `end` event. ``` -------------------------------- ### Diarization Enabled Transcription Source: https://github.com/pfrankov/whisper-server/blob/main/README.md Enable speaker diarization by setting 'diarize=true' in your request when using the FluidAudio provider. This command also specifies a Fluid model and JSON response format. ```bash curl -X POST http://localhost:12017/v1/audio/transcriptions \ -F file=@meeting.wav \ -F model=parakeet-tdt-0.6b-v3 \ -F response_format=json \ -F diarize=true ``` -------------------------------- ### Run Specific Test Group: Whisper Source: https://github.com/pfrankov/whisper-server/blob/main/TESTING.md Execute only the tests related to the core Whisper transcription functionality. This group focuses on the primary transcription endpoint. ```bash ./test_api.sh --only=whisper ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.