AuraX API Documentation (僅供參考)
全面了解如何將 Aurax AI 無縫接入您的應用程式。我們提供與 OpenAI 完全兼容的 API 格式,讓您以極低成本調用全球頂級模型。
Learn how to seamlessly integrate Aurax AI into your applications. We provide an OpenAI-compatible API format, allowing you to access top-tier global models at a fraction of the cost.
# 快速開始指南 / Quick Start Guide
1. 獲取 Token / Get API Key
登入後台系統,進入「令牌 (Token)」頁面,點擊「添加令牌」即可獲取您的專屬 API Key。
Log into the dashboard, navigate to the "Tokens" page, and click "Add Token" to generate your exclusive API Key.
2. 接口配置 / Base URL Configuration
我們完美兼容 OpenAI 的 SDK,您只需要將原有的 Base URL 替換為以下任一地址:
We are fully compatible with OpenAI SDKs. Simply replace your existing Base URL with any of the following:
https://api.auraxai.dev/v1
https://api.auraxai.dev/v1/chat/completions
注意:不同客戶端 (如 NextChat、LobeChat) 可能需要使用不同的 Base URL 後綴,建議依次嘗試以上地址。
3. 配置範例 / Configuration Example
{
"base_url": "https://api.auraxai.dev",
"api_key": "your_aurax_token_here",
"model": "gpt-4o"
}# 發出首個請求 / Make Your First Request
您可以將下面的命令粘貼到您的終端機 (Terminal) 中以運行您的第一個 API 請求。請確保將 YOUR_API_KEY 替換為您的真實金鑰。
Paste the following command into your terminal to run your first API request. Make sure to replace YOUR_API_KEY with your actual key.
curl https://api.auraxai.dev/v1/chat/completions \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "Say this is a test!"}],
"temperature": 0.7
}'# API 分組類型對比 / Routing & Billing
💡 關於官方費率與價格差異 / About Official Rates
為確保透明度,我們引入了「官方費率」概念:
• 當分組費率 = 1 時:官方價格扣 $1,我們平台也只扣 $1。
• 當分組費率 = 1.65 時:官方價格扣 $1,我們平台扣 $1.65。
不同的路由渠道成本不同,用戶可根據對穩定性及價格的需求自由選擇。
| 分組名稱 / Group | 類型說明 / Description | 費率倍數 / Multiplier | 支援模型 / Supported |
|---|---|---|---|
| default 默認 | 混合 ChatGPT + Claude + MJ + 國產(DeepSeek+Qwen) | 官方費率 * 1 | All |
| 純 AZ | 只有 ChatGPT 模型(AZ渠道) + 國產模型 | 官方費率 * 1.5 | OpenAI, 國產 |
| 逆向 / Reverse | 支援 GPT + Claude + Gemini + Grok | 官方費率 * 1.4 | All |
| 直連克勞德 | Claude (Anthropic 官方直連渠道,極致穩定) | 官方費率 * 16 | Claude |
# 代理接口調用地址 / API Endpoints
🌐 推薦節點 (全域加速) / Global CDN
- CDN 分站 (全球 60+ 節點)
https://api.auraxai.dev - CF 站 (Cloudflare CDN)
https://cf.auraxai.dev
🔍 其他服務地址 / Other Services
- 免登錄 API 接口 (Proxy)
https://api.proxy.auraxai.dev
# 線上除錯與 FAQ / Debugging & FAQ
1. 報錯:Invalid authorization header
Authorization: Bearer YOUR_API_KEY,並且沒有多餘的空格。2. 無法請求地址 api.openai.com
api.openai.com 完全替換為我們的代理地址 api.auraxai.dev。數據模型 / Data Models
聊天完成對象 (Chat Completion Object)
| 參數 / Parameter | 類型 / Type | 描述 / Description |
|---|---|---|
| id | string | 聊天完成的唯一標識符 |
| choices | array | 聊天完成選項列表。如果 n 大於 1,可以有多個選項 |
| created | integer | 創建聊天完成的 Unix 時間戳 (秒) |
| model | string | 用於聊天完成的模型 |
| system_fingerprint | string | 該指紋表示模型運行的後端配置 |
| object | string | 對象類型,總是 `chat.completion` |
| usage | object | 完成請求的使用統計信息 |
{
"id": "chatcmpl-123",
"object": "chat.completion",
"created": 1677652288,
"model": "gpt-3.5-turbo-0613",
"system_fingerprint": "fp_44709d6fcb",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "\n\nHello there, how may I assist you today?"
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 9,
"completion_tokens": 12,
"total_tokens": 21
}
}聊天完成塊對象 (Chat Completion Chunk Object)
| 參數 / Parameter | 類型 / Type | 描述 / Description |
|---|---|---|
| id | string | 聊天完成的唯一標識符。每個塊具有相同的 ID |
| choices | array | 聊天完成選項列表。如果 n 大於 1,可以有多個選項 |
| created | integer | 創建聊天完成的 Unix 時間戳 (秒)。每個塊具有相同的時間戳 |
| model | string | 生成完成的模型 |
| system_fingerprint | string | 該指紋表示模型運行的後端配置 |
| object | string | 對象類型,總是 `chat.completion.chunk` |
{"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-3.5-turbo-0613", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}
{"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-3.5-turbo-0613", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{"content":"Hello"},"finish_reason":null}]}
{"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-3.5-turbo-0613", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{"content":"!"},"finish_reason":null}]}
....
{"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-3.5-turbo-0613", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{"content":" today"},"finish_reason":null}]}
{"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-3.5-turbo-0613", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{"content":"?"},"finish_reason":null}]}
{"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-3.5-turbo-0613", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}API 參考 / API Reference
GPT-4o-audio 音頻對話
/v1/chat/completions支援文本與音頻模態輸出的對話模型。 / Supports text and audio modality output.
Example Request
{
"model": "gpt-4o-audio-preview",
"modalities": ["text", "audio"],
"audio": {
"voice": "alloy",
"format": "wav"
},
"messages": [
{ "role": "user", "content": "Is a golden retriever a good family dog?" }
]
}音頻轉文字 / Audio Transcription (whisper-1)
/v1/audio/transcriptions將音頻轉換為文字。 / Transcribe audio into text using whisper-1.
Example Request
// Content-Type: multipart/form-data
{
"file": "<Binary Audio File>",
"model": "whisper-1",
"language": "zh",
"response_format": "json"
}音頻轉文字 / Audio Transcription (gpt-4o-transcribe)
/v1/audio/transcriptions使用 GPT-4o 進行高精度音頻轉文字。 / High-accuracy transcription using GPT-4o.
Example Request
// Content-Type: multipart/form-data
{
"file": "<Binary Audio File>",
"model": "gpt-4o-transcribe",
"response_format": "json"
}創建語音 / Create Speech (gpt-4o-mini-tts)
/v1/audio/speech文本轉語音功能。 / Text-to-Speech generation.
Example Request
{
"model": "gpt-4o-mini-tts",
"input": "The quick brown fox jumped over the lazy dog.",
"voice": "alloy"
}創建聊天補全 / Chat Completions (Stream)
/v1/chat/completions標準流式對話輸出。 / Standard streaming chat completions.
Example Request
{
"model": "gpt-4o-mini",
"messages": [
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": "你好 / Hello" }
],
"temperature": 1,
"stream": true,
"stream_options": { "include_usage": true }
}創建聊天補全 / Chat Completions (Non-stream)
/v1/chat/completions非流式對話輸出。 / Non-streaming chat completions.
Example Request
{
"model": "gpt-4o",
"messages": [
{ "role": "user", "content": "nihao。" }
],
"max_tokens": 1000
}創建聊天識圖 / Chat Vision (Stream)
/v1/chat/completions支援圖像理解的流式輸出。 / Vision capabilities with streaming.
Example Request
{
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": [
{ "type": "text", "text": "這張圖片裡有什麼?請詳細描述。 / What's in this image?" },
{ "type": "image_url", "image_url": { "url": "https://example.com/image.png" } }
]
}
],
"stream": true
}創建聊天創作圖 / Chat Image Generation
/v1/chat/completions透過對話接口生成或編輯圖片。 / Generate or edit images via Chat API.
Example Request
{
"model": "gpt-4o-image-vip",
"messages": [
{
"role": "user",
"content": [
{ "type": "text", "text": "美化一下這種圖片,加上 我愛中國 四個字 尺寸[4:3]" },
{ "type": "image_url", "image_url": { "url": "https://example.com/image.png" } }
]
}
]
}函數調用 / Function Calling
/v1/chat/completions讓模型根據提示自動選擇並輸出函數調用 JSON。 / Allow the model to call functions.
Example Request
{
"model": "gpt-4o",
"messages": [{ "role": "user", "content": "北京今天天氣怎麼樣 / How is the weather in Beijing?" }],
"tools": [{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": { "type": "string" },
"unit": { "type": "string", "enum": ["celsius", "fahrenheit"] }
},
"required": ["location"]
}
}
}]
}結構化輸出 / Structured Outputs
/v1/chat/completions強制模型按照指定的 JSON Schema 輸出格式。 / Force the model to output matching a JSON Schema.
Example Request
{
"model": "gpt-4.5-preview",
"messages": [{ "role": "user", "content": "How do I prepare for a job interview?" }],
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "content_compliance",
"schema": {
"type": "object",
"properties": {
"is_violating": { "type": "boolean" },
"category": { "type": "string" }
},
"required": ["is_violating", "category"],
"additionalProperties": false
},
"strict": true
}
}
}控制推理模型努力程度 / Reasoning Effort
/v1/chat/completions調整思考型模型(如 o1, o3-mini)的推理深度。 / Control reasoning depth for thinking models.
Example Request
{
"model": "o3-mini",
"messages": [{ "role": "user", "content": "你好 / Hello" }],
"reasoning_effort": "medium"
}DeepSeek v3/R1 思考程度 / DeepSeek Reasoning
/v1/chat/completions針對 DeepSeek 模型控制深度思考能力。 / Control deep thinking for DeepSeek models.
Example Request
{
"model": "deepseek-reasoner",
"messages": [{ "role": "user", "content": "你好 / Hello" }],
"thinking": {
"type": "enabled"
}
}DeepSeek OCR 識別 / DeepSeek OCR
/v1/chat/completions利用 DeepSeek 進行精準的光學字元識別。 / Optical Character Recognition using DeepSeek.
Example Request
{
"model": "deepseek-ocr",
"stream": true,
"messages": [
{ "role": "system", "content": "<image>\nFree OCR." },
{
"role": "user",
"content": [
{ "type": "image_url", "image_url": { "url": "https://example.com/document.jpg" } }
]
}
]
}網路搜索 / Web Search
/v1/chat/completions具備聯網能力的對話端點。 / Chat completion with web browsing capabilities.
Example Request
{
"model": "gpt-4o-search-preview",
"web_search_options": {},
"messages": [
{ "role": "user", "content": "What was a positive news story from today?" }
]
}創建完成 / Completions (Legacy)
/v1/completions傳統的文本補全端點。 / Legacy text completion endpoint.
Example Request
{
"model": "gpt-3.5-turbo-instruct",
"prompt": "你好, / Hello,",
"max_tokens": 30,
"temperature": 0
}創建嵌入 / Create Embeddings
/v1/embeddings獲取輸入文本的向量表示。 / Get vector representation of input text.
Example Request
{
"model": "text-embedding-3-large",
"input": "喵喵喵喵喵喵喵喵喵喵喵喵喵喵喵 / Meow meow meow"
}列出模型 / List Models
/v1/models獲取所有可用模型的列表。 / Get a list of all available models.
Example Request
// No Request Body Required
創建思考聊天 / Claude Extended Thinking
/v1/messagesClaude 模型的擴展思考模式調用。 / Claude extended thinking mode.
Example Request
{
"model": "claude-sonnet-4-20250514",
"system": "你是一个智能AI助手,叫小王",
"messages": [
{ "role": "user", "content": "你是谁?!" }
],
"stream": true,
"max_tokens": 8000,
"thinking": {
"type": "enabled",
"budget_tokens": 1200
}
}Claude 聊天補全 (流式) / Claude Chat (Stream)
/v1/chat/completionsClaude 模型的流式聊天補全。 / Claude streaming chat completions.
Example Request
{
"model": "claude-3-7-sonnet-20250219",
"messages": [
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": "Hello!" }
],
"stream": true
}Claude 聊天補全 (非流) / Claude Chat (Non-stream)
/v1/chat/completionsClaude 模型的非流式聊天補全。 / Claude non-streaming chat completions.
Example Request
{
"model": "claude-sonnet-4-20250514",
"messages": [
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": "Hello!" }
]
}Claude 聊天識圖 (流式) / Claude Vision (Stream)
/v1/chat/completionsClaude 模型的流式圖片理解。 / Claude vision streaming.
Example Request
{
"model": "claude-sonnet-4-20250514",
"messages": [
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": [
{ "type": "text", "text": "这张图片里有什么?请详细描述。" },
{ "type": "image_url", "image_url": { "url": "https://example.com/image.png" } }
]}
],
"stream": true
}Claude 聊天識圖 (非流) / Claude Vision (Non-stream)
/v1/chat/completionsClaude 模型的非流式圖片理解。 / Claude vision non-streaming.
Example Request
{
"model": "claude-sonnet-4-20250514",
"messages": [
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": [
{ "type": "text", "text": "这张图片里有什么?请详细描述。" },
{ "type": "image_url", "image_url": { "url": "https://example.com/image.png" } }
]}
]
}Gemini 文本生成 / Text Generation
/v1beta/models/gemini-2.5-pro:generateContentGemini 模型原生格式文本生成。 / Gemini native format text generation.
Example Request
{
"systemInstruction": {
"parts": [
{ "text": "你是一直小猪.你会在回复开始的时候 加一个'哼哼'" }
]
},
"contents": [
{
"role": "user",
"parts": [
{ "text": "你是谁?" }
]
}
],
"generationConfig": {
"temperature": 1,
"topP": 1,
"thinkingConfig": {
"includeThoughts": true,
"thinkingBudget": 26240
}
}
}Gemini 文本生成 (流式) / Text Generation (Stream)
/v1beta/models/gemini-3-pro-preview:streamGenerateContentGemini 模型原生格式流式輸出。 / Gemini native format streaming.
Example Request
{
"systemInstruction": {
"parts": [
{ "text": "You are a cat. Your name is Neko." }
]
},
"contents": [
{
"role": "user",
"parts": [
{ "text": "Hello there" }
]
}
],
"generationConfig": {
"temperature": 1,
"topP": 1,
"thinkingConfig": {
"includeThoughts": true,
"thinkingBudget": 26240
}
}
}Gemini 文本生成+思考 (流式) / Text+Thinking (Stream)
/v1beta/models/gemini-2.5-pro:streamGenerateContentGemini 結合深度思考的流式輸出。 / Gemini streaming with deep thinking.
Example Request
{
"contents": [
{
"parts": [{ "text": "1+2+3+4+5+....+999?" }],
"role": "user"
}
],
"systemInstruction": {
"parts": [{ "text": "hi" }],
"role": "user"
},
"generationConfig": {
"temperature": 1,
"topP": 1,
"thinkingConfig": {
"includeThoughts": true,
"thinkingBudget": 26240
}
}
}Gemini 圖片生成 / Image Generation
/v1beta/models/{modeName}:generateContentGemini 原生格式的文生圖與圖生圖。 / Gemini native text-to-image and image-to-image.
Example Request
{
"contents": [
{
"role": "user",
"parts": [
{ "text": "Hi, can you create a 3d rendered image of a pig with wings and a top hat flying over a happy futuristic scifi city with lots of greenery?" }
]
}
],
"generationConfig": {
"responseModalities": ["IMAGE"]
}
}Gemini Google 搜索 / Google Search
/v1beta/models/gemini-2.5-flash:generateContent具備 Google Search 聯網功能的生成接口。 / Generation with Google Search capability.
Example Request
{
"contents": [
{
"role": "user",
"parts": [
{ "text": "今天重庆天气如何?" }
]
}
],
"tools": [
{ "googleSearch": {} }
]
}