Building apps on local models
For engineers
Calling local models from code through OpenAI-compatible APIs, getting valid JSON and tool calls from them, local embeddings and connecting coding tools
110 questions across four stages: Understand, Apply, Solve and Judge.
Try 5 questions
Practice items, not counted towards your mastery. No account needed.
Check yourself · 1 of 5
You have an app that uses the OpenAI SDK. You want it to call a model running in Ollama on the same laptop. What is the smallest change?
Check yourself · 2 of 5
What does constrained decoding do differently from asking a model to "return only JSON"?
Check yourself · 3 of 5
A local model's reply has an empty tool_calls field, but its content is {"name":"lookup_order","arguments":{"id":4417}}. What is the likely problem?
Check yourself · 4 of 5
Why can an embedding search find a document about "refund policy" for the query "getting my money back"?
Check yourself · 5 of 5
An editor assistant on a local model ignores the project's rules file, which is the first part of its prompt. What should you check first?
Topics
- Calling local models through OpenAI-compatible APIs4 min read · Pointing an existing SDK at Ollama, llama-server, LM Studio or vLLM by changing the base URL and model name, and the gaps in compatibility
- Forcing valid JSON with grammars and schemas4 min read · Constrained decoding with JSON schemas and GBNF grammars in Ollama, llama.cpp and vLLM, and why it beats asking nicely
- Tool calling reliability with local models4 min read · Chat templates and tool parsers, small-model failures such as invented tools and broken arguments, and validating every call
- Local embeddings for private document search4 min read · Running embedding models locally, storing vectors next to the app and searching private files without a cloud call
- Pointing coding tools at local models4 min read · Using local models in editor assistants and coding agents, the context length they need and where a local model falls short
Start here
- Ollama: OpenAI compatibility (opens in a new tab)DocsFree
Lists the endpoints and request fields Ollama accepts through its OpenAI-style API, and what is not supported.
- llama.cpp server README (opens in a new tab)DocsFree
Flags and endpoints of llama-server, including its OpenAI-compatible routes and JSON schema options.
- vLLM: structured outputs (opens in a new tab)DocsFree
How vLLM constrains output to a JSON schema, regex or grammar.
110 questions · last verified 2026-12