EN ▾
Get API key

GLM API Base URL: Connect Any OpenAI Client

The glm api base url for this service is https://api.glmapi.cc/v1, the model ID is uncensored, and auth is a standard Bearer key. Below are the exact settings for curl, Python, Node and the usual chat front ends, plus the mistakes that cause most failed first calls.

Key points

  • Base URL: https://api.glmapi.cc/v1. Model: uncensored. Header: Authorization: Bearer <key>.
  • Two endpoints: POST /v1/chat/completions and GET /v1/models.
  • Most connection errors come from a missing /v1, a doubled path or a pasted trailing slash.
  • This is an independent endpoint, not the official API of the vendor behind GLM or any other vendor.
Terminal linked by a glowing cable to a server, illustrating pointing a client at a new API base URL

The three values you need

A glm api base url question usually comes from someone who has a client that wants a URL, a key and a model name, and no idea which values go where. Here they are in one place.

SettingValue
Base URLhttps://api.glmapi.cc/v1
Model IDuncensored
Auth headerAuthorization: Bearer YOUR_KEY
Chat endpointPOST /v1/chat/completions
Model listGET /v1/models

One clarification before you copy anything. The name on the domain refers to the search term, not to the model. This is a hosted, OpenAI-compatible text API for one open-weight model run by an independent provider, tuned to answer without content refusals for lawful adult use. It is not the official API of the vendor behind GLM, and not a router that forwards to other vendors. If you need an official GLM model, use that vendor's own service.

You get a key by signing up with Google or with email and password. The API key page also has a one-click $0.50 trial claim, valid for 7 days with no card.

Check the connection with curl

Before touching any SDK or app, confirm the key and URL with a plain request. If this works, every later problem is in your client configuration and not in the account. First, list the models:

curl https://api.glmapi.cc/v1/models \
  -H "Authorization: Bearer YOUR_KEY"

You should get a JSON list that includes the id uncensored. Then send one chat completion:

curl https://api.glmapi.cc/v1/chat/completions \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Reply with the word ready."}],
    "max_tokens": 20
  }'

Add -i to see the response headers. They include X-Request-Id, X-Balance-USD (your remaining credit), X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency. Keep the request ID if you ever need to ask support about a call.

Python and Node

Both official OpenAI SDKs accept a custom base URL. You change two constructor arguments and the model name; the rest of your code stays as it is.

Python

from openai import OpenAI

client = OpenAI(
    base_url="https://api.glmapi.cc/v1",
    api_key="YOUR_KEY",
)

resp = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Give me three names for a tavern."}],
)
print(resp.choices[0].message.content)

Node.js

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.glmapi.cc/v1",
  apiKey: process.env.GLM_API_KEY,
});

const resp = await client.chat.completions.create({
  model: "uncensored",
  messages: [{ role: "user", content: "Give me three names for a tavern." }],
});
console.log(resp.choices[0].message.content);

The Node property is baseURL with capital letters, while the Python argument is base_url. Mixing them up is a classic way to silently fall back to the SDK's default host and get an authentication error from the wrong server.

Environment variables instead of code

The OpenAI SDKs read OPENAI_BASE_URL and OPENAI_API_KEY from the environment when you do not pass them explicitly. That is the least invasive way to retarget a tool you cannot edit, such as a script from a repository or a framework that builds the client for you.

export OPENAI_BASE_URL="https://api.glmapi.cc/v1"
export OPENAI_API_KEY="YOUR_KEY"
python my_existing_script.py

You still have to set the model name inside the tool or its config file to uncensored, because no environment variable carries it. If the tool has a model dropdown that only lists names it knows, look for a custom model or free-text option.

Keep the values in one place

Once the connection works, avoid pasting the URL into five files. Put the three values in one place and read them everywhere else. A .env file works for small projects:

GLM_BASE_URL=https://api.glmapi.cc/v1
GLM_API_KEY=YOUR_KEY
GLM_MODEL=uncensored

Then load them once at start-up and build a single client that the rest of the program imports. The benefit shows up the day you change keys, add a staging key with a trial balance, or compare this endpoint with another one. You edit a file, not your codebase.

Keep separate keys for development and production where the account allows it, and rotate a key immediately if it appears in a commit, a screenshot or a shared log. A leaked key spends your prepaid credit, and credit does not come back.

Chat apps and frameworks

