创建多模态向量
curl --request POST \
--url https://api.upmore.net/v1/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "doubao-embedding-vision",
"input": [
{
"type": "text",
"text": "一只在钢琴上打盹的橘猫"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/cat.jpg"
}
}
]
}
'import requests
url = "https://api.upmore.net/v1/embeddings"
payload = {
"model": "doubao-embedding-vision",
"input": [
{
"type": "text",
"text": "一只在钢琴上打盹的橘猫"
},
{
"type": "image_url",
"image_url": { "url": "https://example.com/cat.jpg" }
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'doubao-embedding-vision',
input: [
{type: 'text', text: '一只在钢琴上打盹的橘猫'},
{type: 'image_url', image_url: {url: 'https://example.com/cat.jpg'}}
]
})
};
fetch('https://api.upmore.net/v1/embeddings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.upmore.net/v1/embeddings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'doubao-embedding-vision',
'input' => [
[
'type' => 'text',
'text' => '一只在钢琴上打盹的橘猫'
],
[
'type' => 'image_url',
'image_url' => [
'url' => 'https://example.com/cat.jpg'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.upmore.net/v1/embeddings"
payload := strings.NewReader("{\n \"model\": \"doubao-embedding-vision\",\n \"input\": [\n {\n \"type\": \"text\",\n \"text\": \"一只在钢琴上打盹的橘猫\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://example.com/cat.jpg\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.upmore.net/v1/embeddings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"doubao-embedding-vision\",\n \"input\": [\n {\n \"type\": \"text\",\n \"text\": \"一只在钢琴上打盹的橘猫\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://example.com/cat.jpg\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.upmore.net/v1/embeddings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"doubao-embedding-vision\",\n \"input\": [\n {\n \"type\": \"text\",\n \"text\": \"一只在钢琴上打盹的橘猫\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://example.com/cat.jpg\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"object": "list",
"model": "<string>",
"data": {
"object": "embedding",
"embedding": [
123
]
},
"usage": {
"prompt_tokens": 123,
"total_tokens": 123,
"prompt_tokens_details": {
"text_tokens": 123,
"image_tokens": 123
}
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}ByteDance
Doubao Embedding Vision
将文本、图片或图文混合输入向量化为一个 2048 维向量。文本与图片 token 分开计价。
POST
/
v1
/
embeddings
创建多模态向量
curl --request POST \
--url https://api.upmore.net/v1/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "doubao-embedding-vision",
"input": [
{
"type": "text",
"text": "一只在钢琴上打盹的橘猫"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/cat.jpg"
}
}
]
}
'import requests
url = "https://api.upmore.net/v1/embeddings"
payload = {
"model": "doubao-embedding-vision",
"input": [
{
"type": "text",
"text": "一只在钢琴上打盹的橘猫"
},
{
"type": "image_url",
"image_url": { "url": "https://example.com/cat.jpg" }
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'doubao-embedding-vision',
input: [
{type: 'text', text: '一只在钢琴上打盹的橘猫'},
{type: 'image_url', image_url: {url: 'https://example.com/cat.jpg'}}
]
})
};
fetch('https://api.upmore.net/v1/embeddings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.upmore.net/v1/embeddings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'doubao-embedding-vision',
'input' => [
[
'type' => 'text',
'text' => '一只在钢琴上打盹的橘猫'
],
[
'type' => 'image_url',
'image_url' => [
'url' => 'https://example.com/cat.jpg'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.upmore.net/v1/embeddings"
payload := strings.NewReader("{\n \"model\": \"doubao-embedding-vision\",\n \"input\": [\n {\n \"type\": \"text\",\n \"text\": \"一只在钢琴上打盹的橘猫\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://example.com/cat.jpg\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.upmore.net/v1/embeddings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"doubao-embedding-vision\",\n \"input\": [\n {\n \"type\": \"text\",\n \"text\": \"一只在钢琴上打盹的橘猫\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://example.com/cat.jpg\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.upmore.net/v1/embeddings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"doubao-embedding-vision\",\n \"input\": [\n {\n \"type\": \"text\",\n \"text\": \"一只在钢琴上打盹的橘猫\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://example.com/cat.jpg\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"object": "list",
"model": "<string>",
"data": {
"object": "embedding",
"embedding": [
123
]
},
"usage": {
"prompt_tokens": 123,
"total_tokens": 123,
"prompt_tokens_details": {
"text_tokens": 123,
"image_tokens": 123
}
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
请求体
application/json
固定为 doubao-embedding-vision。
可用选项:
doubao-embedding-vision 示例:
"doubao-embedding-vision"
内容对象数组(方舟多模态格式)。纯文本也用数组形式。整个输入生成一个融合向量。
Show child attributes
Show child attributes
示例:
[
{ "type": "text", "text": "一只在钢琴上打盹的橘猫" },
{
"type": "image_url",
"image_url": { "url": "https://example.com/cat.jpg" }
}
]⌘I