Edge Developer Platform
  • AI Gateway
    • Product Introduction
    • Quick Start
    • Development Guide
      • V1
      • V2
        • Overview
        • Introduction to Common Request Headers
        • Tencent-HunYuan
        • Baidu-QianFan
        • Byte-Doubao
        • Ali-TongYi
        • Moonshot-KIMI
        • Minimax
        • Open AI
        • Gemini
    • FAQs
    • Release Notes

Baidu-QianFan

chat v1

Request URL

https://ai-gateway-intl.eo-edgefunctions7.com

Request method

POST

Request headers

Parameter name
Required
Type
Description
OE-Key
Yes
string
Gateway API key
OE-Gateway-Name
Yes
string
Gateway name
OE-AI-Provider
Yes
string
AI service provider, fixed value: baidu
OE-Gateway-Version
Yes
string
Gateway version, fixed value: 2
Api-Version
Yes
string
API version, fixed value: v1
Action
Yes
string
Fixed value: chat
Access-Token
Yes
string
Authentication Key of LLM Service Provider
Content-Type
Yes
string
Fixed value: application/json

Request body

Parameter name
Required
Type
Description
model
Yes
string
Model Name
messages
Yes
array
Message list, each message includes role and content
stream
Yes
boolean
Enable stream processing
Request Body Example
{
"model": "completions_pro",
"messages": [
{
"role": "user",
"content": "1+1=?"
}
]
"stream": true
}

Sample response

The response format is JSON, and the specific content depends on the actual API return result.

Sample code for curl request

curl --location --request POST 'https://ai-gateway-intl.eo-edgefunctions7.com' \
--header 'OE-Key: xxxx' \
--header 'OE-Gateway-Name: xxxx' \
--header 'OE-AI-Provider: baidu' \
--header 'OE-Gateway-Version: 2' \
--header 'Access-Token: xxxx' \
--header 'Api-Version: v1' \
--header 'Action: completions' \
--header 'Content-Type: application/json' \
--data-raw '{
"model":"completions_pro",
"messages": [
{
"role": "user",
"content": "1+1=?"
}
]
"stream":true
}'

Notes

Note:
1. Please ensure all required parameters are correctly filled out.
2. Adjust the Access-Token and Action headers as needed based on actual conditions.
3. The messages array in the request body can contain multiple Message Objects, depending on business needs.

chat v2

This connects to Baidu QianFan chat v2 interface https://qianfan.baidubce.com/v2/chat/completions, please refer to: https://cloud.baidu.com/doc/WENXINWORKSHOP/s/Um2wxbaps for details.

Request URL

https://ai-gateway-intl.eo-edgefunctions7.com

Request method

POST

Request headers

Parameter name
Required
Type
Description
OE-Key
Yes
string
Gateway API key
OE-Gateway-Name
Yes
string
Gateway name
OE-AI-Provider
Yes
string
AI service provider, fixed value: baidu
OE-Gateway-Version
Yes
string
Gateway version, fixed value: 2
Api-Version
Yes
string
API version, fixed value: v2
Authorization
Yes
string
Authentication Key of LLM Service Provider
Content-Type
Yes
string
Fixed value: application/json

Request body

Parameter name
Required
Type
Description
model
Yes
string
Model Name
messages
Yes
array
Message list, each message includes role and content
stream
Yes
boolean
Enable stream processing
Request Body Example
{
"model": "completions_pro",
"messages": [
{
"role": "user",
"content": "1+1=?"
}
]
"stream": true
}

Sample response

The response format is JSON, and the specific content depends on the actual API return result.

Sample code for curl request

curl --location --request POST 'https://ai-gateway-intl.eo-edgefunctions7.com' \
--header 'OE-Key: xxxx' \
--header 'OE-Gateway-Name: xxxx' \
--header 'OE-AI-Provider: baidu' \
--header 'OE-Gateway-Version: 2' \
--header 'Api-Version: v2' \
--header 'Authorization: xxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"model":"completions_pro",
"messages": [
{
"role": "user",
"content": "1+1=?"
}
]
"stream":true
}'

Notes

Note:
1. Please ensure all required parameters are correctly filled out.
2. Adjust the Authorization header based on actual conditions.
3. The messages array in the request body can contain multiple Message Objects, depending on business needs.