Skip to content

/ollama/v1/chat/completions endpoint broke (405 Method Not Allowed) in v0.3.6 #3489

Description

@kobaltz

Bug Report

Description

Bug Summary:
Making a HTTP POST to /ollama/v1/chat/completions worked in v0.3.5 but now returns 405 - Method not allowed

Steps to Reproduce:
Using the docker compose file which at the time was referencing v0.3.6, I was unable to make API calls to the Chat Completion
Reverting the open webui image to v0.3.5 and the POST works as expected.

services:
  ollama:
    volumes:
      - ollama:/root/.ollama
    container_name: ollama
    pull_policy: always
    tty: true
    restart: unless-stopped
    image: ollama/ollama:${OLLAMA_DOCKER_TAG-latest}
    environment:
      - NVIDIA_VISIBLE_DEVICES=all
      - NVIDIA_DRIVER_CAPABILITIES=all
    deploy:
      resources:
        reservations:
          devices:
            - capabilities: [gpu]
  open-webui:
    build:
      context: .
      args:
        OLLAMA_BASE_URL: '/ollama'
      dockerfile: Dockerfile
    image: ghcr.io/open-webui/open-webui:${WEBUI_DOCKER_TAG-main}
    container_name: open-webui
    volumes:
      - open-webui:/app/backend/data
    depends_on:
      - ollama
    ports:
      - ${OPEN_WEBUI_PORT-2039}:8080
    environment:
      - 'OLLAMA_BASE_URL=http://ollama:11434'
    extra_hosts:
      - host.docker.internal:host-gateway
    restart: unless-stopped

volumes:
  ollama: {}
  open-webui: {}

Expected Behavior:
HTTP POST to /ollama/v1/chat/completions returns the JSON response

Actual Behavior:
405 Method Not Allowed when making HTTP POST to /ollama/v1/chat/completions

Environment

  • Open WebUI Version: main (and v0.3.6)

  • Ollama (if applicable): latest (and 0.1.47)

  • Operating System: Debian Bookworm

  • Browser (if applicable): n/a

Reproduction Details

Confirmation:

  • I have read and followed all the instructions provided in the README.md.
  • I am on the latest version of both Open WebUI and Ollama.
  • I have included the Docker container logs.

Logs and Screenshots

Docker Container Logs:

INFO:apps.ollama.main:url: http://ollama:11434
INFO:     my-ip:0 - "POST /ollama/v1/chat/completions HTTP/1.1" 405 Method Not Allowed
INFO:apps.ollama.main:url: http://ollama:11434
INFO:     my-ip:0 - "POST /ollama/v1/chat/completions HTTP/1.1" 405 Method Not Allowed

Installation Method

Docker Compose

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