Skip to content

Feature Request: Support for custom OpenAI-compatible endpoints (vLLM) #19

@sfc-gh-valamuri

Description

@sfc-gh-valamuri

Problem Description

Currently, streamlit-openai appears to be tightly coupled to OpenAI's full platform ecosystem, including containers, assistants, and other platform-specific APIs. This prevents usage with OpenAI-compatible inference servers like vLLM that only implement the chat completions API.

Use Case

Many organizations run their own LLM inference servers (vLLM, TGI, etc.) that provide OpenAI-compatible APIs for cost, privacy, or custom model requirements. It would be valuable to use streamlit-openai's excellent UI/UX with these deployments.

Current Behavior

When attempting to use a custom endpoint, the library fails during initialization:

import streamlit_openai
import os

os.environ["OPENAI_API_KEY"] = "dummy-key"
os.environ["OPENAI_BASE_URL"] = "https://my-vllm-server.com/v1"

# This fails with 406 error because vLLM does not support the other endpoints (like Container)
chat = streamlit_openai.Chat(model="meta-llama/Llama-3.1-8B-Instruct")

Proposed Solutions

  1. Configuration Option: Add a parameter to disable OpenAI-specific features:

    chat = streamlit_openai.Chat(
        model="custom-model",
        openai_compatible_mode=True  # Disables containers, assistants, etc.
    )
  2. Client Injection: Allow passing a pre-configured OpenAI client:

    custom_client = OpenAI(base_url="...", default_headers={"Auth": "..."})
    chat = streamlit_openai.Chat(client=custom_client)

Benefits

  • Broader compatibility with the growing ecosystem of LLM deployment tools
  • Maintains the excellent UX of streamlit-openai for custom deployments
  • Could significantly expand the user base

Environment

  • streamlit-openai version: 0.1.3
  • Python version: 3.11
  • Testing with: vLLM server with OpenAI-compatible API

TLDR

It would be amazing if this library was less tightly coupled with the OpenAI backend and had flexibility to plug in with other OpenAI compatible backends like vLLM!

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