How to Get a GLM API Key and Make Your First Call
This page shows how to get a GLM API key for an OpenAI-compatible, uncensored text model, test it, and keep it safe. Sign-up takes a few minutes and the trial needs no card.
Updated
Key points
- Sign up with Google or email, then claim $0.50 of trial credit with one click on the key page.
- The key works with any OpenAI SDK: change the base URL and use model ID uncensored.
- Full keys allow 8 concurrent requests and 300 per minute; trial keys allow 2 and 60.
- Top-ups run from $20 to $500 with bonuses from $50, and credit never expires.

The short version
If you searched for a glm api key, here is the whole path. You create an account, open the key page, copy the key, and point your OpenAI-compatible client at https://api.glmapi.top/v1. The model ID is uncensored. That is all the configuration there is.
One clarification before you start. This site sells access to a single open-weight model run by an independent provider and tuned to answer without content refusals for lawful adult use. It is not the official API of any model vendor and it does not route between vendors. The key you get here only works on this service.
Step by step: from sign-up to a working key
- Sign up. Use Google, or register with an email address and a password. There is no card form at this stage.
- Open the key page. After sign-up, go to the API key page. Your key is created there and shown once you are signed in.
- Claim the trial. New users can press one button on that page to receive $0.50 of trial credit. It is one per person, valid for 7 days, and needs no card.
- Copy the key. Treat it like a password. Paste it into an environment variable, not into your source code.
- Make a test call. The next section has a curl command and a Python script that you can paste as they are.
Google sign-up means there is no new password to invent. Email and password works just as well if you prefer to keep this account separate from your other logins.
The whole thing is prepaid. There is no subscription, so nothing renews and nothing bills you in the background. When the trial credit is gone or expired, you either stop or add credit yourself.
Check that the key works
Start with the models endpoint. It is a cheap request that proves the key is accepted and the base URL is correct.
export GLM_KEY="paste-your-key-here"
curl https://api.glmapi.top/v1/models \
-H "Authorization: Bearer $GLM_KEY"
You should get a JSON list that contains the model ID uncensored. Now send a real chat request:
curl https://api.glmapi.top/v1/chat/completions \
-H "Authorization: Bearer $GLM_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Say hello in five words."}],
"max_tokens": 30
}'
The same call from Python with the official OpenAI SDK:
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.glmapi.top/v1",
api_key=os.environ["GLM_KEY"],
)
resp = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Say hello in five words."}],
max_tokens=30,
)
print(resp.choices[0].message.content)
print(resp.usage)
Look at the response headers too. X-Request-Id is worth logging because support can find a request by it, and X-Balance-USD shows what is left on the account after the call. The docs page covers streaming, tool calling and JSON mode once the basic call works.
Keep the key out of places it will leak
A key is a bearer token: whoever holds the string can spend your credit. A few habits prevent most accidents.
- Load it from an environment variable or a secrets manager. Add
.envto.gitignorebefore the first commit, not after. - Call the API from a server you control. A key placed in browser JavaScript or a mobile app bundle can be read by anyone who opens the developer tools.
- Use a separate key per project when you can, so one leak does not force you to touch every deployment.
- Keep keys out of logs. If you log request headers for debugging, redact the
Authorizationline.
If a key does end up in a public repository, assume it is compromised. Replace it and rotate it in every place it was used. Deleting the commit is not enough, because scanners copy keys within minutes of a push.
Trial key and funded key: what changes
The trial and a funded account use the same endpoint and the same model. What differs is the rate ceiling.
| Trial key | Full key | |
|---|---|---|
| Concurrent requests | 2 | 8 |
| Requests per minute | 60 | 300 |
| Cost | $0.50 credit, 7 days | Prepaid, never expires |
| Card needed | No | Only if you choose to pay by crypto when you top up, and a card is never needed |
How far does $0.50 go? Prices are $0.15 per 1M input tokens and $0.50 per 1M output tokens. Take a typical chat request with 2,000 input tokens and 500 output tokens. Input costs 2,000 × $0.15 / 1,000,000 = $0.0003. Output costs 500 × $0.50 / 1,000,000 = $0.00025. The request costs $0.00055, so $0.50 covers about 909 of them. That is plenty for testing a client, a prompt, or an integration.
Failed or refused requests are not charged, so a request that returns an error does not eat into the trial.
Adding credit when the trial runs out
Top-ups are any whole amount from $20 to $500. Larger top-ups add a bonus: +5% from $50, +10% from $100, +15% from $200. In practice that works out as follows:
- $20 gives $20.00 of credit.
- $50 gives $52.50 of credit.
- $100 gives $110.00 of credit.
- $200 gives $230.00 of credit.
You can pay with crypto (USDT on TRC20, USDC on Base). Credit never expires, so there is no pressure to spend it in a month. Current figures are always on the pricing page.
A rough sense of scale: $20 buys the equivalent of about 133 million input tokens, or 40 million output tokens, if you used only one kind. Real workloads mix both, and output tokens cost more than three times as much as input, so a chat that produces long replies uses credit faster than one that reads long documents.
When the key does not work
Most problems come from a short list of causes.
The request is rejected as unauthenticated
Check that the header is exactly Authorization: Bearer YOUR_KEY with one space and no quotes in the value. Check that you did not paste a trailing newline into the environment variable. Make sure the client is not still pointing at another provider's base URL while sending this key.
The client says the model does not exist
Use uncensored exactly. Names you may have seen on other services will not match here.
HTTP 429
Two different causes share this status. An error code of rate_limited means you went past the requests-per-minute ceiling. An error code of concurrency means too many requests were open at once. On a trial key those ceilings are 60 per minute and 2 at a time, so a script that fires ten parallel calls will hit them at once. Streamed requests hold their slot until the stream ends, which catches people who start a stream and never read it to the end. If the response carries Retry-After: 5, the service is briefly overloaded and a retry after five seconds is the right move.
The balance looks wrong
Read X-Balance-USD from a response header and compare it with the dashboard. If they disagree, send the X-Request-Id of a recent call to support.
More guides
Questions and answers
Is the trial really free, and do I need a card?
The trial gives $0.50 of credit, claimed with one click on the API key page after sign-up. It is one per person, valid for 7 days, and requires no card.
Can I use my key with the official OpenAI SDK?
Yes. Set the base URL to https://api.glmapi.top/v1, pass your key as the API key, and use the model ID uncensored. Nothing else in your code has to change.
Is this the official API of the GLM model family?
No. It is one open-weight model run by an independent provider and tuned to answer without content refusals for lawful adult use. It is not an official vendor API and not a router.
Does the credit expire?
Paid credit never expires. The $0.50 trial credit is valid for 7 days.
Are my prompts used for training?
No. Prompts are not used for training.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.
Get API key