We use cookies. Cookies and browser storage keep you signed in and remember your preferences. With your permission we also measure how the site is used. You can any time. See our cookie policy.

Meta: Llama 3.1 8B Instruct

meta-llama/llama-3.1-8b-instruct
TextInput: textTools131KAdded Jul 23, 2024

Try Meta: Llama 3.1 8B Instruct now

Runs on your balance at the prices above. New accounts start with free usage.

One API. Every model.

5 of 5 free messages left today. A free account adds free usage and an API key.Create free accountSign in

Session cost $0.00

Meta: Llama 3.1 8B Instruct at a glance

  • Input price is 89% lower than the median of 434 Text models.
  • Context window of 131,072 tokens, enough for long documents and multi-turn conversations.
  • Supports tool (function) calling for agents and integrations.
  • Supports structured JSON output with a schema.
  • A typical request (1,000 input / 500 output tokens) costs about $0.000315.

About Meta: Llama 3.1 8B Instruct

Meta: Llama 3.1 8B Instruct is an instruction-tuned text model from Meta, part of the Llama 3.1 family that launched in July 2024. The 8B size sits at the smaller end of that family, which makes it a reasonable default when you want a capable general purpose assistant without the weight of a much larger model. It is a text-only model, so it works well for chat, drafting, extraction and similar language tasks rather than anything involving images or audio.

The model takes text in and returns text out. It supports a context window of 131,072 tokens, which is large enough to hold long documents, extended conversations or sizeable code files in a single request. The maximum output is 117,964 tokens, so long generations are possible within that window. Its knowledge cutoff is 2023-12-31, meaning events and information after that date are not part of its training data. Where accuracy depends on recent facts, you should supply the relevant context yourself rather than rely on the model's memory.

Those characteristics point to a few practical uses. Summarising and question answering over long inputs fit the large context window well. Instruction following makes it suitable for chat assistants, rewriting, classification and structured data extraction from messy text. Because it accepts tools and structured outputs, it can also serve as the reasoning step in a pipeline that calls functions or returns JSON. The 8B size keeps latency and resource use comparatively low, which helps when you are running many requests or prototyping an idea before committing to a larger model.

You can call it through api14's OpenAI-compatible API using the model id meta-llama/llama-3.1-8b-instruct. Point your existing OpenAI client at the api14 base URL and pass that id in the model field. The model accepts frequency_penalty, logit_bias, logprobs, max_tokens, min_p, presence_penalty, repetition_penalty, response_format, seed, stop, structured_outputs, temperature, tool_choice, tools, top_k, top_logprobs and top_p. That covers the usual sampling controls plus tool calling, structured outputs and reproducible runs via seed.

One thing to weigh is the knowledge cutoff and the model's size. If your task needs facts from after 2023-12-31, plan to provide them in the prompt or through retrieval. If you need image or audio input, this model does not accept it, and a multimodal model would be a better fit. For the hardest reasoning or the most demanding generation quality, a larger model in the same family may suit you better, while this 8B version remains a solid choice for high volume, lower complexity work.

How to call the Meta: Llama 3.1 8B Instruct API

  1. Create an API key in your dashboard.
  2. Install the official openai SDK for your language.
  3. Set baseURL to https://api14.com/api/v1 and model to "meta-llama/llama-3.1-8b-instruct".
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api14.com/api/v1",
  apiKey: process.env.API14_API_KEY,
});

const result = await client.chat.completions.create({
  "model": "meta-llama/llama-3.1-8b-instruct",
  "messages": [
    {
      "role": "user",
      "content": "Explain vector databases in two sentences."
    }
  ]
});
console.log(result.choices[0].message.content);

Supported parameters

frequency_penaltylogit_biaslogprobsmax_tokensmin_ppresence_penaltyrepetition_penaltyresponse_formatseedstopstructured_outputstemperaturetool_choicetoolstop_ktop_logprobstop_p

Specifications

Context length
131,072
Max output
117,964
Input
text
Output
text
Knowledge cutoff
2023-12-31

Requests on api14 · last 7 days

10-1610-1710-1810-1910-2010-2110-22

Meta: Llama 3.1 8B Instruct: frequently asked questions

How much does the Meta: Llama 3.1 8B Instruct API cost?
Meta: Llama 3.1 8B Instruct costs Input $0.18 / 1M tokens. It is charged from your USD balance only for successful requests; failed requests are free.
What is the context window of Meta: Llama 3.1 8B Instruct?
Meta: Llama 3.1 8B Instruct reads up to 131,072 tokens per request: prompt, history and documents together. It writes up to 117,964 output tokens per response.
What can Meta: Llama 3.1 8B Instruct do?
Meta: Llama 3.1 8B Instruct accepts text and returns text. It supports tool calling, structured JSON output.
How do I call Meta: Llama 3.1 8B Instruct from my code?
Point any OpenAI SDK at https://api14.com/api/v1 and set the model to "meta-llama/llama-3.1-8b-instruct". No other code changes. Copy a ready example from the code panel on this page.
What are alternatives to Meta: Llama 3.1 8B Instruct?
Comparable Text models at a similar price: Mistral: Mistral Small 3, IBM: Granite 4.0 Micro, Nex AGI: Nex-N2.5-Mini. Each runs through the same API key, so switching is one string.

Meta: Llama 3.1 8B Instruct community

New topic

This community has no topics yet. Open the first one about Meta: Llama 3.1 8B Instruct.