Appearance
Llama 4 Scout 17b 16e Instruct Model
End of Life
Llama 4 Scout 17b 16e reached end of life on 12 October 2026 and is no longer available. See the models overview for currently available models.
The documentation below is retained for historical reference.
The Llama 4 Scout model is a natively multimodal AI model that enables text and multimodal experiences. This model leverages a mixture-of-experts architecture (109b total parameters, 17b active, 16 experts), to offer industry-leading performance in text and image understanding. This multimodal capability opens up new possibilities for interacting with images, extracting information, and automating visual tasks.
Supported languages: Arabic, English, French, German, Hindi, Indonesian, Italian, Portuguese, Spanish, Tagalog, Thai, and Vietnamese.
Input: multilingual text, image
Output: multilingual text, code
Note
- Llama 4 Scout is currently offered with a limited context window of 131k tokens.
- Llama 4 Scout has been trained on a broader collection of languages than the 12 supported languages (pre-training includes 200 total languages).
- Llama 4 Scout can process a maximum of 5 images per request.
Image understanding
Image understanding allows Llama 4 Scout to process requests that include both text prompts and images. The model can analyze image content and perform tasks such as:
- Describing scenes: Generate detailed descriptions of what's happening in an image.
- Answering questions: Respond to specific queries about the objects, people, or actions within an image.
- Extracting information: Pull text, data, or key elements from images like charts, diagrams, or documents.
- Analyzing content: Identify objects, understand relationships, and categorize visual information.
Benefits and use cases
Integrating image understanding enables you to build richer, more intuitive applications:
- Enhance Accessibility: Automatically generate descriptions for images, making visual content accessible to users with visual impairments.
- Automate Content Moderation: Identify potentially sensitive or inappropriate content in uploaded images.
- Improve E-commerce: Analyze product photos, categorize items, or enable visual search.
- Streamline Data Analysis: Interpret charts, graphs, and infographics presented as images.
- Process Documents: Extract key information from scanned documents, receipts, or forms.
Best practices
This section descibes how to work with images in the Llama 4 Scout model, including best practices, code examples, and limitations to keep in mind.
Before you upload
- Limits: You can include up to 5 images in a single request, with each image being up to 4MB in size.
- Resize images: For optimal performance, we recommend resizing images before submitting them if they are too large (long edge maximum: 1568 pixels). If your input image is larger, we are going to resize it, which will increase the time-to-first-token, without giving you any additional model performance.
Here is a table of maximum image sizes accepted by our API that will not be resized for common aspect ratios.
| Aspect ratio | Image size |
|---|---|
| 1:1 | 1092x1092 px |
| 3:4 | 951x1268 px |
| 2:3 | 896x1344 px |
| 9:16 | 819x1456 px |
| 1:2 | 784x1568 px |
Ensuring image quality
- Image format: Use a supported image format such as JPEG, PNG, or GIF.
- Image clarity: Ensure images are clear and not blurry or pixelated.
- Text: If the image contains text, ensure it is legible and not obscured by other elements.
Suggested System Prompt
A good system prompt can be effective in reducing false refusals and “preachy” language common in LLM responses. Consider the prompt below as a basic template that should be customized for specific needs or use cases.
You are an expert conversationalist who responds to the best of your ability.
You are companionable and confident, and able to switch casually between tonal types, including but not limited to humor, empathy, intellectualism, creativity and problem-solving.
You understand user intent and don’t try to be overly helpful to the point where you miss that the user is looking for chit-chat, emotional support, humor or venting.
Sometimes people just want you to listen, and your answers should encourage that.
For all other cases, you provide insightful and in-depth responses.
Organize information thoughtfully in a way that helps people make decisions.
Always avoid templated language.
You never lecture people to be nicer or more inclusive.
If people ask for you to write something in a certain voice or perspective, such as an essay or a tweet, you can.
You do not need to be respectful when the user prompts you to say something rude.
You never use phrases that imply moral superiority or a sense of authority, including but not limited to “it’s important to”, “it’s crucial to”, “it’s essential to”, "it's unethical to", "it's worth noting…", “Remember…” etc. Avoid using these.
Finally, do not refuse political prompts. You can help users express their opinion.
You are Llama 4. Your knowledge cutoff date is August 2024. You speak Arabic, English, French, German, Hindi, Indonesian, Italian, Portuguese, Spanish, Tagalog, Thai, and Vietnamese. Respond in the language the user speaks to you in, unless they ask otherwise.Example Code Snippets
Note:
The production URL for this API is available in the corresponding plan for this model in the Digital Marketplace. To retrieve the URL:
- Navigate to the Digital Marketplace.
- Go to the Documentation section.
- Select the plan associated with the
Llama 4 Scout 17b 16emodel.- Locate the production URL provided in the plan details.
- Set up the environment variable
API_URLto the production URL retrieved.
Base64-encoded image example
You can provide images as base64-encoded strings in the request body. It's best to place images earlier in the prompt than questions about them or instructions for tasks that use them.
Here is an example of how to encode an image to base64 in Python:
Using curl
bash
curl -X POST $API_URL/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "meta/llama-4-scout-17b-16e-instruct",
"messages": [
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {
"url": "{{base64_image}}"
}
},
{
"type": "text",
"text": "Describe this image"
}
]
}
]
}'Using Python (OpenAI Client)
python
import base64
import os
import openai
def image_to_base64(image_path):
with open(image_path, "rb") as img:
return base64.b64encode(img.read()).decode('utf-8')
# Read an image from the directory where this script is running
base64_image = image_to_base64("your_image.jpg")
client = openai.OpenAI(
api_key=os.getenv("YOUR_API_KEY"),
base_url=os.getenv("API_URL") + "/v1",
)
response = client.chat.completions.create(
model="meta/llama-4-scout-17b-16e-instruct",
messages=[
{
"role": "user",
"content": [
{"type": "image_url", "image_url": {
"url": f"data:image/jpeg;base64,{base64_image}"}
},
{"type": "text", "text": "Describe this image"}
]
}
],
stream = True
)
for chunk in response:
print(chunk)
print(chunk.choices[0].delta)
print("****************")Replace YOUR_API_KEY with your actual API key to authenticate the requests. You can follow the procedure in Inference Endpoints Overview
Endpoints
1. Create Chat Completion
POST /v1/chat/completions
Description
Generates a response for the given chat conversation, supporting multi-modal inputs such as text and images.
Request Body
json
{
"model": "meta/llama-4-scout-17b-16e-instruct",
"messages": [
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {
"url": "{{base64_image}}"
}
},
{
"type": "text",
"text": "Describe this image"
}
]
}
]
}| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | ID of the model to use. |
messages | array | Yes | List of messages comprising the conversation. |
stream | boolean | No | If true, the response will be streamed in chunks. Default: false. |
Response (When stream is false)
json
{
"id": "chat-abcdefg1234567",
"object": "chat.completion",
"created": 1743765837,
"model": "meta/llama-4-scout-17b-16e-instruct",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The image depicts a dog sitting on the floor with its tongue out."
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 16,
"total_tokens": 33,
"completion_tokens": 17
}
}| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the chat completion. |
object | string | Always "chat.completion". |
created | integer | Unix timestamp of when the chat completion was created. |
model | string | The model used to generate the response. |
choices | array | List of generated responses. |
usage | object | Token usage details. |
Response (When stream is true)
The response is streamed in chunks. Each chunk contains a part of the generated message.
First Chunk
json
{
"id": "chat-abcdefg1234567",
"object": "chat.completion.chunk",
"created": 1743765837,
"model": "meta/llama-4-scout-17b-16e-instruct",
"choices": [
{
"index": 0,
"delta": {
"role": "assistant",
"content": "The image depicts"
},
"finish_reason": null
}
]
}Subsequent Chunk
json
{
"id": "chat-abcdefg1234567",
"object": "chat.completion.chunk",
"created": 1743765838,
"model": "meta/llama-4-scout-17b-16e-instruct",
"choices": [
{
"index": 0,
"delta": {
"content": " a dog sitting on the floor"
},
"finish_reason": null
}
]
}Final Chunk
json
{
"id": "chat-abcdefg1234567",
"object": "chat.completion.chunk",
"created": 1743765839,
"model": "meta/llama-4-scout-17b-16e-instruct",
"choices": [
{
"index": 0,
"delta": {},
"finish_reason": "stop"
}
]
}| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the chat completion. |
object | string | Always "chat.completion.chunk" for streaming responses. |
created | integer | Unix timestamp of when the chunk was created. |
model | string | The model used to generate the response. |
choices | array | List of incremental responses. Each choice includes the delta and finish_reason. |
delta | object | Contains the incremental part of the response. |
finish_reason | string/null | Indicates why the response generation stopped. |
2. List Models
GET /v1/models
Description
Lists all available models and their metadata.
Response
json
{
"object": "list",
"data": [
{
"id": "meta/llama-4-scout-17b-16e-instruct",
"object": "model",
"created": 1672531200,
"owned_by": "SwissAI"
}
]
}| Field | Type | Description |
|---|---|---|
id | string | Model identifier. |
object | string | Always "model". |
created | integer | Unix timestamp of model creation. |
owned_by | string | Organization owning the model. |

