EN ▾

OpenAI-compatible uncensored API

https://api.uncensoredollamamodel.com/v1uncensored
Claim trial key

Ollama Get Models API: List Models Locally and Hosted

The Ollama get models API is GET /api/tags on your machine, or GET /v1/models if you prefer the OpenAI format. This walkthrough builds a small startup check that works with either, so your app fails early with a clear message when the model you asked for is missing.

Last updated

A glowing panel listing model cubes with a beam selecting one, and two doors for local and cloud endpoints.

Step 1: list models on your own Ollama

With the Ollama server running, call the native endpoint:

curl -s http://localhost:11434/api/tags

You get a models array. For a quick look at just the names, pipe the output through jq:

curl -s http://localhost:11434/api/tags | jq -r '.models[].name'

The names include the tag, such as name:latest, and that full string is what you pass as the model in later requests. If the array is empty, nothing has been pulled yet.

Step 2: use the OpenAI-shaped list instead

When your code already uses an OpenAI client, the compatible route is simpler. Ollama serves the same list at /v1/models:

curl -s http://localhost:11434/v1/models | jq -r '.data[].id'

The shape is {"object":"list","data":[{"id":"..."}]}. Every OpenAI-compatible server, local or hosted, uses the same layout, which is the reason one helper can serve both. You lose Ollama-only details like quantization level, so keep /api/tags around for tooling that needs them.

Step 3: call the hosted endpoint

On a hosted API, the model list tells you what you may call, not what is on a disk. Ours holds one model. Send your key as a Bearer token:

curl -s https://api.uncensoredollamamodel.com/v1/models \
  -H "Authorization: Bearer $API_KEY"

Expect an OpenAI-style list with one entry whose id is uncensored. That string is the value for the model field in POST /v1/chat/completions and POST /v1/responses. The service is one open-weight model run by an independent provider; it is not a router across vendors, so there is no need to filter a long list.

If the call returns an authentication error, regenerate your key on the API key page. Regeneration is self-service and the old key stops working at once.

Step 4: one helper for both

This Python helper lists ids from any base URL and refuses to continue when the model you need is missing. Local Ollama ignores the key; the hosted API checks it.

import os
from openai import OpenAI

def list_models(base_url, api_key):
    client = OpenAI(base_url=base_url, api_key=api_key)
    return [m.id for m in client.models.list().data]

def require_model(base_url, api_key, wanted):
    ids = list_models(base_url, api_key)
    if wanted not in ids:
        raise SystemExit(f"model {wanted} not found. Available: {ids}")
    return wanted

# Local Ollama (key ignored)
print(list_models("http://localhost:11434/v1", "ollama"))

# Hosted
model = require_model(
    "https://api.uncensoredollamamodel.com/v1",
    os.environ["API_KEY"],
    "uncensored",
)
print("ready:", model)

Run it at application start, not on every request. The list rarely changes within a session, and a single check is enough to catch typos, wrong tags and a forgotten ollama pull.

The same check in Node

For JavaScript projects, the built-in fetch in Node 18 and later is enough, with no extra package. Save the file with an .mjs extension to use top-level await.

const base = "https://api.uncensoredollamamodel.com/v1";

const res = await fetch(`${base}/models`, {
  headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
if (res.ok === false) throw new Error(`models call failed: ${res.status}`);

const { data } = await res.json();
console.log(data.map((m) => m.id)); // [ 'uncensored' ]

Pointing the same code at Ollama needs two changes: use http://localhost:11434/v1 as the base and drop the Authorization header, or send any dummy value.

Pitfalls

  • Wrong host in containers. Inside Docker, localhost is the container itself. Use the host's address, or set OLLAMA_HOST as required for your setup, before you decide Ollama has no models.
  • Tag mismatch. A request for name is read as name:latest. If you pulled name:8b, the name differs, so copy the string from the list.
  • Empty hosted list. If the call returns data but not the id you expected, you are on the wrong base URL. Compare it to https://api.uncensoredollamamodel.com/v1.
  • Rate limits. The list call counts as a request. A full key allows 300 requests per minute and 8 concurrent ones; the trial key allows 60 and 2. Over a limit you get HTTP 429 with the code rate_limited or concurrency.

Handling errors from the list call

Treat the list call like any other request and check its status before you read the body. Three outcomes are worth handling on purpose.

  • Success, model present. Continue to normal work.
  • Success, model missing. Stop with a message that names the wanted id and the ids found. This catches typos and tag mismatches in seconds.
  • Failure. An authentication error means the key is wrong. A 429 means a limit was reached, so wait and retry. A connection error means the host or port is wrong, or the local server is down.

Avoid swallowing errors and carrying on with a guessed model name. The failure then shows up later, inside a user's chat, with a message that says nothing about the real cause.

A small amount of retry logic is enough for the 429 case. Wait a few seconds, as the Retry-After: 5 header suggests when the API is briefly overloaded, then try again once or twice. Do not retry authentication errors, because repeating a wrong key only produces more failures.

For long-running services, repeat the check when you deploy rather than on a timer. The set of local models changes when a person runs a pull or remove command, and the hosted id is stable. A startup check plus normal error handling on real requests covers both.

Testing the check itself

A startup check is only useful if you know it fails the way you expect. Break it on purpose once, before you rely on it. Four quick experiments cover most real failures:

  1. Wrong key. Set API_KEY to a made-up value and run the hosted check. You should see an authentication error and your script should stop with a readable message.
  2. Wrong base URL. Remove /v1 from the base URL, or misspell the host. The call should fail loudly instead of returning an empty list.
  3. Missing model. Ask the helper for a name that is not in the list, such as uncensored-2. The error should print the ids that were found, so the typo is obvious.
  4. Local server stopped. Quit Ollama and run the local check. You want a connection error, not a hang. Setting a timeout on the client keeps a dead server from stalling startup.

Once all four behave, wire the helper into your application entry point. If you run several processes, each one performs its own check, which is fine at this scale: one listing call per process per deploy is a negligible share of a 300-requests-per-minute budget.

One more detail for teams: keep the wanted model id in configuration, not in code. The hosted id is uncensored, while a local one is whatever string ollama list shows, tag included. A single setting per environment lets the same code run on a laptop and in production without edits.

Next steps

Once the check passes, send a real request. Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens from prepaid credit; failed or refused requests are not charged. Details and top-up bonuses sit on the pricing page, and the docs list balance endpoints such as GET /v1/balance and the X-Balance-USD header.

To try it first, claim the $0.50 trial on the key page: one click after sign-up, 7 days, no card. For habits that keep AI integrations tidy, see common mistakes with uncensored AI.

Frequently asked questions

What is the Ollama endpoint that returns installed models?

GET /api/tags on port 11434. The OpenAI-compatible alternative is GET /v1/models. Both list models you have pulled.

Does a hosted API expose GET /v1/models?

This one does. It returns a list with one model, uncensored, and requires your Bearer key.

Why does my model list come back empty?

Either nothing has been pulled yet, or you are calling a different Ollama instance than the one you pulled into, which often happens in containers.

Do I have to check the list before every request?

No. Check once at startup. The list only changes when models are pulled or removed locally.

Your API key is ready

Sign up, retrieve your key, and update your base URL. That is all you need to do.

Begin with trial credit

Enter email and password to receive your key instantly.

Summary

  1. Ollama: GET /api/tags (native) or GET /v1/models (OpenAI-compatible) on port 11434.
  2. A hosted OpenAI-compatible endpoint answers GET /v1/models with its own ids; here that is uncensored.
  3. A model check at startup turns a confusing 404 later into a clear error now.
  4. The same helper works against both backends because both use the OpenAI list shape.