EN ▾
Get API key

Llama 3 API Key: How to Get One and Send a Request

A llama 3 api key comes from whoever hosts the model, not from the weights themselves. This walkthrough shows how to create a key on this service, store it safely and make your first request in about five minutes.

Updated

Glowing key above an abstract terminal and server cube representing a new API key and first request

Key points

  • Sign up with Google or email and password, then open the API key page.
  • New users can claim $0.50 of trial credit with one click; no card, valid for 7 days.
  • Send the key as Authorization: Bearer, with the base URL https://api.llamauncensored.cc/v1 and model uncensored.
  • Keep the key in an environment variable and never commit it.

Where an API key comes from

Model weights have no keys. A key is a password issued by a service that runs the model on its servers and bills you for usage. That is why a search for a llama 3 api key leads to many different sites: each hosting company issues its own, and a key from one will not work on another.

A clarification before you start. This service does not offer Meta's Llama 3. It runs a single open-weight model under the ID uncensored, operated by an independent provider and tuned to answer without content refusals for lawful adult use. It speaks the OpenAI protocol, so tools written for Llama endpoints that follow that protocol usually need only a new base URL and key. If your project depends on one exact model release, confirm that before you integrate.

Steps to get your key

  1. Create an account. Sign up with Google, or with an email address and password.
  2. Open the API key page. The key page shows your key after sign-up. Copy it once and store it somewhere safe.
  3. Claim the trial. Press the trial button. You receive $0.50 of credit, valid for 7 days, with no card. It is limited to one per person.
  4. Send a test request. Use curl or an SDK, as shown below.
  5. Top up when you are ready. Any whole amount from $20 to $500 works, with +5% from $50, +10% from $100 and +15% from $200.

Trial keys are limited to 2 concurrent requests and 60 requests per minute. A funded full key allows 8 concurrent requests and 300 per minute. The response headers X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency tell you which limits apply to the key you are using.

Store the key properly

A key in source code ends up in a repository, and a key in a public repository gets found by scanners within hours. Spend a minute on this part.

  • Put the key in an environment variable. On macOS or Linux, add export LLAMA_UNCENSORED_KEY="..." to your shell profile or to a .env file that is listed in .gitignore.
  • Read it in code with os.environ or process.env instead of pasting it inline.
  • Never place the key in a browser page. If you build a web app, call the API from your server and let the browser talk to your server.
  • Use one key per project so you can replace one without breaking the others.
  • If a key leaks, create a new one and stop using the old one at once.

Remember that spend follows the key. Anybody holding it can use your prepaid balance.

Keeping the key safe in a team or a deployed app

A personal script on your laptop can read the key from your shell. A deployed service needs a better home. Put the key in your host's secret store or environment settings, and keep separate values for development and production, so a test run cannot spend the production balance.

Three practices cost almost nothing and prevent most incidents. Do not print the key in logs, including debug logs that dump request headers. Do not send it to a front end, even obfuscated, since anyone can read what the browser receives. And do not share a single key between people. If a colleague leaves, you want to retire their access without touching a key that five other services use.

If you ever suspect a leak, look at the balance. Every response carries an X-Balance-USD header, so a quick check of that value over a day or two shows whether spend matches your own traffic.

Your first request with curl

The endpoint is POST /v1/chat/completions and authentication is a bearer header.

export LLAMA_UNCENSORED_KEY="paste-your-key-here"

curl https://api.llamauncensored.cc/v1/chat/completions \
  -H "Authorization: Bearer $LLAMA_UNCENSORED_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Say hello in five words."}],
    "max_tokens": 30
  }'

A JSON response comes back with a choices array and a usage object. The response headers include X-Request-Id, useful when you contact support, and X-Balance-USD, which shows what remains in your account. To check the key and see the available model, call GET https://api.llamauncensored.cc/v1/models with the same header.

Using the same key in existing tools

You do not have to write code to use the key. Many chat front ends, writing tools and bot frameworks have a field for a custom OpenAI-compatible endpoint. The pattern is the same everywhere: choose the OpenAI-style provider, paste https://api.llamauncensored.cc/v1 into the base URL field, paste the key into the API key field, and type uncensored as the model name.

