EasyRouterEasyRouter
使用指南API 文档接入 Agent 工具
AI 模型接口图像(Images)Gemini 格式

OpenAI聊天格式

Gemini 图片生成

POST
/v1/chat/completions

Authorization

BearerAuth

AuthorizationBearer <token>

使用 Bearer Token 认证。 格式: Authorization: Bearer sk-xxxxxx

In: header

Request Body

application/json

model*string
stream*boolean
messages*
extra_body?
contents*

Response Body

application/json

curl -X POST "https://easyrouter.io/v1/chat/completions" \  -H "Content-Type: application/json" \  -d '{    "model": "gemini-3.1-flash-image-preview",    "stream": false,    "messages": [      {        "role": "user",        "content": "生成一张宇航员在奥宇宙中飘浮的图片"      }    ],    "modalities": [      "text",      "image"    ]  }'
{
  "id": "string",
  "model": "string",
  "object": "string",
  "created": 0,
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "string",
        "content": "string"
      },
      "finish_reason": "string"
    }
  ],
  "usage": {
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "total_tokens": 0
  }
}