openapi: 3.0.3
info:
  title: HyperWhisper Local API
  description: |
    HTTP API exposed by HyperWhisper.app on `127.0.0.1` when the user enables
    Settings → API Server. Off by default. Used by MCP wrappers, benchmarking
    scripts, and power-user automation.

    **Port + token discovery.** The server writes
    `~/Library/Application Support/HyperWhisper/local-api.json`
    (chmod 600) on every start. Clients read that file to find the port
    and bearer token — neither value is hard-coded.

    **Response envelope.** Successful calls return `{"ok": true, ...}` with
    HTTP 200. Expected business failures (model not installed, missing API
    key, file not found, transcription engine errored, etc.) also return HTTP
    200 with `{"ok": false, "error": {"code": "...", "message": "...", "hint": "..."}}`.
    HTTP 4xx is reserved for protocol failures: malformed JSON (400), missing
    or invalid bearer token (401), or a rejected Host/Origin header (403 — a
    DNS-rebinding guard applied to every route, including the unauthenticated
    /health, on every platform). On macOS, a request head over 8 KiB a line
    or 64 KiB in total gets a bare 431 and the connection closes.
  version: "1.0.0"
servers:
  - url: http://127.0.0.1:{port}
    description: Local-only loopback. The port is dynamic — read it from the discovery file.
    variables:
      port:
        default: "39201"
        description: Persisted port from `~/Library/Application Support/HyperWhisper/local-api.json`.

security:
  - bearerAuth: []