Two details trip people up. Some tools append /chat/completions themselves, so enter the base URL ending at /v1 and nothing more. Others ask you to pick a model from a dropdown filled by GET /v1/models; if the list stays empty, type the name by hand.

Environment variables work for tools built on the official libraries. Setting OPENAI_BASE_URL and OPENAI_API_KEY before launching a script that uses the OpenAI SDK is often enough to redirect it, with no code change at all. Keep in mind that the service is text only, so any feature that sends images, audio or embedding requests will not work against it.

Python and Node

With the official OpenAI libraries you set two options and keep everything else.

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.llamauncensored.cc/v1",
    api_key=os.environ["LLAMA_UNCENSORED_KEY"],
)

resp = client.chat.completions.create(
    model="uncensored",
    messages=[
        {"role": "system", "content": "You answer in short plain sentences."},
        {"role": "user", "content": "What is an API key?"},
    ],
)
print(resp.choices[0].message.content)
import OpenAI from "openai";

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

const resp = await client.chat.completions.create({
  model: "uncensored",
  messages: [{ role: "user", content: "What is an API key?" }],
});
console.log(resp.choices[0].message.content);

Streaming is a single flag, stream: true, and the final chunk carries usage. The docs cover that and tool calling, and the integration guide goes through more client setups.

Reading usage and balance from code

Cost surprises are easy to avoid when you log two things per request: the usage block in the body and the balance header. The raw-response mode of the Python SDK gives you both.

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.llamauncensored.cc/v1",
    api_key=os.environ["LLAMA_UNCENSORED_KEY"],
)

raw = client.chat.completions.with_raw_response.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Name three rivers."}],
    max_tokens=60,
)
print("request id:", raw.headers.get("x-request-id"))
print("balance usd:", raw.headers.get("x-balance-usd"))
completion = raw.parse()
print(completion.usage)

Store the request ID next to your own log line. If something looks wrong, that ID is what lets support find the exact call. Add a simple alert in your app when the balance falls below a number you choose, such as the price of a day of traffic, so top-ups happen before users see failures.

When you move from the trial to a funded account, nothing in this code changes. The same key keeps working, and the higher limits of 8 concurrent requests and 300 per minute apply to the full key. Check the pricing page for the bonus tiers if you plan a larger first top-up.

If the request fails

Most first-run problems come from a short list.

SymptomLikely causeFix
Authentication errorKey missing, truncated, or pasted with a spaceRe-copy the key and check the header reads Bearer followed by the key
Not found or connection errorBase URL lacks /v1 or has a typoUse https://api.llamauncensored.cc/v1 exactly
Model errorWrong model nameSet model to uncensored
HTTP 429, rate_limitedOver the per-minute limitSlow down and add backoff
HTTP 429, concurrencyToo many requests at once; streams hold a slot until they endQueue requests, or close streams you no longer read
HTTP 429 with Retry-After: 5Temporary overloadWait five seconds and retry
Empty balanceTrial credit used or expired after 7 daysTop up from $20 on the pricing page

Failed or refused requests are not charged, so retrying a failure does not drain credit.

What it costs once the trial ends

Billing is prepaid and per token: $0.15 per 1M input tokens and $0.50 per 1M output tokens. A request with 2,000 input tokens and 300 output tokens costs 2,000 x $0.15 / 1,000,000 = $0.0003 plus 300 x $0.50 / 1,000,000 = $0.00015, so $0.00045 in total. The $0.50 trial therefore covers roughly 1,100 such requests (0.50 / 0.00045 = 1,111). Credit never expires, and you can pay with USDT on TRC20 or USDC on Base. Prompts are not used for training, and the content rule that no sexual content involving minors is accepted applies to every key.

Questions and answers

Does Meta hand out keys for Llama 3?

Weights are downloaded, not keyed. API keys come from the company that hosts the model, and each one works only on that company's service.

Do I need a card to get a key?

No. Sign up with Google or email and password, then claim the $0.50 trial with one click. Crypto is only needed to top up.

How long does the trial credit last?

It is valid for 7 days and is limited to one per person.

Which model name do I send?

Send uncensored as the model value, with the base URL https://api.llamauncensored.cc/v1.

Your key is one form away

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

Start with trial credit

Email and password, key on screen right away.