Local LLM API Tester - LM Studio & Ollama API Setup
Check that your LM Studio, Ollama or llama.cpp server is answering, find the right base URL and port, and copy working curl, Python and JavaScript code for its OpenAI-compatible API.
- Instant
- 100% Client-Side
- No Login Required
- Data Stays in Your Browser
Your local server
Test the connection
GET http://localhost:1234/v1/models
Ready-to-run code
curl http://localhost:1234/v1/chat/completions \
-H "Content-Type: application/json" \
-H 'Authorization: Bearer lm-studio' \
-d '{
"model": "qwen/qwen3-8b",
"messages": [
{
"role": "user",
"content": "Say hello in one short sentence."
}
],
"temperature": 0.7
}'Base URL for any app or SDK: http://localhost:1234/v1
Fixes for LM Studio
- Let a web page call it (CORS)
- lms server start --cors (or Developer tab > Server Settings > Enable CORS)
- Use it from another device on your Wi-Fi
- lms server start --bind 0.0.0.0 (or Server Settings > Serve on Local Network)
The test runs from your browser to your own machine. Processing happens entirely in your browser.
One API, three local servers
LM Studio, Ollama and llama.cpp all copy the shape of the OpenAI API. That means any app or SDK built for OpenAI can talk to a model on your own machine if you change two things: the base URL and the API key. The request and response bodies stay the same. A chat call goes to /v1/chat/completions, and the list of available models comes from /v1/models, which is the endpoint this tester calls.
The part people get wrong is the address. Each server picks its own default port, and the /v1suffix matters for OpenAI clients but not for Anthropic ones. These are the defaults from each project’s own documentation:
| Server | Default address | OpenAI base URL | Key when auth is off |
|---|---|---|---|
| LM Studio | localhost:1234 | http://localhost:1234/v1 | any, e.g. lm-studio |
| Ollama | 127.0.0.1:11434 | http://localhost:11434/v1 | ollama (ignored) |
| llama.cpp llama-server | 127.0.0.1:9931 | http://localhost:9931/v1 | sk-no-key-required |
Starting the server in each app
LM Studio. Open the Developer tab and switch on Start server, or run lms server start in a terminal. Load a model before you send a chat request, or turn on Just in Time model loading in Server Settings so the first request loads it. LM Studio also serves an Anthropic-compatible /v1/messages endpoint and the OpenAI /v1/responses endpoint that Codex uses. Our LM Studio local API server guide covers structured output and tool use on that server.
Ollama. The desktop app starts the server for you, and ollama serve starts it by hand. The model name is whatever ollama list shows, such as llama3.2. Ollama has its own native API under /api as well, but the OpenAI-compatible routes under /v1 are what most apps expect.
llama.cpp. Run llama-server -m model.gguf. It serves one model by default, so the model field in requests can be any name. It also answers GET /health with 503 while the model is loading and 200 when it is ready, which is handy in scripts that wait for start-up.
Why the browser test needs CORS
A page on one site can only read a response from another address if that server says it allows it. curl, Python and desktop apps skip this check, which is why a request can work in a terminal and fail here. The tester sends a second, opaque request when the first fails. If that one gets through, the server is running and only CORS is blocking the page, so you get the CORS command instead of “not running”.
The local network permission
Recent Chrome versions ask before a website may contact devices on your local network, including your own machine. If a prompt appears when you press Test now, choose Allow. If you blocked it earlier, reset the permission from the site settings next to the address bar and test again.
A worked example with Ollama
Say Ollama is running on your laptop and you pulled llama3.2. Choose Ollama, keep localhost and port 11434, and type the model name. The curl tab gives you this. The key is the placeholder Ollama’s docs use, because the local server ignores it:
curl http://localhost:11434/v1/chat/completions \
-H "Content-Type: application/json" \
-H 'Authorization: Bearer ollama' \
-d '{
"model": "llama3.2",
"messages": [
{
"role": "user",
"content": "Say hello in one short sentence."
}
],
"temperature": 0.7
}'Run it in a terminal. A JSON reply with a choices array means the server and model both work. The Python tab gives the same request through the official openaipackage, so an existing OpenAI project only needs these lines changed:
from openai import OpenAI
client = OpenAI(base_url="http://localhost:11434/v1", api_key="ollama")
reply = client.chat.completions.create(
model="llama3.2",
messages=[{"role": "user", "content": "Say hello in one short sentence."}],
)
print(reply.choices[0].message.content)Tools that read environment variables, such as Claude-style coding agents, take the .env tab instead. Here is the output for LM Studio running on another computer at 192.168.1.20 with the Anthropic API style. The base URL has no /v1, because the Anthropic SDK adds/v1/messages itself:
export ANTHROPIC_BASE_URL=http://192.168.1.20:1234 export ANTHROPIC_AUTH_TOKEN='lm-studio' export ANTHROPIC_MODEL='qwen/qwen3-8b'
Change the model to any name from your server’s list and every snippet updates. Quotes or apostrophes in a model name or prompt are escaped for the shell and for each language, so the code runs as pasted.
Reading the result
- Connected, with models. Everything works. Click a model to fill the snippets, then paste them into your project.
- 401 or 403. Authentication is on. In LM Studio that is the Require Authentication switch, and the token goes in an
Authorization: Bearerheader. For llama.cpp it is the--api-keyyou started it with. - 404. Something answered on that port, but not an OpenAI-style server. Usually it is another program, or a port typed from an old guide.
- Running, but CORS blocks the page. The server is fine for code. Use the CORS command shown only if you want browser apps to call it.
- Nothing answered. The server is not started, the port is wrong, or the browser permission was declined.
Using one model from every device at home
All three servers listen on localhost only until you change it. Use lms server start --bind 0.0.0.0, OLLAMA_HOST=0.0.0.0:11434 or --host 0.0.0.0, then point other devices at the machine’s IP, such as 192.168.1.20. LM Studio’s docs recommend turning on authentication whenever you bind beyond localhost.
Do not open the port to the internet
A local model server with no key will run prompts for anyone who reaches it, using your GPU. Keep it on localhost or your home network. If you need remote access, put it behind a reverse proxy or tunnel that requires a login, and set an API key on the server too.
Before you download a model
Whether a model loads at all depends on your GPU memory. The AI VRAM Calculator shows which models and quantizations fit your card. To compare what the same workload would cost on a hosted API instead, use the API Cost Calculator. When you need to put a JSON request body into code or an environment variable, the JSON to String Converter escapes it for you.
How to Use
Pick your server: LM Studio, Ollama, llama.cpp or another OpenAI-compatible one. The default port fills in.
Keep localhost, or type the IP of the machine running the model.
Press Test now. The page asks your server for /v1/models and explains any failure.
Click a model from the list, or type its name, to put it into the code.
Copy the curl, Python, JavaScript or .env snippet and run it.
Features
Common Questions
Local LLM API tester for LM Studio, Ollama and llama.cpp. Find the right base URL and port (LM Studio 1234, Ollama 11434, llama.cpp 9931), test that the OpenAI-compatible /v1/models endpoint answers, list loaded models, and copy curl, Python and JavaScript code for /v1/chat/completions or the Anthropic-compatible /v1/messages endpoint. The tool explains CORS, mixed-content and network failures with the exact fix for each server.
About Local LLM API Tester
Check that a local OpenAI-compatible model server is answering and get code that works with it. Pick LM Studio (port 1234), Ollama (11434), llama.cpp llama-server (9931) or any other server, keep localhost or type a LAN IP, and press Test now. The page calls /v1/models from your browser, lists the loaded models, and tells a stopped server apart from a CORS block, an auth error or a wrong port, with the exact command to fix each one. Snippets cover the OpenAI chat completions API and the Anthropic-compatible /v1/messages endpoint in curl, Python, JavaScript and .env form. Nothing is sent to ToolMintX.
Processing Note
Local LLM API Tester runs in your browser, so the input you enter is processed locally on this page and is not uploaded to a ToolMintX account.
Tool Limits
IT tools provide quick diagnostics and transformations. They cannot see every private network, deployment setting, proxy, firewall, or production edge case.
Explore More
AI VRAM Calculator
See which local LLMs fit on your GPU, from RTX 3060 and RTX 5090 to H100, H200 and B200, the max context each holds, and a full VRAM breakdown.
Client-sideAI API Cost Calculator
Compare and estimate AI API costs across OpenAI, Claude, Gemini, DeepSeek and more for text, image, video, and embeddings.
Client-sideAPI Key and .env Secret Generator
Generate secure .env secrets plus selectable Hugging Face, OpenAI, JWT, database, and webhook variables.
Client-sideSubnet Calculator
IPv4 subnet calculator: network and broadcast address, subnet and wildcard mask, usable host range, and host count from any IP and CIDR prefix.
Client-side