~/tools / Run a local LLM on your server / Ollama API Request Builder
Ollama API Request Builder — Build a curl request to Ollama's /api/chat: format, tools, think, options
Build a request to Ollama's /api/chat endpoint from a form: the model, a system and a user message, structured output with format and a JSON Schema, tool definitions, thinking, streaming, options such as temperature and num_ctx, stop sequences and keep_alive. You get a ready-to-run curl command and the JSON body. Every field comes from the official Ollama API reference. Nothing leaves your browser.
Options, stop sequences and keep_alive
Empty fields are not sent, so the model's settings stay in effect.
curl command
Run it in a terminal on a machine that can reach Ollama.
curl http://localhost:11434/api/chat -d '{
"model": "qwen3:4b",
"messages": [
{
"role": "user",
"content": "Tell me about Canada."
}
],
"format": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"capital": {
"type": "string"
},
"languages": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"name",
"capital",
"languages"
]
},
"options": {
"temperature": 0
},
"stream": false
}'JSON body
{
"model": "qwen3:4b",
"messages": [
{
"role": "user",
"content": "Tell me about Canada."
}
],
"format": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"capital": {
"type": "string"
},
"languages": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"name",
"capital",
"languages"
]
},
"options": {
"temperature": 0
},
"stream": false
}Fields as given in the Ollama API reference for /api/chat, checked on 2026-11-03. Ollama API: Generate a chat message
Everything is done in your browser. The tool only writes the command and sends nothing.
Ollama's /api/chat endpoint takes a JSON body with a model and a list of messages, plus optional fields: tools for function calling, format for a JSON answer or an answer that follows a JSON Schema, options for settings such as temperature and num_ctx, stream, think and keep_alive. Writing that body by hand in a terminal is error-prone: a missing comma breaks it, an apostrophe in a message ends the shell quote, and a number typed as text may not be read as a number. This tool builds the body from a form and wraps it in a curl command in the shape of the examples in the Ollama documentation, escaping apostrophes for the shell. It checks that the JSON Schema and the tool list are valid JSON, that each tool has the type, name and parameters the API reference requires, and that options are numbers of the right kind. We ran the generated commands against Ollama 0.40.11 with qwen2.5:7b: a JSON Schema request returned an answer in that shape, a request with a tool returned a tool call, and streaming, json mode, stop sequences and keep_alive worked without errors.
The core logic of this tool is open source under the MIT License. github.com/seigo5555/toolkitbox-lib/src/ollama-api-request.ts
Use Cases
- Try structured output on your own server before you write code: paste a JSON Schema and see what the model returns
- Check that a model calls your function, with the tool definition you plan to use in your application
- Call Ollama behind an nginx proxy with a password, with the right URL and curl -u
Usage
- Enter the address of your Ollama server (http://localhost:11434 if you leave it empty) and the model name, then write the user message and, if you want, a system message.
- Choose an output format, add tool definitions as a JSON array, and set thinking and streaming. Open Options to set temperature, num_ctx, a seed, stop sequences or keep_alive. Empty fields are left out.
- Copy the curl command and run it in a terminal on a machine that can reach Ollama. The JSON body is shown separately if you want to send it from your own code.
FAQ
What does stream do?
The API reference gives stream a default of true. A streamed answer arrives as newline-delimited JSON, one piece at a time. With stream set to false, the documentation says the answer comes back as a single JSON object, which the streaming page calls simpler to process and better for short responses or structured outputs. The tool writes "stream": false only when you turn streaming off.
What values can think take?
The API reference says true requests thinking, false requests no thinking output, and a string selects a level that the model defines; numbers are not supported. The documentation says to use /api/show to find the values a model supports, and the tool shows that command when you set think. In our test, think false worked with qwen2.5:7b, and think true was refused with "qwen2.5:7b" does not support thinking.
What is the difference between json and a JSON Schema in format?
The API reference says format can be json or a JSON schema. json asks for any valid JSON. A schema describes the exact shape, such as the property names and which ones are required, and in our test the answer followed it. The tool sends the schema as an object, not as a string.
How should a tool definition look?
The API reference requires type, which is always function, and a function object with a name and parameters, where parameters is a JSON Schema for the arguments; description is optional. The tool checks these fields. When the model decides to call the function, the answer contains message.tool_calls instead of text.
How do I call an Ollama that is behind a password?
Enter the proxy's address, such as https://ollama.example.com, and the user name. The tool adds -u with that name to the curl command, and curl then asks for the password, so the password is never part of the command. The Ollama nginx Config Generator on this site builds such a proxy.
Is anything sent to a server?
No. The tool only writes the command. Nothing is sent until you run it yourself.
Related articles
- Watch the memory of Ollama on a small VPSSee what Ollama holds in memory, how long it stays there and which settings change it: ollama ps, keep_alive and the limits, from the official FAQ.
- Connect Dify to Ollama on your own VPSRun Dify on your own VPS and use Ollama as its model: install, the plugin fields, the Docker address problem and embeddings, from the official documentation.
- Start a local LLM without an expensive PC: a beginner's guide to using a VPSNo powerful PC? Rent a VPS and run a small local LLM from your browser: six steps from memory estimate to a protected chat screen, with the limits stated honestly.