DEV Community

Daniel Dong
Daniel Dong

Posted on

Build a Multi-Model AI Chat App in 10 Minutes (Python + Streamlit)

Want to build a chat app that lets users switch between DeepSeek, Qwen, and GLM instantly?

Here's how to do it in 10 minutes with AIBridge + Streamlit.


What We're Building

A simple web chat app where users can:
✅ Select any of 14+ AI models
✅ Chat with the selected model
✅ See response times and token usage
✅ Switch models mid-conversation


Step 1: Install Dependencies

pip install streamlit openai
Enter fullscreen mode Exit fullscreen mode

Step 2: Get AIBridge API Key

1.Sign up at aibridge-api.com
2.Get 3M free tokens (no credit card)
3.Copy your API key (mb_...)

Step 3: Create the App

Create app.py:

import streamlit as st
from openai import OpenAI

# Initialize AIBridge client
client = OpenAI(
    api_key="mb_your_key",  # Replace with your key
    base_url="https://aibridge-api.com/v1"
)

# Available models
MODELS = [
    "deepseek-v4-pro",
    "deepseek-v4-flash",
    "qwen3-235b-a22b",
    "qwen-max",
    "glm-4-plus",
    "glm-4-flash",
    "moonshot-v1-128k"
]

# Streamlit UI
st.title("Multi-Model AI Chat")
st.caption("Powered by AIBridge — 14+ models, one API key")

# Model selector
model = st.selectbox("Select Model", MODELS)

# Chat input
if prompt := st.chat_input("Ask anything..."):
    # Display user message
    st.chat_message("user").write(prompt)

    # Get AI response
    with st.chat_message("assistant"):
        with st.spinner(f"Thinking with {model}..."):
            response = client.chat.completions.create(
                model=model,
                messages=[{"role": "user", "content": prompt}]
            )
            message = response.choices[0].message.content
            st.write(message)

            # Show metadata
            st.caption(f"Model: {model} | Tokens: {response.usage.total_tokens}")
Enter fullscreen mode Exit fullscreen mode

Step 4: Run It

streamlit run app.py
Enter fullscreen mode Exit fullscreen mode

Boom — you now have a multi-model AI chat app running locally! 🎉

Try It Yourself
AIBridge gives you:
✅ 14+ models through one OpenAI-compatible API
✅ 3M free tokens to start
✅ 90% cost savings vs direct API
✅ Real-time usage analytics

Get your key: https://aibridge-api.com

Happy building! 🚀

mainpage

models

playground

pricing

Top comments (0)