API Call
Introduction
Wahoo AI enables consistent request and response formats by using a unified format to call Open AI, Claude, and Gemini. This approach greatly simplifies the invocation process and facilitates integration for third-party clients. The unified interface not only improves efficiency but also reduces the time and effort developers spend adapting to different AI platforms. Through this standardized method, Wahoo AI provides a smoother and more seamless user experience, allowing developers to focus more on innovation and application development without being troubled by compatibility issues across different platforms.
Open AI
Curl Invoke
(Please replace the token sk-xxxxxx)
curl https://api.wahooai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxx" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello!"}]
}'
Open AI Python调用方式
from openai import OpenAI
client = OpenAI(
base_url='https://api.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 (Open AI format)
curl https://api.wahooai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxx" \
-d '{
"model": "gemini-1.5-pro",
"messages": [{"role": "user", "content": "Hello!"}]
}'
Curl (Gemini format)
curl "https://api.wahooai.com/gemini/models/gemini-1.5-flash:streamGenerateContent?alt=sse" \
-H 'Content-Type: application/json' \
-H 'x-goog-api-key: sk-xxxxxx' \
-X POST \
-d '{ "system_instruction": {
"parts":
{ "text": "You are a cat. Your name is Neko."}},
"contents": {
"parts": {
"text": "Hello there"}}}'
Anthropic Claude
Curl (Open AI format)
curl https://api.wahooai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxx" \
-d '{
"model": "claude-3-5-sonnet-20241022",
"messages": [{"role": "user", "content": "Hello!"}]
}'
Curl (Anthropic format)
curl https://api.wahooai.com/anthropic/v1/messages \
--header "x-api-key: sk-xxxxxx" \
--header "anthropic-version: 2023-06-01" \
--header "content-type: application/json" \
--data \
'{
"model": "claude-3-5-sonnet-20241022",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Hello, world"}
]
}'
xAI Grok
The model calling method of xAI is the same as that of Open AI. You only need to replace the model name.