新一代語言模型可以接收並分析圖像,這項能力稱為視覺。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
20
21import 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];
if (!imageBase64) throw new Error("The image generation result is empty.");
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: fs.PathLike) {
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 張圖像 |
對於以區塊計算 Token 的圖像輸入,API 會先依所選模型和 detail 等級的規則調整圖像尺寸,調整後每張圖像最多支援 30,000 個區塊。所有支援的細節等級都適用這項限制,區塊數以單張圖像為單位計算,而非加總同一請求中的所有圖像。
如果模型和細節等級對縮放後的區塊數有更低的上限,仍須遵守該上限。如果圖像經處理後仍超過 30,000 個區塊,API 會拒絕請求,不會為了符合這項限制而自動縮小圖像。請縮小圖像尺寸後再試一次。
圖像 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 個區塊的上限,API 會拒絕請求,不會再縮小圖像。若任務需要精確座標,請在傳送前將圖像縮放至符合這些限制,再將傳回的座標換算為原始圖像的座標。座標處理方式請參閱電腦操作指南。
下表整理了一般用途視覺模型的尺寸調整規則。其他模型和專用版本可能採用不同的限制。所有尺寸調整都會維持長寬比,且不會放大較小的圖像。
| 模型系列 | 支援的細節等級 | 區塊數與尺寸調整規則 |
|---|
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 數與費用。
部分模型以 32 × 32 像素的區塊覆蓋圖像,藉此將圖像 Token 化。許多模型與細節等級的組合都會設定縮放時的區塊數上限。API 會先將圖像調整至所選細節等級允許的像素尺寸範圍內,維持長寬比,並將像素尺寸四捨五入為整數,但不會放大較小的圖像。接著依下列步驟計算 Token 用量:
A. 套用像素尺寸限制後,計算覆蓋整張圖像需要多少個 32 × 32 像素的區塊。區塊可以延伸至圖像邊界之外。
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" 時,請依下列步驟計算:
- 維持長寬比,將圖像縮小至 2048 × 2048 像素的正方形範圍內。較小的圖像不會放大。
- 如果最短邊超過 768 像素,請將其縮短至 768 像素,並將等比例縮放後的另一邊長度無條件捨去至整數。
- 計算覆蓋圖像所需的正方形圖塊數,每個圖塊的邊長為 512 像素。每個圖塊使用的 Token 數依模型而定。
- 將模型的基本 Token 數加上所有圖塊的 Token 數。
GPT Image 模型在生成和編輯圖像時,採用獨立的圖像 Token 計價方式。視覺模型的計算機不會估算 GPT Image 模型的輸入或輸出費用。現行費率請參閱圖像生成定價,生成和編輯圖像的流程請參閱圖像生成指南。
gpt-image-1 已於 2026 年 10 月 23 日停用。以下保留輸入 Token 的計算規則,以供比較歷史費用。替代模型請參閱棄用公告。
計算舊版請求的用量時,請採用以圖塊為單位的尺寸調整規則,但將最短邊縮小至 512 像素,而非 768 像素。Token 用量取決於圖像尺寸和 input_fidelity 參數的設定。此參數的說明請參閱 Images API。
輸入保真度設為低時,基本用量為 65 個圖像 Token,每個圖塊另計 129 個圖像 Token。
輸入保真度設為高時,除了上述圖像 Token 外,還會依圖像的長寬比加計固定數量的 Token。
- 如果圖像為正方形,會額外計入 4160 個圖像輸入 Token。
- 如果圖像較接近直幅或橫幅,會額外計入 6240 個 Token。
過去的圖像輸入 Token 價格請參閱 GPT Image 1 模型頁面。
視覺模型可能出錯。設計應用程式時,請考量下列限制:
- 醫學影像:模型不適合判讀電腦斷層掃描(CT)等專業醫學影像,也不應用於提供醫療建議。
- 非英文文字:處理含有日文、韓文等非拉丁文字的圖像時,模型的表現可能較差。
- 小字:請放大圖像中的文字,使其更易於辨識。如果模型支援,使用
"detail": "original" 也可能改善辨識效果。
- 旋轉:模型可能誤讀旋轉或上下顛倒的文字和圖像。
- 視覺元素:模型可能難以理解使用不同顏色或樣式(例如實線、虛線或點線)的圖表或文字。
- 空間推理:模型不擅長需要精確定位的任務,例如辨識西洋棋棋子在棋盤上的位置。
- 準確性:在某些情況下,模型可能生成不正確的圖像描述或圖說。
- 圖像形態:模型不擅長解讀全景或魚眼圖像。
- 中繼資料與尺寸調整:模型不會處理原始檔名或中繼資料。分析前可能會調整圖像尺寸,即使細節等級設為
original 也一樣。各模型適用的限制請參閱各模型的尺寸調整規則。
- 計數:模型對圖中物體數量的回答可能只是約略值。
- 驗證碼(CAPTCHA):基於安全考量,系統會阻擋提交驗證碼的請求。