EN ▾

Llama Model API Key: Get One and Send a Request

You can have a working key in a couple of minutes. Sign up, press one button for the trial credit, and point any OpenAI client at the base URL.

Updated

A glowing key above a terminal and server cube, illustrating getting an API key and sending a first request

What the key gives you

If you searched for a llama model api key, you want one string that lets your code call a hosted model without running anything on your own machine. That is what you get here. The key authorizes requests to an OpenAI-compatible text API at https://api.llamaapi.top/v1, and you pay per token from prepaid credit.

One clarification before you start. The site name says llama, but the key does not open an official Meta service. Behind it runs one open-weight model, operated by an independent provider and tuned to answer without content refusals for lawful adult use. The model ID you send in requests is always uncensored. There is no router across vendors and no model menu to choose from.

The API is text only. It does not generate images, audio or video, it has no embeddings endpoint, and it does not offer fine-tuning. The context window is 100,000 tokens, shared between the prompt and the reply. Prompts are not used for training.

Get the key in four steps

  1. Create an account. Sign-up works with Google, or with an email address and a password.
  2. Open the key page. After sign-up, go to the API key page. Your key is shown there.
  3. Claim the trial. On that same page, one click adds $0.50 of trial credit. It is limited to one per person, it is valid for 7 days, and it needs no card.
  4. Copy the key into a secret store. Put it in an environment variable or your password manager, not in a source file.

That is the whole flow. There is no sales call and no approval queue. If the trial credit does not appear, check that you are signed in with the account you used for the claim and reload the page. If it still looks wrong, the docs list the places to look first.

Store the key safely

Treat the key like a password. Anyone who has it can spend your balance. On macOS or Linux, export it in your shell for the current session:

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

For a project, use a .env file that is listed in .gitignore, or the secret manager of your host. Never ship the key inside a browser bundle or a mobile app, because users can extract it. If you need to call the API from a web front end, put a small server of your own in between and keep the key there.

If you ever paste the key into a chat, a public repository or a screenshot, treat it as leaked and replace it. Rotating is cheap, and a leaked key is a drained balance.

A key is a bearer credential. The server cannot tell your script from a stranger who copied the string, so every habit that protects a password applies here too. Keep one key per project when you can, so a leak in a hobby script does not force you to touch production. Do not email keys to yourself, and do not paste them into shared documents or ticket systems, where they live on in search indexes and backups.

Watch the balance as a cheap early warning. Each response carries an X-Balance-USD header, so a job that logs the value once per run will show a sudden drop long before you notice it on a statement. A balance that falls faster than your own traffic explains is the signal to replace the key.

Also think about who needs access. A teammate who only reads results does not need the key at all. Give a service its own environment variable, restrict who can read that variable in your host's settings, and remove it when the project ends.

Your first request

Check that the key works by listing models. The call is GET /v1/models, and the key goes in the Authorization header as a bearer token.

curl https://api.llamaapi.top/v1/models \
  -H "Authorization: Bearer $LLAMAAPI_KEY"

Now a real completion with POST /v1/chat/completions:

curl https://api.llamaapi.top/v1/chat/completions \
  -H "Authorization: Bearer $LLAMAAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Give me three names for a fantasy tavern."}],
    "max_tokens": 120
  }'

In Python, install the official openai package and change two settings, the base URL and the key:

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.llamaapi.top/v1",
    api_key=os.environ["LLAMAAPI_KEY"],
)

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

And the same call in Node:

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.llamaapi.top/v1",
  apiKey: process.env.LLAMAAPI_KEY,
});

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

What the trial key can and cannot do

The trial key is meant for testing, so its limits are lower than those of a funded key.

Key typeConcurrent requestsRequests per minute
Trial260
Full8300

At $0.15 per 1M input tokens and $0.50 per 1M output tokens, $0.50 of credit goes a long way for a smoke test. A request with 1,000 input tokens and 500 output tokens costs 1,000 x $0.15 / 1,000,000 = $0.00015 for input plus 500 x $0.50 / 1,000,000 = $0.00025 for output, so $0.0004 in total. At that size the trial covers about 1,250 requests, enough to try streaming, tool calling and JSON mode before you decide anything.

Failed or refused requests are not charged. If a call comes back with an error, it does not eat into your credit. Every response carries an X-Balance-USD header, so you can read your remaining balance from code instead of opening a dashboard.

Move from trial to a funded key

When the trial is spent or the 7 days are over, add credit on the pricing page. You can top up any whole amount from $20 to $500, and larger top-ups carry a bonus:

  • $20 to $49: no bonus.
  • From $50: +5%, so $50 becomes $52.50.
  • From $100: +10%, so $100 becomes $110.
  • From $200: +15%, so $200 becomes $230.

You can pay with crypto (USDT on TRC20, USDC on Base). There is no subscription and credit never expires, so a top-up you use slowly stays on the account. For a longer look at how per-token billing works out in practice, see the pay-per-token breakdown.

Common problems with a new key

The request is rejected right away

Check the header first. It must read Authorization: Bearer followed by a space and the key, with no quotes and no trailing newline. A key copied from a terminal sometimes carries an invisible line break.

The client still talks to another service

Many tools read their own environment variables. If your client has a stored OpenAI key or base URL, it may override what you set in code. Print the effective base URL and confirm it points at https://api.llamaapi.top/v1.

Error 429

You hit a limit. The error code rate_limited means too many requests per minute, and concurrency means too many at once. A 429 with a Retry-After: 5 header signals temporary overload, so wait five seconds and try again. Remember that a streamed request holds its concurrency slot until the stream ends.

After the first call: where to go next

Once the first reply prints, three small experiments teach you most of what you need. First, turn on streaming with stream: true and watch tokens arrive one by one; the usage count is sent at the end. Second, try JSON mode by setting response_format to {"type": "json_object"} and asking for a small object with named keys. Third, add a system message that sets the role and tone you want, then compare the replies at temperature 0.2 and 1.0.

If you use a ready-made app instead of writing code, look for a setting called custom endpoint, OpenAI-compatible provider, or base URL. Paste the base URL, the key and the model ID uncensored, and save. The docs walk through the same first request in five minutes, and the model is limited to lawful adult use with one hard rule: no sexual content involving minors.

Questions and answers

Is this the official Llama API key from Meta?

No. It is a key for an independent, OpenAI-compatible text API that runs one open-weight model. It is not an official service of Meta or any other model vendor.

Do I need a credit card to get a key?

No. Sign-up and the $0.50 trial claim need no card. You only pay when you decide to top up.

Which model name do I put in the request?

Use uncensored as the model ID. That is the only model the API exposes.

How long does the trial credit last?

The $0.50 trial credit is valid for 7 days and can be claimed once per person.

Your key is one form away

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