Skip to content

openaichat refuses audio input that Chat Completions servers accept #2949

Open

Description

@mtmcp

Bug description

The Chat Completions adapter (provider/openaichat) refuses every audio part
before sending: Capabilities() reports Audio: false, and userContent
returns openaichat: audio input not supported. Chat Completions defines an
input_audio user content part (wav or mp3), and llama.cpp's llama-server
accepts it for models with an audio projector. So a custom provider with
api_flavor: openai-chat-completions cannot send audio, even to a model that
can hear it.

I'd like to work on this; I have a fix ready and will open a PR.

Steps to reproduce

  1. Run a prebuilt llama-server with an audio-capable model over HTTPS:

    mkdir -p ~/llama
    cd ~/llama
    
    curl -LO https://github.com/ggml-org/llama.cpp/releases/download/b12633/llama-b12633-bin-ubuntu-x64.tar.gz
    tar -xzf llama-b12633-bin-ubuntu-x64.tar.gz
    
    openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -nodes -days 7 \
      -subj "/CN=localhost" -addext "subjectAltName=IP:127.0.0.1,DNS:localhost" \
      -keyout local-key.pem -out local-cert.pem
    
    llama-b12633/llama-server -hf unsloth/gemma-4-E4B-it-GGUF:Q4_K_M --alias gemma-4-e4b \
      --host 127.0.0.1 --port 8443 --ssl-key-file local-key.pem --ssl-cert-file local-cert.pem
  2. Make a clip:

    mkdir -p ~/mecatl-repro/mecatl
    cd ~/mecatl-repro
    ffmpeg -f lavfi -i "flite=text='The quick brown fox jumps over the lazy dog. Seven purple elephants.'" \
      -ac 1 -ar 16000 phrase.wav

    Optionally confirm the server transcribes it when sent directly as
    input_audio (see the curl command in the reproduction notes).

  3. Point Mecatl at the server and attach the clip:

    cd ~/mecatl
    task build
    
    cat > ~/mecatl-repro/mecatl/settings.yaml <<'EOF'
    providers:
      llama-local:
        base_url: https://127.0.0.1:8443/v1
        default_model: gemma-4-e4b
        api_flavor: openai-chat-completions
        auth:
          method: none
    models:
      default_provider: llama-local
    EOF
    
    cd ~/mecatl-repro
    XDG_CONFIG_HOME=~/mecatl-repro SSL_CERT_FILE=~/llama/local-cert.pem ~/mecatl/bin/mecatui

    Submit @phrase.wav What animals are mentioned in this recording and what color are they?

Expected behavior

The audio part reaches the server as an input_audio part, and the reply names
a brown fox and purple elephants. A model that cannot hear is refused by its
server, as with any other unsupported input.

Actual behavior

mecatui refuses the attachment before sending anything:

attach: "phrase.wav": is audio (audio/wave) but the server's model does not accept audio

Over the HTTP API, POST /v1/sessions reports
"session_capabilities": {"image": true, "audio": false}, and a prompt with an
audio part ends with:

"stop":"error","error":"agent: start stream: openaichat: audio input not supported"

llama-server receives no request. The same clip sent directly to llama-server
as an input_audio part (WAV or MP3) is transcribed exactly.

Environment (if relevant)

  • OS/version: Ubuntu 24.04.4 LTS on WSL2 (kernel 6.6.87.2-microsoft-standard-WSL2), Go 1.27.3
  • mecatl version or commit: efcb5d5 (main)
  • Deployment shape: mecatui (embedded server)
  • Model server: llama.cpp llama-server build b12633, unsloth/gemma-4-E4B-it-GGUF:Q4_K_M with its mmproj

Additional context

Cause. openaichat.Capabilities() hard-codes Audio: false ("no target
model consumes it"), and userContent refuses session.MediaAudio. Chat
Completions defines input_audio (wav or mp3), and the Responses adapter
documents its Capabilities() as what its wire can carry, so the Chat
Completions bit should be true, with per-model gating left to composition and
the server.

I'd like to work on this; I have a fix ready and will open a PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions