Back to Blog
local llmcustom AIOpenAI compatibletroubleshootingBYOK

Connect a Local LLM or Custom AI to Your Browser with SurfMind

•17 min read
Connect a Local LLM or Custom AI to Your Browser with SurfMind

SurfMind doesn't lock you into one set of models. You can point it at a model running on your own machine (Ollama, LM Studio, Jan, llama.cpp, vLLM) or at almost any external AI provider that speaks the OpenAI completion API — Poe, z.ai, Together, Groq, DeepSeek, AWS Bedrock, and dozens more.

Most popular providers and local runners are already set up in SurfMind's settings: you click Connect and paste your API key. For anything else, the Custom Providers / API form lets you add the endpoint yourself.

The catch: when it doesn't work on the first try, it could be because of a small config mistake. The error you get back ("connection failed," "401," "404," "model not found") could be tricky.

This post is a quick check and self-help guide. Skim the checklist and confirm your setup. If it still doesn't work, drop us an email at wave@surfmind.ai.

Look for a specific provider? Check out our list: local models (Ollama, LM Studio, OpenWebUI, Jan…) or AI providers (Poe, z.ai, Together, Groq, AWS…).

The 60-second checklist

Before anything else, run through these. Most setup problems come down to one of them:

  1. Is the server actually running? For local models, the runner (Ollama, LM Studio, etc.) has to be started and have a model loaded.
  2. Is the port right? Ollama is 11434. LM Studio is 1234. They are not interchangeable, and this is the single most common mistake.
  3. Is the path right? Ollama's native path is /api/chat. Almost everything else is /v1/chat/completions. Mixing them up gives you an error.
  4. Is the scheme right — http or https? Local models on localhost use http:// (no s). Cloud providers use https://. Getting this backwards looks like a dead connection.
  5. Did you paste the full endpoint, not just the base? SurfMind's API URL field wants the complete URL ending in /chat/completions (or /api/chat for Ollama), not just https://api.provider.com/v1.
  6. Is the API key (and its format) correct? Local runners usually need no key. External providers need Authentication set to API Key, the Authorization: Bearer format, and your real key.
  7. For local models in the browser: is CORS allowed? This is the one extra step local setups need (OLLAMA_ORIGINS, or "Enable CORS" in LM Studio).

If you're still stuck after that, read on — each of these has a subtle version that catches people.

How to connect a provider

It takes a few clicks from the model picker:

Step 1. Click the model name at the bottom of the SurfMind panel to open your Favorites, then click Show all.

SurfMind model picker with the Show all button

Step 2. At the top of the model list, click Add model provider. This opens the Models page in SurfMind settings.

SurfMind model list with the Add model provider button

Step 3. Find your provider. Local runners (Ollama, LM Studio, vLLM, llama.cpp, Open WebUI) are under Self-hosted. Cloud providers (OpenAI, Anthropic, Google, OpenRouter, Groq, DeepSeek, Mistral, Poe, z.ai, Together, AWS Bedrock and more) are under Providers. Use the search box if the list is long, then click Connect.

SurfMind Models settings page listing self-hosted runners and providers, each with a Connect button

Step 4. For a cloud provider, paste your API key and click Connect. The dialog links to the page where you can get a key. For a self-hosted runner, the form opens with the local URLs already filled in, so you just save it (Open WebUI also needs your key).

SurfMind Connect dialog asking for an API key

Once connected, the provider's models show up in the model picker. Expand the provider row to choose which ones appear.

Don't see your provider? Add it as a custom provider

If your provider or runner isn't in the list (Jan, LocalAI, your company's gateway, or a provider we haven't added yet), click Custom Providers / API at the top of the Models page.

SurfMind Custom section with the Custom Providers / API button

The "Custom Model API" form opens, and you enter the endpoint yourself.

SurfMind Custom Model API form

The rest of this guide is mostly about this form, because that's where the setup mistakes happen.

What goes in each field

When you click Custom Providers / API, you get the "Custom Model API" form. Here's exactly what each field wants:

Field What to enter
API Name Any label you like (e.g. "My Gateway" or "Jan"). It's the name you'll see in the model picker.
API URL The full chat endpoint, not the base URL. For Ollama that's http://localhost:11434/api/chat; for everyone else it ends in /chat/completions. See Mistake #1.
Models URL (optional) The endpoint that lists available models, so SurfMind can show them in a dropdown instead of making you type names. Ollama: /api/tags. OpenAI-compatible: /v1/models. Leave blank if the provider has no list endpoint — you'll just type the model id yourself.
Authentication No authentication for local models. API Key for anything that needs a key, which reveals the two fields below.
API Key Format How your key is sent. Authorization: Bearer = Authorization: Bearer <key>, which nearly every cloud provider uses. x-api-key = x-api-key: <key>, used by Anthropic-style APIs and a few others. Custom header lets you name your own header.
API Key The key itself — nothing more. Don't type the word Bearer; SurfMind adds it.

The two things people get wrong are API URL (base vs. full endpoint) and API Key Format (which header). The rest of this guide drills into those.

Mistake #1: the API URL path (the /api/chat vs /v1/chat/completions trap)

This is the big one, and it's worth understanding why it happens.

There are two different API "dialects" in this world:

  • Ollama's native API, which uses http://localhost:11434/api/chat.
  • The OpenAI completion API, which uses .../v1/chat/completions. This is what LM Studio, vLLM, Jan, Poe, z.ai, Together, Groq — basically everyone else — speaks.

So if you copy a setup guide written for LM Studio and try to use that path with Ollama (or vice versa), you'll get a 404 even though the server is running perfectly. The server is up; you're just knocking on the wrong door.

Runner / provider Correct API URL
Ollama (native) http://localhost:11434/api/chat
Ollama (OpenAI-compatible mode) http://localhost:11434/v1/chat/completions
LM Studio http://localhost:1234/v1/chat/completions
OpenWebUI http://localhost:3000/api/chat/completions
Everyone OpenAI-compatible https://<host>/v1/chat/completions

Good to know: Ollama actually speaks both dialects. The Ollama entry under Self-hosted in SurfMind uses the native /api/chat path, which is the simplest route and gives you automatic model discovery. You only need Ollama's /v1/chat/completions path if a tool specifically demands the OpenAI format. For SurfMind, just click Connect on the Ollama row.

Mistake #2: the port number

Every local runner picks its own default port, and they look similar enough to fat-finger:

Tool Default port Full chat URL
Ollama 11434 http://localhost:11434/api/chat
LM Studio 1234 http://localhost:1234/v1/chat/completions
Jan 1337 http://localhost:1337/v1/chat/completions
llama.cpp (llama-server) 8080 http://localhost:8080/v1/chat/completions
vLLM 8000 http://localhost:8000/v1/chat/completions
LocalAI 8080 http://localhost:8080/v1/chat/completions

11434 vs 1234 is the classic mix-up — they're easy to confuse at a glance, but one digit off and nothing connects. If you changed the port yourself (e.g. you ran vLLM with --port 9000), use your port, not the default.

Quick sanity check: open the port in your browser. Visiting http://localhost:11434 should show Ollama's "Ollama is running" message. If the page doesn't load at all, the server isn't up or you have the wrong port.

Mistake #3: pasting the base URL instead of the endpoint

Provider docs almost always give you a base URL — something like https://api.poe.com/v1. That's because their code samples use the OpenAI SDK, which appends /chat/completions for you under the hood.

SurfMind's API URL field does not do that for you. It expects the complete endpoint. So you have to add the path yourself:

  • Base URL from docs: https://api.poe.com/v1
  • What you paste into SurfMind: https://api.poe.com/v1/chat/completions

Same idea for the Models URL field (used to auto-list available models): take the base and add /models → https://api.poe.com/v1/models.

