> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.twelvelabs.io/v1.3/api-reference/create-embeddings-v2/create-embeddings/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.twelvelabs.io/_mcp/server. # Create sync embeddings POST https://api.twelvelabs.io/v1.3/embed-v2 Content-Type: application/json This method synchronously creates embeddings for multimodal content and returns the results immediately in the response. Use this method to embed a query for retrieving matching content. With Marengo 3.5, audio and video can be up to 30 seconds. With Marengo 3.0, they can be up to 10 minutes. For longer content, use the [`POST`](/v1.3/api-reference/create-embeddings-v2/create-async-embedding-task) method of the `/embed-v2/tasks` endpoint instead. The content this method accepts depends on the model. With Marengo 3.5, this method accepts only the `multi_input` input type; provide text, images, audio, or video as media sources. With Marengo 3.0, use the individual input types. For the formats, resolutions, file sizes, and duration limits each model accepts, see the input requirements for [Marengo 3.5](/v1.3/docs/concepts/models/marengo/marengo-3-5#input-requirements) or [Marengo 3.0](/v1.3/docs/concepts/models/marengo/marengo-3-0#input-requirements). This method is rate-limited. With Marengo 3.5, the platform counts input tokens for each type of content. A request can exceed a limit before you see an error. For details, see [Input token limits for embedding](/v1.3/docs/get-started/rate-limits#input-token-limits-for-embedding). Reference: https://docs.twelvelabs.io/api-reference/create-embeddings-v2/create-embeddings ## Authentication - `x-api-key` header (required) — Your API key. You can find your API key on the API Keys page. ## Request ### Body (application/json) This endpoint expects a CreateEmbeddingsRequest. - `input_type` (enum, required) — The type of content for the embeddings. **Values**: * `multi_input`: Text and up to 10 media sources, combined into a single embedding. To reference a specific media source from your text, use a placeholder in the following format: `<@name>`, where `name` matches the `name` field of a media source. Marengo 3.5 accepts images, video, and audio as media sources. Marengo 3.0 accepts images. * `audio`: An audio file. Requires Marengo 3.0. * `video`: A video file. Requires Marengo 3.0. * `image`: An image file. Requires Marengo 3.0. * `text`: Text input. Requires Marengo 3.0. * `text_image`: Text and an image. Requires Marengo 3.0. - Allowed values: `text`, `image`, `text_image`, `audio`, `video`, `multi_input` - `model_name` (enum, required, default: marengo3.0) — The embedding model to use. **Values**: - `marengo3.5`: For details about this version, see the [Marengo 3.5](/v1.3/docs/concepts/models/marengo/marengo-3-5) page. - `marengo3.0`: For details about this version, see the [Marengo 3.0](/v1.3/docs/concepts/models/marengo/marengo-3-0) page. - Allowed values: `marengo3.0`, `marengo3.5` - `auto_truncate` (boolean, optional, default: false) — Controls the behavior of the platform when the text in your request exceeds 2,000 tokens. Requires Marengo 3.5. **Values**: - `false`: Return a `400` error. - `true`: Truncate your text to fit the limit, and set the [`usage.truncated`](/v1.3/api-reference/create-embeddings-v2/create-embeddings#response.body.usage.truncated) field to `true` in the response. - `embedding_uncertainty` (boolean, optional, default: false) — Set this parameter to `true` to receive a [`data[].embedding_uncertainty`](/v1.3/api-reference/create-embeddings-v2/create-embeddings#response.body.data.embedding-uncertainty) field in the response, representing a per-dimension uncertainty vector with the same length as the `embedding` array. A higher value shows lower confidence in that dimension. Requires Marengo 3.5. Set this parameter to `true` only when your request embeds text only, or media only. Requests that combine text with media sources return a `400` error. - `text` (TextInputRequest, optional) — This field is required if the `input_type` parameter is `text`. - `image` (ImageInputRequest, optional) — This field is required if the `input_type` parameter is `image`. - `text_image` (TextImageInputRequest, optional) — This field is required if the `input_type` parameter is `text_image`. - `audio` (AudioInputRequest, optional) — This field is required if the `input_type` parameter is `audio`. - `video` (VideoInputRequest, optional) — This field is required if the `input_type` parameter is `video`. - `multi_input` (MultiInputRequest, optional) — This field is required if the `input_type` parameter is `multi_input`. It combines text and up to 10 media sources into a single embedding. Provide the `input_text` field, the `media_sources` field, or both. Marengo 3.5 accepts images, video, and audio as media sources. Marengo 3.0 accepts images. Include text in the `input_text` field when you combine media sources of different types. For example, a request that combines an image and a video returns a `400` error without text. Media sources of the same type do not require text. ## Response ### 200 The embeddings have been successfully created. - `data` (list of EmbeddingData, required) — Array of embedding results - `usage` (EmbeddingUsage, optional) — Token counts for the request. Only Marengo 3.5 returns this field. - `metadata` (EmbeddingMediaMetadata, optional) — Metadata for the media input. Available for the `image`, `text_image`, `audio`, `video`, and `multi_input` input types. ## Errors ### 400 Bad Request Error Validation failure or inaccessible asset - `error` (ErrorResponseError, required) ### 429 Too Many Requests Error You have exceeded a rate limit, and the platform has not processed the request. For an asynchronous submission, no task has been created. For an input token limit, an earlier request exceeds it. That request completes normally, returning its embeddings or finishing as a task. The platform returns the error for the requests that follow. The `X-Ratelimit-Dimensions` header lists the limits the request was checked against. The `Retry-After` header contains the number of seconds to wait. - `error` (ErrorResponseError, required) ### 500 Internal Server Error Internal server error. - `error` (ErrorResponseError, required) ## Types ### TextInputRequest This field is required if the `input_type` parameter is `text`. - `input_text` (string, required) — The text for which you wish to create an embedding. The maximum length is 500 tokens. ### ImageInputRequest This field is required if the `input_type` parameter is `image`. - `media_source` (MediaSource, required) — An object specifying the source of the media file. You must provide exactly one of `url`, `base64_string`, or `asset_id`. ### TextImageInputRequest This field is required if the `input_type` parameter is `text_image`. - `media_source` (MediaSource, required) — An object specifying the source of the media file. You must provide exactly one of `url`, `base64_string`, or `asset_id`. - `input_text` (string, required) — The text for which you wish to create an embedding. The maximum length is 500 tokens. ### AudioInputRequest This field is required if the `input_type` parameter is `audio`. - `media_source` (MediaSource, required) — An object specifying the source of the media file. You must provide exactly one of `url`, `base64_string`, or `asset_id`. - `start_sec` (double, optional) — The start time in seconds for processing the audio file. Use this parameter to process a portion of the audio file starting from a specific time. **Default**: 0 (start from the beginning). - `end_sec` (double, optional) — The end time in seconds for processing the audio file. Use this parameter to process a portion of the audio file ending at a specific time. The end time must be greater than the start time. **Default**: End of the audio file - `segmentation` (AudioSegmentation, optional) — Specifies how the platform divides the audio into segments. - `embedding_option` (list of enum, optional) — The types of embeddings you wish to generate. **Values**: - `audio`: Generates embeddings based on audio content (sounds, music, effects) - `transcription`: Generates embeddings based on transcribed speech You can specify multiple values to generate different types of embeddings for the same audio. **Default**: `["audio", "transcription"]` - Allowed values: `audio`, `transcription` - `embedding_scope` (list of enum, optional) — The scope for which you wish to generate embeddings. **Values**: - `clip`: Generates one embedding for each segment - `asset`: Generates one embedding for the entire audio file You can specify multiple scopes to generate embeddings at different levels. **Default**: `["clip", "asset"]` - Allowed values: `clip`, `asset` - `embedding_type` (list of enum, optional) — Specifies how to structure the embedding. Include this parameter only when the `embedding_option` parameter contains at least two values. **Values**: - `separate_embedding`: Returns separate embeddings for each modality specified in the `embedding_option` parameter. - `fused_embedding`: Returns a single combined embedding that integrates all modalities into one vector. Specify both values to receive separate and fused embeddings in the same response. **Default**: `separate_embedding`. - Allowed values: `separate_embedding`, `fused_embedding` ### VideoInputRequest This field is required if the `input_type` parameter is `video`. - `media_source` (MediaSource, required) — An object specifying the source of the media file. You must provide exactly one of `url`, `base64_string`, or `asset_id`. - `start_sec` (double, optional) — The start time in seconds for processing the video file. Use this parameter to process a portion of the video file starting from a specific time. **Default**: 0 (start from the beginning) - `end_sec` (double, optional) — The end time in seconds for processing the video file. Use this parameter to process a portion of the video file ending at a specific time. The end time must be greater than the start time. **Default**: End of the video file - `segmentation` (VideoSegmentation, optional) — Specifies how the platform divides the video into segments. The `strategy` field selects one variant: - `strategy: fixed` - Creates segments of equal, predetermined length. Use this for consistent timing. - `strategy: dynamic` - Creates segments of variable length that align with scene boundaries. Use this for content-aware segmentation. - `embedding_option` (list of enum, optional) — The types of embeddings to generate for the video. **Values**: - `visual`: Generates embeddings based on visual content (scenes, objects, actions) - `audio`: Generates embeddings based on audio content (sounds, music, effects) - `transcription`: Generates embeddings based on transcribed speech You can specify multiple values to generate different types of embeddings for the same video. **Default**: `["visual", "audio", "transcription"]` - Allowed values: `visual`, `audio`, `transcription` - `embedding_scope` (list of enum, optional) — The scope for which you wish to generate embeddings. **Values**: - `clip`: Generates one embedding for each segment - `asset`: Generates one embedding for the entire video file. Use this scope for videos up to 10-30 seconds to maintain optimal performance. You can specify multiple scopes to generate embeddings at different levels. **Default**: `["clip", "asset"]` - Allowed values: `clip`, `asset` - `embedding_type` (list of enum, optional) — Specifies how to structure the embedding. Include this parameter only when `embedding_option` contains at least two values. **Values**: - `separate_embedding`: Returns separate embeddings per modality specified in `embedding_option` - `fused_embedding`: Returns a single embedding that combines all modalities into one vector Specify both values to receive separate and fused embeddings in the same response. **Default**: `separate_embedding`. - Allowed values: `separate_embedding`, `fused_embedding` ### MultiInputRequest This field is required if the `input_type` parameter is `multi_input`. It combines text and up to 10 media sources into a single embedding. Provide the `input_text` field, the `media_sources` field, or both. Marengo 3.5 accepts images, video, and audio as media sources. Marengo 3.0 accepts images. Include text in the `input_text` field when you combine media sources of different types. For example, a request that combines an image and a video returns a `400` error without text. Media sources of the same type do not require text. - `input_text` (string, optional) — Text to include in the embedding. With Marengo 3.5, the text cannot exceed 2,000 tokens. Use the `auto_truncate` parameter to control the behavior of the platform when your text exceeds it. **Usage options**: * Provide text without media sources to create a text-only embedding. * Combine text with media sources to add context. Example: "A person cooking." * Use media source references to describe relationships between specific media sources. The format is `<@name>`, where `name` matches the `name` field of a media source. Example: "A person wearing \<@outfit> and holding \<@accessory>." * Omit this field to create an embedding from media sources only. - `media_sources` (list of MultiInputMediaSource, optional) — An array of up to 10 media sources to include in the embedding. Omit it to create a text-only embedding from the `input_text` field. The platform processes media sources in the order they appear in the array. If you use media source references in the [`input_text`](/v1.3/api-reference/create-embeddings-v2/create-embeddings#request.body.multi_input.input_text) parameter, each must have a corresponding media source with a matching `name` field. If a reference has no match, the request fails. ### EmbeddingData An embedding with its metadata. - `embedding` (list of double, required) — The embedding vector for the content. - `embedding_uncertainty` (list of double, optional) — A per-dimension uncertainty vector with the same length as the `embedding` array. A higher value shows lower confidence in that dimension. Present when the request sets [`embedding_uncertainty: true`](/v1.3/api-reference/create-embeddings-v2/create-embeddings#request.body.embedding-uncertainty). Only Marengo 3.5 returns this field. - `embedding_option` (enum, optional, nullable) — The modality used to generate this embedding. **Values**: - `visual`: Embedding based on visual content (a video, a page of a PDF file, or an image embedded asynchronously). - `audio`: Embedding based on audio content. - `text`: The platform does not return this value. - `transcription`: Embedding based on transcribed speech. Returned only for content embedded with Marengo 3.0. - `fused`: Embedding based on a combination of the modalities specified in the request. The platform returns this embedding only for video and audio input, and only when the `embedding_type` parameter includes the `fused_embedding` value. - `null`: For text embeddings and images embedded synchronously. - Allowed values: `visual`, `audio`, `transcription`, `text`, `fused` - `embedding_scope` (enum, optional, nullable) — The scope for which the embedding was generated. **Values**: - `clip`: Embedding for a segment. For video and audio input, one embedding per detected segment. - `page`: Embedding for one page of a document. The platform returns this value only for PDF files embedded asynchronously. - `asset`: Embedding for the entire file. For video and audio input, use this scope for content up to 10-30 seconds to maintain optimal performance. - `null`: For text embeddings and images embedded synchronously. When you request the `local` scope, the platform returns `clip` for audio and video, and `page` for PDF files. For audio, video, and document input, the `metadata.embedding_scopes` field contains the scopes you requested. - Allowed values: `clip`, `page`, `asset` - `start_sec` (double, optional, nullable) — The start time in seconds for this segment. This field is `null` for text and image embeddings. - `end_sec` (double, optional, nullable) — The end time in seconds for this segment. This field is `null` for text and image embeddings. - `start_page_number` (integer, optional, nullable) — The first page this embedding covers, counting from 1. The platform returns this field only for page-level embeddings of a PDF file, and `null` in every other case. - `end_page_number` (integer, optional, nullable) — The last page this embedding covers, counting from 1 and including that page. This field matches the `start_page_number` field when the embedding covers a single page. The platform returns this field only for page-level embeddings of a PDF file, and `null` in every other case. ### EmbeddingUsage Token counts for the request. Only Marengo 3.5 returns this object. - `input_tokens` (map from string to integer, required) — The number of tokens the request used. Each key names a type of content the request processed, and each value is the token count for that content. - `truncated` (boolean, required) — Whether the input was truncated to fit within the token limit. ### EmbeddingMediaMetadata Metadata for the media input. Available for the `image`, `text_image`, `audio`, `video`, and `multi_input` input types. - `input_type`: `image` (image) - `input_filename` (string, optional) — The name of the image file. - `input_url` (string, optional) — The publicly accessible URL for the image file. - `input_type`: `text_image` (text_image) - `input_filename` (string, optional) — The name of the image file. - `input_url` (string, optional) — The publicly accessible URL for the image file. - `input_type`: `audio` (audio) - `duration` (double, required) — The duration of the audio in seconds. - `embedding_options` (list of string, required) — The `embedding_option` values used to generate the embedding. - `embedding_scopes` (list of enum, required) — The `embedding_scope` values used to generate the embedding. - Allowed values: `clip`, `local`, `asset` - `end_offset_sec` (double, optional) — The end offset in seconds. - `input_filename` (string, optional) — The name of the audio file. - `input_url` (string, optional) — The publicly accessible URL for the audio file. - `start_offset_sec` (double, optional) — The start offset in seconds. - `input_type`: `video` (video) - `duration` (double, required) — The duration of the video in seconds. - `embedding_options` (list of string, required) — The `embedding_option` values used to generate the embedding. - `embedding_scopes` (list of enum, required) — The `embedding_scope` values used to generate the embedding. - Allowed values: `clip`, `local`, `asset` - `clip_length` (integer, optional) — Length of each video clip in seconds. Only available for fixed segmentation. - `end_offset_sec` (double, optional) — The end offset in seconds. - `input_filename` (string, optional) — The name of the video file. - `input_url` (string, optional) — The publicly accessible URL for the video file. - `start_offset_sec` (double, optional) — The start offset in seconds. - `input_type`: `multi_input` (multi_input) ### ErrorResponseError - `code` (string, required) — A string representing the code associated with the error. See the [Error codes](/v1.3/api-reference/error-codes) page for details. - `message` (string, required) — A human-readable string describing the error, intended to be suitable for display in a user interface. - `details` (map from string to any, optional) — Additional error details (optional) ### MediaSource An object specifying the source of the media file. You must provide exactly one of `url`, `base64_string`, or `asset_id`. - `base64_string` (string, optional) — The base64-encoded media data. The decoded file can be up to 36 MB; encoded, it can be up to 48 MB. - `url` (string, optional) — The publicly accessible URL of the media file. Use direct links to raw media files. Video hosting platforms and cloud storage sharing links are not supported. - `asset_id` (string, optional) — The unique identifier of an asset from a [direct](/v1.3/api-reference/upload-content/direct-uploads) or [multipart](/v1.3/api-reference/upload-content/multipart-uploads) upload. The asset status must be `ready`. Use the [Retrieve an asset](/v1.3/api-reference/upload-content/direct-uploads/retrieve) method to check the status. ### AudioSegmentation Specifies how the platform divides the audio into segments. - `strategy` ("fixed", required) - `fixed` (AudioSegmentationFixed, required) — Configuration for fixed segmentation. This object is required when the `strategy` field is `fixed`. ### VideoSegmentation Specifies how the platform divides the video into segments. The `strategy` field selects one variant: - `strategy: fixed` - Creates segments of equal, predetermined length. Use this for consistent timing. - `strategy: dynamic` - Creates segments of variable length that align with scene boundaries. Use this for content-aware segmentation. - `strategy`: `dynamic` (dynamic) - `dynamic` (VideoSegmentationDiscriminatorMappingDynamicDynamic, required) — Configuration for dynamic segmentation. This object is required when `strategy` is `dynamic`. - `strategy`: `fixed` (fixed) - `fixed` (VideoSegmentationDiscriminatorMappingFixedFixed, required) — Configuration for fixed segmentation. This object is required when `strategy` is `fixed`. ### MultiInputMediaSource An object specifying a media source for multi-input embeddings. You must provide exactly one of `url`, `base64_string`, or `asset_id`. With Marengo 3.5, each media source can be up to 32 MB, whichever of the three fields you use. Audio and video can be up to 30 seconds. Content above either limit returns a `400` error. - `media_type` (enum, required) — The type of media. **Values**: - `image`: An image file. Works with both Marengo 3.0 and Marengo 3.5. - `video`: A video file. Requires Marengo 3.5. - `audio`: An audio file. Requires Marengo 3.5. - Allowed values: `image`, `video`, `audio` - `name` (string, optional) — The unique identifier for this media source. This field is required when `input_text` references this media source. - `url` (string, optional) — The publicly accessible URL of the media file. Use direct links to raw files. Media hosting platforms and cloud storage sharing links are not supported. - `base64_string` (string, optional) — The base64-encoded media data. - `asset_id` (string, optional) — The unique identifier of an asset from a [direct](/v1.3/api-reference/upload-content) or [multipart](/v1.3/api-reference/upload-content/multipart-uploads) upload. ### AudioSegmentationFixed Configuration for fixed segmentation. This object is required when the `strategy` field is `fixed`. - `duration_sec` (integer, required) — The duration in seconds for each segment. The platform divides the audio into segments of this exact length. The final segment may be shorter if the audio duration is not evenly divisible. **Min**: `2`. **Max**: `10`. **Example**: With `duration_sec: 5`, a 12-second audio file produces segments: [0-5s], [5-10s], [10-12s]. ### VideoSegmentationDiscriminatorMappingDynamicDynamic Configuration for dynamic segmentation. This object is required when `strategy` is `dynamic`. - `min_duration_sec` (integer, required) — The minimum duration in seconds for each segment. The platform divides the video into segments that are at least this long. Segments adapt to scene changes and content boundaries and may be longer than the minimum. **Min**: `2`. **Max**: `5`. **Example**: With `min_duration_sec: 3`, segments might be: [0-3.2s], [3.2-7.8s], [7.8-12.1s] ### VideoSegmentationDiscriminatorMappingFixedFixed Configuration for fixed segmentation. This object is required when `strategy` is `fixed`. - `duration_sec` (integer, required) — The duration in seconds for each segment. The platform divides the video into segments of this exact length. The final segment may be shorter if the video duration is not evenly divisible. **Min**: `2`. **Max**: `10`. **Example**: With `duration_sec: 5`, a 12-second video produces segments: [0-5s], [5-10s], [10-12s]. ## Examples ### Text embedding response **Response** ```json { "data": [ { "embedding": [ 0.111, 0.234, -0.567, 0.89 ] } ] } ``` **SDK Code** ```python Text embedding response import requests url = "https://api.twelvelabs.io/v1.3/embed-v2" headers = {"x-api-key": ""} response = requests.post(url, headers=headers) print(response.json()) ``` ```javascript Text embedding response const url = 'https://api.twelvelabs.io/v1.3/embed-v2'; const options = {method: 'POST', headers: {'x-api-key': ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Text embedding response package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2" req, _ := http.NewRequest("POST", url, nil) req.Header.Add("x-api-key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Text embedding response require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' response = http.request(request) puts response.read_body ``` ```java Text embedding response import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2") .header("x-api-key", "") .asString(); ``` ```php Text embedding response request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2', [ 'headers' => [ 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Text embedding response using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); IRestResponse response = client.Execute(request); ``` ```swift Text embedding response import Foundation let headers = ["x-api-key": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Video clip embedding response **Response** ```json { "data": [ { "embedding": [ 0.123, -0.456, 0.789, 0.012 ], "embedding_option": "visual", "embedding_scope": "clip", "start_sec": 0, "end_sec": 4.2 }, { "embedding": [ 0.234, 0.567, -0.89, 0.123 ], "embedding_option": "audio", "embedding_scope": "clip", "start_sec": 0, "end_sec": 4.2 }, { "embedding": [ 0.345, -0.678, 0.901, 0.234 ], "embedding_option": "transcription", "embedding_scope": "clip", "start_sec": 0, "end_sec": 4.2 } ] } ``` **SDK Code** ```python Video clip embedding response import requests url = "https://api.twelvelabs.io/v1.3/embed-v2" headers = {"x-api-key": ""} response = requests.post(url, headers=headers) print(response.json()) ``` ```javascript Video clip embedding response const url = 'https://api.twelvelabs.io/v1.3/embed-v2'; const options = {method: 'POST', headers: {'x-api-key': ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Video clip embedding response package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2" req, _ := http.NewRequest("POST", url, nil) req.Header.Add("x-api-key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Video clip embedding response require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' response = http.request(request) puts response.read_body ``` ```java Video clip embedding response import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2") .header("x-api-key", "") .asString(); ``` ```php Video clip embedding response request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2', [ 'headers' => [ 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Video clip embedding response using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); IRestResponse response = client.Execute(request); ``` ```swift Video clip embedding response import Foundation let headers = ["x-api-key": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Audio asset embedding response **Response** ```json { "data": [ { "embedding": [ 0.345, -0.678, 0.901, 0.234 ], "embedding_option": "audio", "embedding_scope": "asset", "start_sec": 0, "end_sec": 6 }, { "embedding": [ 0.123, -0.456, 0.789, 0.012 ], "embedding_option": "transcription", "embedding_scope": "asset", "start_sec": 0, "end_sec": 6 } ] } ``` **SDK Code** ```python Audio asset embedding response import requests url = "https://api.twelvelabs.io/v1.3/embed-v2" headers = {"x-api-key": ""} response = requests.post(url, headers=headers) print(response.json()) ``` ```javascript Audio asset embedding response const url = 'https://api.twelvelabs.io/v1.3/embed-v2'; const options = {method: 'POST', headers: {'x-api-key': ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Audio asset embedding response package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2" req, _ := http.NewRequest("POST", url, nil) req.Header.Add("x-api-key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Audio asset embedding response require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' response = http.request(request) puts response.read_body ``` ```java Audio asset embedding response import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2") .header("x-api-key", "") .asString(); ``` ```php Audio asset embedding response request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2', [ 'headers' => [ 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Audio asset embedding response using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); IRestResponse response = client.Execute(request); ``` ```swift Audio asset embedding response import Foundation let headers = ["x-api-key": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Video with fused embedding response **Response** ```json { "data": [ { "embedding": [ 0.123, -0.456, 0.789, 0.012 ], "embedding_option": "visual", "embedding_scope": "clip", "start_sec": 0, "end_sec": 4.2 }, { "embedding": [ 0.234, 0.567, -0.89, 0.123 ], "embedding_option": "audio", "embedding_scope": "clip", "start_sec": 0, "end_sec": 4.2 }, { "embedding": [ 0.456, 0.789, -0.123, 0.567 ], "embedding_option": "fused", "embedding_scope": "clip", "start_sec": 0, "end_sec": 4.2 } ] } ``` **SDK Code** ```python Video with fused embedding response import requests url = "https://api.twelvelabs.io/v1.3/embed-v2" headers = {"x-api-key": ""} response = requests.post(url, headers=headers) print(response.json()) ``` ```javascript Video with fused embedding response const url = 'https://api.twelvelabs.io/v1.3/embed-v2'; const options = {method: 'POST', headers: {'x-api-key': ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Video with fused embedding response package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2" req, _ := http.NewRequest("POST", url, nil) req.Header.Add("x-api-key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Video with fused embedding response require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' response = http.request(request) puts response.read_body ``` ```java Video with fused embedding response import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2") .header("x-api-key", "") .asString(); ``` ```php Video with fused embedding response request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2', [ 'headers' => [ 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Video with fused embedding response using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); IRestResponse response = client.Execute(request); ``` ```swift Video with fused embedding response import Foundation let headers = ["x-api-key": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Multi-input embedding response **Response** ```json { "data": [ { "embedding": [ 0.123, -0.456, 0.789, 0.012 ] } ] } ``` **SDK Code** ```python Multi-input embedding response import requests url = "https://api.twelvelabs.io/v1.3/embed-v2" headers = {"x-api-key": ""} response = requests.post(url, headers=headers) print(response.json()) ``` ```javascript Multi-input embedding response const url = 'https://api.twelvelabs.io/v1.3/embed-v2'; const options = {method: 'POST', headers: {'x-api-key': ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Multi-input embedding response package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2" req, _ := http.NewRequest("POST", url, nil) req.Header.Add("x-api-key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Multi-input embedding response require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' response = http.request(request) puts response.read_body ``` ```java Multi-input embedding response import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2") .header("x-api-key", "") .asString(); ``` ```php Multi-input embedding response request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2', [ 'headers' => [ 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Multi-input embedding response using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); IRestResponse response = client.Execute(request); ``` ```swift Multi-input embedding response import Foundation let headers = ["x-api-key": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Multi-input response with embedding uncertainty and token counts **Response** ```json { "data": [ { "embedding": [ 0.33, -0.12, 0.78, 0.29 ], "embedding_uncertainty": [ 0.005, 0.018, 0.002, 0.011 ] } ], "usage": { "input_tokens": { "image": 1000 }, "truncated": false } } ``` **SDK Code** ```python Multi-input response with embedding uncertainty and token counts import requests url = "https://api.twelvelabs.io/v1.3/embed-v2" headers = {"x-api-key": ""} response = requests.post(url, headers=headers) print(response.json()) ``` ```javascript Multi-input response with embedding uncertainty and token counts const url = 'https://api.twelvelabs.io/v1.3/embed-v2'; const options = {method: 'POST', headers: {'x-api-key': ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Multi-input response with embedding uncertainty and token counts package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2" req, _ := http.NewRequest("POST", url, nil) req.Header.Add("x-api-key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Multi-input response with embedding uncertainty and token counts require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' response = http.request(request) puts response.read_body ``` ```java Multi-input response with embedding uncertainty and token counts import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2") .header("x-api-key", "") .asString(); ``` ```php Multi-input response with embedding uncertainty and token counts request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2', [ 'headers' => [ 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Multi-input response with embedding uncertainty and token counts using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); IRestResponse response = client.Execute(request); ``` ```swift Multi-input response with embedding uncertainty and token counts import Foundation let headers = ["x-api-key": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.5: text **Request** ```json { "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": { "input_text": "man walking a dog" } } ``` **Response** ```json { "data": [ { "embedding": [ 0.111, 0.234, -0.567, 0.89 ] } ] } ``` **SDK Code** ```python Marengo 3.5: text import requests url = "https://api.twelvelabs.io/v1.3/embed-v2" payload = { "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": { "input_text": "man walking a dog" } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.5: text const url = 'https://api.twelvelabs.io/v1.3/embed-v2'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"multi_input","model_name":"marengo3.5","multi_input":{"input_text":"man walking a dog"}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.5: text package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2" payload := strings.NewReader("{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"input_text\": \"man walking a dog\"\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.5: text require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"input_text\": \"man walking a dog\"\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.5: text import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"input_text\": \"man walking a dog\"\n }\n}") .asString(); ``` ```php Marengo 3.5: text request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2', [ 'body' => '{ "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": { "input_text": "man walking a dog" } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.5: text using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"input_text\": \"man walking a dog\"\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.5: text import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": ["input_text": "man walking a dog"] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.5: image via publicly accessible URL **Request** ```json { "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": { "media_sources": [ { "media_type": "image", "url": "https://user-bucket.com/folder/dog.jpg" } ] } } ``` **Response** ```json { "data": [ { "embedding": [ 0.111, 0.234, -0.567, 0.89 ] } ] } ``` **SDK Code** ```python Marengo 3.5: image via publicly accessible URL import requests url = "https://api.twelvelabs.io/v1.3/embed-v2" payload = { "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": { "media_sources": [ { "media_type": "image", "url": "https://user-bucket.com/folder/dog.jpg" } ] } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.5: image via publicly accessible URL const url = 'https://api.twelvelabs.io/v1.3/embed-v2'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"multi_input","model_name":"marengo3.5","multi_input":{"media_sources":[{"media_type":"image","url":"https://user-bucket.com/folder/dog.jpg"}]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.5: image via publicly accessible URL package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2" payload := strings.NewReader("{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"media_sources\": [\n {\n \"media_type\": \"image\",\n \"url\": \"https://user-bucket.com/folder/dog.jpg\"\n }\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.5: image via publicly accessible URL require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"media_sources\": [\n {\n \"media_type\": \"image\",\n \"url\": \"https://user-bucket.com/folder/dog.jpg\"\n }\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.5: image via publicly accessible URL import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"media_sources\": [\n {\n \"media_type\": \"image\",\n \"url\": \"https://user-bucket.com/folder/dog.jpg\"\n }\n ]\n }\n}") .asString(); ``` ```php Marengo 3.5: image via publicly accessible URL request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2', [ 'body' => '{ "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": { "media_sources": [ { "media_type": "image", "url": "https://user-bucket.com/folder/dog.jpg" } ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.5: image via publicly accessible URL using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"media_sources\": [\n {\n \"media_type\": \"image\",\n \"url\": \"https://user-bucket.com/folder/dog.jpg\"\n }\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.5: image via publicly accessible URL import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": ["media_sources": [ [ "media_type": "image", "url": "https://user-bucket.com/folder/dog.jpg" ] ]] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.5: image with asset id **Request** ```json { "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": { "media_sources": [ { "media_type": "image", "asset_id": "1234567890" } ] } } ``` **Response** ```json { "data": [ { "embedding": [ 0.111, 0.234, -0.567, 0.89 ] } ] } ``` **SDK Code** ```python Marengo 3.5: image with asset id import requests url = "https://api.twelvelabs.io/v1.3/embed-v2" payload = { "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": { "media_sources": [ { "media_type": "image", "asset_id": "1234567890" } ] } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.5: image with asset id const url = 'https://api.twelvelabs.io/v1.3/embed-v2'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"multi_input","model_name":"marengo3.5","multi_input":{"media_sources":[{"media_type":"image","asset_id":"1234567890"}]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.5: image with asset id package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2" payload := strings.NewReader("{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"media_sources\": [\n {\n \"media_type\": \"image\",\n \"asset_id\": \"1234567890\"\n }\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.5: image with asset id require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"media_sources\": [\n {\n \"media_type\": \"image\",\n \"asset_id\": \"1234567890\"\n }\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.5: image with asset id import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"media_sources\": [\n {\n \"media_type\": \"image\",\n \"asset_id\": \"1234567890\"\n }\n ]\n }\n}") .asString(); ``` ```php Marengo 3.5: image with asset id request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2', [ 'body' => '{ "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": { "media_sources": [ { "media_type": "image", "asset_id": "1234567890" } ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.5: image with asset id using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"media_sources\": [\n {\n \"media_type\": \"image\",\n \"asset_id\": \"1234567890\"\n }\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.5: image with asset id import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": ["media_sources": [ [ "media_type": "image", "asset_id": "1234567890" ] ]] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.5: text and image combined into one embedding **Request** ```json { "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": { "input_text": "man walking a dog", "media_sources": [ { "media_type": "image", "url": "https://user-bucket.com/folder/dog.jpg" } ] } } ``` **Response** ```json { "data": [ { "embedding": [ 0.111, 0.234, -0.567, 0.89 ] } ] } ``` **SDK Code** ```python Marengo 3.5: text and image combined into one embedding import requests url = "https://api.twelvelabs.io/v1.3/embed-v2" payload = { "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": { "input_text": "man walking a dog", "media_sources": [ { "media_type": "image", "url": "https://user-bucket.com/folder/dog.jpg" } ] } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.5: text and image combined into one embedding const url = 'https://api.twelvelabs.io/v1.3/embed-v2'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"multi_input","model_name":"marengo3.5","multi_input":{"input_text":"man walking a dog","media_sources":[{"media_type":"image","url":"https://user-bucket.com/folder/dog.jpg"}]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.5: text and image combined into one embedding package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2" payload := strings.NewReader("{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"input_text\": \"man walking a dog\",\n \"media_sources\": [\n {\n \"media_type\": \"image\",\n \"url\": \"https://user-bucket.com/folder/dog.jpg\"\n }\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.5: text and image combined into one embedding require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"input_text\": \"man walking a dog\",\n \"media_sources\": [\n {\n \"media_type\": \"image\",\n \"url\": \"https://user-bucket.com/folder/dog.jpg\"\n }\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.5: text and image combined into one embedding import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"input_text\": \"man walking a dog\",\n \"media_sources\": [\n {\n \"media_type\": \"image\",\n \"url\": \"https://user-bucket.com/folder/dog.jpg\"\n }\n ]\n }\n}") .asString(); ``` ```php Marengo 3.5: text and image combined into one embedding request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2', [ 'body' => '{ "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": { "input_text": "man walking a dog", "media_sources": [ { "media_type": "image", "url": "https://user-bucket.com/folder/dog.jpg" } ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.5: text and image combined into one embedding using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"input_text\": \"man walking a dog\",\n \"media_sources\": [\n {\n \"media_type\": \"image\",\n \"url\": \"https://user-bucket.com/folder/dog.jpg\"\n }\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.5: text and image combined into one embedding import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": [ "input_text": "man walking a dog", "media_sources": [ [ "media_type": "image", "url": "https://user-bucket.com/folder/dog.jpg" ] ] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.5: audio **Request** ```json { "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": { "media_sources": [ { "media_type": "audio", "url": "https://user-bucket.com/audio/a.wav" } ] } } ``` **Response** ```json { "data": [ { "embedding": [ 0.111, 0.234, -0.567, 0.89 ] } ] } ``` **SDK Code** ```python Marengo 3.5: audio import requests url = "https://api.twelvelabs.io/v1.3/embed-v2" payload = { "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": { "media_sources": [ { "media_type": "audio", "url": "https://user-bucket.com/audio/a.wav" } ] } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.5: audio const url = 'https://api.twelvelabs.io/v1.3/embed-v2'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"multi_input","model_name":"marengo3.5","multi_input":{"media_sources":[{"media_type":"audio","url":"https://user-bucket.com/audio/a.wav"}]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.5: audio package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2" payload := strings.NewReader("{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"media_sources\": [\n {\n \"media_type\": \"audio\",\n \"url\": \"https://user-bucket.com/audio/a.wav\"\n }\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.5: audio require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"media_sources\": [\n {\n \"media_type\": \"audio\",\n \"url\": \"https://user-bucket.com/audio/a.wav\"\n }\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.5: audio import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"media_sources\": [\n {\n \"media_type\": \"audio\",\n \"url\": \"https://user-bucket.com/audio/a.wav\"\n }\n ]\n }\n}") .asString(); ``` ```php Marengo 3.5: audio request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2', [ 'body' => '{ "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": { "media_sources": [ { "media_type": "audio", "url": "https://user-bucket.com/audio/a.wav" } ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.5: audio using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"media_sources\": [\n {\n \"media_type\": \"audio\",\n \"url\": \"https://user-bucket.com/audio/a.wav\"\n }\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.5: audio import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": ["media_sources": [ [ "media_type": "audio", "url": "https://user-bucket.com/audio/a.wav" ] ]] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.5: video **Request** ```json { "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": { "media_sources": [ { "media_type": "video", "url": "https://user-bucket.com/video/clip.mp4" } ] } } ``` **Response** ```json { "data": [ { "embedding": [ 0.111, 0.234, -0.567, 0.89 ] } ] } ``` **SDK Code** ```python Marengo 3.5: video import requests url = "https://api.twelvelabs.io/v1.3/embed-v2" payload = { "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": { "media_sources": [ { "media_type": "video", "url": "https://user-bucket.com/video/clip.mp4" } ] } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.5: video const url = 'https://api.twelvelabs.io/v1.3/embed-v2'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"multi_input","model_name":"marengo3.5","multi_input":{"media_sources":[{"media_type":"video","url":"https://user-bucket.com/video/clip.mp4"}]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.5: video package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2" payload := strings.NewReader("{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"media_sources\": [\n {\n \"media_type\": \"video\",\n \"url\": \"https://user-bucket.com/video/clip.mp4\"\n }\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.5: video require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"media_sources\": [\n {\n \"media_type\": \"video\",\n \"url\": \"https://user-bucket.com/video/clip.mp4\"\n }\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.5: video import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"media_sources\": [\n {\n \"media_type\": \"video\",\n \"url\": \"https://user-bucket.com/video/clip.mp4\"\n }\n ]\n }\n}") .asString(); ``` ```php Marengo 3.5: video request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2', [ 'body' => '{ "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": { "media_sources": [ { "media_type": "video", "url": "https://user-bucket.com/video/clip.mp4" } ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.5: video using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"media_sources\": [\n {\n \"media_type\": \"video\",\n \"url\": \"https://user-bucket.com/video/clip.mp4\"\n }\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.5: video import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": ["media_sources": [ [ "media_type": "video", "url": "https://user-bucket.com/video/clip.mp4" ] ]] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.5: multiple images without text placeholders **Request** ```json { "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": { "input_text": "A person cooking in the kitchen", "media_sources": [ { "media_type": "image", "url": "https://user-bucket.com/images/person.jpg" }, { "media_type": "image", "url": "https://user-bucket.com/images/kitchen.jpg" } ] } } ``` **Response** ```json { "data": [ { "embedding": [ 0.111, 0.234, -0.567, 0.89 ] } ] } ``` **SDK Code** ```python Marengo 3.5: multiple images without text placeholders import requests url = "https://api.twelvelabs.io/v1.3/embed-v2" payload = { "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": { "input_text": "A person cooking in the kitchen", "media_sources": [ { "media_type": "image", "url": "https://user-bucket.com/images/person.jpg" }, { "media_type": "image", "url": "https://user-bucket.com/images/kitchen.jpg" } ] } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.5: multiple images without text placeholders const url = 'https://api.twelvelabs.io/v1.3/embed-v2'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"multi_input","model_name":"marengo3.5","multi_input":{"input_text":"A person cooking in the kitchen","media_sources":[{"media_type":"image","url":"https://user-bucket.com/images/person.jpg"},{"media_type":"image","url":"https://user-bucket.com/images/kitchen.jpg"}]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.5: multiple images without text placeholders package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2" payload := strings.NewReader("{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"input_text\": \"A person cooking in the kitchen\",\n \"media_sources\": [\n {\n \"media_type\": \"image\",\n \"url\": \"https://user-bucket.com/images/person.jpg\"\n },\n {\n \"media_type\": \"image\",\n \"url\": \"https://user-bucket.com/images/kitchen.jpg\"\n }\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.5: multiple images without text placeholders require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"input_text\": \"A person cooking in the kitchen\",\n \"media_sources\": [\n {\n \"media_type\": \"image\",\n \"url\": \"https://user-bucket.com/images/person.jpg\"\n },\n {\n \"media_type\": \"image\",\n \"url\": \"https://user-bucket.com/images/kitchen.jpg\"\n }\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.5: multiple images without text placeholders import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"input_text\": \"A person cooking in the kitchen\",\n \"media_sources\": [\n {\n \"media_type\": \"image\",\n \"url\": \"https://user-bucket.com/images/person.jpg\"\n },\n {\n \"media_type\": \"image\",\n \"url\": \"https://user-bucket.com/images/kitchen.jpg\"\n }\n ]\n }\n}") .asString(); ``` ```php Marengo 3.5: multiple images without text placeholders request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2', [ 'body' => '{ "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": { "input_text": "A person cooking in the kitchen", "media_sources": [ { "media_type": "image", "url": "https://user-bucket.com/images/person.jpg" }, { "media_type": "image", "url": "https://user-bucket.com/images/kitchen.jpg" } ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.5: multiple images without text placeholders using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"input_text\": \"A person cooking in the kitchen\",\n \"media_sources\": [\n {\n \"media_type\": \"image\",\n \"url\": \"https://user-bucket.com/images/person.jpg\"\n },\n {\n \"media_type\": \"image\",\n \"url\": \"https://user-bucket.com/images/kitchen.jpg\"\n }\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.5: multiple images without text placeholders import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": [ "input_text": "A person cooking in the kitchen", "media_sources": [ [ "media_type": "image", "url": "https://user-bucket.com/images/person.jpg" ], [ "media_type": "image", "url": "https://user-bucket.com/images/kitchen.jpg" ] ] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.5: multiple images with text placeholders **Request** ```json { "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": { "input_text": "A person wearing <@outfit> and holding <@accessory>", "media_sources": [ { "media_type": "image", "name": "outfit", "url": "https://user-bucket.com/images/outfit.jpg" }, { "media_type": "image", "name": "accessory", "url": "https://user-bucket.com/images/accessory.jpg" } ] } } ``` **Response** ```json { "data": [ { "embedding": [ 0.111, 0.234, -0.567, 0.89 ] } ] } ``` **SDK Code** ```python Marengo 3.5: multiple images with text placeholders import requests url = "https://api.twelvelabs.io/v1.3/embed-v2" payload = { "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": { "input_text": "A person wearing <@outfit> and holding <@accessory>", "media_sources": [ { "media_type": "image", "name": "outfit", "url": "https://user-bucket.com/images/outfit.jpg" }, { "media_type": "image", "name": "accessory", "url": "https://user-bucket.com/images/accessory.jpg" } ] } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.5: multiple images with text placeholders const url = 'https://api.twelvelabs.io/v1.3/embed-v2'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"multi_input","model_name":"marengo3.5","multi_input":{"input_text":"A person wearing <@outfit> and holding <@accessory>","media_sources":[{"media_type":"image","name":"outfit","url":"https://user-bucket.com/images/outfit.jpg"},{"media_type":"image","name":"accessory","url":"https://user-bucket.com/images/accessory.jpg"}]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.5: multiple images with text placeholders package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2" payload := strings.NewReader("{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"input_text\": \"A person wearing <@outfit> and holding <@accessory>\",\n \"media_sources\": [\n {\n \"media_type\": \"image\",\n \"name\": \"outfit\",\n \"url\": \"https://user-bucket.com/images/outfit.jpg\"\n },\n {\n \"media_type\": \"image\",\n \"name\": \"accessory\",\n \"url\": \"https://user-bucket.com/images/accessory.jpg\"\n }\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.5: multiple images with text placeholders require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"input_text\": \"A person wearing <@outfit> and holding <@accessory>\",\n \"media_sources\": [\n {\n \"media_type\": \"image\",\n \"name\": \"outfit\",\n \"url\": \"https://user-bucket.com/images/outfit.jpg\"\n },\n {\n \"media_type\": \"image\",\n \"name\": \"accessory\",\n \"url\": \"https://user-bucket.com/images/accessory.jpg\"\n }\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.5: multiple images with text placeholders import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"input_text\": \"A person wearing <@outfit> and holding <@accessory>\",\n \"media_sources\": [\n {\n \"media_type\": \"image\",\n \"name\": \"outfit\",\n \"url\": \"https://user-bucket.com/images/outfit.jpg\"\n },\n {\n \"media_type\": \"image\",\n \"name\": \"accessory\",\n \"url\": \"https://user-bucket.com/images/accessory.jpg\"\n }\n ]\n }\n}") .asString(); ``` ```php Marengo 3.5: multiple images with text placeholders request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2', [ 'body' => '{ "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": { "input_text": "A person wearing <@outfit> and holding <@accessory>", "media_sources": [ { "media_type": "image", "name": "outfit", "url": "https://user-bucket.com/images/outfit.jpg" }, { "media_type": "image", "name": "accessory", "url": "https://user-bucket.com/images/accessory.jpg" } ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.5: multiple images with text placeholders using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"multi_input\",\n \"model_name\": \"marengo3.5\",\n \"multi_input\": {\n \"input_text\": \"A person wearing <@outfit> and holding <@accessory>\",\n \"media_sources\": [\n {\n \"media_type\": \"image\",\n \"name\": \"outfit\",\n \"url\": \"https://user-bucket.com/images/outfit.jpg\"\n },\n {\n \"media_type\": \"image\",\n \"name\": \"accessory\",\n \"url\": \"https://user-bucket.com/images/accessory.jpg\"\n }\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.5: multiple images with text placeholders import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "multi_input", "model_name": "marengo3.5", "multi_input": [ "input_text": "A person wearing <@outfit> and holding <@accessory>", "media_sources": [ [ "media_type": "image", "name": "outfit", "url": "https://user-bucket.com/images/outfit.jpg" ], [ "media_type": "image", "name": "accessory", "url": "https://user-bucket.com/images/accessory.jpg" ] ] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.0: text **Request** ```json { "input_type": "text", "model_name": "marengo3.0", "text": { "input_text": "man walking a dog" } } ``` **Response** ```json { "data": [ { "embedding": [ 0.111, 0.234, -0.567, 0.89 ] } ] } ``` **SDK Code** ```python Marengo 3.0: text import requests url = "https://api.twelvelabs.io/v1.3/embed-v2" payload = { "input_type": "text", "model_name": "marengo3.0", "text": { "input_text": "man walking a dog" } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.0: text const url = 'https://api.twelvelabs.io/v1.3/embed-v2'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"text","model_name":"marengo3.0","text":{"input_text":"man walking a dog"}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.0: text package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2" payload := strings.NewReader("{\n \"input_type\": \"text\",\n \"model_name\": \"marengo3.0\",\n \"text\": {\n \"input_text\": \"man walking a dog\"\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.0: text require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"text\",\n \"model_name\": \"marengo3.0\",\n \"text\": {\n \"input_text\": \"man walking a dog\"\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.0: text import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"text\",\n \"model_name\": \"marengo3.0\",\n \"text\": {\n \"input_text\": \"man walking a dog\"\n }\n}") .asString(); ``` ```php Marengo 3.0: text request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2', [ 'body' => '{ "input_type": "text", "model_name": "marengo3.0", "text": { "input_text": "man walking a dog" } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.0: text using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"text\",\n \"model_name\": \"marengo3.0\",\n \"text\": {\n \"input_text\": \"man walking a dog\"\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.0: text import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "text", "model_name": "marengo3.0", "text": ["input_text": "man walking a dog"] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.0: image via publicly accessible URL **Request** ```json { "input_type": "image", "model_name": "marengo3.0", "image": { "media_source": { "url": "https://user-bucket.com/folder/dog.jpg" } } } ``` **Response** ```json { "data": [ { "embedding": [ 0.111, 0.234, -0.567, 0.89 ] } ] } ``` **SDK Code** ```python Marengo 3.0: image via publicly accessible URL import requests url = "https://api.twelvelabs.io/v1.3/embed-v2" payload = { "input_type": "image", "model_name": "marengo3.0", "image": { "media_source": { "url": "https://user-bucket.com/folder/dog.jpg" } } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.0: image via publicly accessible URL const url = 'https://api.twelvelabs.io/v1.3/embed-v2'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"image","model_name":"marengo3.0","image":{"media_source":{"url":"https://user-bucket.com/folder/dog.jpg"}}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.0: image via publicly accessible URL package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2" payload := strings.NewReader("{\n \"input_type\": \"image\",\n \"model_name\": \"marengo3.0\",\n \"image\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/folder/dog.jpg\"\n }\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.0: image via publicly accessible URL require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"image\",\n \"model_name\": \"marengo3.0\",\n \"image\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/folder/dog.jpg\"\n }\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.0: image via publicly accessible URL import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"image\",\n \"model_name\": \"marengo3.0\",\n \"image\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/folder/dog.jpg\"\n }\n }\n}") .asString(); ``` ```php Marengo 3.0: image via publicly accessible URL request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2', [ 'body' => '{ "input_type": "image", "model_name": "marengo3.0", "image": { "media_source": { "url": "https://user-bucket.com/folder/dog.jpg" } } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.0: image via publicly accessible URL using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"image\",\n \"model_name\": \"marengo3.0\",\n \"image\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/folder/dog.jpg\"\n }\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.0: image via publicly accessible URL import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "image", "model_name": "marengo3.0", "image": ["media_source": ["url": "https://user-bucket.com/folder/dog.jpg"]] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.0: image with asset id **Request** ```json { "input_type": "image", "model_name": "marengo3.0", "image": { "media_source": { "asset_id": "1234567890" } } } ``` **Response** ```json { "data": [ { "embedding": [ 0.111, 0.234, -0.567, 0.89 ] } ] } ``` **SDK Code** ```python Marengo 3.0: image with asset id import requests url = "https://api.twelvelabs.io/v1.3/embed-v2" payload = { "input_type": "image", "model_name": "marengo3.0", "image": { "media_source": { "asset_id": "1234567890" } } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.0: image with asset id const url = 'https://api.twelvelabs.io/v1.3/embed-v2'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"image","model_name":"marengo3.0","image":{"media_source":{"asset_id":"1234567890"}}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.0: image with asset id package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2" payload := strings.NewReader("{\n \"input_type\": \"image\",\n \"model_name\": \"marengo3.0\",\n \"image\": {\n \"media_source\": {\n \"asset_id\": \"1234567890\"\n }\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.0: image with asset id require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"image\",\n \"model_name\": \"marengo3.0\",\n \"image\": {\n \"media_source\": {\n \"asset_id\": \"1234567890\"\n }\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.0: image with asset id import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"image\",\n \"model_name\": \"marengo3.0\",\n \"image\": {\n \"media_source\": {\n \"asset_id\": \"1234567890\"\n }\n }\n}") .asString(); ``` ```php Marengo 3.0: image with asset id request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2', [ 'body' => '{ "input_type": "image", "model_name": "marengo3.0", "image": { "media_source": { "asset_id": "1234567890" } } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.0: image with asset id using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"image\",\n \"model_name\": \"marengo3.0\",\n \"image\": {\n \"media_source\": {\n \"asset_id\": \"1234567890\"\n }\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.0: image with asset id import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "image", "model_name": "marengo3.0", "image": ["media_source": ["asset_id": "1234567890"]] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.0: text and image via publicly accessible URL **Request** ```json { "input_type": "text_image", "model_name": "marengo3.0", "text_image": { "media_source": { "url": "https://user-bucket.com/folder/dog.jpg" }, "input_text": "man walking a dog" } } ``` **Response** ```json { "data": [ { "embedding": [ 0.111, 0.234, -0.567, 0.89 ] } ] } ``` **SDK Code** ```python Marengo 3.0: text and image via publicly accessible URL import requests url = "https://api.twelvelabs.io/v1.3/embed-v2" payload = { "input_type": "text_image", "model_name": "marengo3.0", "text_image": { "media_source": { "url": "https://user-bucket.com/folder/dog.jpg" }, "input_text": "man walking a dog" } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.0: text and image via publicly accessible URL const url = 'https://api.twelvelabs.io/v1.3/embed-v2'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"text_image","model_name":"marengo3.0","text_image":{"media_source":{"url":"https://user-bucket.com/folder/dog.jpg"},"input_text":"man walking a dog"}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.0: text and image via publicly accessible URL package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2" payload := strings.NewReader("{\n \"input_type\": \"text_image\",\n \"model_name\": \"marengo3.0\",\n \"text_image\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/folder/dog.jpg\"\n },\n \"input_text\": \"man walking a dog\"\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.0: text and image via publicly accessible URL require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"text_image\",\n \"model_name\": \"marengo3.0\",\n \"text_image\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/folder/dog.jpg\"\n },\n \"input_text\": \"man walking a dog\"\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.0: text and image via publicly accessible URL import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"text_image\",\n \"model_name\": \"marengo3.0\",\n \"text_image\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/folder/dog.jpg\"\n },\n \"input_text\": \"man walking a dog\"\n }\n}") .asString(); ``` ```php Marengo 3.0: text and image via publicly accessible URL request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2', [ 'body' => '{ "input_type": "text_image", "model_name": "marengo3.0", "text_image": { "media_source": { "url": "https://user-bucket.com/folder/dog.jpg" }, "input_text": "man walking a dog" } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.0: text and image via publicly accessible URL using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"text_image\",\n \"model_name\": \"marengo3.0\",\n \"text_image\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/folder/dog.jpg\"\n },\n \"input_text\": \"man walking a dog\"\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.0: text and image via publicly accessible URL import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "text_image", "model_name": "marengo3.0", "text_image": [ "media_source": ["url": "https://user-bucket.com/folder/dog.jpg"], "input_text": "man walking a dog" ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.0: audio with fixed segmentation **Request** ```json { "input_type": "audio", "model_name": "marengo3.0", "audio": { "media_source": { "url": "https://user-bucket.com/audio/a.wav" }, "start_sec": 0, "end_sec": 6, "segmentation": { "strategy": "fixed", "fixed": { "duration_sec": 6 } }, "embedding_option": [ "audio", "transcription" ], "embedding_scope": [ "clip", "asset" ] } } ``` **Response** ```json { "data": [ { "embedding": [ 0.111, 0.234, -0.567, 0.89 ] } ] } ``` **SDK Code** ```python Marengo 3.0: audio with fixed segmentation import requests url = "https://api.twelvelabs.io/v1.3/embed-v2" payload = { "input_type": "audio", "model_name": "marengo3.0", "audio": { "media_source": { "url": "https://user-bucket.com/audio/a.wav" }, "start_sec": 0, "end_sec": 6, "segmentation": { "strategy": "fixed", "fixed": { "duration_sec": 6 } }, "embedding_option": ["audio", "transcription"], "embedding_scope": ["clip", "asset"] } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.0: audio with fixed segmentation const url = 'https://api.twelvelabs.io/v1.3/embed-v2'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"audio","model_name":"marengo3.0","audio":{"media_source":{"url":"https://user-bucket.com/audio/a.wav"},"start_sec":0,"end_sec":6,"segmentation":{"strategy":"fixed","fixed":{"duration_sec":6}},"embedding_option":["audio","transcription"],"embedding_scope":["clip","asset"]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.0: audio with fixed segmentation package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2" payload := strings.NewReader("{\n \"input_type\": \"audio\",\n \"model_name\": \"marengo3.0\",\n \"audio\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/audio/a.wav\"\n },\n \"start_sec\": 0,\n \"end_sec\": 6,\n \"segmentation\": {\n \"strategy\": \"fixed\",\n \"fixed\": {\n \"duration_sec\": 6\n }\n },\n \"embedding_option\": [\n \"audio\",\n \"transcription\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.0: audio with fixed segmentation require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"audio\",\n \"model_name\": \"marengo3.0\",\n \"audio\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/audio/a.wav\"\n },\n \"start_sec\": 0,\n \"end_sec\": 6,\n \"segmentation\": {\n \"strategy\": \"fixed\",\n \"fixed\": {\n \"duration_sec\": 6\n }\n },\n \"embedding_option\": [\n \"audio\",\n \"transcription\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.0: audio with fixed segmentation import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"audio\",\n \"model_name\": \"marengo3.0\",\n \"audio\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/audio/a.wav\"\n },\n \"start_sec\": 0,\n \"end_sec\": 6,\n \"segmentation\": {\n \"strategy\": \"fixed\",\n \"fixed\": {\n \"duration_sec\": 6\n }\n },\n \"embedding_option\": [\n \"audio\",\n \"transcription\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ]\n }\n}") .asString(); ``` ```php Marengo 3.0: audio with fixed segmentation request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2', [ 'body' => '{ "input_type": "audio", "model_name": "marengo3.0", "audio": { "media_source": { "url": "https://user-bucket.com/audio/a.wav" }, "start_sec": 0, "end_sec": 6, "segmentation": { "strategy": "fixed", "fixed": { "duration_sec": 6 } }, "embedding_option": [ "audio", "transcription" ], "embedding_scope": [ "clip", "asset" ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.0: audio with fixed segmentation using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"audio\",\n \"model_name\": \"marengo3.0\",\n \"audio\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/audio/a.wav\"\n },\n \"start_sec\": 0,\n \"end_sec\": 6,\n \"segmentation\": {\n \"strategy\": \"fixed\",\n \"fixed\": {\n \"duration_sec\": 6\n }\n },\n \"embedding_option\": [\n \"audio\",\n \"transcription\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.0: audio with fixed segmentation import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "audio", "model_name": "marengo3.0", "audio": [ "media_source": ["url": "https://user-bucket.com/audio/a.wav"], "start_sec": 0, "end_sec": 6, "segmentation": [ "strategy": "fixed", "fixed": ["duration_sec": 6] ], "embedding_option": ["audio", "transcription"], "embedding_scope": ["clip", "asset"] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.0: audio with transcription embeddings only **Request** ```json { "input_type": "audio", "model_name": "marengo3.0", "audio": { "media_source": { "url": "https://user-bucket.com/audio/speech.wav" }, "embedding_option": [ "transcription" ], "embedding_scope": [ "asset" ] } } ``` **Response** ```json { "data": [ { "embedding": [ 0.111, 0.234, -0.567, 0.89 ] } ] } ``` **SDK Code** ```python Marengo 3.0: audio with transcription embeddings only import requests url = "https://api.twelvelabs.io/v1.3/embed-v2" payload = { "input_type": "audio", "model_name": "marengo3.0", "audio": { "media_source": { "url": "https://user-bucket.com/audio/speech.wav" }, "embedding_option": ["transcription"], "embedding_scope": ["asset"] } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.0: audio with transcription embeddings only const url = 'https://api.twelvelabs.io/v1.3/embed-v2'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"audio","model_name":"marengo3.0","audio":{"media_source":{"url":"https://user-bucket.com/audio/speech.wav"},"embedding_option":["transcription"],"embedding_scope":["asset"]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.0: audio with transcription embeddings only package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2" payload := strings.NewReader("{\n \"input_type\": \"audio\",\n \"model_name\": \"marengo3.0\",\n \"audio\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/audio/speech.wav\"\n },\n \"embedding_option\": [\n \"transcription\"\n ],\n \"embedding_scope\": [\n \"asset\"\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.0: audio with transcription embeddings only require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"audio\",\n \"model_name\": \"marengo3.0\",\n \"audio\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/audio/speech.wav\"\n },\n \"embedding_option\": [\n \"transcription\"\n ],\n \"embedding_scope\": [\n \"asset\"\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.0: audio with transcription embeddings only import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"audio\",\n \"model_name\": \"marengo3.0\",\n \"audio\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/audio/speech.wav\"\n },\n \"embedding_option\": [\n \"transcription\"\n ],\n \"embedding_scope\": [\n \"asset\"\n ]\n }\n}") .asString(); ``` ```php Marengo 3.0: audio with transcription embeddings only request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2', [ 'body' => '{ "input_type": "audio", "model_name": "marengo3.0", "audio": { "media_source": { "url": "https://user-bucket.com/audio/speech.wav" }, "embedding_option": [ "transcription" ], "embedding_scope": [ "asset" ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.0: audio with transcription embeddings only using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"audio\",\n \"model_name\": \"marengo3.0\",\n \"audio\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/audio/speech.wav\"\n },\n \"embedding_option\": [\n \"transcription\"\n ],\n \"embedding_scope\": [\n \"asset\"\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.0: audio with transcription embeddings only import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "audio", "model_name": "marengo3.0", "audio": [ "media_source": ["url": "https://user-bucket.com/audio/speech.wav"], "embedding_option": ["transcription"], "embedding_scope": ["asset"] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.0: video with dynamic segmentation **Request** ```json { "input_type": "video", "model_name": "marengo3.0", "video": { "media_source": { "url": "https://user-bucket.com/video/clip.mp4" }, "start_sec": 0, "end_sec": 12, "segmentation": { "strategy": "dynamic", "dynamic": { "min_duration_sec": 4 } }, "embedding_option": [ "visual", "audio", "transcription" ], "embedding_scope": [ "clip", "asset" ] } } ``` **Response** ```json { "data": [ { "embedding": [ 0.111, 0.234, -0.567, 0.89 ] } ] } ``` **SDK Code** ```python Marengo 3.0: video with dynamic segmentation import requests url = "https://api.twelvelabs.io/v1.3/embed-v2" payload = { "input_type": "video", "model_name": "marengo3.0", "video": { "media_source": { "url": "https://user-bucket.com/video/clip.mp4" }, "start_sec": 0, "end_sec": 12, "segmentation": { "strategy": "dynamic", "dynamic": { "min_duration_sec": 4 } }, "embedding_option": ["visual", "audio", "transcription"], "embedding_scope": ["clip", "asset"] } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.0: video with dynamic segmentation const url = 'https://api.twelvelabs.io/v1.3/embed-v2'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"video","model_name":"marengo3.0","video":{"media_source":{"url":"https://user-bucket.com/video/clip.mp4"},"start_sec":0,"end_sec":12,"segmentation":{"strategy":"dynamic","dynamic":{"min_duration_sec":4}},"embedding_option":["visual","audio","transcription"],"embedding_scope":["clip","asset"]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.0: video with dynamic segmentation package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2" payload := strings.NewReader("{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.0\",\n \"video\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/video/clip.mp4\"\n },\n \"start_sec\": 0,\n \"end_sec\": 12,\n \"segmentation\": {\n \"strategy\": \"dynamic\",\n \"dynamic\": {\n \"min_duration_sec\": 4\n }\n },\n \"embedding_option\": [\n \"visual\",\n \"audio\",\n \"transcription\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.0: video with dynamic segmentation require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.0\",\n \"video\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/video/clip.mp4\"\n },\n \"start_sec\": 0,\n \"end_sec\": 12,\n \"segmentation\": {\n \"strategy\": \"dynamic\",\n \"dynamic\": {\n \"min_duration_sec\": 4\n }\n },\n \"embedding_option\": [\n \"visual\",\n \"audio\",\n \"transcription\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.0: video with dynamic segmentation import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.0\",\n \"video\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/video/clip.mp4\"\n },\n \"start_sec\": 0,\n \"end_sec\": 12,\n \"segmentation\": {\n \"strategy\": \"dynamic\",\n \"dynamic\": {\n \"min_duration_sec\": 4\n }\n },\n \"embedding_option\": [\n \"visual\",\n \"audio\",\n \"transcription\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ]\n }\n}") .asString(); ``` ```php Marengo 3.0: video with dynamic segmentation request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2', [ 'body' => '{ "input_type": "video", "model_name": "marengo3.0", "video": { "media_source": { "url": "https://user-bucket.com/video/clip.mp4" }, "start_sec": 0, "end_sec": 12, "segmentation": { "strategy": "dynamic", "dynamic": { "min_duration_sec": 4 } }, "embedding_option": [ "visual", "audio", "transcription" ], "embedding_scope": [ "clip", "asset" ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.0: video with dynamic segmentation using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.0\",\n \"video\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/video/clip.mp4\"\n },\n \"start_sec\": 0,\n \"end_sec\": 12,\n \"segmentation\": {\n \"strategy\": \"dynamic\",\n \"dynamic\": {\n \"min_duration_sec\": 4\n }\n },\n \"embedding_option\": [\n \"visual\",\n \"audio\",\n \"transcription\"\n ],\n \"embedding_scope\": [\n \"clip\",\n \"asset\"\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.0: video with dynamic segmentation import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "video", "model_name": "marengo3.0", "video": [ "media_source": ["url": "https://user-bucket.com/video/clip.mp4"], "start_sec": 0, "end_sec": 12, "segmentation": [ "strategy": "dynamic", "dynamic": ["min_duration_sec": 4] ], "embedding_option": ["visual", "audio", "transcription"], "embedding_scope": ["clip", "asset"] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.0: video with minimal configuration **Request** ```json { "input_type": "video", "model_name": "marengo3.0", "video": { "media_source": { "url": "https://user-bucket.com/video/simple.mp4" } } } ``` **Response** ```json { "data": [ { "embedding": [ 0.111, 0.234, -0.567, 0.89 ] } ] } ``` **SDK Code** ```python Marengo 3.0: video with minimal configuration import requests url = "https://api.twelvelabs.io/v1.3/embed-v2" payload = { "input_type": "video", "model_name": "marengo3.0", "video": { "media_source": { "url": "https://user-bucket.com/video/simple.mp4" } } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.0: video with minimal configuration const url = 'https://api.twelvelabs.io/v1.3/embed-v2'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"video","model_name":"marengo3.0","video":{"media_source":{"url":"https://user-bucket.com/video/simple.mp4"}}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.0: video with minimal configuration package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2" payload := strings.NewReader("{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.0\",\n \"video\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/video/simple.mp4\"\n }\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.0: video with minimal configuration require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.0\",\n \"video\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/video/simple.mp4\"\n }\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.0: video with minimal configuration import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.0\",\n \"video\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/video/simple.mp4\"\n }\n }\n}") .asString(); ``` ```php Marengo 3.0: video with minimal configuration request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2', [ 'body' => '{ "input_type": "video", "model_name": "marengo3.0", "video": { "media_source": { "url": "https://user-bucket.com/video/simple.mp4" } } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.0: video with minimal configuration using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.0\",\n \"video\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/video/simple.mp4\"\n }\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.0: video with minimal configuration import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "video", "model_name": "marengo3.0", "video": ["media_source": ["url": "https://user-bucket.com/video/simple.mp4"]] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Marengo 3.0: video with fused embedding **Request** ```json { "input_type": "video", "model_name": "marengo3.0", "video": { "media_source": { "url": "https://user-bucket.com/video/clip.mp4" }, "embedding_option": [ "visual", "audio" ], "embedding_scope": [ "clip" ], "embedding_type": [ "separate_embedding", "fused_embedding" ] } } ``` **Response** ```json { "data": [ { "embedding": [ 0.111, 0.234, -0.567, 0.89 ] } ] } ``` **SDK Code** ```python Marengo 3.0: video with fused embedding import requests url = "https://api.twelvelabs.io/v1.3/embed-v2" payload = { "input_type": "video", "model_name": "marengo3.0", "video": { "media_source": { "url": "https://user-bucket.com/video/clip.mp4" }, "embedding_option": ["visual", "audio"], "embedding_scope": ["clip"], "embedding_type": ["separate_embedding", "fused_embedding"] } } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Marengo 3.0: video with fused embedding const url = 'https://api.twelvelabs.io/v1.3/embed-v2'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"input_type":"video","model_name":"marengo3.0","video":{"media_source":{"url":"https://user-bucket.com/video/clip.mp4"},"embedding_option":["visual","audio"],"embedding_scope":["clip"],"embedding_type":["separate_embedding","fused_embedding"]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Marengo 3.0: video with fused embedding package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.twelvelabs.io/v1.3/embed-v2" payload := strings.NewReader("{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.0\",\n \"video\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/video/clip.mp4\"\n },\n \"embedding_option\": [\n \"visual\",\n \"audio\"\n ],\n \"embedding_scope\": [\n \"clip\"\n ],\n \"embedding_type\": [\n \"separate_embedding\",\n \"fused_embedding\"\n ]\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Marengo 3.0: video with fused embedding require 'uri' require 'net/http' url = URI("https://api.twelvelabs.io/v1.3/embed-v2") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.0\",\n \"video\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/video/clip.mp4\"\n },\n \"embedding_option\": [\n \"visual\",\n \"audio\"\n ],\n \"embedding_scope\": [\n \"clip\"\n ],\n \"embedding_type\": [\n \"separate_embedding\",\n \"fused_embedding\"\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java Marengo 3.0: video with fused embedding import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.twelvelabs.io/v1.3/embed-v2") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.0\",\n \"video\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/video/clip.mp4\"\n },\n \"embedding_option\": [\n \"visual\",\n \"audio\"\n ],\n \"embedding_scope\": [\n \"clip\"\n ],\n \"embedding_type\": [\n \"separate_embedding\",\n \"fused_embedding\"\n ]\n }\n}") .asString(); ``` ```php Marengo 3.0: video with fused embedding request('POST', 'https://api.twelvelabs.io/v1.3/embed-v2', [ 'body' => '{ "input_type": "video", "model_name": "marengo3.0", "video": { "media_source": { "url": "https://user-bucket.com/video/clip.mp4" }, "embedding_option": [ "visual", "audio" ], "embedding_scope": [ "clip" ], "embedding_type": [ "separate_embedding", "fused_embedding" ] } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Marengo 3.0: video with fused embedding using RestSharp; var client = new RestClient("https://api.twelvelabs.io/v1.3/embed-v2"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"input_type\": \"video\",\n \"model_name\": \"marengo3.0\",\n \"video\": {\n \"media_source\": {\n \"url\": \"https://user-bucket.com/video/clip.mp4\"\n },\n \"embedding_option\": [\n \"visual\",\n \"audio\"\n ],\n \"embedding_scope\": [\n \"clip\"\n ],\n \"embedding_type\": [\n \"separate_embedding\",\n \"fused_embedding\"\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Marengo 3.0: video with fused embedding import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "input_type": "video", "model_name": "marengo3.0", "video": [ "media_source": ["url": "https://user-bucket.com/video/clip.mp4"], "embedding_option": ["visual", "audio"], "embedding_scope": ["clip"], "embedding_type": ["separate_embedding", "fused_embedding"] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/embed-v2")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```