gemini测试

export GEMINI_API_KEY="AQ.Ab8RN6Llv6eH0IFQsCfmquXA-CXPJE9U79zV5RIygTBhNhYAmQ"

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H 'Content-Type: application/json' \
  -X POST \
  -d '{
    "contents": [
      {
        "parts": [
          {
            "text": "Explain how AI works in a few words"
          }
        ]
      }
    ]
  }'
sk-cfM4JRNqd4UYwWnfBwCaS3LXozDkrCX4IT2PLJBvM4TAoXk5
http://152.32.216.51/image.jpg http://152.32.216.51/audio.mp3 http://152.32.216.51/video.mp4 ==文字测试通过
curl http://51.81.184.93:32691/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-RwB8UKDFnhGl9sQIXQyth4V2xRhZX5fKnV4A7XRykTC8l94a" \
  -d '{
    "model": "gemini-2.5-flash",
    "messages": [
      {
        "role": "user",
        "content": "你好,写一首诗歌"
      }
    ]
  }'
==图片测试通过
curl https://workerapi.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-cfM4JRNqd4UYwWnfBwCaS3LXozDkrCX4IT2PLJBvM4TAoXk5" \
  -d '{
    "model": "gemini-2.5-flash",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "请分析总结下面这张图片主要讲了什么?"
          },
          {
            "type": "image_url",
            "image_url": {
              "url": "http://152.32.216.51/image.jpg"
            }
          }
        ]
      }
    ]
  }'
==音频测试
curl https://workerapi.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-cfM4JRNqd4UYwWnfBwCaS3LXozDkrCX4IT2PLJBvM4TAoXk5" \
  -d '{
    "model": "gemini-2.5-flash",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "请分析总结下面这个音频主要讲了什么?"
          },
          {
            "type": "audio_url",
            "audio_url": {
              "url": "http://152.32.216.51/audio.mp3"
            }
          }
        ]
      }
    ]
  }'
==视频测试
curl https://workerapi.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-cfM4JRNqd4UYwWnfBwCaS3LXozDkrCX4IT2PLJBvM4TAoXk5" \
  -d '{
    "model": "gemini-2.5-flash",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "请分析总结下面这个视频主要讲了什么?"
          },
          {
            "type": "video_url",
            "video_url": {
              "url": "http://152.32.216.51/video.mp4"
            }
          }
        ]
      }
    ]
  }'
curl https://workerapi.com/v1/chat/completions \
   -H 'Content-Type: application/json' \
   -H 'Authorization: Bearer sk-cfM4JRNqd4UYwWnfBwCaS3LXozDkrCX4IT2PLJBvM4TAoXk5' \
  -d '{
    "contents": [
      {
        "role": "user",
        "parts": [
          {
            "text": "请分析总结下面的图片、音频、视频各自主要讲了什么?"
          },
          {
            "inlineData": {
              "mimeType": "image/jpeg",
              "data": "BASE64_IMAGE_DATA"
            }
          },
          {
            "fileData": {
              "mimeType": "audio/mpeg",
              "fileUri": "https://example.com/audio/file-xxx.mp3"
            }
          },
          {
            "fileData": {
              "mimeType": "video/mp4",
              "fileUri": "https://example.com/video/file-xxx.mp4"
            }
          }
        ]
      }
    ]
  }'
==图片测试通过2
curl https://workerapi.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-cfM4JRNqd4UYwWnfBwCaS3LXozDkrCX4IT2PLJBvM4TAoXk5" \
  -d '{
    "model": "gemini-2.5-flash",
    "messages": [
      {
        "role": "user",
        "content": [
          { "type": "text", "text": "请分析总结下面的图片主要讲了什么?" },
          { "type": "image_url", "image_url": { "url": "http://152.32.216.51/image.jpg" } }
        ]
      }
    ]
  }'

==音频测试通过✅
curl https://workerapi.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-cfM4JRNqd4UYwWnfBwCaS3LXozDkrCX4IT2PLJBvM4TAoXk5" \
  -d '{
    "model": "gemini-2.5-flash",
    "messages": [
      {
        "role": "user",
        "content": [
          { "type": "text", "text": "请分析总结下面这个音频主要讲了什么?" },
          { "type": "audio_url", "audio_url": { "url": "http://152.32.216.51/audio.mp3" } }
        ]
      }
    ]
  }'
curl https://workerapi.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-vY4wqt6m37TxbT1olXbFKP50IXQmxPVp2zSXjDcBaqfLYkLY" \
  -d '{
    "raw_proxy": true,
    "model": "gemini-2.5-flash",
    "contents": [
      {
        "role": "user",
        "parts": [
          { "text": "请分析总结下面这个音频主要讲了什么?" },
          {
            "fileData": {
              "mimeType": "audio/mpeg",
              "fileUri": "http://152.32.216.51/audio.mp3"
            }
          }
        ]
      }
    ]
  }'

Date:
Words:
430
Time to read:
2 mins