POST
/
chat
/
completions
Chat Completions Nova
curl --request POST \
  --url https://mavi-backend.memories.ai/serve/api/v2/chat/completions \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "nova:amazon.nova-lite-v1:0",
  "messages": [
    {
      "role": "system",
      "content": "<string>"
    }
  ],
  "temperature": 1,
  "max_tokens": 1000,
  "top_p": 1,
  "frequency_penalty": 0,
  "presence_penalty": 0,
  "n": 1,
  "stream": false,
  "stop": "<string>",
  "extra_body": {
    "metadata": {
      "toolConfig": {
        "tools": [
          {
            "toolSpec": {
              "name": "<string>",
              "description": "<string>",
              "inputSchema": {
                "json": {}
              }
            }
          }
        ]
      }
    }
  }
}
'
{
  "id": "chatcmpl_705304384e4143db9e162cda30295762",
  "object": "chat.completion",
  "created": 1767098064,
  "model": "nova:amazon.nova-lite-v1:0",
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "At the start of the video, the screen displays the words \"VACUUM VS ORANGE\". The objects in the video are visible. The first is an orange resting on a stand. The second involves a small orange placed on a stand that is inside of a tall glass. The third is a glass filled with a yellow, orange-like liquid. The background is blurry. At 3 seconds, there is a small burst of citrus juice from the small orange that was resting on a stand. The juice splatters and travels onto the large orange. At 7 seconds, there is another burst of juice. This time, the juice comes from the glass, and more juices splatters onto the large orange. A hand can be seen at the top of the screen. This hand adjusts some sort of machinery, which is the metal pipe and circular object that is directly above the objects in the glass box. At around 14 seconds, liquid pours from the glass. At 17 seconds, the person adjusts the machinery again. The same things happens around 27 seconds. By 34 seconds, there is an excessive amount of juice and liquid inside of the glass box. At 43 seconds, all of the juice and liquid is gone from the glass box. At 46 seconds, there is no juice or liquid inside of the glass box. At 53 seconds, the person adjusts the machinery again."
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 17463,
    "output_token": 290,
    "total_tokens": 17753
  }
}
This endpoint allows you to generate chat completions with video and text inputs using Nova model.

Request Body

ParameterTypeRequiredDefaultDescription
modelstringYes-The model to use (e.g., nova:amazon.nova-lite-v1:0)
messagesarrayYes-Array of message objects. Each message contains:
- role: Role type, values: system, user, assistant
- content: Message content, can be a string or array. Array items can contain:
- type: Content type, text or video_url
- text: Text content (when type is text)
- video_url: Video URL or base64 encoded video (when type is video_url)
temperaturenumberNo1.0Controls randomness: 0.0-2.0, higher = more random
max_tokensintegerNo1000Maximum number of tokens to generate
top_pnumberNo1.0Nucleus sampling: 0.0-1.0, consider tokens with top_p probability mass
frequency_penaltynumberNo0.0Reduces repetition of frequent tokens: -2.0 to 2.0
presence_penaltynumberNo0.0Increases likelihood of new topics: -2.0 to 2.0
nintegerNo1Number of completions to generate
streambooleanNofalseWhether to stream the response
stopstring | array | nullNonullStop sequences. Can be a string, array of strings, or null
extra_bodyobjectNo-Additional body parameters. Contains:
- metadata: Metadata object
- toolConfig: Tool configuration
- tools: Array of tool specifications

Code Example

from openai import OpenAI

client = OpenAI(
    api_key="2cfb0d30fe04a784362ffdbc054ba859",
    base_url="https://mavi-backend.memories.ai/serve/api/v2/"
)

def call_my_ilm():
    resp = client.chat.completions.create(
        model="nova:amazon.nova-lite-v1:0",
        messages=[
            {"role": "system", "content": "You are a multimodal assistant. Keep your answers concise."},
            {
                "role": "user",
                "content": [
                    {
                        "type": "video_url",
                        "video_url": {
                            "url": "https://storage.googleapis.com/memories-test-data/test_1min.mp4"
                            # or use base64: "url": f"data:video/mp4;base64,{base64_string}"
                        }
                    },
                    {"type": "text", "text": "What is the content of this video?"}
                ]
            }
        ],
        temperature=1.0,  # Controls randomness: 0.0-2.0, higher = more random
        max_tokens=1000,  # Maximum number of tokens to generate
        top_p=1.0,  # Nucleus sampling: 0.0-1.0, consider tokens with top_p probability mass
        frequency_penalty=0.0,  # -2.0 to 2.0, reduces repetition of frequent tokens
        presence_penalty=0.0,  # -2.0 to 2.0, increases likelihood of new topics
        n=1,  # Number of completions to generate
        stream=False,  # Whether to stream the response
        stop=None,  # Stop sequences (list of strings)
        extra_body={
            "metadata": {
                "toolConfig": {
                    "tools": [
                        {
                            "toolSpec": {
                                "name": "extract_video_summary",
                                "description": "Extract a concise summary of the video",
                                "inputSchema": {
                                    "json": {
                                        "type": "object",
                                        "properties": {
                                            "result": {"type": "string", "description": "Summary content."}
                                        },
                                        "required": ["result"]
                                    }
                                }
                            }
                        }
                    ]
                }
            }
        }
    )
    return resp

# Usage example
result = call_my_ilm()
print(result)

Response

Returns the chat completion response.
{
  "id": "chatcmpl_705304384e4143db9e162cda30295762",
  "object": "chat.completion",
  "created": 1767098064,
  "model": "nova:amazon.nova-lite-v1:0",
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "At the start of the video, the screen displays the words \"VACUUM VS ORANGE\". The objects in the video are visible. The first is an orange resting on a stand. The second involves a small orange placed on a stand that is inside of a tall glass. The third is a glass filled with a yellow, orange-like liquid. The background is blurry. At 3 seconds, there is a small burst of citrus juice from the small orange that was resting on a stand. The juice splatters and travels onto the large orange. At 7 seconds, there is another burst of juice. This time, the juice comes from the glass, and more juices splatters onto the large orange. A hand can be seen at the top of the screen. This hand adjusts some sort of machinery, which is the metal pipe and circular object that is directly above the objects in the glass box. At around 14 seconds, liquid pours from the glass. At 17 seconds, the person adjusts the machinery again. The same things happens around 27 seconds. By 34 seconds, there is an excessive amount of juice and liquid inside of the glass box. At 43 seconds, all of the juice and liquid is gone from the glass box. At 46 seconds, there is no juice or liquid inside of the glass box. At 53 seconds, the person adjusts the machinery again."
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 17463,
    "output_token": 290,
    "total_tokens": 17753
  }
}

Response Parameters

ParameterTypeDescription
idstringUnique identifier for the chat completion
objectstringObject type, always “chat.completion”
createdintegerUnix timestamp of when the completion was created
modelstringThe model used for the completion
choicesarrayArray of completion choices
choices[].indexintegerIndex of the choice in the choices array
choices[].messageobjectMessage object containing the assistant’s response
choices[].message.rolestringRole of the message, always “assistant”
choices[].message.contentstringContent of the message
choices[].finish_reasonstringReason why the completion finished
usageobjectToken usage information
usage.prompt_tokensintegerNumber of tokens in the prompt
usage.output_tokenintegerNumber of tokens in the completion output
usage.total_tokensintegerTotal number of tokens used

Authorizations

Authorization
string
header
required

Body

application/json
model
string
required

The model to use (e.g., nova:amazon.nova-lite-v1:0)

Example:

"nova:amazon.nova-lite-v1:0"

messages
object[]
required

Array of message objects

temperature
number
default:1

Controls randomness: 0.0-2.0, higher = more random

Required range: 0 <= x <= 2
max_tokens
integer
default:1000

Maximum number of tokens to generate

top_p
number
default:1

Nucleus sampling: 0.0-1.0

Required range: 0 <= x <= 1
frequency_penalty
number
default:0

Reduces repetition of frequent tokens: -2.0 to 2.0

Required range: -2 <= x <= 2
presence_penalty
number
default:0

Increases likelihood of new topics: -2.0 to 2.0

Required range: -2 <= x <= 2
n
integer
default:1

Number of completions to generate

stream
boolean
default:false

Whether to stream the response

stop

Stop sequences

extra_body
object

Response

200 - application/json

Chat completion response

id
string

Unique identifier for the chat completion

Example:

"chatcmpl_705304384e4143db9e162cda30295762"

object
string

Object type, always "chat.completion"

Example:

"chat.completion"

created
integer

Unix timestamp of when the completion was created

Example:

1767098064

model
string

The model used for the completion

Example:

"nova:amazon.nova-lite-v1:0"

choices
object[]

Array of completion choices

usage
object

Token usage information