Llama-4-scout

This documentation is valid for the following list of our models:

  • meta-llama/llama-4-scout

Model Overview

A 17 billion active parameter model with 16 experts, is the best multimodal model in the world in its class and is more powerful than all previous generation Llama models. Additionally, the model offers an industry-leading context window of 10M and delivers better results than Gemma 3, Gemini 2.0 Flash-Lite, and Mistral 3.1 on a wide range of common benchmarks.

How to Make a Call

1

Setup You Can’t Skip

▪️ Create an Account: Visit the AI/ML API website and create an account (if you don’t have one yet). ▪️ Generate an API Key: After logging in, navigate to your account dashboard and generate your API key. Ensure that key is enabled on UI.

2

Copy the code example

At the bottom of this page, you'll find a code example that shows how to structure the request. Choose the code snippet in your preferred programming language and copy it into your development environment.

3

Modify the code example

▪️ Replace <YOUR_AIMLAPI_KEY> with your actual AI/ML API key from your account. ▪️ Insert your question or request into the content field—this is what the model will respond to.

4

(Optional) Adjust other optional parameters if needed

Only model and messages are required parameters for this model (and we’ve already filled them in for you in the example), but you can include optional parameters if needed to adjust the model’s behavior. Below, you can find the corresponding API schema, which lists all available parameters along with notes on how to use them.

5

Run your modified code

Run your modified code in your development environment. Response time depends on various factors, but for simple prompts it rarely exceeds a few seconds.

API Schema

Generate a conversational response using a language model.

post

Creates a chat completion using a language model, allowing interactive conversation by predicting the next response based on the given chat history. This is useful for AI-driven dialogue systems and virtual assistants.

Authorizations
Body
modelundefined · enumRequiredAvailable options:
messagesone of[]Required
max_tokensnumber · min: 1OptionalDefault: 512
stopany ofOptional
streambooleanOptionalDefault: false
stream_optionsobjectOptional
ninteger · min: 1Optional
seedinteger · min: 1Optional
top_pnumber · min: 0.01 · max: 1Optional
top_knumberOptional
temperaturenumberOptional
repetition_penaltynumber | nullableOptional
logprobsboolean | nullableOptional
echobooleanOptional
min_pnumber · max: 1Optional
presence_penaltynumber | nullableOptional
frequency_penaltynumber | nullableOptional
logit_biasobject | nullableOptional
toolsobject[]Optional
tool_choiceany ofOptional
response_formatone ofOptional
Responses
post
POST /v1/chat/completions HTTP/1.1
Host: api.aimlapi.com
Authorization: Bearer <YOUR_AIMLAPI_KEY>
Content-Type: application/json
Accept: */*
Content-Length: 530

{
  "model": "meta-llama/llama-4-scout",
  "messages": [
    {
      "role": "system",
      "content": "text",
      "name": "text"
    }
  ],
  "max_tokens": 1,
  "stop": "text",
  "stream": true,
  "stream_options": {
    "include_usage": true
  },
  "n": 1,
  "seed": 1,
  "top_p": 1,
  "top_k": 1,
  "temperature": 1,
  "repetition_penalty": 1,
  "logprobs": true,
  "echo": true,
  "min_p": 1,
  "presence_penalty": 1,
  "frequency_penalty": 1,
  "logit_bias": {
    "ANY_ADDITIONAL_PROPERTY": 1
  },
  "tools": [
    {
      "type": "function",
      "function": {
        "description": "text",
        "name": "text",
        "parameters": null
      }
    }
  ],
  "tool_choice": "none",
  "response_format": {
    "type": "text"
  }
}
201Success

No content

Code Example (Python)

import requests

response = requests.post(
    "https://api.aimlapi.com/v1/chat/completions",
    headers={
        "Content-Type":"application/json", 

        # Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
        "Authorization":"Bearer <YOUR_AIMLAPI_KEY>",
        "Content-Type":"application/json"
    },
    json={
        "model":"meta-llama/llama-4-scout",
        "messages":[
            {
                "role":"user",

                # Insert your question for the model here, instead of Hello:
                "content":"Hello"
            }
        ]
    }
)

data = response.json()
print(data)
Response
{'id': 'npXpsYC-2j9zxn-92e24e9e0c97d74d', 'object': 'chat.completion', 'choices': [{'index': 0, 'finish_reason': 'stop', 'logprobs': None, 'message': {'role': 'assistant', 'content': "Hello! It's nice to meet you. Is there something I can help you with or would you like to chat?", 'tool_calls': []}}], 'created': 1744288767, 'model': 'meta-llama/Llama-4-Scout-17B-16E-Instruct', 'usage': {'prompt_tokens': 4, 'completion_tokens': 30, 'total_tokens': 34}}

Last updated

Was this helpful?