Skip to content
Dashboard

Llama 4 Scout 17B 16E Instruct

Llama 4 Scout 17B 16E Instruct is a natively multimodal Mixture of Experts (MoE) model with a context window of 131.1K tokens, purpose-built for processing entire codebases, multi-document corpora, and extended user activity logs in a single inference call.

View API reference
Input and output price
Prices from: Input $0.10, Output $0.30, Per 1M tokens
24h uptime
Loading AI Gateway uptime
import { streamText } from 'ai'
const result = streamText({
model: 'meta/llama-4-scout',
prompt: 'Why is the sky blue?'
})
Read docs

Copy link to headingPlayground

Try out Llama 4 Scout 17B 16E Instruct by Meta. Usage is billed to your team at API rates. Free users (those who haven't made a payment) get $5 of credits every 30 days.

meta logo
meta logo

Llama 4 Scout 17B 16E Instruct

Copy link to headingProviders

Route requests across multiple providers. Copy a provider slug to set your preference. Visit the docs for more info. Using a provider means you agree to their terms, listed under Legal.

Provider
Context
Max Output
Latency
Throughput
Input
Output
Cache
Web Search
Capabilities
ZDR
No Training
Free Tier
Release Date
131K8K0.4 s30 tps
$0.10/M
$0.30/M
04/05/2025
128K8K0.2 s205 tps
$0.17/M
$0.66/M
04/05/2025

Copy link to headingUptime

Direct request success rate on AI Gateway and per-provider. Visit the docs for more info.

Copy link to headingThroughput

P50 throughput on live AI Gateway traffic, in tokens per second (TPS). Visit the docs for more info.

Copy link to headingLatency

P50 time to first token (TTFT) on live AI Gateway traffic, in milliseconds. View the docs for more info.

Getting started

Call Llama 4 Scout 17B 16E Instruct through AI Gateway with the AI SDK generateText and streamText functions, or through the OpenAI Chat Completions, OpenAI Responses, and Anthropic Messages APIs by changing the base URL. AI Gateway authenticates the request and routes it to an available provider.

Install the AI SDK (pnpm add ai dotenv), create an API key from the API Keys page, and set it as AI_GATEWAY_API_KEY in your environment. Full setup is covered in the text generation quickstart.

index.ts
import { generateText } from 'ai';
import 'dotenv/config';
async function main() {
const result = await generateText({
model: 'meta/llama-4-scout',
prompt: 'Why is the sky blue?',
});
console.log(result.text);
}
main().catch(console.error);

Top-level parameters

The same Llama 4 Scout 17B 16E Instruct request in each API format AI Gateway supports.

top-level-params.ts
import { generateText } from 'ai';
import 'dotenv/config';
async function main() {
const result = await generateText({
model: 'meta/llama-4-scout',
system: 'You are a concise technical assistant.',
prompt: 'Summarize the tradeoffs between static generation and SSR.',
maxOutputTokens: 1024,
temperature: 0.5,
});
console.log(result.text);
}
main().catch(console.error);

Standard parameters like prompt, messages, temperature, and tools work as documented in the AI SDK docs. These are the parameters with model-specific behavior.

ParameterTypeRequiredDescription
modelstringYesModel ID in the form creator/model, e.g. meta/llama-4-scout. AI Gateway routes the request to an available provider.
maxOutputTokensnumberNoHard cap on generated tokens. Llama 4 Scout 17B 16E Instruct supports up to 8,192 output tokens.
providerOptionsRecord<string, JSONValue>NoAI Gateway routing options under gateway, plus any provider-native options under the provider’s own namespace — see the table below.

Input limits

InputFormatsSourcesMax countMax sizeLimits
TextPrompt and response share the 131K-token context window
ImageURL, base64, Uint8ArraySent as image parts in messages; counts as input tokens

Provider options

Set AI Gateway routing options under providerOptions.gateway. For provider-specific options, pass them under the provider’s namespace as documented by the AI SDK.

Learn more in the AI SDK provider docs.

provider-options.ts
import { generateText } from 'ai';
import 'dotenv/config';
async function main() {
const result = await generateText({
model: 'meta/llama-4-scout',
prompt: 'Why is the sky blue?',
providerOptions: {
gateway: {
only: ['deepinfra', 'bedrock'],
},
},
});
console.log(result.text);
}
main().catch(console.error);

These AI Gateway routing options apply to every model. Provider-specific options pass through under the provider’s own namespace (for example providerOptions.anthropic) exactly as documented by the AI SDK.

ParameterTypeRequiredDescription
providerOptions.gateway.onlystring[]NoRestrict routing to these provider slugs. Requests fail over only within the listed providers.
providerOptions.gateway.orderstring[]NoPreferred provider order. Listed providers are tried first; unlisted providers remain available as fallbacks.
providerOptions.gateway.sort'cost' | 'ttft' | 'tps'NoRank candidate providers by price, time to first token, or tokens per second instead of the default routing order.
providerOptions.gateway.zeroDataRetentionbooleanNoRoute only to providers with a zero-data-retention policy for this model.

Routing across providers

AI Gateway serves the same model through multiple providers and fails over automatically. order expresses a preference while keeping every provider eligible; only is a hard allowlist — if none of the listed providers are available the request fails instead of falling back.

Options under a provider's own namespace (for example providerOptions.anthropic) are forwarded to that provider with the request. Providers ignore option namespaces that don't apply to them, so it is safe to set provider options alongside gateway routing options.

Image input

Send images alongside text as message parts. Images count as input tokens.

image-input.ts
import { generateText } from 'ai';
import 'dotenv/config';
async function main() {
const result = await generateText({
model: 'meta/llama-4-scout',
messages: [
{
role: 'user',
content: [
{ type: 'text', text: 'Describe this image.' },
{ type: 'image', image: 'https://example.com/photo.jpg' },
],
},
],
});
console.log(result.text);
}
main().catch(console.error);

Tool calling

Expose tools the model can call. Define each tool’s inputs with a Zod schema.

tool-calling.ts
import { generateText, tool } from 'ai';
import { z } from 'zod';
import 'dotenv/config';
async function main() {
const result = await generateText({
model: 'meta/llama-4-scout',
prompt: 'What is the weather in San Francisco?',
tools: {
getWeather: tool({
description: 'Get the current weather for a location',
inputSchema: z.object({ location: z.string() }),
execute: async ({ location }) => ({ location, temperatureC: 18 }),
}),
},
});
console.log(result.text);
}
main().catch(console.error);

Copy link to headingMore models by Meta

Model
Context
Latency
Throughput
Input
Output
Cache
Web Search
Capabilities
Providers
ZDR
No Training
Free Tier
Release Date
$0.01/img
meta logo
08/26/2026
1M4.9 s105 tps
$0.10/M
$0.20/M
Read$0.002/M
+2
meta logo
08/05/2026
1M4.0 s160 tps
$1.25/M
$4.25/M
Read$0.15/M
+2
meta logo
08/05/2026
1M3.0 s175 tps
$1.25/M
$4.25/M
Read$0.15/M
+2
meta logo
07/09/2026
1M3.9 s99 tps
$0.10/M
$0.20/M
Read$0.002/M
+2
meta logo
1M3.1 s97 tps
$1.25/M
$4.25/M
Read$0.15/M
+2
meta logo

Copy link to headingAbout Llama 4 Scout 17B 16E Instruct

Meta released Llama 4 Scout 17B 16E Instruct on April 5, 2025 alongside Llama 4 Maverick as one of the founding models of the Llama 4 generation. Llama 4 Scout 17B 16E Instruct is a 17-billion-active-parameter Mixture of Experts model with 16 experts and 109 billion total parameters. It's substantially leaner in total parameter count than Maverick's 400B. Like Maverick, Llama 4 Scout 17B 16E Instruct was built with native multimodality across text, image, and video frame data.

Llama 4 Scout 17B 16E Instruct's defining characteristic is its context length. Meta extended context from 128K tokens in Llama 3 to 131.1K tokens in Llama 4 Scout 17B 16E Instruct, about a 78x increase. The architecture enabling this is iRoPE (interleaved Rotary Position Embeddings): most layers use standard RoPE, but the model also interleaves attention layers without positional embeddings. Inference-time temperature scaling of attention further enhances length generalization. Llama 4 Scout 17B 16E Instruct was validated with needle-in-a-haystack retrieval tests and cumulative negative log-likelihood evaluations over 131.1K tokens of code.

A context of 131.1K tokens can hold roughly 7.5 million words of plain text, the equivalent of approximately 25 full-length novels, or a large enterprise codebase with all source files, documentation, and test suites loaded together. Use cases include multi-document summarization across a large corpus, parsing extensive user activity logs, and reasoning over entire codebases in a single prompt without chunking or retrieval-augmented generation (RAG). This last capability is particularly notable for software development tooling, where RAG-based approaches introduce retrieval errors and context fragmentation.

Llama 4 Scout 17B 16E Instruct delivers better results across a broad range of benchmarks in its class. It also supports image grounding (aligning user prompts with specific visual regions) and exceeds prior Llama models on coding, reasoning, long context, and image benchmarks.

Copy link to headingWhat To Consider When Choosing a Provider

  • Configuration: Scout's long-context capabilities introduce pricing considerations: longer prompts raise per-request costs substantially. Compare $0.17 and $0.66 against your expected context length.
  • Zero Data Retention: Zero Data Retention is available for this model. It is offered on a per-provider and model basis. See the documentation for details.
  • Authentication: AI Gateway authenticates requests using an API key or OIDC token. You do not need to manage provider credentials directly.

Copy link to headingWhen to Use Llama 4 Scout 17B 16E Instruct

Best for

  • Entire codebase processing: Architecture review, cross-file refactoring suggestions, and comprehensive code search in a single inference call
  • Multi-document analysis: Legal discovery across large contract sets or literature review across a research corpus where chunking loses coherence
  • Long-session personalization: Parsing extensive user history or activity logs without summarization loss
  • Image grounding applications: Precise visual localization across multi-image inputs

Consider alternatives when

  • Standard context sufficient: Maximum multimodal capability within a standard context window is more important, so Maverick's 128-expert architecture offers greater image and text depth
  • General assistant workload: Maverick is Meta's designated product workhorse
  • Modest context tasks: A smaller, cheaper model such as Llama 3.3 70B would satisfy quality requirements
  • Cost concerns at scale: 131.1K tokens inputs result in substantially higher per-request costs than typical short-context usage

Llama 4 Scout 17B 16E Instruct extends what open-weight models can handle for long-context applications. The combination of a window of 131.1K tokens and native multimodality suits it for codebase-scale reasoning, multi-document analysis, and long-session personalization tasks that were previously impractical without chunking or retrieval augmentation. Its iRoPE architecture makes it the long-context specialist within the Llama 4 generation.

Copy link to headingFrequently Asked Questions

  • How large is the context window of 131.1K tokens in practical terms?

    Approximately 7.5 million words. That's roughly 25 full-length novels, a multi-year document archive, or a large enterprise codebase with source files, tests, and documentation all loaded simultaneously.

  • What is the iRoPE architecture and why does it matter for long context?

    iRoPE stands for interleaved Rotary Position Embeddings. Most attention layers use standard RoPE, but some layers use no positional embeddings. Inference-time temperature scaling of attention further enhances length generalization. This combination lets the model generalize beyond its training context length.

  • How does Llama 4 Scout 17B 16E Instruct handle multi-image inputs?

    Llama 4 Scout 17B 16E Instruct supports up to eight images per request. It also supports image grounding, aligning natural language prompts with specific regions or objects in images.

  • Is Llama 4 Scout 17B 16E Instruct suited for RAG, or does the context of 131.1K tokens replace it?

    For applications where the full corpus fits within 131.1K tokens, loading everything into context can be more accurate than retrieval augmentation because it avoids retrieval errors and fragmentation. For larger corpora, RAG remains appropriate, but Llama 4 Scout 17B 16E Instruct can handle much larger retrieval chunks or multiple retrieved documents simultaneously.

  • How does Llama 4 Scout 17B 16E Instruct differ from Maverick? They have the same active parameter count.

    Both have 17B active parameters but differ in expert count and total parameters. Llama 4 Scout 17B 16E Instruct has 16 experts and 109B total; Maverick has 128 experts and 400B total. Maverick stores more knowledge in its larger parameter budget. Llama 4 Scout 17B 16E Instruct is leaner but specialized for extreme context length. Meta designates Maverick as the general-purpose product model and Llama 4 Scout 17B 16E Instruct as the long-context specialist.

  • What languages does Llama 4 Scout 17B 16E Instruct support?

    Like all Llama 4 models, Llama 4 Scout 17B 16E Instruct supports 200 languages with over 100 having more than 1 billion tokens each, 10x more multilingual coverage than Llama 3.

Your use is subject to Meta's Terms & Privacy Policies.