Want your app to talk to any AI model without rewriting code? An OpenAI-compatible chat completions server built on Simon Willison’s LLM project lets you plug local or alternative providers into tools that expect the OpenAI Chat API.
What this is
Simon Willison outlines a “chat completions server” for LLM that exposes an OpenAI-compatible endpoint, so existing apps, SDKs, and workflows can point to your local server instead of api.openai.com—no major code changes needed. It routes requests to models managed by LLM (local or cloud, via plugins).
Source: Simon Willison — LLM Chat Completions Server.
Why it matters
- Portability: Point tools expecting OpenAI’s Chat API at any model LLM supports (local or hosted).
- Cost control: Try cheaper or open-source models without changing your application code.
- Data locality: Keep prompts and responses on your machine or VPC for privacy and compliance.
- Vendor flexibility: Swap providers quickly for experiments or failover.
Quick-start pattern
- Install LLM and the plugins for your target providers/models (e.g., local runtimes or cloud backends).
- Start the chat completions server per the project’s instructions.
- Point your app to the local endpoint by setting typical SDK variables, for example:
OPENAI_API_BASE=http://localhost:8000/v1
OPENAI_API_KEY=anything - Use your chosen model name in requests (mapped by LLM and its plugins).
Compatibility and caveats
- API surface: Many tools still use the Chat Completions pattern; confirm your SDK supports overriding base_url and key.
- Feature parity: Function/tool calling, system prompts, and streaming can vary by provider. Test critical paths.
- Token limits: Verify context window and pricing-equivalent limits for your chosen model.
- Security: Don’t expose the server to the public internet without authentication and TLS. Keep keys out of logs.
- Observability: Enable request logging and rate limiting; add caching if you fan out to slower backends.
Great use cases
- Local-first dev: Build against an OpenAI-style API while running open-source models on your laptop.
- Evaluation harnesses: Swap models quickly to A/B test quality, latency, and cost.
- Enterprise guardrails: Route traffic through a controlled gateway for audit and redaction.
Resources
- Announcement and details: LLM Chat Completions Server (Simon Willison)
- Reference: OpenAI Chat Completions API
Takeaway
An OpenAI-compatible chat completions server for LLM is a powerful portability layer: keep your apps and SDKs, but gain freedom to choose the models behind them.
Get more practical AI tips in your inbox. Subscribe to The AI Nuggets newsletter.

