身份验证
所有 API 请求都需要使用您的 API 密钥进行身份验证。在每个请求的 Authorization 标头中包含您的 API 密钥。
标头示例
Authorization: Bearer YOUR_API_KEY重要: 保护您的 API 密钥安全,永远不要在客户端代码中暴露它。
速率限制
免费层
1,000
每天请求数
每分钟
60
每分钟请求数
上下文窗口
1M
令牌上下文窗口
API 端点
POST
/v1/generateGenerate text using Gemini models
请求
curl -X POST \
  https://api.gemini-guide.com/v1/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Your prompt here"}'
响应
{
  "status": "success",
  "data": {
    "response": "Generated content...",
    "model": "gemini-pro",
    "usage": {
      "tokens": 150
    }
  }
}
POST
/v1/chatStart or continue a chat conversation
请求
curl -X POST \
  https://api.gemini-guide.com/v1/chat \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Your prompt here"}'
响应
{
  "status": "success",
  "data": {
    "response": "Generated content...",
    "model": "gemini-pro",
    "usage": {
      "tokens": 150
    }
  }
}
GET
/v1/modelsList available models
请求
curl -X GET \
  https://api.gemini-guide.com/v1/models \
  -H "Authorization: Bearer YOUR_API_KEY" \
响应
{
  "status": "success",
  "data": {
    "response": "Generated content...",
    "model": "gemini-pro",
    "usage": {
      "tokens": 150
    }
  }
}
GET
/v1/usageGet API usage statistics
请求
curl -X GET \
  https://api.gemini-guide.com/v1/usage \
  -H "Authorization: Bearer YOUR_API_KEY" \
响应
{
  "status": "success",
  "data": {
    "response": "Generated content...",
    "model": "gemini-pro",
    "usage": {
      "tokens": 150
    }
  }
}
错误代码
400Bad Request
Invalid request parameters
401Unauthorized
Invalid or missing API key
429Too Many Requests
Rate limit exceeded
500Internal Server Error
Server error occurred