近期的語言模型能處理並分析圖像輸入,這項能力稱為 視覺。GPT Image 模型能根據文字與圖像輸入建立新圖像,或編輯現有圖像。
根據你要分析還是生成圖像,選擇適合的端點:
如要進一步瞭解我們的模型支援哪些輸入和輸出模態,請參閱模型頁面。
使用 Images API 時,選擇 gpt-image-2.5-sunburst,即可根據文字生成圖像或編輯現有圖像。使用 Responses API 時,請選擇支援圖像生成工具的主系列模型;工具會負責選擇 GPT Image 模型。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20import OpenAI from "openai";
const openai = new OpenAI();
const response = await openai.responses.create({
model: "gpt-6-astra",
input:
"Generate an image of gray tabby cat hugging an otter with an orange scarf",
tools: [{ type: "image_generation" }],
});
// Save the image to a file
const imageData = response.output
.filter((output) => output.type === "image_generation_call")
.map((output) => output.result);
if (imageData.length > 0) {
const imageBase64 = imageData[0];
const fs = await import("fs");
fs.writeFileSync("cat_and_otter.png", Buffer.from(imageBase64, "base64"));
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22from openai import OpenAI
import base64
client = OpenAI()
response = client.responses.create(
model="gpt-6-astra",
input="Generate an image of gray tabby cat hugging an otter with an orange scarf",
tools=[{"type": "image_generation"}],
)
# Save the image to a file
image_data = [
output.result
for output in response.output
if output.type == "image_generation_call"
]
if image_data:
image_base64 = image_data[0]
with open("cat_and_otter.png", "wb") as f:
f.write(base64.b64decode(image_base64))
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43package main
import (
"context"
"encoding/base64"
"os"
"github.com/openai/openai-go/v3"
"github.com/openai/openai-go/v3/responses"
)
func main() {
client := openai.NewClient()
response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{
Model: "gpt-6-astra",
Input: responses.ResponseNewParamsInputUnion{
OfString: openai.String("Generate an image of a gray tabby cat hugging an otter with an orange scarf."),
},
Tools: []responses.ToolUnionParam{{
OfImageGeneration: &responses.ToolImageGenerationParam{},
}},
})
if err != nil {
panic(err)
}
for _, output := range response.Output {
if output.Type != "image_generation_call" {
continue
}
image, err := base64.StdEncoding.DecodeString(output.AsImageGenerationCall().Result)
if err != nil {
panic(err)
}
if err := os.WriteFile("cat_and_otter.png", image, 0o600); err != nil {
panic(err)
}
return
}
panic("response did not include an image generation call")
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.responses.ResponseCreateParams;
import com.openai.models.responses.Tool;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Base64;
ResponseCreateParams params =
ResponseCreateParams.builder()
.model("gpt-6-astra")
.input("Generate an image of a gray tabby cat hugging an otter with an orange scarf.")
.addTool(Tool.ImageGeneration.builder().build())
.build();
String imageResult =
client.responses().create(params).output().stream()
.flatMap(item -> item.imageGenerationCall().stream())
.flatMap(call -> call.result().stream())
.findFirst()
.orElseThrow(() -> new IllegalStateException("No generated image returned"));
Files.write(Path.of("cat_and_otter.png"), Base64.getDecoder().decode(imageResult));
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28using OpenAI.Responses;
#pragma warning disable OPENAI001
string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;
ResponsesClient client = new(key);
CreateResponseOptions options = new()
{
Model = "gpt-6-astra",
};
options.InputItems.Add(
ResponseItem.CreateUserMessageItem(
"Generate an image of a gray tabby cat hugging an otter with an orange scarf."
)
);
options.Tools.Add(
ResponseTool.CreateImageGenerationTool(model: "gpt-image-2")
);
ResponseResult response = await client.CreateResponseAsync(options);
ImageGenerationCallResponseItem image = response
.OutputItems.OfType<ImageGenerationCallResponseItem>()
.FirstOrDefault()
?? throw new InvalidOperationException("No generated image was returned.");
await File.WriteAllBytesAsync(
"cat_and_otter.png",
image.ImageResultBytes.ToArray()
);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21require "base64"
require "openai"
client = OpenAI::Client.new
response = client.responses.create(
model: "gpt-6-astra",
input: "Generate an image of a gray tabby cat hugging an otter with an orange scarf.",
tools: [{ type: :image_generation }]
)
image_call = response.output.find do |item|
item.is_a?(OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall)
end
unless image_call.is_a?(OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall)
raise "No image generation call returned"
end
File.binwrite(
"cat_and_otter.png",
Base64.strict_decode64(image_call.result)
)
1
2
3
4
5
6
7
8openai responses create \
--model gpt-6-astra \
--raw-output \
--transform 'output.#(type=="image_generation_call").result' <<'YAML' | base64 --decode > cat_and_otter.png
tools:
- type: image_generation
input: Generate an image of a gray tabby cat hugging an otter with an orange scarf.
YAML
GPT Image 模型不需要參考圖像,也能運用對世界的知識。例如,要求生成一櫃半寶石的提示詞,可以產生包含紫水晶、粉晶和玉石等可辨識寶石的場景。
使用具備視覺能力的模型描述圖像、讀取可見文字,並回答關於物件、形狀、顏色或紋理的問題。使用模型的回答時,請將其限制納入考量。
使用完整的圖像 URL 或 Base64 編碼的資料 URL,提供要分析的圖像。
你可以在 content 陣列中加入多張圖像,在單一請求中提供多張圖像作為輸入。不過請注意,圖像會計入 Token 用量,並據此計費。
傳入 URL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22import OpenAI from "openai";
const openai = new OpenAI();
const response = await openai.chat.completions.create({
model: "gpt-6-astra",
messages: [
{
role: "user",
content: [
{ type: "text", text: "What is in this image?" },
{
type: "image_url",
image_url: {
url: "https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg",
},
},
],
},
],
});
console.log(response.choices[0].message.content);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
model="gpt-6-astra",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "What's in this image?"},
{
"type": "image_url",
"image_url": {
"url": "https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg",
},
},
],
}
],
)
print(response.choices[0].message.content)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29package main
import (
"context"
"fmt"
"github.com/openai/openai-go/v3"
)
func main() {
client := openai.NewClient()
completion, err := client.Chat.Completions.New(context.Background(), openai.ChatCompletionNewParams{
Model: "gpt-6-astra",
Messages: []openai.ChatCompletionMessageParamUnion{
openai.UserMessage([]openai.ChatCompletionContentPartUnionParam{
openai.TextContentPart("What's in this image?"),
openai.ImageContentPart(openai.ChatCompletionContentPartImageImageURLParam{
URL: "https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg",
}),
}),
},
})
if err != nil {
panic(err)
}
fmt.Println(completion.Choices[0].Message.Content)
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.chat.completions.ChatCompletionContentPart;
import com.openai.models.chat.completions.ChatCompletionContentPartImage;
import com.openai.models.chat.completions.ChatCompletionContentPartText;
import com.openai.models.chat.completions.ChatCompletionCreateParams;
import com.openai.models.chat.completions.ChatCompletionUserMessageParam;
import java.util.List;
String imageUrl =
"https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg";
ChatCompletionContentPart text =
ChatCompletionContentPart.ofText(
ChatCompletionContentPartText.builder().text("What's in this image?").build());
ChatCompletionContentPart image =
ChatCompletionContentPart.ofImageUrl(
ChatCompletionContentPartImage.builder()
.imageUrl(ChatCompletionContentPartImage.ImageUrl.builder().url(imageUrl).build())
.build());
ChatCompletionCreateParams params =
ChatCompletionCreateParams.builder()
.model("gpt-6-astra")
.addMessage(
ChatCompletionUserMessageParam.builder()
.contentOfArrayOfContentParts(List.of(text, image))
.build())
.build();
client.chat().completions().create(params).choices().stream()
.flatMap(choice -> choice.message().content().stream())
.forEach(System.out::println);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19using OpenAI.Chat;
string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;
string model = "gpt-6-astra";
ChatClient client = new(model, key);
Uri imageUrl = new(
"https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg"
);
UserChatMessage message = new(
[
ChatMessageContentPart.CreateTextPart("What is in this image?"),
ChatMessageContentPart.CreateImagePart(imageUrl),
]
);
ChatCompletion completion = await client.CompleteChatAsync(message);
Console.WriteLine(completion.Content[0].Text);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26require "openai"
client = OpenAI::Client.new
completion = client.chat.completions.create(
model: "gpt-6-astra",
messages: [
{
role: :user,
content: [
{
type: :text,
text: "What's in this image?"
},
{
type: :image_url,
image_url: {
url: "https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg"
}
}
]
}
]
)
puts(completion.choices.fetch(0).message.content)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24curl https://api.openai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "gpt-6-astra",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What is in this image?"
},
{
"type": "image_url",
"image_url": {
"url": "https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg"
}
}
]
}
],
"max_completion_tokens": 300
}'
傳入 Base64 編碼的圖像
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27import fs from "fs";
import OpenAI from "openai";
const openai = new OpenAI();
const imagePath = "fixtures/example.jpg";
const base64Image = fs.readFileSync(imagePath, "base64");
const completion = await openai.chat.completions.create({
model: "gpt-6-astra",
messages: [
{
role: "user",
content: [
{ type: "text", text: "what's in this image?" },
{
type: "image_url",
image_url: {
url: `data:image/jpeg;base64,${base64Image}`,
},
},
],
},
],
});
console.log(completion.choices[0].message.content);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37import base64
from openai import OpenAI
client = OpenAI()
# Function to encode the image
def encode_image(image_path):
with open(image_path, "rb") as image_file:
return base64.b64encode(image_file.read()).decode("utf-8")
# Path to your image
image_path = "path_to_your_image.jpg"
# Getting the Base64 string
base64_image = encode_image(image_path)
completion = client.chat.completions.create(
model="gpt-6-astra",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "what's in this image?"},
{
"type": "image_url",
"image_url": {
"url": f"data:image/jpeg;base64,{base64_image}",
},
},
],
}
],
)
print(completion.choices[0].message.content)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34package main
import (
"context"
"encoding/base64"
"fmt"
"os"
"github.com/openai/openai-go/v3"
)
func main() {
client := openai.NewClient()
image, err := os.ReadFile("image.png")
if err != nil {
panic(err)
}
imageURL := "data:image/png;base64," + base64.StdEncoding.EncodeToString(image)
completion, err := client.Chat.Completions.New(context.Background(), openai.ChatCompletionNewParams{
Model: "gpt-6-astra",
Messages: []openai.ChatCompletionMessageParamUnion{
openai.UserMessage([]openai.ChatCompletionContentPartUnionParam{
openai.TextContentPart("What's in this image?"),
openai.ImageContentPart(openai.ChatCompletionContentPartImageImageURLParam{URL: imageURL}),
}),
},
})
if err != nil {
panic(err)
}
fmt.Println(completion.Choices[0].Message.Content)
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.chat.completions.ChatCompletionContentPart;
import com.openai.models.chat.completions.ChatCompletionContentPartImage;
import com.openai.models.chat.completions.ChatCompletionContentPartText;
import com.openai.models.chat.completions.ChatCompletionCreateParams;
import com.openai.models.chat.completions.ChatCompletionUserMessageParam;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Base64;
import java.util.List;
String imageUrl =
"data:image/jpeg;base64,"
+ Base64.getEncoder()
.encodeToString(
Files.readAllBytes(Path.of(System.getenv("OPENAI_EXAMPLE_IMAGE_PATH"))));
ChatCompletionContentPart text =
ChatCompletionContentPart.ofText(
ChatCompletionContentPartText.builder().text("What's in this image?").build());
ChatCompletionContentPart image =
ChatCompletionContentPart.ofImageUrl(
ChatCompletionContentPartImage.builder()
.imageUrl(ChatCompletionContentPartImage.ImageUrl.builder().url(imageUrl).build())
.build());
ChatCompletionCreateParams params =
ChatCompletionCreateParams.builder()
.model("gpt-6-astra")
.addMessage(
ChatCompletionUserMessageParam.builder()
.contentOfArrayOfContentParts(List.of(text, image))
.build())
.build();
client.chat().completions().create(params).choices().stream()
.flatMap(choice -> choice.message().content().stream())
.forEach(System.out::println);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24using OpenAI.Chat;
string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;
string model = "gpt-6-astra";
ChatClient client = new(model, key);
Uri imageUrl = new(
"https://openai-documentation.vercel.app/images/cat_and_otter.png"
);
using HttpClient http = new();
BinaryData image = BinaryData.FromBytes(
await http.GetByteArrayAsync(imageUrl)
);
UserChatMessage message = new(
[
ChatMessageContentPart.CreateTextPart("What's in this image?"),
ChatMessageContentPart.CreateImagePart(image, "image/png"),
]
);
ChatCompletion completion = await client.CompleteChatAsync(message);
Console.WriteLine(completion.Content[0].Text);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26require "base64"
require "openai"
client = OpenAI::Client.new
image = Base64.strict_encode64(File.binread("image.png"))
completion = client.chat.completions.create(
model: "gpt-6-astra",
messages: [
{
role: :user,
content: [
{
type: :text,
text: "What's in this image?"
},
{
type: :image_url,
image_url: { url: "data:image/png;base64,#{image}" }
}
]
}
]
)
puts(completion.choices.fetch(0).message.content)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23BASE64_IMAGE=$(base64 < path_to_your_image.jpg) && curl https://api.openai.com/v1/chat/completions -H "Content-Type: application/json" -H "Authorization: Bearer $OPENAI_API_KEY" -d @- <<EOF
{
"model": "gpt-6-astra",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What is in this image?"
},
{
"type": "image_url",
"image_url": {
"url": "data:image/jpeg;base64,$BASE64_IMAGE"
}
}
]
}
],
"max_completion_tokens": 300
}
EOF
透過下列任一方式提供要分析的圖像:
- 提供圖像檔案的完整 URL
- 以 Base64 編碼的資料 URL 提供圖像
- 提供檔案 ID(使用 Files API 建立)
你可以在 content 陣列中加入多張圖像,在單一請求中提供多張圖像作為輸入。不過請注意,圖像會計入 Token 用量,並據此計費。
傳入 URL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23import OpenAI from "openai";
const openai = new OpenAI();
const response = await openai.responses.create({
model: "gpt-6-astra",
input: [
{
role: "user",
content: [
{ type: "input_text", text: "what's in this image?" },
{
type: "input_image",
image_url:
"https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg",
detail: "auto",
},
],
},
],
});
console.log(response.output_text);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21from openai import OpenAI
client = OpenAI()
response = client.responses.create(
model="gpt-6-astra",
input=[
{
"role": "user",
"content": [
{"type": "input_text", "text": "what's in this image?"},
{
"type": "input_image",
"image_url": "https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg",
},
],
}
],
)
print(response.output_text)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36package main
import (
"context"
"fmt"
"github.com/openai/openai-go/v3"
"github.com/openai/openai-go/v3/responses"
)
func main() {
client := openai.NewClient()
response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{
Model: "gpt-6-astra",
Input: responses.ResponseNewParamsInputUnion{
OfInputItemList: responses.ResponseInputParam{
responses.ResponseInputItemParamOfMessage(
responses.ResponseInputMessageContentListParam{
responses.ResponseInputContentParamOfInputText("What's in this image?"),
{OfInputImage: &responses.ResponseInputImageParam{
Detail: responses.ResponseInputImageDetailAuto,
ImageURL: openai.String("https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg"),
}},
},
responses.EasyInputMessageRoleUser,
),
},
},
})
if err != nil {
panic(err)
}
fmt.Println(response.OutputText())
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.responses.ResponseCreateParams;
import com.openai.models.responses.ResponseInputImage;
import com.openai.models.responses.ResponseInputItem;
import java.util.List;
ResponseInputItem imageInput =
ResponseInputItem.ofMessage(
ResponseInputItem.Message.builder()
.role(ResponseInputItem.Message.Role.USER)
.addInputTextContent("What's in this image?")
.addContent(
ResponseInputImage.builder()
.detail(ResponseInputImage.Detail.AUTO)
.imageUrl(
"https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg")
.build())
.build());
ResponseCreateParams params =
ResponseCreateParams.builder()
.model("gpt-6-astra")
.inputOfResponse(List.of(imageInput))
.build();
client.responses().create(params).output().stream()
.flatMap(item -> item.message().stream())
.flatMap(message -> message.content().stream())
.flatMap(content -> content.outputText().stream())
.forEach(text -> System.out.println(text.text()));
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23using OpenAI.Responses;
#pragma warning disable OPENAI001
string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;
ResponsesClient client = new(key);
Uri imageUrl = new(
"https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg"
);
ResponseResult response = await client.CreateResponseAsync(
"gpt-6-astra",
[
ResponseItem.CreateUserMessageItem(
[
ResponseContentPart.CreateInputTextPart("What is in this image?"),
ResponseContentPart.CreateInputImagePart(imageUrl),
]
),
]
);
Console.WriteLine(response.GetOutputText());
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25require "openai"
client = OpenAI::Client.new
response = client.responses.create(
model: "gpt-6-astra",
input: [
{
role: :user,
content: [
{
type: :input_text,
text: "What's in this image?"
},
{
type: :input_image,
detail: :auto,
image_url: "https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg"
}
]
}
]
)
puts(response.output_text)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18curl https://api.openai.com/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "gpt-6-astra",
"input": [
{
"role": "user",
"content": [
{"type": "input_text", "text": "what is in this image?"},
{
"type": "input_image",
"image_url": "https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg"
}
]
}
]
}'
1
2
3
4
5
6
7
8
9
10
11
12openai responses create \
--model gpt-6-astra \
--raw-output \
--transform 'output.#(type=="message").content.0.text' <<'YAML'
input:
- role: user
content:
- type: input_text
text: What is in this image?
- type: input_image
image_url: https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg
YAML
傳入 Base64 編碼的圖像
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26import fs from "fs";
import OpenAI from "openai";
const openai = new OpenAI();
const imagePath = "fixtures/example.jpg";
const base64Image = fs.readFileSync(imagePath, "base64");
const response = await openai.responses.create({
model: "gpt-6-astra",
input: [
{
role: "user",
content: [
{ type: "input_text", text: "what's in this image?" },
{
type: "input_image",
image_url: `data:image/jpeg;base64,${base64Image}`,
detail: "auto",
},
],
},
],
});
console.log(response.output_text);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36import base64
from openai import OpenAI
client = OpenAI()
# Function to encode the image
def encode_image(image_path):
with open(image_path, "rb") as image_file:
return base64.b64encode(image_file.read()).decode("utf-8")
# Path to your image
image_path = "path_to_your_image.jpg"
# Getting the Base64 string
base64_image = encode_image(image_path)
response = client.responses.create(
model="gpt-6-astra",
input=[
{
"role": "user",
"content": [
{"type": "input_text", "text": "what's in this image?"},
{
"type": "input_image",
"image_url": f"data:image/jpeg;base64,{base64_image}",
},
],
}
],
)
print(response.output_text)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43package main
import (
"context"
"encoding/base64"
"fmt"
"os"
"github.com/openai/openai-go/v3"
"github.com/openai/openai-go/v3/responses"
)
func main() {
client := openai.NewClient()
image, err := os.ReadFile("image.png")
if err != nil {
panic(err)
}
imageURL := "data:image/png;base64," + base64.StdEncoding.EncodeToString(image)
response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{
Model: "gpt-6-astra",
Input: responses.ResponseNewParamsInputUnion{
OfInputItemList: responses.ResponseInputParam{
responses.ResponseInputItemParamOfMessage(
responses.ResponseInputMessageContentListParam{
responses.ResponseInputContentParamOfInputText("What's in this image?"),
{OfInputImage: &responses.ResponseInputImageParam{
Detail: responses.ResponseInputImageDetailAuto,
ImageURL: openai.String(imageURL),
}},
},
responses.EasyInputMessageRoleUser,
),
},
},
})
if err != nil {
panic(err)
}
fmt.Println(response.OutputText())
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.responses.ResponseCreateParams;
import com.openai.models.responses.ResponseInputImage;
import com.openai.models.responses.ResponseInputItem;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Base64;
import java.util.List;
String imageBase64 =
Base64.getEncoder()
.encodeToString(
Files.readAllBytes(Path.of(System.getenv("OPENAI_EXAMPLE_IMAGE_PATH"))));
ResponseInputItem imageInput =
ResponseInputItem.ofMessage(
ResponseInputItem.Message.builder()
.role(ResponseInputItem.Message.Role.USER)
.addInputTextContent("What's in this image?")
.addContent(
ResponseInputImage.builder()
.detail(ResponseInputImage.Detail.AUTO)
.imageUrl("data:image/png;base64," + imageBase64)
.build())
.build());
ResponseCreateParams params =
ResponseCreateParams.builder()
.model("gpt-6-astra")
.inputOfResponse(List.of(imageInput))
.build();
client.responses().create(params).output().stream()
.flatMap(item -> item.message().stream())
.flatMap(message -> message.content().stream())
.flatMap(content -> content.outputText().stream())
.forEach(text -> System.out.println(text.text()));
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47using OpenAI.Responses;
#pragma warning disable OPENAI001
string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;
ResponsesClient client = new(key);
Uri imageUrl = new(
"https://openai-documentation.vercel.app/images/cat_and_otter.png"
);
using HttpClient http = new();
// Download an image as a stream.
using Stream stream = await http.GetStreamAsync(imageUrl);
BinaryData imageData = BinaryData.FromStream(stream, "image/png");
ResponseResult response1 = await client.CreateResponseAsync(
"gpt-6-astra",
[
ResponseItem.CreateUserMessageItem(
[
ResponseContentPart.CreateInputTextPart("What is in this image?"),
ResponseContentPart.CreateInputImagePart(imageData),
]
),
]
);
Console.WriteLine($"From image stream: {response1.GetOutputText()}");
// Download an image as a byte array.
byte[] bytes = await http.GetByteArrayAsync(imageUrl);
imageData = BinaryData.FromBytes(bytes, "image/png");
ResponseResult response2 = await client.CreateResponseAsync(
"gpt-6-astra",
[
ResponseItem.CreateUserMessageItem(
[
ResponseContentPart.CreateInputTextPart("What is in this image?"),
ResponseContentPart.CreateInputImagePart(imageData),
]
),
]
);
Console.WriteLine($"From byte array: {response2.GetOutputText()}");
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27require "base64"
require "openai"
client = OpenAI::Client.new
image = Base64.strict_encode64(File.binread("image.png"))
response = client.responses.create(
model: "gpt-6-astra",
input: [
{
role: :user,
content: [
{
type: :input_text,
text: "What's in this image?"
},
{
type: :input_image,
detail: :auto,
image_url: "data:image/png;base64,#{image}"
}
]
}
]
)
puts(response.output_text)
傳入檔案 ID
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36import OpenAI from "openai";
import fs from "fs";
const openai = new OpenAI();
// Function to create a file with the Files API
async function createFile(filePath) {
const fileContent = fs.createReadStream(filePath);
const result = await openai.files.create({
file: fileContent,
purpose: "vision",
});
return result.id;
}
// Getting the file ID
const fileId = await createFile("fixtures/example.jpg");
const response = await openai.responses.create({
model: "gpt-6-astra",
input: [
{
role: "user",
content: [
{ type: "input_text", text: "what's in this image?" },
{
type: "input_image",
file_id: fileId,
detail: "auto",
},
],
},
],
});
console.log(response.output_text);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35from openai import OpenAI
client = OpenAI()
# Function to create a file with the Files API
def create_file(file_path):
with open(file_path, "rb") as file_content:
result = client.files.create(
file=file_content,
purpose="vision",
)
return result.id
# Getting the file ID
file_id = create_file("path_to_your_image.jpg")
response = client.responses.create(
model="gpt-6-astra",
input=[
{
"role": "user",
"content": [
{"type": "input_text", "text": "what's in this image?"},
{
"type": "input_image",
"file_id": file_id,
},
],
}
],
)
print(response.output_text)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50package main
import (
"context"
"fmt"
"os"
"github.com/openai/openai-go/v3"
"github.com/openai/openai-go/v3/responses"
)
func main() {
client := openai.NewClient()
file, err := os.Open("image.png")
if err != nil {
panic(err)
}
defer file.Close()
uploaded, err := client.Files.New(context.Background(), openai.FileNewParams{
File: file,
Purpose: openai.FilePurposeVision,
})
if err != nil {
panic(err)
}
response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{
Model: "gpt-6-astra",
Input: responses.ResponseNewParamsInputUnion{
OfInputItemList: responses.ResponseInputParam{
responses.ResponseInputItemParamOfMessage(
responses.ResponseInputMessageContentListParam{
responses.ResponseInputContentParamOfInputText("What's in this image?"),
{OfInputImage: &responses.ResponseInputImageParam{
Detail: responses.ResponseInputImageDetailAuto,
FileID: openai.String(uploaded.ID),
}},
},
responses.EasyInputMessageRoleUser,
),
},
},
})
if err != nil {
panic(err)
}
fmt.Println(response.OutputText())
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.files.FileCreateParams;
import com.openai.models.files.FilePurpose;
import com.openai.models.responses.ResponseCreateParams;
import com.openai.models.responses.ResponseInputImage;
import com.openai.models.responses.ResponseInputItem;
import java.nio.file.Path;
import java.util.List;
var file =
client
.files()
.create(
FileCreateParams.builder()
.file(Path.of(System.getenv("OPENAI_EXAMPLE_FILE_PATH")))
.purpose(FilePurpose.VISION)
.build());
var response =
client
.responses()
.create(
ResponseCreateParams.builder()
.model("gpt-6-astra")
.inputOfResponse(
List.of(
ResponseInputItem.ofMessage(
ResponseInputItem.Message.builder()
.role(ResponseInputItem.Message.Role.USER)
.addInputTextContent("What's in this image?")
.addContent(
ResponseInputImage.builder()
.detail(ResponseInputImage.Detail.AUTO)
.fileId(file.id())
.build())
.build())))
.build());
response.output().stream()
.flatMap(item -> item.message().stream())
.flatMap(message -> message.content().stream())
.flatMap(content -> content.outputText().stream())
.forEach(text -> System.out.println(text.text()));
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38using OpenAI.Files;
using OpenAI.Responses;
#pragma warning disable OPENAI001
string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;
ResponsesClient client = new(key);
string filename = "cat_and_otter.png";
Uri imageUrl = new(
$"https://openai-documentation.vercel.app/images/{filename}"
);
using HttpClient http = new();
// Download an image as a stream.
using Stream stream = await http.GetStreamAsync(imageUrl);
OpenAIFileClient files = new(key);
OpenAIFile file = await files.UploadFileAsync(
stream,
filename,
FileUploadPurpose.Vision
);
ResponseResult response = await client.CreateResponseAsync(
"gpt-6-astra",
[
ResponseItem.CreateUserMessageItem(
[
ResponseContentPart.CreateInputTextPart("what's in this image?"),
ResponseContentPart.CreateInputImagePart(file.Id),
]
),
]
);
Console.WriteLine(response.GetOutputText());
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30require "openai"
require "pathname"
client = OpenAI::Client.new
uploaded = client.files.create(
file: Pathname("image.png"),
purpose: :vision
)
response = client.responses.create(
model: "gpt-6-astra",
input: [
{
role: :user,
content: [
{
type: :input_text,
text: "What's in this image?"
},
{
type: :input_image,
detail: :auto,
file_id: uploaded.id
}
]
}
]
)
puts(response.output_text)
使用支援的圖像檔案,並確保圖像足夠清晰,讓模型能夠分析。
| 需求 | 支援的輸入 |
|---|
| 檔案類型 | PNG(.png)、JPEG(.jpeg 或 .jpg)、WEBP(.webp)及非動畫 GIF(.gif) |
| 請求大小 | 每個請求的酬載總大小上限為 512 MB |
| 圖像數量 | 每個請求最多可包含 1,500 張圖像 |
對於以圖像區塊為基礎的圖像輸入,套用所選模型與 detail 等級的尺寸調整規則後,API 支援每張圖像最多 30,000 個圖像區塊。此上限適用於所有支援的細節等級,並且個別套用至每張圖像,而非整個請求的圖像區塊總數。
各模型和細節等級所指定的較低尺寸調整額度仍然適用。處理後超過 30,000 個圖像區塊上限的圖像會遭到拒絕,系統不會自動調整尺寸以符合此上限。請縮小圖像尺寸後再試一次。
圖像 Token 與提示詞的其餘內容也必須符合模型的輸入及上下文限制。Token 估算值並不保證請求符合所有輸入限制。圖像使用必須遵守我們的使用政策。
detail 參數控制圖像的前置處理。支援的值因模型而異,包括 low、high、original 或 auto。如果省略此參數,Responses API 和 Chat Completions API 都會預設使用 auto。對應的處理方式請參閱模型尺寸調整表。
1
2
3
4"image_url": {
"url": "https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg",
"detail": "original"
},
1
2
3
4
5{
"type": "input_image",
"image_url": "https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg",
"detail": "original"
}
請依照下列指引選擇細節等級:
| 細節等級 | 最適合 |
|---|
low | 概略理解圖像。尺寸調整方式與 Token 用量因模型而異;low 使用的 Token 不一定比 high 少。 |
high | 不需要精確原始圖像座標時,進行標準的高傳真度圖像理解。 |
original | 在模型支援的情況下,處理尺寸大、內容密集、對空間位置敏感或用於電腦操作的圖像。 |
auto | 使用模型尺寸調整表中列出的模型預設尺寸調整方式。 |
對於需要精細視覺細節或精確座標的任務,例如光學字元辨識(OCR)、小型物件偵測或電腦操作,請在支援的情況下使用 "detail": "original"。原始細節等級仍可能調整圖像尺寸,以符合模型的像素尺寸上限或尺寸調整的圖像區塊額度,但不會為了符合獨立的 30,000 個圖像區塊拒絕門檻而調整尺寸。對於座標敏感的任務,請先將圖像調整至符合上述限制的尺寸再傳送,並將傳回的座標對應回原始圖像。座標處理方式請參閱電腦指南。
下表彙整了通用視覺模型的尺寸調整方式。其他模型及特定用途的變體可能採用不同限制。所有尺寸調整都會維持長寬比,且不會放大小尺寸圖像。
| 模型系列 |
支援的細節等級 |
圖像區塊與尺寸調整方式 |
|---|
gpt-6-astra | low、high、original、
auto
| low 將圖像尺寸限制在 512 × 512 像素以內。high 最多允許
2,500 個圖像區塊,且單邊尺寸上限為 65,535 像素。兩項限制均適用。
original 會保留圖像的原始尺寸,但若圖像
任一邊超過 65,535 像素,就會縮小以符合
該限制。若調整後的圖像需要超過
30,000 個圖像區塊,API 就會拒絕
請求,而不會再調整圖像尺寸以符合圖像區塊上限。
auto 採用與 original 相同的尺寸調整方式。
|
gpt-5.6-sol、gpt-5.6-terra、
gpt-5.6-luna
| low、high、original、
auto
| low 會將圖像限制在 512 × 512 像素內。high 會將圖像限制在
2048 × 2048 像素及 2,500 個圖像區塊內。original
會保留圖像尺寸,但任一邊超過 65,535 像素的圖像
會縮小至符合該上限。如果處理後的
圖像需要超過
30,000 個圖像區塊,API 就會拒絕
該請求;不會調整圖像尺寸來符合圖像區塊上限。
auto 採用與 original 相同的尺寸調整方式。
|
gpt-5.5 | low、high、original、
auto
| low 會將圖像限制在 512 × 512 像素內。high 最多允許
2,500 個圖像區塊,且任一邊最多為 2048 像素。original
最多允許 10,000 個圖像區塊,且任一邊最多為 6000 像素。這兩項
限制都適用。auto 採用與
original 相同的尺寸調整方式。
|
gpt-5.4、gpt-5.4-mini、gpt-5.4-nano
| low、high、original、
auto
| low 的任一邊上限為 2048 像素,圖像區塊
額度為 6,144 個,因此可能比 high 使用更多 Token。
high 最多允許 2,500 個圖像區塊,且任一邊
最多為 2048 像素。original 最多允許 10,000 個圖像區塊,且
任一邊最多為 6000 像素。這兩項限制都適用。auto 採用
與 high 相同的尺寸調整方式。
|
gpt-5.2、gpt-4.1-mini
| low、high、auto
| 這些細節等級採用相同的尺寸限制:任一邊最多為 2048 像素,
圖像區塊額度為 6,144 個。不支援 original
細節等級。 |
gpt-5.1、gpt-4.1、gpt-4o、
gpt-4o-mini
| low、high、auto
| low 使用固定的 Token 數量。high 和
auto 採用
以圖像分塊為基礎的尺寸調整規則。
|
視覺模型會將圖像輸入轉換為計費的輸入 Token。圖像輸入費用計算器與本節的圖像區塊/分塊規則適用於視覺模型的輸入,不適用於 GPT Image 的圖像生成或編輯。後者的獨立定價請參閱GPT Image 模型輸入。
圖像 Token 也會計入每分鐘 Token 數(TPM)限制。計算器依標準輸入費率估算單張圖像的費用,不包含提示詞的其餘內容或模型輸出。
使用圖像輸入費用計算器,依據模型、圖像尺寸與細節等級,估算單張圖像的輸入 Token 數量和費用。
部分模型會用 32px x 32px 的圖像區塊覆蓋圖像,藉此進行 Token 化處理。許多模型與細節等級的組合都訂有尺寸調整的圖像區塊額度。API 會先將圖像調整至所選細節等級的像素尺寸上限內,保留長寬比並將像素數四捨五入為整數,且不會放大較小的圖像。接著依下列方式計算 Token 費用:
A. 套用像素尺寸上限後,計算覆蓋整張圖像需要多少個 32px x 32px 的圖像區塊。圖像區塊可以超出圖像邊界。
patch_count = ceil(width/32)×ceil(height/32)
B. 如果所選模型和細節等級指定了尺寸調整的圖像區塊額度,且圖像超出該額度,請按比例縮小圖像。否則,請略過此步驟。調整縮放比例,確保轉換為整數像素尺寸並計算覆蓋圖像所需的區塊數後,仍不超過額度。在計算最終尺寸之前,請保留完整精度。
shrink_factor = sqrt((32^2 * patch_budget) / (width * height))
adjusted_shrink_factor = shrink_factor * min(
floor(width * shrink_factor / 32) / (width * shrink_factor / 32),
floor(height * shrink_factor / 32) / (height * shrink_factor / 32)
)
C. 如果步驟 B 調整了圖像尺寸,請將縮放後的最終寬度與高度無條件捨去為整數像素。計算覆蓋處理後的圖像所需的圖像區塊數,這就是套用模型乘數之前的圖像 Token 數量。如果有圖像區塊額度限制,此數量就不會超過該額度。
resized_patch_count = ceil(resized_width/32)×ceil(resized_height/32)
如果此數量超過 30,000 個圖像區塊,API 就會拒絕請求。請先檢查此上限,再套用 Token 乘數。
D. 將圖像區塊數乘以模型的乘數,再無條件進位,即可得出計費的圖像輸入 Token 數量。依模型的輸入單價計算這些 Token 的費用即可;此乘數不適用於提示詞的其他 Token,也不應再次套用至價格。
| 模型 | 乘數 |
|---|
gpt-6-astra | 1.2 |
gpt-5.6-sol | 1.2 |
gpt-5.6-terra | 1.2 |
gpt-5.6-luna | 1.2 |
gpt-5.5 | 1.2 |
gpt-5.4 | 1.2 |
gpt-5.4-mini | 1.2 |
gpt-5.4-nano | 1.2 |
gpt-5.2 | 1.2 |
gpt-5-mini* | 1.2 |
gpt-5-nano* | 1.5 |
gpt-4.1-mini | 1.62 |
gpt-4.1-nano*(2025-04-14 快照) | 2.46 |
o4-mini* | 1.72 |
對於 gpt-4.1-mini,此數值適用於 2025-04-14 快照。
* 已棄用並預定停止服務。如需日期與替代模型,請參閱棄用時程。計算工具和上方的模型尺寸調整表均未包含這些模型。
gpt-6-astra 搭配 detail: high 的圖像 Token 計算範例
此組合的單邊尺寸上限為 65,535 像素,圖像區塊額度為 2,500 個,乘數為 1.2×。
- 一張 1024 × 1024 的圖像需要
32 × 32 = 1024 個圖像區塊,無須調整尺寸。計費的圖像輸入量為 ceil(1024 × 1.2) = 1229 個 Token。
- 一張 2048 × 2048 的圖像原本需要
64 × 64 = 4096 個圖像區塊。為符合圖像區塊額度,圖像會縮小至 1600 × 1600 像素,即 50 × 50 = 2500 個圖像區塊。預估用量為 ceil(2500 × 1.2) = 3000 個 Token。
- 一張 4096 × 512 的圖像會維持原始尺寸:需要
128 × 16 = 2048 個圖像區塊,用量為 ceil(2048 × 1.2) = 2458 個 Token。
計費時的浮點數捨入可能導致最終數量與預估值相差一個 Token。
此表中的模型以基礎 Token 數加上圖像圖磚的 Token 數計算用量:
| 模型 | 基礎 Token 數 | 每個圖磚的 Token 數 |
|---|
gpt-5.1 | 70 | 140 |
gpt-5* | 70 | 140 |
gpt-4o、gpt-4.1 | 85 | 170 |
gpt-4o-mini | 2833 | 5667 |
o1*、o1-pro*、o3* | 75 | 150 |
* 已棄用並預定停止服務。如需日期與替代模型,請參閱棄用時程。計算工具和上方的模型尺寸調整表均未包含這些模型。
使用 "detail": "low" 時,無論圖像尺寸為何,都只計入模型的基礎 Token 數。使用 "detail": "high" 或 "detail": "auto" 時:
- 維持長寬比,將圖像縮小至可容納於 2048px x 2048px 的正方形內。較小的圖像不會放大。
- 如果最短邊超過 768px,將其縮小至 768px,並將另一邊的尺寸向下取整。
- 計算覆蓋圖像所需的 512px 正方形數量。每個正方形都使用該模型的每個圖磚 Token 數。
- 將模型的基礎 Token 數加到圖磚的 Token 總數中。
GPT Image 模型的生成與編輯功能採用獨立的圖像 Token 定價。視覺計算工具不會估算這些模型的輸入或輸出費用。如需目前的費率,請參閱圖像生成定價;如需生成與編輯工作流程,請參閱圖像生成指南。
以下輸入 Token 規則適用於 gpt-image-1。採用以圖磚為基礎的圖像尺寸調整方式,但將最短邊縮小至 512px,而非 768px。Token 用量取決於圖像尺寸和 Images API 中的 input_fidelity 參數。
當輸入傳真度設為低時,基礎用量為 65 個圖像 Token,每個圖磚則使用 129 個圖像 Token。
使用高輸入傳真度時,除了上述圖像 Token,我們還會根據圖像的長寬比加上固定數量的 Token。
- 如果圖像為正方形,我們會額外加上 4160 個輸入圖像 Token。
- 如果圖像較接近直式或橫式,我們會額外加上 6240 個 Token。
如需圖像輸入 Token 的定價,請參閱圖像定價章節。
視覺模型可能會出錯。設計應用程式時,請將以下限制納入考量:
- 醫療影像:模型不適合判讀 CT 掃描等專業醫療影像,也不應用於提供醫療建議。
- 非英語:處理包含日文或韓文等非拉丁字母文字的圖像時,模型的表現可能不盡理想。
- 小字:放大圖像中的文字可提高可讀性。如果模型支援,使用
"detail": "original" 也有助於改善表現。
- 旋轉:模型可能會誤判旋轉或上下顛倒的文字與圖像。
- 視覺元素:模型可能難以理解顏色或樣式各異的圖表或文字,例如使用實線、虛線或點線的內容。
- 空間推理:模型難以處理需要精確空間定位的任務,例如辨識西洋棋棋子的位置。
- 準確性:在某些情況下,模型可能會生成不正確的描述或圖說。
- 圖像形狀:模型難以處理全景和魚眼圖像。
- 中繼資料與尺寸調整:模型不會處理原始檔名或中繼資料。圖像可能會在分析前調整尺寸,即使使用
original 詳細程度也一樣。如需各模型適用的限制,請參閱模型尺寸調整行為。
- 計數:模型可能只會提供圖像中物件的大致數量。
- CAPTCHA 驗證碼:基於安全考量,我們的系統會封鎖 CAPTCHA 驗證碼的提交。