paths:
  /health:
    get:
      summary: Server + provider snapshot
      description: Unauthenticated. Returns server identity, the cached cloud-provider health snapshot, and the installed local-model inventory.
      security: []
      responses:
        '200':
          description: Health snapshot
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HealthResponse'

  /models:
    get:
      summary: List models
      parameters:
        - in: query
          name: kind
          description: macOS only. Windows and Linux ignore this parameter and return the full catalog.
          schema: { type: string, enum: [voice, text, all], default: all }
        - in: query
          name: installed_only
          description: macOS only. Windows and Linux ignore this parameter and return the full catalog.
          schema: { type: boolean, default: false }
      responses:
        '200':
          description: Model list
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ModelsListResponse'

  /modes:
    get:
      summary: List saved Modes
      responses:
        '200':
          description: Modes list
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ModesListResponse'
    post:
      summary: Create a new Mode
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Mode'
      responses:
        '200':
          description: Created mode
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ModeResponse'

  /modes/{id}:
    get:
      summary: Fetch one Mode
      parameters:
        - in: path
          name: id
          required: true
          schema: { type: string, format: uuid }
      responses:
        '200':
          description: Mode payload
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ModeResponse'
    patch:
      summary: Partial-field update
      parameters:
        - in: path
          name: id
          required: true
          schema: { type: string, format: uuid }
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ModePatch'
      responses:
        '200':
          description: Updated mode
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ModeResponse'
    delete:
      summary: Delete a Mode
      description: Refuses to delete the last remaining Mode (returns ok=false / INVALID_REQUEST).
      parameters:
        - in: path
          name: id
          required: true
          schema: { type: string, format: uuid }
      responses:
        '200':
          description: Ok wrapper
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OkResponse'

  /transcribe:
    post:
      summary: Transcribe audio
      description: |
        Accepts either an absolute `file` path OR an `audio_base64` + `mime_type`
        pair. The engine + model can come from a saved `mode_id`, from explicit
        `engine`/`model`/`language` fields, or a mix (mode supplies defaults
        and per-call fields override).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TranscribeRequest'
      responses:
        '200':
          description: Transcript or business error envelope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TranscribeResponse'

  /post-process:
    post:
      summary: Rewrite text with AI post-processing
      description: |
        `post_processed` says whether an LLM actually ran. Every platform sends
        the key on every `ok: true` body, and macOS decodes it as a
        non-optional `Bool`, so always read it rather than assuming a 200 means
        a rewrite happened.

        WHAT COUNTS AS A GRACEFUL DEGRADATION STILL DIFFERS PER PLATFORM, and
        this is a known gap rather than a documented guarantee. For a bad key,
        a model or network error, or an offline provider: macOS answers
        `ok: true` with the raw input and `post_processed: false`; Windows
        answers an `ok: false` / `TRANSCRIPTION_FAILED` envelope; the
        portable/Linux head answers an `ok: false` / `ENGINE_UNAVAILABLE`
        envelope. A `post_processed: false` on a 200 therefore means a silent
        skip (post-processing off for the resolved mode, or an empty system
        prompt) on Windows and Linux, and either that or a provider failure on
        macOS. Handle both the `ok: false` envelope and `post_processed: false`.

        One case is the same on every platform: a HyperWhisper Cloud run with
        no account key stored answers `ok: false` / `MISSING_API_KEY`, the same
        refusal `/transcribe` gives for that mode.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostProcessRequest'
      responses:
        '200':
          description: Rewritten text or business error envelope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostProcessResponse'

  /recordings/search:
    get:
      summary: Search past transcripts
      parameters:
        - in: query
          name: q
          schema: { type: string }
          description: Substring matched against text / postProcessedText / transcribedText.
        - in: query
          name: since
          schema: { type: string, format: date-time }
        - in: query
          name: until
          schema: { type: string, format: date-time }
        - in: query
          name: limit
          schema: { type: integer, minimum: 1, maximum: 500, default: 50 }
      responses:
        '200':
          description: Matching recordings, newest first
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecordingsListResponse'

  /recordings:
    get:
      summary: Search past transcripts (alias)
      description: |
        Windows and Linux only. The same handler and the same query parameters
        as `/recordings/search`. macOS does not serve this path.
      parameters:
        - in: query
          name: q
          schema: { type: string }
          description: Substring matched against text / postProcessedText / transcribedText.
        - in: query
          name: since
          schema: { type: string, format: date-time }
        - in: query
          name: until
          schema: { type: string, format: date-time }
        - in: query
          name: limit
          schema: { type: integer, minimum: 1, maximum: 500, default: 50 }
      responses:
        '200':
          description: Matching recordings, newest first
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecordingsListResponse'

  /recordings/{id}:
    get:
      summary: Fetch one recording
      parameters:
        - in: path
          name: id
          required: true
          schema: { type: string, format: uuid }
      responses:
        '200':
          description: Recording payload
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecordingResponse'

  /recording/toggle:
    post:
      summary: Start the microphone, or stop it and transcribe
      description: |
        Works on Linux only. macOS does not serve this path. Windows answers it with
        `ok: false` and the code `ENGINE_UNAVAILABLE`. The route takes no
        request body and no `mode_id`, so it uses the current Mode.

        When the recorder is idle, the call starts it. When the recorder is
        recording, the call stops it and transcribes, and it waits for that
        transcription — so it is as slow as a `/transcribe` call.

        A call during the `stopping` or the `transcribing` state is refused with
        HTTP 400 and the code `INVALID_REQUEST`, because a transcription is
        already in progress.
      responses:
        '200':
          description: Recorder state after the toggle
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecordingStateResponse'
        '400':
          description: A transcription is already in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'

  /recording/cancel:
    post:
      summary: Stop the microphone and keep no transcript
      description: |
        Works on Linux only. macOS does not serve this path. Windows answers it with
        `ok: false` and the code `ENGINE_UNAVAILABLE`. The route takes no
        request body. It stops the recorder at any point and writes no
        transcript.
      responses:
        '200':
          description: Recorder state after the cancel
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecordingStateResponse'