Two related slip-ups:

  • Double /v1. If the base already ends in /v1, don't add another. .../v1/v1/chat/completions is a 404.
  • Trailing slashes. .../chat/completions/ with a trailing slash can fail on some servers. Drop it.

Mistake #4: http vs https mismatch

The scheme at the front of the URL matters, and mixing it up produces a "connection failed" that looks like the server is down when it isn't.

  • Local models are http. Ollama, LM Studio, Jan, llama.cpp — anything on localhost — serves plain http://. Typing https://localhost:11434 fails, because there's no TLS certificate on a local server. If you copied a snippet with https in front of localhost, drop the s.
  • Cloud providers are https. Poe, z.ai, Together, Groq, and the rest only accept https://. Sending http:// to them gets refused or silently redirected.

There's also a browser-security angle: pages served over https block requests to plain http endpoints ("mixed content"). SurfMind handles http://localhost as a trusted exception, so local models work — but a bare LAN IP like http://192.168.1.50:11434 may still be blocked. If you're pointing at another machine on your network, prefer https, or serve the model behind a local https proxy.

Rule of thumb: http for localhost, https for everything on the public internet.

Mistake #5: the Models URL doesn't match the API URL

The Models URL is optional. It's the endpoint SurfMind calls to fetch the list of models a provider offers, so it can show them in a dropdown instead of making you type names. If your models don't show up in the picker after saving, this field is usually the culprit. It has to follow the same dialect as the chat endpoint:

Dialect Models URL
Ollama (native) http://localhost:11434/api/tags
OpenAI-compatible (everyone else) https://<host>/v1/models

A common mistake is mixing them — using /api/tags with an OpenAI-compatible provider, or /v1/models with Ollama's native /api/chat. If you connected through the Ollama row under Self-hosted, this is filled in for you correctly; leave it alone.

