1. openai-completions接口
Grsai API
  • Grsai图片/视频生成接口
    • nano-banana接口
      POST
    • gpt-image-2接口
      POST
    • 异步生成结果查询接口
      GET
  • openai-completions接口
    • /v1/chat/completions
      POST
  • openai-generations接口
    • /v1/images/generations
      POST
  1. openai-completions接口

/v1/chat/completions

POST
https://{base_url}/v1/chat/completions
基础节点:
https://grsaiapi.com (全球节点)
https://grsai.dakka.com.cn (国内节点)
例子:
https://grsaiapi.com/v1/chat/completions
https://grsai.dakka.com.cn/v1/chat/completions

请求参数

Path 参数

Header 参数

Body 参数application/json必填

示例
{
    "model": "gemini-3.1-pro",
    "stream": false,
    "messages": [
        {
            "role": "user",
            "content": "你好"
        }
    ]
}

请求示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
cURL
curl --location 'https://v1/chat/completions' \
--header 'Authorization: Bearer sk-xxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
    "model": "gemini-3.1-pro",
    "stream": false,
    "messages": [
        {
            "role": "user",
            "content": "你好"
        }
    ]
}'

返回响应

🟢200json响应
application/json
Bodyapplication/json

示例
{
    "id": "1-2ede12b5-77cc-48f9-b1d0-7ae35ee8d444",
    "object": "",
    "created": 1777897048,
    "model": "gemini-3.1-pro",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "你好!请问有什么我可以帮您的吗?"
            },
            "finish_reason": "stop",
            "content_filter_results": {
                "hate": {
                    "filtered": false
                },
                "self_harm": {
                    "filtered": false
                },
                "sexual": {
                    "filtered": false
                },
                "violence": {
                    "filtered": false
                },
                "jailbreak": {
                    "filtered": false,
                    "detected": false
                },
                "profanity": {
                    "filtered": false,
                    "detected": false
                }
            }
        }
    ],
    "usage": {
        "prompt_tokens": 2,
        "completion_tokens": 261,
        "total_tokens": 263,
        "prompt_tokens_details": null,
        "completion_tokens_details": null
    },
    "system_fingerprint": ""
}
🟢200stream流响应
🟠400报错
修改于 2026-05-05 11:53:56
上一页
异步生成结果查询接口
下一页
/v1/images/generations
Built with