components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: base64-url
      description: Token from the discovery file. Required on every endpoint except /health.

  schemas:
    ErrorEnvelope:
      type: object
      required: [ok, error]
      properties:
        ok:
          type: boolean
          enum: [false]
        error:
          type: object
          required: [code, message]
          properties:
            code:
              type: string
              enum:
                - MODEL_NOT_INSTALLED
                - MODEL_NOT_FOUND
                - ENGINE_UNAVAILABLE
                - MISSING_API_KEY
                - FILE_NOT_FOUND
                - FILE_ACCESS_DENIED
                - FILE_NOT_ALLOWED
                - AUDIO_DECODE_FAILED
                - TRANSCRIPTION_FAILED
                - MODE_NOT_FOUND
                - MODE_NAME_TAKEN
                - INVALID_REQUEST
                - RATE_LIMITED
                - TIMEOUT
            message: { type: string }
            hint: { type: string }

    OkResponse:
      type: object
      required: [ok]
      properties:
        ok: { type: boolean, enum: [true] }

    HealthResponse:
      type: object
      properties:
        ok: { type: boolean }
        app_version: { type: string }
        api_version: { type: integer }
        port: { type: integer }
        pid: { type: integer }
        providers:
          type: array
          items: { $ref: '#/components/schemas/HealthProvider' }
        post_processing_providers:
          type: array
          items: { $ref: '#/components/schemas/HealthProvider' }
        local_models:
          $ref: '#/components/schemas/HealthLocalModels'

    HealthProvider:
      type: object
      properties:
        id: { type: string }
        key_present: { type: boolean }
        reachable: { type: boolean }
        status: { type: string, enum: [unknown, checking, healthy, unauthorized, unreachable, notInstalled] }

    HealthLocalModels:
      type: object
      properties:
        whisper:        { type: array, items: { $ref: '#/components/schemas/HealthLocalModelEntry' } }
        parakeet:       { type: array, items: { $ref: '#/components/schemas/HealthLocalModelEntry' } }
        nemotron:       { type: array, items: { $ref: '#/components/schemas/HealthLocalModelEntry' }, description: "macOS only. Windows and Linux never return this key." }
        qwen3_asr:      { type: array, items: { $ref: '#/components/schemas/HealthLocalModelEntry' } }
        apple_speech:   { type: array, items: { $ref: '#/components/schemas/HealthLocalModelEntry' } }
        local_llm:      { type: array, items: { $ref: '#/components/schemas/HealthLocalModelEntry' } }

    HealthLocalModelEntry:
      type: object
      properties:
        id: { type: string }
        displayName: { type: string }
        installed: { type: boolean }

    ModelEntry:
      type: object
      properties:
        id: { type: string }
        kind: { type: string, enum: [voice, text] }
        provider: { type: string }
        displayName: { type: string }
        installed: { type: boolean }
        size_mb: { type: number, nullable: true }

    ModelsListResponse:
      type: object
      properties:
        ok: { type: boolean }
        models:
          type: array
          items: { $ref: '#/components/schemas/ModelEntry' }

    Mode:
      description: >-
        A key that is not listed here is IGNORED, on every platform. That is
        what makes the "Windows and Linux" keys below safe to send from a
        cross-platform client. The seven `required` keys are required on
        `POST /modes` only; a body missing one is refused on every platform
        with HTTP 200 and `INVALID_REQUEST`, naming the keys that are
        missing. A well-formed JSON object that is merely incomplete is a
        business failure, not a protocol failure — see the envelope rule in
        this document's introduction. A body that is not a JSON object, or
        that carries a value of the wrong type, is still the protocol failure
        that rule describes: HTTP 400.
      type: object
      required: [name, preset, language, model, punctuation, capitalization, profanityFilter]
      properties:
        id: { type: string, format: uuid }
        name:
          type: string
          minLength: 1
          maxLength: 100
          description: >-
            Must not be empty after normalization and must be unique. Two names
            are the same name when they are equal after trimming Unicode
            whitespace and lowercasing. Windows and Linux trim boundary
            whitespace first; macOS also normalizes Unicode, trims invisible
            boundary characters, and rejects names with no visible base
            character. Lengths are counted in Unicode scalar values.
        preset:
          type: string
          minLength: 1
          maxLength: 64
          description: "hyper | message | mail | note | meeting | code | custom"
        language: { type: string, minLength: 1, maxLength: 32 }
        model: { type: string }
        punctuation: { type: boolean }
        capitalization: { type: boolean }
        profanityFilter: { type: boolean }
        customInstructions: { type: string, nullable: true }
        userSystemPrompt: { type: string, nullable: true, maxLength: 8000 }
        isDefault: { type: boolean, nullable: true }
        isSystemProvided: { type: boolean, nullable: true }
        sortOrder:
          type: integer
          nullable: true
          minimum: -32768
          maximum: 32767
          description: >-
            Every platform accepts values from -32768 through 32767 and refuses
            anything outside that range with `INVALID_REQUEST`. On create,
            macOS ignores the value and assigns the next stored order.
        createdDate: { type: string, format: date-time, nullable: true }
        modifiedDate: { type: string, format: date-time, nullable: true }
        languageModel: { type: string, nullable: true }
        cloudTranscriptionModel: { type: string, nullable: true }
        cloudProvider:
          type: string
          nullable: true
          description: >-
            The cloud vendor this Mode dictates on. A value you WRITE is
            normalized before it is stored, on every platform: it is lowercased,
            and the two LEGACY names `googlespeech` and `microsoftazurespeech`
            (either casing) are folded onto `hyperwhisper` plus the matching
            `cloudAccuracyTier` (`geminiTranscribe`, `azureMaiTranscribe`) —
            those providers are HyperWhisper Cloud accuracy tiers now, not
            standalone vendors. So a Mode read back may not carry the string you
            sent. On CREATE the folded tier wins over a `cloudAccuracyTier` in
            the same body; on PATCH a `cloudAccuracyTier` in the same request
            wins — so PATCHING BACK A WHOLE DOCUMENT YOU FETCHED WITH `GET` folds
            the provider but PINS the tier the Mode already had, which may not be
            the tier the name implies. Send only the keys you are changing.
            A Mode that ALREADY holds a legacy name is not rewritten by this
            endpoint and is reported as stored. Windows, macOS and Linux fold such
            a row once at app startup.
        postProcessingMode:
          type: integer
          minimum: 0
          maximum: 2
          description: "0 = off, 1 = cloud, 2 = local. Every platform rejects all other values."
        postProcessingProvider: { type: string, nullable: true }
        englishSpelling:
          type: string
          nullable: true
          description: >-
            american | british | australian | canadian. On create, an omitted
            value is seeded from the system region (Canada → canadian,
            Australia → australian, UK/IE/IN/SG/ZA/NZ and other British-English
            regions → british, everything else and an unknown region →
            american).
        useStreamingTranscription: { type: boolean, nullable: true }
        cloudAccuracyTier:
          type: string
          nullable: true
          description: "On create, an omitted or empty value resolves to `elevenLabsScribeV2`."
        removeTrailingPeriod: { type: boolean, nullable: true }
        enableScreenOCR: { type: boolean, nullable: true }
        geminiCustomPrompt: { type: string, nullable: true, maxLength: 2000 }
        cloudPostProcessingModel:
          type: string
          nullable: true
          description: "On create, an omitted or empty value resolves to `anthropic:claude-haiku-5-5`."
        cloudTranscriptionDomain: { type: string, nullable: true }
        localEngine: { type: string, nullable: true, description: "Windows and Linux. macOS ignores this key and never returns it. Defaults to `whisper` on create." }
        localParakeetModel: { type: string, nullable: true, description: "Windows and Linux. macOS ignores this key and never returns it." }
        localPostProcessingModel: { type: string, nullable: true, description: "Windows and Linux. macOS ignores this key and never returns it." }
        customVocabulary:
          type: array
          nullable: true
          maxItems: 1000
          items: { type: string, maxLength: 200 }
          description: "Windows and Linux. macOS ignores this key and never returns it."
        providerType: { type: string, nullable: true, description: "Windows and Linux. macOS ignores this key and never returns it. Windows accepts `local` or `cloud` in any casing, stores it lowercase, and refuses any other value with INVALID_REQUEST. A mode written before that rule may still return another value; Windows runs it on-device. Linux stores any value other than `cloud` as `local` and does not refuse it." }

    ModePatch:
      description: >-
        Partial Mode. Any field omitted is left untouched on the server. All
        fields are optional. `id`, `isSystemProvided`, `createdDate` and
        `modifiedDate` are read-only: the server ignores them here, and sets
        `modifiedDate` itself on each patch. On macOS, an explicit JSON null
        clears `customInstructions`, `userSystemPrompt`, `languageModel`,
        `cloudTranscriptionModel`, `cloudTranscriptionDomain`, `cloudProvider`,
        `postProcessingProvider`, `englishSpelling`, `cloudAccuracyTier`,
        `geminiCustomPrompt`, or `cloudPostProcessingModel`. Windows treats null
        like omission for nullable PATCH fields. A key that is not listed here
        is IGNORED, on every platform. The value bounds are the same as on
        `Mode`; only the required-key rule is create-only.
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 100
          description: >-
            Must not be empty after normalization and must be unique. Two names
            are the same name when they are equal after trimming Unicode
            whitespace and lowercasing. Windows and Linux trim boundary
            whitespace first; macOS also normalizes Unicode, trims invisible
            boundary characters, and rejects names with no visible base
            character. Lengths are counted in Unicode scalar values.
        preset:
          type: string
          minLength: 1
          maxLength: 64
          description: "hyper | message | mail | note | meeting | code | custom"
        language: { type: string, minLength: 1, maxLength: 32 }
        model: { type: string }
        punctuation: { type: boolean }
        capitalization: { type: boolean }
        profanityFilter: { type: boolean }
        customInstructions: { type: string, nullable: true }
        userSystemPrompt: { type: string, nullable: true, maxLength: 8000 }
        isDefault: { type: boolean, nullable: true }
        sortOrder:
          type: integer
          nullable: true
          minimum: -32768
          maximum: 32767
          description: "Every platform accepts values from -32768 through 32767."
        languageModel: { type: string, nullable: true }
        cloudTranscriptionModel: { type: string, nullable: true }
        cloudProvider:
          type: string
          nullable: true
          description: >-
            The cloud vendor this Mode dictates on. A value you WRITE is
            normalized before it is stored, on every platform: it is lowercased,
            and the two LEGACY names `googlespeech` and `microsoftazurespeech`
            (either casing) are folded onto `hyperwhisper` plus the matching
            `cloudAccuracyTier` (`geminiTranscribe`, `azureMaiTranscribe`) —
            those providers are HyperWhisper Cloud accuracy tiers now, not
            standalone vendors. So a Mode read back may not carry the string you
            sent. On CREATE the folded tier wins over a `cloudAccuracyTier` in
            the same body; on PATCH a `cloudAccuracyTier` in the same request
            wins — so PATCHING BACK A WHOLE DOCUMENT YOU FETCHED WITH `GET` folds
            the provider but PINS the tier the Mode already had, which may not be
            the tier the name implies. Send only the keys you are changing.
            A Mode that ALREADY holds a legacy name is not rewritten by this
            endpoint and is reported as stored. Windows, macOS and Linux fold such
            a row once at app startup.
        postProcessingMode:
          type: integer
          minimum: 0
          maximum: 2
          description: "0 = off, 1 = cloud, 2 = local. Every platform rejects all other values."
        postProcessingProvider: { type: string, nullable: true }
        englishSpelling: { type: string, nullable: true, description: "american | british | australian | canadian" }
        useStreamingTranscription: { type: boolean, nullable: true }
        cloudAccuracyTier: { type: string, nullable: true }
        removeTrailingPeriod: { type: boolean, nullable: true }
        enableScreenOCR: { type: boolean, nullable: true }
        geminiCustomPrompt: { type: string, nullable: true, maxLength: 2000 }
        cloudPostProcessingModel: { type: string, nullable: true }
        cloudTranscriptionDomain: { type: string, nullable: true }
        localEngine: { type: string, nullable: true, description: "Windows and Linux. macOS ignores this key." }
        localParakeetModel: { type: string, nullable: true, description: "Windows and Linux. macOS ignores this key." }
        localPostProcessingModel: { type: string, nullable: true, description: "Windows and Linux. macOS ignores this key." }
        customVocabulary:
          type: array
          nullable: true
          maxItems: 1000
          items: { type: string, maxLength: 200 }
          description: "Windows and Linux. macOS ignores this key."
        providerType: { type: string, nullable: true, description: "Windows and Linux. macOS ignores this key. Windows accepts `local` or `cloud` in any casing, stores it lowercase, and refuses any other value with INVALID_REQUEST. A mode written before that rule may still return another value; Windows runs it on-device. Linux stores any value other than `cloud` as `local` and does not refuse it." }

    ModeResponse:
      type: object
      properties:
        ok: { type: boolean }
        mode: { $ref: '#/components/schemas/Mode' }

    ModesListResponse:
      type: object
      properties:
        ok: { type: boolean }
        modes:
          type: array
          items: { $ref: '#/components/schemas/Mode' }

    TranscribeRequest:
      type: object
      properties:
        file:
          type: string
          description: "Absolute filesystem path. Mutually exclusive with audio_base64. Where a platform applies the 48 MiB audio limit to a file path, a larger file is refused with INVALID_REQUEST — see Request limits in the Local API overview for what each platform enforces."
        audio_base64:
          type: string
          description: base64-encoded audio bytes. Pair with mime_type.
        mime_type:
          type: string
          description: e.g. audio/wav, audio/m4a, audio/mpeg, audio/flac
        mode_id:
          type: string
          format: uuid
          description: >-
            Saved Mode used as the baseline. May be combined with
            engine/model/language to override per-call. When `mode_id` and
            `engine` name DIFFERENT cloud providers, the Mode's saved model is
            not carried across to the new provider: the request runs the engine's
            own default model. An inherited model is kept only when it really
            belongs to the engine you named — including under its legacy
            spelling, so an AssemblyAI Mode on `universal` re-run with
            `engine: "assemblyai"` still runs `universal` and is not upgraded to
            a different-priced model. Send an explicit `model` to pin one; for a
            BYOK provider that wins outright. HyperWhisper Cloud is different,
            because it selects by the Mode's accuracy tier rather than by a model
            id: `engine: "cloud"` keeps the Mode's model only when that model
            belongs to the tier, and otherwise runs the tier's default — an
            explicit `model` included. The default a dropped model falls back to
            is the same on every platform: every head reads it from
            `cloud-stt-catalog.json`, and
            `shared-conformance/default-model-vectors.json` pins the answer for
            all of them, so `engine: "openai"` with no `model` resolves to
            `gpt-transcribe` everywhere. The legacy engine names
            `googlespeech` and `microsoftazurespeech` now fold onto the same
            HyperWhisper Cloud accuracy tiers on every platform too, so neither
            of the two gaps this paragraph used to list is still open.
        engine:
          type: string
          description: >-
            whisperLocal | parakeet | nemotron | qwen3Asr | appleSpeech |
            <CloudProvider rawValue>. nemotron and appleSpeech are macOS only.
            Windows and Linux reject them with ENGINE_UNAVAILABLE. The value is
            trimmed and matched without regard to case on every platform, and
            every platform accepts the same alias spellings: whisper,
            whisperLocal, libwhisper; parakeet; nemotron, nemotronLocal,
            nemotron-local, nemotron-asr; qwen3Asr, qwen3, qwen3-asr, qwen3_asr,
            qwen; appleSpeech, apple, apple-speech, apple-speech-analyzer,
            speech-analyzer. So the engine a response reports can always be fed
            back into the next request, on any platform.

            TWO CLOUD VALUES ARE LEGACY NAMES AND ARE FOLDED, on every platform.
            `googlespeech` and `microsoftazurespeech` (either casing) name
            providers that HyperWhisper Cloud now serves as accuracy tiers, so
            the request runs on HyperWhisper Cloud — spending credits — with the
            tier `geminiTranscribe` or `azureMaiTranscribe`, and the response
            reports `engine: "hyperwhisper"`. Send an explicit `model` to pin a
            model INSIDE that tier (`mai-transcribe-1.5` rather than the default
            `mai-transcribe-2`); with no `model`, the Mode's own sub-model is
            kept when the tier serves it and the tier default runs otherwise.
            The fold replaces the Mode's provider and tier for this one call and
            supersedes whatever `mode_id` held, so the model rules under
            `mode_id` above are the HyperWhisper Cloud ones. `cloud` and
            `hyperwhisper` are NOT legacy names: they select HyperWhisper Cloud
            without changing the Mode's accuracy tier.
        model:
          type: string
          description: >-
            The model to run. Optional. It is echoed back unvalidated, and it
            wins over everything the Mode holds. Omit it to let the `engine`
            choose, and read `mode_id` above for what happens when the Mode and
            the `engine` disagree about the model. `whisperLocal` (and its
            aliases) is the exception: sent with `engine` and no `mode_id`, it
            needs a `model` (for example `base.en`), and a missing or blank one
            is refused with `INVALID_REQUEST` on all three platforms (macOS
            and Windows answer HTTP 200 with the message "A Whisper model is
            required."; Linux answers HTTP 400). `nemotron` with no `model` tries
            `nemotron-asr-3.5-multilingual`; on macOS, sent with `engine` and no
            `mode_id`, the `MODEL_NOT_INSTALLED` message names that model when it
            is not installed.
        language:
          type: string
        timestamp_granularities:
          type: array
          items: { type: string, enum: [segment, word] }
          description: "macOS only. Opt-in caption timestamps — ['segment'], ['word'], or both. Populates segments/words on the response."

    TranscribeResponse:
      type: object
      properties:
        ok: { type: boolean }
        text:
          type: string
          description: >-
            The transcript. /transcribe never runs AI post-processing —
            /post-process is the endpoint for that. The deterministic text
            passes DO run, on all three platforms: vocabulary replacements,
            dictated "new line" / "new paragraph" break commands, and
            filler-word removal when Remove filler words is on. Filler-word
            removal is English-only everywhere, but each platform decides
            "English" the way its own dictation does: Windows and Linux read
            the request's / Mode's language, so the default "auto" does not
            remove fillers and you should send "language": "en"; macOS prefers
            the language the engine reported and falls back to the request's,
            so "auto" against an engine that reports English does remove them
            there.
        engine: { type: string }
        model:
          type: string
          description: >-
            The model that actually transcribed the audio, on all three
            platforms. When the request names an explicit `model`, that value is
            echoed back unvalidated. When the request sends `engine` (or only
            `mode_id`) and no `model`, the response reports the model the engine
            resolved to rather than an empty string, so a caller driving the API
            by `engine` can still record which model produced the text; for
            HyperWhisper Cloud that is the model behind the mode's accuracy tier
            (for example `scribe_v2`), because the tier is what the service
            dispatches on. It is still empty for the handful of providers that
            take no model parameter at all — read an empty value as "this engine
            has no model id", not as "unreported".
        language: { type: string, nullable: true }
        timings:
          type: object
          properties:
            load_ms: { type: integer }
            decode_ms: { type: integer }
        latency_ms: { type: integer }
        raw_text: { type: string, nullable: true, description: "macOS only. Set when timestamp_granularities was requested." }
        segments:
          type: array
          nullable: true
          description: "macOS only. Present when timestamp_granularities included 'segment'."
          items: { $ref: '#/components/schemas/TranscribeSegment' }
        words:
          type: array
          nullable: true
          description: "macOS only. Present when timestamp_granularities included 'word'."
          items: { $ref: '#/components/schemas/TranscribeWord' }

    TranscribeSegment:
      type: object
      properties:
        id: { type: integer }
        text: { type: string }
        start: { type: number }
        end: { type: number }

    TranscribeWord:
      type: object
      properties:
        word: { type: string }
        start: { type: number }
        end: { type: number }

    PostProcessRequest:
      type: object
      required: [text]
      properties:
        text: { type: string }
        mode_id: { type: string, format: uuid }
        preset: { type: string, description: "hyper | message | mail | note | meeting | code | custom. Mutually exclusive with prompt." }
        prompt: { type: string, description: "Free-form system prompt. Sets preset=custom." }
        provider: { type: string }
        model: { type: string }

    PostProcessResponse:
      type: object
      properties:
        ok: { type: boolean }
        text: { type: string }
        provider: { type: string, description: "The provider that ACTUALLY ran, not the one stored on the mode. All three heads return a provider id (`openai`, `anthropic`, `local_llm`, or the `custom:<uuid>` string you configured); when the mode's stored spelling names the same provider, that spelling is echoed back unchanged, so the value differs from what you sent only when post-processing genuinely routed elsewhere. HyperWhisper Cloud has two accepted spellings for the one provider — macOS resolves it as `hyperwhisper` and Windows and Linux as `hyperwhispercloud` — and either can come back, because the spelling on your mode is preserved. Windows returns `none` when post-processing was skipped; macOS then returns the provider the mode resolves to, which is not a claim about a run (read `post_processed`); Linux fails the request rather than returning a skipped body." }
        model: { type: string, description: "The model that ACTUALLY ran and produced this text, not the one stored on the mode. Post-processing substitutes silently at several layers, and the substituted id is what appears here: a retired or unknown model id is remapped to the provider default, a local run reports the GGUF that was loaded, a custom endpoint reports the model name that went on the wire, and a HyperWhisper Cloud run reports the engine's catalog model id rather than the unrelated model field stored on the mode. The value is always a model id from the same vocabulary you would send in a request — never a display label. ONE KNOWN GAP: the hosted HyperWhisper Cloud backend runs a fallback of its own (a 5xx retry on another provider, or a prompt-leakage reroute) and that substitution is NOT visible here — a rerouted hosted request still reports the engine you asked for, because the backend does not expose the model it served as an id. When NO model ran, this falls back to the model the mode's own engine would have used (the cloud engine for a HyperWhisper Cloud mode, not the mode's `model` field) and is not a claim about a run; it can be empty. `post_processed: false` on macOS and `provider: none` on Windows are what tell you that happened. An EMPTY value on a run that DID happen means the opposite of nothing: an LLM ran and no single model id names this text. That is a macOS and Windows case only, and the cause is a MIXED-MODEL run — dictated-paragraph segments post-processed by different models, so no one id names the combined text. (Those two heads can also report `\"\"` for a stored custom endpoint whose model name is blank, but only when its URL needs repair as well: a blank model on its own is rejected before the call, and saving an endpoint rejects both, so only an endpoint carried in from an older build or a backup is in that state.) Linux never emits it — it post-processes the whole text in one call, and it rejects a blank-model custom endpoint before the call rather than running it — so an empty `model` there is always the nothing-ran fallback above. Read `post_processed` / `provider` to tell an empty run value from an empty fallback; never read empty as \"nothing ran\"." }
        preset: { type: string, description: "The preset the mode was resolved to. Never remapped, so this always matches the mode." }
        latency_ms: { type: integer }
        post_processed: { type: boolean, description: "true when an LLM actually ran and produced post-processed text; false when a failure path returned the raw input unchanged. ok stays true for graceful degradation, so read this to know post-processing happened. Sent by every platform on every ok:true body; macOS decodes it as a non-optional Bool. Which failures degrade to ok:true and which answer an ok:false envelope instead still differs per platform — see the note on this endpoint." }

    RecordingDTO:
      type: object
      properties:
        id: { type: string, format: uuid }
        text: { type: string }
        postProcessedText: { type: string, nullable: true }
        transcribedText: { type: string, nullable: true }
        date: { type: string, format: date-time }
        duration: { type: number }
        mode: { type: string, nullable: true }
        transcriptionProvider: { type: string, nullable: true }
        postProcessingProvider: { type: string, nullable: true, description: "The provider id post-processing ran with (`openai`, `local_llm`, `custom:<uuid>`, ...), or null when it did not run. A Linux recording saved before this field held an id may still hold a display label such as `OpenAI · gpt-5.6-luna`; those rows are not rewritten." }
        status: { type: string, nullable: true }
        audioFilePath: { type: string, nullable: true }

    RecordingsListResponse:
      type: object
      properties:
        ok: { type: boolean }
        total: { type: integer, description: "Number of recordings that match the filters, before limit is applied. Page with limit and since/until while total is more than returned." }
        returned: { type: integer, description: "Number of recordings in this response. Equal to the length of recordings, and never more than limit." }
        recordings:
          type: array
          items: { $ref: '#/components/schemas/RecordingDTO' }

    RecordingResponse:
      type: object
      properties:
        ok: { type: boolean }
        recording: { $ref: '#/components/schemas/RecordingDTO' }

    RecordingState:
      type: object
      description: State of the live recorder. Linux only.
      properties:
        is_recording:
          type: boolean
          description: True for the `recording` state only.
        state:
          type: string
          enum: [idle, recording, stopping, transcribing, retrying, completed, cancelled, failed]

    RecordingStateResponse:
      type: object
      properties:
        ok: { type: boolean }
        recording: { $ref: '#/components/schemas/RecordingState' }
