The values you need
| Setting | Value |
|---|---|
| Base URL | https://api.llamaapi.top/v1 |
| Chat endpoint | POST https://api.llamaapi.top/v1/chat/completions |
| Responses endpoint | POST https://api.llamaapi.top/v1/responses |
| Model list | GET https://api.llamaapi.top/v1/models |
| Auth header | Authorization: Bearer YOUR_KEY |
| Model ID | uncensored |
Get a key from the API key page. Sign-up works with Google or with email and password, and a one-click $0.50 trial is available there. For what the key can and cannot do, see the Llama model API key page.
Clients differ in one detail: some ask for the base URL and add the path themselves, others ask for the full endpoint. If a field says "API base" or "OpenAI base URL", use the first form, ending in /v1. If it asks for the "chat completions URL", use the long form.
Python, Node and curl
Python (openai package)
from openai import OpenAI
client = OpenAI(
base_url="https://api.llamaapi.top/v1",
api_key="YOUR_KEY",
)
r = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Say hello."}],
)
print(r.choices[0].message.content)
Node
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.llamaapi.top/v1",
apiKey: process.env.API_KEY,
});
const r = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Say hello." }],
});
console.log(r.choices[0].message.content);
curl
curl https://api.llamaapi.top/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"uncensored","messages":[{"role":"user","content":"Say hello."}]}'
Add "stream": true to the body for server-sent events. The documentation lists the other parameters.
Environment variables
The official OpenAI SDKs read OPENAI_BASE_URL and OPENAI_API_KEY when you do not pass them in code. That lets you switch a whole project without editing it:
export OPENAI_BASE_URL="https://api.llamaapi.top/v1"
export OPENAI_API_KEY="YOUR_KEY"
python app.py
Older libraries may use OPENAI_API_BASE instead, so set both if a tool ignores the first. You still need to change the model name inside the app to uncensored, because a leftover model name from another provider is a common cause of "model not found" errors.
A trailing slash after /v1 is usually tolerated by SDKs, but if a client builds a path with a double slash and fails, remove it. Use https only, never http, and do not add a port number.
Keep keys out of source control. Put them in a .env file that is git-ignored, or in your host's secrets store.
LangChain and similar frameworks
Frameworks built on the OpenAI client accept the same two values under slightly different names. In LangChain's Python package:
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
base_url="https://api.llamaapi.top/v1",
api_key="YOUR_KEY",
model="uncensored",
temperature=0.7,
)
print(llm.invoke("Give me one sentence about harbors.").content)
If you are looking at local models instead of a hosted endpoint, the page on llama.cpp with LangChain covers that side. Tool calling and JSON mode pass through the OpenAI format, so agents that use tools work with this URL as long as they only need text.
Entering the URL in apps and chat frontends
Many chat apps, writing tools and roleplay frontends have an "OpenAI-compatible" or "custom endpoint" option. The pattern is the same everywhere:
- Pick the OpenAI-compatible or custom provider type.
- Paste
https://api.llamaapi.top/v1into the base URL or API host field. - Paste your key into the API key field.
- Type
uncensoredas the model name if the model list does not fill in by itself. - Save and send a short test message.
Field names vary by app, but these four values are all there is. If a tool has a fixed provider list and no custom option, it cannot be pointed at this API. Image, audio and embedding features inside such apps will not work either, since the service is text only.
Calling it from a website without exposing the key
Browser JavaScript is public. If you put the key in a front-end bundle, anyone can read it and spend your balance. Instead, call the API from a small server route and let the page talk to your route. A minimal Node example with Express:
import express from "express";
import OpenAI from "openai";
const app = express();
app.use(express.json());
const client = new OpenAI({
baseURL: "https://api.llamaapi.top/v1",
apiKey: process.env.API_KEY,
});
app.post("/api/chat", async (req, res) => {
try {
const r = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: String(req.body.text).slice(0, 4000) }],
max_tokens: 500,
});
res.json({ reply: r.choices[0].message.content });
} catch (e) {
res.status(e.status === 429 ? 429 : 502).json({ error: "try again shortly" });
}
});
app.listen(3000);
Three details matter here. The key lives only in an environment variable on the server. The input is length-limited so a visitor cannot send a huge prompt at your expense. And a 429 from the API is passed on, so your page can show a retry message. Add your own per-user limits on top, because every visitor shares one key and its 8 concurrent requests.
Fixing URL and key errors
| Symptom | Likely cause | Fix |
|---|---|---|
| 404 Not Found | Missing /v1, or a doubled path such as /v1/chat/completions/chat/completions | Use the base URL ending in /v1 where the app adds the path itself |
| 401 Unauthorized | Key missing, mistyped, or sent without the Bearer prefix | Re-copy the key and check there is no trailing space |
| Model not found | Model name left from another provider | Set the model to uncensored |
| 429 rate_limited | Over requests per minute (300 full, 60 trial) | Slow down and retry |
| 429 concurrency | Too many requests at once (8 full, 2 trial) | Reduce parallel requests |
| Connection or TLS error | Typo in the host, or http instead of https | Use exactly the https URL above |
A 429 with a Retry-After: 5 header means temporary overload, so wait five seconds. A streamed request holds its concurrency slot until the stream ends, which can surprise tools that open many streams. Failed requests are not charged. When you contact support, include the X-Request-Id response header.
Check that it works and what it costs
A quick sanity check is GET /v1/models, which lists the model:
curl https://api.llamaapi.top/v1/models -H "Authorization: Bearer $API_KEY"
To see your balance, call GET /v1/balance or the OpenAI-style GET /v1/dashboard/billing/credit_grants, or read the X-Balance-USD header on any response. Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens, from prepaid credit that never expires. A "Say hello." test costs a fraction of a cent. Top-ups run from $20 to $500, by crypto, with bonuses at $50, $100 and $200. See the pricing page.
The context window is 100,000 tokens, prompt plus completion, and request bodies can be up to 8 MB. The model is tuned to answer without content refusals for lawful adult use; sexual content involving minors is never produced.

