Endpoints
Vision
The SambaNova Cloud Vision API enables models to process image inputs alongside text. View our Vision Capability guide for an introduction.
Please see the Vision capabilities document for additional information.
Endpoint
Creates a model response for the given an input that can include both text and image data.
POST
https://api.sambanova.ai/v1/chat/completions
Request body
Parameter | Type | Description | Required |
---|---|---|---|
model | string | The ID of the selected model to query. For vision tasks, use models like Llama-3.2-11B-Vision-Instruct. | Yes |
messages | array of objects | A list of messages forming the conversation. Each message can include both text and image inputs. See the Image Input Format below for details. | Yes |
max_tokens | integer | Maximum number of tokens to generate. The total length of input and generated tokens is limited by the model’s context length. Default is 1000. | No |
temperature | float | Controls randomness in responses. Value can be between 0 and 1. Default is 0. | No |
top_p | float | Adjusts the number of choices for each predicted token based on cumulative probabilities. Value can be between 0 and 1. Default is 0.9. | No |
top_k | integer | Limits the number of choices for the next predicted word or token. Value can be between 1 and 100. Default is 50. | No |
stop | string or array | Up to 4 sequences where the API will stop generating further tokens. Default is null. | No |
stream | boolean | If true, partial message deltas will be sent. Default is false. | No |
stream_options | object | Options for streaming response. Only set this when stream: true. Available option: include_usage (boolean). Default is null. | No |
Messages format for image input
-
Single image per request
- Each request supports only one image input. For multiple images, send separate requests.
-
Encoding requirements
- Ensure the image is base64-encoded and within size limits. Invalid encoding will result in errors. View more information on our API Error page.
Parameter | Type | Description | Required |
---|---|---|---|
type | string | Indicates the type of content. For images, set this to image_url. | Yes |
image_url.url | string | The base64-encoded image string. Must follow the format: data:<image_format>;base64,<data>. | Yes |
Example request
Response
The API returns a chat completion object containing the model’s response to the provided input.
In this sample, the image entered was a nature scene, and your response will reflect your selected image.