"github.com/openai/openai-go/v3"
"github.com/openai/openai-go/v3/option"
"github.com/openai/openai-go/v3/responses"
client := openai.NewClient(option.WithBaseURL("https://ark.cn-beijing.volces.com/api/v3"))
ctx := context.Background()
tools := []map[string]any{
"type": "image_process",
"point": map[string]string{
"grounding": map[string]string{
"zoom": map[string]string{
"rotate": map[string]string{
"type": "enabled", // 启用旋转(rotate)工具
stream := client.Responses.NewStreaming(ctx, responses.ResponseNewParams{
Input: responses.ResponseNewParamsInputUnion{
OfInputItemList: []responses.ResponseInputItemUnionParam{
OfInputMessage: &responses.ResponseInputItemMessageParam{
Role: openai.F(responses.ResponseInputMessageItemRoleUser),
Content: openai.F([]responses.ResponseInputContentUnionParam{
OfInputImage: &responses.ResponseInputImageParam{
ImageURL: openai.String("https://ark-project.tos-cn-beijing.volces.com/doc_image/image_process_1.jpg"),
OfInputText: &responses.ResponseInputTextParam{
Text: openai.F("帮我把图片顺时针旋转 90 度。"),
Model: openai.F("doubao-seed-2-0-lite-260215"),
}, option.WithJSONSet("tools", tools), option.WithHeaderAdd("ark-beta-image-process", "true"))
data := stream.Current()
fmt.Println(data.RawJSON())
if stream.Err() != nil {