> ## Documentation Index
> Fetch the complete documentation index at: https://docs.geekai.co/llms.txt
> Use this file to discover all available pages before exploring further.

# 图片对话

### 支持的模型

极客智坊支持图片对话，你可以在[模型广场](https://geekai.co/models)通过对话模型->图片识别筛选来查看所有支持图片分析的对话模型：

![筛选极客智坊支持图片分析的对话模型](https://static.geekai.co/storage/2025/10/15/image-20251015212402629.png)

### 单张图片

以下是包含单张图片的对话请求示例：

<CodeGroup>
  ```bash curl theme={null}
  curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \
  --header 'Authorization: Bearer $GEEKAI_API_KEY' \
  --header 'Content-Type: application/json' \
  --data-raw '{
      "model": "gpt-5-mini",
      "messages": [
        {
          "role": "user",
          "content": [
            {
              "type": "text",
              "text": "请提取中包含的文字，并以列表形式输出"
            },
            {
              "type": "image_url",
              "image_url": {
                "url": "https://static.geekai.co/storage/2025/03/08/1741444660440.jpg"
              }
            }
          ]
        }
      ]
  }'
  ```

  ```bash python theme={null}
  from openai import OpenAI

  client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1")

  response = client.chat.completions.create(
      model="gpt-5-mini",
      messages=[{
          "role": "user",
          "content": [
              {"type": "text", "text": "图片中包含什么内容?"},
              {
                  "type": "image_url",
                  "image_url": {
                      "url": "https://static.geekai.co/storage/2025/03/08/1741444660440.jpg",
                  },
              },
          ],
      }],
  )

  print(response.choices[0].message.content)
  ```

  ```bash javascript theme={null}
  import OpenAI from "openai";

  const openai = new OpenAI({
      baseURL: 'https://geekai.co/api/v1',
      apiKey: '$GEEKAI_API_KEY'
  });

  const response = await openai.chat.completions.create({
      model: "gpt-5-mini",
      messages: [{
          role: "user",
          content: [
              { type: "text", text: "图片中包含什么内容?" },
              {
                  type: "image_url",
                  image_url: {
                      url: "https://static.geekai.co/storage/2025/03/08/1741444660440.jpg",
                  },
              },
          ],
      }],
  });

  console.log(response.choices[0].message.content);
  ```

  ```bash go theme={null}
  package main

  import (
  	"bytes"
  	"encoding/json"
  	"fmt"
  	"io"
  	"net/http"
  )

  func main() {
  	requestBody := map[string]interface{}{
  		"model": "gpt-5-mini",
  		"messages": []interface{}{
        map[string]interface{}{
          "role": "user", 
          "content": []interface{}{
            map[string]interface{}{
              "type": "text", 
              "text": "图片包含什么内容?",
            },
            map[string]interface{}{
              "type": "image_url", 
              "image_url": map[string]interface{}{
                "url": "https://static.geekai.co/logo/geekai-logo-main-tr.png",
              },
            },
          },
        },
      }
  	}
  	
  	jsonData, err := json.Marshal(requestBody)
  	if err != nil {
  		panic(err)
  	}

  	client := &http.Client{}
  	req, err := http.NewRequest("POST", "https://geekai.co/api/v1/chat/completions", bytes.NewBuffer(jsonData))
  	if err != nil {
  		panic(err)
  	}

  	req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY")
  	req.Header.Set("Content-Type", "application/json")

  	resp, err := client.Do(req)
  	if err != nil {
  		panic(err)
  	}
  	defer resp.Body.Close()

  	body, err := io.ReadAll(resp.Body)
  	if err != nil {
  		panic(err)
  	}

  	fmt.Println(string(body))
  }
  ```
</CodeGroup>

### 多张图片

多张图片识别传入多个 `image_url` 对象到 `content` 列表即可:

<CodeGroup>
  ```bash curl theme={null}
  curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \
  --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \
  --header 'Content-Type: application/json' \
  --data-raw '{
      "model": "gpt-5-mini",
      "messages": [
        {
          "role": "user",
          "content": [
            {
              "type": "text",
              "text": "找出两张图片中的不同点"
            },
            {
              "type": "image_url",
              "image_url": {
                "url": "https://static.geekai.co/storage/2025/05/14/image1.jpg"
              }
            },
            {
              "type": "image_url",
              "image_url": {
                "url": "https://static.geekai.co/storage/2025/05/14/image2.jpg"
              }
            }
          ]
        }
      ]
  }'
  ```

  ```bash python theme={null}
  from openai import OpenAI

  client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1")

  response = client.chat.completions.create(
      model="gpt-5-mini",
      messages=[{
          "role": "user",
          "content": [
              {"type": "text", "text": "找出两张图片中的不同点"},
              {
                  "type": "image_url",
                  "image_url": {
                      "url": "https://static.geekai.co/storage/2025/05/14/image1.jpg"
                  }
              },
              {
                  "type": "image_url",
                  "image_url": {
                      "url": "https://static.geekai.co/storage/2025/05/14/image2.jpg"
                  }
              }
          ]
      }]
  )

  print(response.choices[0].message.content)
  ```

  ```bash javascript theme={null}
  import OpenAI from "openai";

  const openai = new OpenAI({
      baseURL: 'https://geekai.co/api/v1',
      apiKey: '$GEEKAI_API_KEY'
  });

  const response = await openai.chat.completions.create({
      model: "gpt-5-mini",
      messages: [{
          role: "user",
          content: [
              { type: "text", text: "找出两张图片中的不同点" },
              {
                  type: "image_url",
                  image_url: {
                      url: "https://static.geekai.co/storage/2025/05/14/image1.jpg"
                  }
              },
              {
                  type: "image_url",
                  image_url: {
                      url: "https://static.geekai.co/storage/2025/05/14/image2.jpg"
                  }
              }
          ]
      }]
  });

  console.log(response.choices[0].message.content);
  ```

  ```bash go theme={null}
  package main

  import (
  	"bytes"
  	"encoding/json"
  	"fmt"
  	"io"
  	"net/http"
  )

  func main() {
  	requestBody := map[string]interface{}{
  		"model": "gpt-5-mini",
  		"messages": []interface{}{
  			map[string]interface{}{
  				"role": "user",
  				"content": []interface{}{
  					map[string]interface{}{
  						"type": "text",
  						"text": "找出两张图片中的不同点",
  					},
  					map[string]interface{}{
  						"type": "image_url",
  						"image_url": map[string]interface{}{
  							"url": "https://static.geekai.co/storage/2025/05/14/image1.jpg",
  						},
  					},
  					map[string]interface{}{
  						"type": "image_url",
  						"image_url": map[string]interface{}{
  							"url": "https://static.geekai.co/storage/2025/05/14/image2.jpg",
  						},
  					},
  				},
  			},
  		},
  	}

  	jsonData, err := json.Marshal(requestBody)
  	if err != nil {
  		panic(err)
  	}

  	client := &http.Client{}
  	req, err := http.NewRequest("POST", "https://geekai.co/api/v1/chat/completions", bytes.NewBuffer(jsonData))
  	if err != nil {
  		panic(err)
  	}

  	req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY")
  	req.Header.Set("Content-Type", "application/json")

  	resp, err := client.Do(req)
  	if err != nil {
  		panic(err)
  	}
  	defer resp.Body.Close()

  	body, err := io.ReadAll(resp.Body)
  	if err != nil {
  		panic(err)
  	}

  	fmt.Println(string(body))
  }
  ```
</CodeGroup>
