Skip to content

图片编辑不支持gemini API: Unknown name \"image_config\": Cannot find field. #7

@renewboy

Description

@renewboy
const res = await fetch(`${BASE_URL}/chat/completions`, {
      method: "POST",
      headers: {
        Authorization: `Bearer ${API_KEY}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        model: MODEL,
        messages: [
          {
            role: "user",
            content: [
              { type: "text", text },
              {
                type: "image_url",
                image_url: { url: `data:image/png;base64,${base64}` },
              },
            ],
          },
        ],
        modalities: ["image", "text"],
        image_config: { image_size: imageSize },
      }),
      signal: controller.signal,
    });

这个写法gemini api不支持,只有openrouter能这样写,建议改成官方写法

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions