Skip to content
This repository was archived by the owner on Jan 4, 2026. It is now read-only.
This repository was archived by the owner on Jan 4, 2026. It is now read-only.

method not allowed #9

@WasamiKirua

Description

@WasamiKirua

Client error '405 Method Not Allowed' for url 'http://127.0.0.1:8000/v1/audio/transcriptions

i am trying integrating chainlit https://github.com/Chainlit/cookbook/blob/main/openai-whisper/app.py example using the openedai-whisper endpoint but i am getting the above error. I have tried both the openai lib as well httpx to format the post in a different way

async def speech_to_text(audio_file):
    # Unpack the tuple containing filename, audio data, and mime type
    filename, audio_data, _ = audio_file
    
    # Save audio data to a temporary file
    temp_path = "temp_audio.wav"
    with open(temp_path, "wb") as f:
        f.write(audio_data)
    
    # Prepare the form data
    files = {
        'file': ('audio.wav', open(temp_path, 'rb'), 'audio/wav')
    }
    data = {
        'model': 'whisper-1',
        'language': 'it',
        'response_format': 'json'
    }
    
    try:
        async with httpx.AsyncClient() as client:
            response = await client.post(
                'http://127.0.0.1:8000/v1/audio/transcriptions',
                files=files,
                data=data
            )
            response.raise_for_status()
            result = response.json()
        
        # Clean up the temporary file
        os.remove(temp_path)
        
        return result['text']
    except Exception as e:
        print(f"Error during transcription: {e}")
        raise

always getting the same methos not allowed error. it works with the code snippet in readme.md so i am wondering if is there a way to make it working with the chainlit code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions