POST
/
ilm
/
chat
/
completions
Chat Completions Nova ILM
curl --request POST \
  --url https://mavi-backend.memories.ai/serve/api/v2/ilm/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_703da855e7e0415296d5365265a1b323",
  "object": "chat.completion",
  "created": 1767097779,
  "model": "nova:amazon.nova-lite-v1:0",
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "This is a photo showing a yellow sign with \"AMENDMENT 35\" marking in the background, with a white room wall as the background and a curtain above. There are circular blue dots and white gear icons on the right side of the image. The photo may be from a game or simulation training device, with two fork spears on the right side of the image and a cursor mouse marker above the circular dot. The signs on the left and right sides have the number \"100\". The lower side has signs such as \"IDC, ANYMORE, AMMO 100\". The top and bottom of the photo are slightly blurred."
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 739,
    "output_token": 207,
    "total_tokens": 946
  }
}
This endpoint allows you to generate chat completions with image and text inputs using Nova ILM 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 image_url
- text: Text content (when type is text)
- image_url: Image URL or base64 encoded image (when type is image_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": "image_url",
                        "image_url": {
                            "url": "https://storage.googleapis.com/memories-test-data/gun5.png"
                            # or use base64: "url": f"data:image/png;base64,{base64_string}"
                        }
                    },
                    {"type": "text", "text": "What is the content of this image?"}
                ]
            }
        ],
        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_image_summary",
                        #                         "description": "Extract a concise summary of the image",
        #                         "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_703da855e7e0415296d5365265a1b323",
  "object": "chat.completion",
  "created": 1767097779,
  "model": "nova:amazon.nova-lite-v1:0",
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "This is a photo showing a yellow sign with \"AMENDMENT 35\" marking in the background, with a white room wall as the background and a curtain above. There are circular blue dots and white gear icons on the right side of the image. The photo may be from a game or simulation training device, with two fork spears on the right side of the image and a cursor mouse marker above the circular dot. The signs on the left and right sides have the number \"100\". The lower side has signs such as \"IDC, ANYMORE, AMMO 100\". The top and bottom of the photo are slightly blurred."
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 739,
    "output_token": 207,
    "total_tokens": 946
  }
}

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_703da855e7e0415296d5365265a1b323"

object
string

Object type, always "chat.completion"

Example:

"chat.completion"

created
integer

Unix timestamp of when the completion was created

Example:

1767097779

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