Front ends differ in wording but ask for the same three values. Look for a connection type called OpenAI-compatible, custom OpenAI or similar, then fill in:

  • API URL / Base URL: https://api.glmapi.cc/v1
  • API key: the key from your account
  • Model: uncensored

SillyTavern lets you add an OpenAI-compatible endpoint through its custom chat completion source, and Open WebUI has an OpenAI-compatible connection type in its settings. Frameworks such as LangChain take a base_url on their chat model class, and LiteLLM can route an OpenAI-style model through a custom API base. Menu names change between versions, so follow each project's current documentation for exactly where the field sits.

Some apps ask whether to append /chat/completions for you. Many do, which means the URL you enter must stop at /v1. If an app instead asks for the full endpoint, give it https://api.glmapi.cc/v1/chat/completions. The quickstart shows the supported request fields in more detail.

Why the first call fails

If the curl test passes and your app still errors, the cause is nearly always one of these:

  • Missing /v1. Using https://api.glmapi.cc alone will most likely fail with a not-found error, because the routes live under /v1.
  • Doubled path. The app appends /chat/completions and you also typed it, producing /chat/completions/chat/completions. Strip it from the base URL.
  • Trailing slash. Some clients join paths badly. Remove a final / if you see a double slash in the logged URL.
  • Wrong model name. The only model ID is uncensored. Names from other services will not match.
  • Key problems. Check for a stray space or line break when pasting, and for the key being sent as Bearer twice by an app that already adds the prefix.
  • Calling the wrong host. In a browser app, an unset base URL falls back to the SDK default. Log the actual request URL.

Browser-side calls also expose your key to anyone who opens the dev tools. For a public site, send requests from your own server and keep the key there.

When none of that explains it, work backwards from the smallest case. Run the curl command from earlier on the same machine as the failing app. If curl succeeds there, the network and key are fine and the app is building the request differently, so turn on its debug logging and compare the logged URL, headers and JSON body with the curl version, character by character. If curl fails on that machine only, look at corporate proxies, VPN rules and DNS filters, which sometimes block unfamiliar API hostnames. A request that never reaches the server returns no X-Request-Id, which is a quick way to tell the two cases apart.

Limits and 429 responses

A full key allows 8 concurrent requests and 300 requests per minute. A trial key allows 2 and 60. Go over either and the API returns HTTP 429 with the code rate_limited (too many per minute) or concurrency (too many at once). During temporary overload you also get a 429, with a Retry-After: 5 header.

A streamed request holds its concurrency slot until the stream ends, so an app that opens a stream and abandons it without closing the connection can starve itself. The maximum request body is 8 MB, and the context window is 100,000 tokens covering prompt and completion together. For rates and top-ups, see the pricing page.

Streaming, tools and JSON use the same URL

There is no separate address for streaming or function calling. Everything goes to /v1/chat/completions, and you switch features on in the request body. A streaming request sets "stream": true and returns server-sent events; a request with tools adds tools and optionally tool_choice; JSON mode adds response_format with the type json_object. Sampling fields such as temperature, top_p, stop, seed and the penalties are passed through.

Here is a streaming curl call. The -N flag turns off curl's output buffering, so you see chunks as they arrive:

curl -N https://api.glmapi.cc/v1/chat/completions \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"uncensored","stream":true,"messages":[{"role":"user","content":"Count to five."}]}'

If your proxy or hosting layer buffers responses, streaming will look like one big delayed reply. Reverse proxies often need response buffering turned off for server-sent events, so check that setting before you blame the API. For a worked Python version of each feature, see the quickstart.

Questions and answers

What is the base URL for this API?

https://api.glmapi.cc/v1. Chat requests go to /chat/completions under it, and the model list is at /models.

What model name should I use?

Use uncensored. It is the only model ID, and it works in any OpenAI-style client that lets you type a custom model.

Is this the official GLM API?

No. It is an independent, OpenAI-compatible service running one open-weight model, and it is not the official API of any vendor.

Which header carries the key?

Authorization: Bearer followed by your key. The OpenAI SDKs add this for you when you pass the key.

Do I need a card to test the connection?

No. A one-click trial of $0.50, valid for 7 days, is available on the API key page after sign-up.

Your key is one form away

Create an account, copy the key, change the base URL. That is the whole setup.

Get API keyRead the docs