New Project

AI SDK with Flask

Use Flask and AI SDK on Vercel with Serverless Functions using the Python Runtime.

DeployView Demo
ai-sdk-with-flask
GitHub Repovercel-labs/ai-sdk-flask
filter section list

Related Templates

AI SDK Python Streaming

AI SDK streaming chat completions from a FastAPI Python Vercel Function.
AI SDK Python Streaming thumbnail
DeployView Demo

Flask + Vercel

This example shows how to use Flask and AI SDK on Vercel with Serverless Functions using the Python Runtime.

Demo

https://ai-sdk-preview-flask.vercel.app/api/generate?prompt="hey!"

How it Works

This example uses the Web Server Gateway Interface (WSGI) with Flask to handle requests on Vercel with Serverless Functions.

Running Locally

npm i -g vercel
python -m venv .venv
source .venv/bin/activate
uv sync # or alternatively pip install flask gunicorn
gunicorn main:app

Your Flask application is now available at http://localhost:3000.

Use Cases
AI
Backend
Stack
Python
Flask