💻OpenAI-Compatible API
Also known as OpenAI-Compatible Endpoint, OpenAI-Compatible Server, OpenAI API Format
A server that takes the same requests as OpenAI's API. Apps can switch to it.
Think of it like
It is like a plug that fits every socket in the house. Any lamp works with it.
Example
Why it matters
You can try a local model in an app you already have, with no new code.
Definition
Example code
bash
curl http://localhost:11434/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model": "llama3.2", "messages": [{"role": "user", "content": "Hi"}]}'Common mistake
Key takeaways
- 1Same shape. The requests look the same.
- 2Change the address. Point the app somewhere else.
- 3Not every feature. Mostly the main calls.