API调用
简介
Wahoo AI 通过使用统一格式调用 Open AI、Claude 和 Gemini,使请求和返回格式一致。这种方法极大地简化了调用过程,并为第三方客户端的整合带来了便利。统一的接口不仅提高了效率,还减少了开发人员在适应不同 AI 平台上的时间和精力。通过这种标准化的方式,Wahoo AI 提供了一个更为流畅和无缝的用户体验,使开发人员能够更加专注于创新和应用开发,而不必为不同平台的兼容性问题所困扰。
Open AI
Curl调用方式
(请替换令牌sk-xxxxxx)
curl https://my.wahooai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxx" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "Hello!"}]
}'
Open AI Python调用方式
from openai import OpenAI
client = OpenAI(
base_url='https://my.wahooai.com/v1',
api_key='sk-xxxxxx',
)
chat_completion = client.chat.completions.create(
messages=[
{
"role": "user",
"content": "Hello",
}
],
model="gpt-4o-mini",
)
Google Gemini
Curl调用方式
curl https://my.wahooai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxx" \
-d '{
"model": "gemini-1.5-pro-001",
"messages": [{"role": "user", "content": "Hello!"}]
}'
Anthropic Claude
Curl调用方式
curl https://my.wahooai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxx" \
-d '{
"model": "claude-3-5-sonnet-20240620",
"messages": [{"role": "user", "content": "Hello!"}]
}'