When to leave it blank: some providers don't expose a public model-list endpoint, or block it. That's fine — leave Models URL empty and just type the exact model id into the model field yourself (see Mistake #8). The chat will still work; you just won't get the auto-populated dropdown.

Mistake #6: the API key format (Bearer vs x-api-key)

In the custom form, Authentication and API Key Format decide how your key is attached to the request. Pick the wrong one and you'll get a 401 Unauthorized even with a perfectly valid key. The options:

Setting What SurfMind sends Use it for
No authentication nothing Local models usually don't need auth but it's worth confirming your actual setup.
API Key → Authorization: Bearer Authorization: Bearer <your key> Almost every cloud provider: Poe, z.ai, Together, Groq, DeepSeek, Mistral, Fireworks, xAI, AWS Bedrock. This is the default for OpenAI-compatible APIs.
API Key → x-api-key x-api-key: <your key> Anthropic-style APIs and a handful of providers that expect a raw key header instead of a Bearer token.
API Key → Custom header <your header>: <your key> Gateways and proxies that read the key from a header with their own name.

Then the API Key field takes only the key itself:

  • Don't type the word Bearer — SurfMind adds it when you choose Authorization: Bearer.
  • Don't leave a trailing space (a surprisingly common cause of 401s).
  • For local models, choose No authentication. (LM Studio is the exception — it wants some non-empty value; its own docs use lm-studio.)

If unsure which format a provider uses: 99% of OpenAI-compatible providers use Authorization: Bearer. Only reach for x-api-key if the provider's docs explicitly show an x-api-key header. Still getting a 401? Regenerate the key, double-check the format, and confirm there's no stray space.

Mistake #7: CORS — the local-only gotcha

Browsers refuse to call a local server unless that server explicitly allows requests from the extension. This trips up local setups specifically (external providers already allow it).

  • Ollama: start it with browser access enabled:

    # Mac/Linux
    OLLAMA_ORIGINS="*" ollama serve
    
    # Windows (PowerShell)
    $env:OLLAMA_ORIGINS="*"; ollama serve

    "port 11434 already in use"? The Ollama background app is already running. Quit it first (menu bar on Mac, system tray on Windows), then run the command above.

  • LM Studio: in the Developer / local server tab, toggle Enable CORS on before starting the server.

One more subtlety: if localhost doesn't connect, try 127.0.0.1 instead (or the reverse). On some systems they don't resolve the same way.

Mistake #8: the model name has to match exactly

Once you're connected, the model name you select has to match what the provider expects — exactly, including capitalization. This bites people on providers that don't auto-list models, or that use unusual naming:

  • Poe uses display-style bot names like Claude-Sonnet-4.6 and GPT-5.4 — copy them exactly as they appear on Poe.
  • z.ai uses ids like glm-4.6 and glm-5.
  • Together AI uses namespaced ids: meta-llama/Llama-3.3-70B-Instruct-Turbo, deepseek-ai/DeepSeek-V3.
  • Fireworks uses a full path id: accounts/fireworks/models/llama-v3p3-70b-instruct.

If the connection works but you get "model not found," it's almost always a name typo or wrong casing. When SurfMind can auto-list models via the Models URL, pick from the list instead of typing.

Quick reference: local models

All of these run on your own machine. Ollama, LM Studio, vLLM, llama.cpp and Open WebUI are already listed under Self-hosted on the Models page: click Connect and the URLs below are filled in for you. For Jan and LocalAI, click Custom Providers / API, paste the URLs, and set Authentication to No authentication. If you changed a runner's port, edit the URL to match. Provider names link to each tool's setup docs.

Ollama

  • API URL: http://localhost:11434/api/chat
  • Models URL: http://localhost:11434/api/tags
  • API key: none

LM Studio

  • API URL: http://localhost:1234/v1/chat/completions
  • Models URL: http://localhost:1234/v1/models
  • API key: any non-empty value (e.g. lm-studio)

Jan

  • API URL: http://localhost:1337/v1/chat/completions
  • Models URL: http://localhost:1337/v1/models
  • API key: none (or your Jan key)

llama.cpp

  • API URL: http://localhost:8080/v1/chat/completions
  • Models URL: http://localhost:8080/v1/models
  • API key: none (unless you started it with --api-key)

vLLM

  • API URL: http://localhost:8000/v1/chat/completions
  • Models URL: http://localhost:8000/v1/models
  • API key: your --api-key if you set one

LocalAI

  • API URL: http://localhost:8080/v1/chat/completions
  • Models URL: http://localhost:8080/v1/models
  • API key: none

OpenWebUI: the exception to "no key". OpenWebUI needs an API key, and its paths are /api/..., not /v1/.... Connect it from the Self-hosted list and paste your sk-… key from Settings → Account → API keys. Use http://localhost:3000 for a typical Docker install, or your server's address if it runs elsewhere.

  • API URL: http://localhost:3000/api/chat/completions
  • Models URL: http://localhost:3000/api/models
  • API key: your OpenWebUI key (sk-…)

Full setup and troubleshooting are in our OpenWebUI API guide.

Don't forget the CORS step (Mistake #7) for any of these. For Ollama specifically, the full walkthrough with screenshots is in our Ollama guide, and if you're deciding between the first two, see Ollama vs LM Studio.

Every provider below is already listed under Providers on the Models page: click Connect and paste your key — the URLs are filled in for you. They're listed here for reference, or in case you'd rather add one by hand with Custom Providers / API (set Authentication to API Key with the Authorization: Bearer format). Provider names link to each provider's API docs.

Poe — one key for hundreds of models (Claude, GPT, Gemini, Llama…), billed against your Poe subscription points. Model names are display-style bot names — copy them exactly as shown on Poe (e.g. Claude-Sonnet-4.6, GPT-5.4). Key from poe.com → Settings → API key.

  • API URL: https://api.poe.com/v1/chat/completions
  • Models URL: https://api.poe.com/v1/models

CanopyWave — GPU-cloud provider serving open models (Kimi, DeepSeek, Llama, Qwen). Key from the CanopyWave dashboard.

  • API URL: https://inference.canopywave.io/v1/chat/completions
  • Models URL: https://inference.canopywave.io/v1/models

z.ai (GLM) — Zhipu's GLM models (glm-4.6, glm-5). Watch out: z.ai also publishes a separate Coding Plan endpoint (https://api.z.ai/api/coding/paas/v4) and a PaaS endpoint (https://api.z.ai/api/paas/v4) — use the OpenAI-compatible one below and don't add an extra /v1.

  • API URL: https://api.z.ai/api/openai/v1/chat/completions
  • Models URL: https://api.z.ai/api/openai/v1/models

Together AI — large open-model catalog. Model ids are long (meta-llama/Llama-3.3-70B-Instruct-Turbo) — copy them exactly from Together's model page.

  • API URL: https://api.together.xyz/v1/chat/completions
  • Models URL: https://api.together.xyz/v1/models

Groq — extremely fast inference. Gotcha: the path is /openai/v1, not just /v1.

  • API URL: https://api.groq.com/openai/v1/chat/completions
  • Models URL: https://api.groq.com/openai/v1/models

DeepSeek — current models are deepseek-v4-flash and deepseek-v4-pro (the older deepseek-chat / deepseek-reasoner aliases are being retired — check DeepSeek's docs for the latest). The /v1 is optional; DeepSeek accepts the URL with or without it.

  • API URL: https://api.deepseek.com/v1/chat/completions
  • Models URL: https://api.deepseek.com/v1/models

Mistral — mistral-large-latest, mistral-small-latest, etc. Standard OpenAI-compatible.

  • API URL: https://api.mistral.ai/v1/chat/completions
  • Models URL: https://api.mistral.ai/v1/models

Fireworks AI — gotcha: the path is /inference/v1, not /v1. Model ids look like accounts/fireworks/models/llama-v3p3-70b-instruct.

  • API URL: https://api.fireworks.ai/inference/v1/chat/completions
  • Models URL: https://api.fireworks.ai/inference/v1/models

xAI (Grok) — Grok models (grok-4, etc.). Standard OpenAI-compatible.

  • API URL: https://api.x.ai/v1/chat/completions
  • Models URL: https://api.x.ai/v1/models

AWS Bedrock — Bedrock now has an OpenAI-compatible endpoint, but with two gotchas: the host is region-specific (e.g. us-west-2) and the path is /openai/v1. You must use a Bedrock API key (a bearer token you generate in the console) — not your normal AWS access keys/SigV4. Model ids look like openai.gpt-oss-120b-1:0. When you connect Bedrock from the Providers list, pick your region from the dropdown and SurfMind builds the URL for you.

  • API URL: https://bedrock-runtime.<region>.amazonaws.com/openai/v1/chat/completions
  • Models URL: leave blank — enter model id later

Still not connecting? Final triage

Work down this list:

  1. Check the Models page first. If your provider is listed, connect it from there instead of a custom entry.
  2. Open the API URL's host in your browser. Local server not loading → it's not running, or wrong port.
  3. Re-read the path. Ollama → /api/chat. Everyone else → /v1/chat/completions (or the provider's special path from the table).
  4. Confirm you pasted the full endpoint, not the base, and that there's no double /v1 or trailing slash.
  5. 401? It's the key or its format. Format = Authorization: Bearer, key with no spaces, no Bearer prefix.
  6. 404 "model not found"? Connection is fine — fix the model name (exact case).
  7. Local model, browser blocked? Enable CORS (OLLAMA_ORIGINS="*" or LM Studio's toggle), and try 127.0.0.1 vs localhost.

That sequence resolves the overwhelming majority of setups.

Still need help?

If you've worked through the checklist and your provider still won't connect, email us at wave@surfmind.ai with the provider you're trying and the error you see. We'll help you get it connected.


Got it connected? Open SurfMind on the next page you were going to read and put your model to work.

Get SurfMind →

Related posts

View all