Skip to content

API Key

1. API Key

我们的 API 使用 Bearer 令牌对请求进行身份验证。你可以直接通过 curl 或 OpenAI SDK 与 AI Ping 交互。

1.1 管理 API Key

  1. 在上方导航栏进入“个人中心”,并点击左侧“API 密钥”来到 API 密钥管理页面

  1. 注册账号时,系统会默认为您创建一个 API Key。若需新增,点击右上角的 “API KEY” 按钮即可创建新的 API Key。

  2. 请妥善保管密钥,避免泄露。您可以随时删除它。

1.2 使用 API Key

替换 <API_KEY> 为您的 API Key 即可

python
import requests
headers = {
  'Authorization': '<API_KEY>',
  'Content-Type': 'application/json',
}
response = requests.post('https://aiping.cn/api/v1/chat/completions', headers=headers, json={
    'model': 'DeepSeek-R1-0528',
    'messages': [
      {
        'role': 'user',
        'content': 'What is the meaning of life?'
      }
    ]
    }
})
response.encoding = 'utf-8'
print(response.text)