EN ▾

Llama API URL: Base URL Settings for OpenAI Clients

The llama api url to use is https://api.llamaapi.top/v1, with your key sent as a Bearer token and the model name uncensored. It is not Meta's official endpoint; it is a hosted open-weight model behind an OpenAI-compatible API. Below is where to paste each value in common clients.

Updated

Signpost at a crossroads pointing along a lit path to a distant server tower, representing an API base URL
Chain of linked blocks joining a local computer and a cloud server, illustrating LangChain with a hosted API

The values you need

SettingValue
Base URLhttps://api.llamaapi.top/v1
Chat endpointPOST https://api.llamaapi.top/v1/chat/completions
Responses endpointPOST https://api.llamaapi.top/v1/responses
Model listGET https://api.llamaapi.top/v1/models
Auth headerAuthorization: Bearer YOUR_KEY
Model IDuncensored

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:

  1. Pick the OpenAI-compatible or custom provider type.
  2. Paste https://api.llamaapi.top/v1 into the base URL or API host field.
  3. Paste your key into the API key field.
  4. Type uncensored as the model name if the model list does not fill in by itself.
  5. 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

SymptomLikely causeFix
404 Not FoundMissing /v1, or a doubled path such as /v1/chat/completions/chat/completionsUse the base URL ending in /v1 where the app adds the path itself
401 UnauthorizedKey missing, mistyped, or sent without the Bearer prefixRe-copy the key and check there is no trailing space
Model not foundModel name left from another providerSet the model to uncensored
429 rate_limitedOver requests per minute (300 full, 60 trial)Slow down and retry
429 concurrencyToo many requests at once (8 full, 2 trial)Reduce parallel requests
Connection or TLS errorTypo in the host, or http instead of httpsUse 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.

Questions and answers

What is the Llama API URL?

For this service it is https://api.llamaapi.top/v1. Chat requests go to /chat/completions under that base. It is not Meta's official endpoint.

Which model name do I use?

Use uncensored as the model ID in every client.

Why do I get a 404?

Usually the base URL lacks /v1, or the app already adds /chat/completions and you entered it too. Use the base URL ending in /v1.

Do I need a special SDK?

No. Any OpenAI SDK or OpenAI-compatible client works once you set the base URL and key. Streaming, tool calling and JSON mode follow the standard OpenAI format.

Can I put the key in front-end code?

No. Browser code is public, so call the API from a server route and keep the key in an environment variable there.

Your key is one form away

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