Make diarized transcription duration and task optional

Open Beginner friendly
#802 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
kotlin
Domain
api

Research direction

Start at the TranscriptionDiarized model and inspect how its duration and task fields are parsed and validated. Use the diarized_json response shown in the issue as the reproduction, then verify that responses omitting both fields are accepted while responses containing them still work.

Written by the indexing model from the issue text.

Description

Update: July 30, 2026

I ran the same reproduction again today, and the API response now includes both duration and task:

{
    "text": "And so, my fellow Americans, ask not what your country can do for you, ask what you can do for your country.",
    "task": "transcribe",
    "duration": 11.0,
    "segments": [
        {
            "type": "transcript.text.segment",
            "text": " And so, my fellow Americans,",
            "speaker": "A",
            "start": 0.0,
            "end": 2.0999999999999996,
            "id": "seg_0"
        },
        {
            "type": "transcript.text.segment",
            "text": " ask not what your country can do for you, ask what you can do for your country.",
            "speaker": "A",
            "start": 2.3,
            "end": 10.3,
            "id": "seg_1"
        }
    ],
    "usage": {
        "type": "tokens",
        "total_tokens": 432,
        "input_tokens": 110,
        "input_token_details": {
            "text_tokens": 0,
            "audio_tokens": 110
        },
        "output_tokens": 322
    }
}

Original report: July 18, 2026

Bug

TranscriptionDiarized models both duration and task as required, but the diarized_json transcription response can omit both fields.

A direct response from the OpenAI API contained text, segments, and usage, but no duration or task properties.

This causes two problems:

  • TranscriptionDiarized.duration() throws OpenAIInvalidDataException: duration is not set.
  • TranscriptionDiarized.validate() fails because an absent task does not match the expected transcribe value.

Reproduction

Audio file: https://github.com/openai/whisper/blob/main/tests/jfk.flac

A direct request to the OpenAI audio transcriptions endpoint with response_format=diarized_json returned:

{
    "text": "And so my fellow Americans, ask not what your country can do for you, ask what you can do for your country.",
    "segments": [
        {
            "type": "transcript.text.segment",
            "text": " And so my fellow Americans, ask not what your country can do for you,",
            "speaker": "A",
            "start": 0.0,
            "end": 7.499999999999999,
            "id": "seg_0"
        },
        {
            "type": "transcript.text.segment",
            "text": " ask what you can do for your country.",
            "speaker": "A",
            "start": 8.15,
            "end": 10.3,
            "id": "seg_1"
        }
    ],
    "usage": {
        "type": "tokens",
        "total_tokens": 431,
        "input_tokens": 110,
        "input_token_details": {
            "text_tokens": 0,
            "audio_tokens": 110
        },
        "output_tokens": 321
    }
}

The response contains no duration nor task property.

I opened a issue on openai/openapi to track the schema correction.

Expected behavior

duration and task should be optional in TranscriptionDiarized, since it can be absent from a valid API response.

Dominant language
Kotlin
Stars
1.5k
Forks
264
Avg merge
13h 31m
Merged PRs (30d)
89

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openai/openai-java

All issues in openai/openai-java

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.