POST https://www.myai168.com/nccu/api/openai/v1/responsesResponses API (新版對話介面,支援 streaming)。
curl https://www.myai168.com/nccu/api/openai/v1/responses \
-H "Authorization: Bearer YOUR_DEV_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-5.6-sol","input":"Hello"}'
import requests
r = requests.post(
"https://www.myai168.com/nccu/api/openai/v1/responses",
headers={"Authorization": "Bearer YOUR_DEV_KEY"},
json={"model": "gpt-5.6-sol", "input": "Hello"},
)
print(r.json())
POST https://www.myai168.com/nccu/api/openai/v1/chat/completionsChat Completions API (舊版對話介面,相容 OpenAI SDK)。
curl https://www.myai168.com/nccu/api/openai/v1/chat/completions \
-H "Authorization: Bearer YOUR_DEV_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-5.6-sol","messages":[{"role":"user","content":"Hello"}]}'
import requests
r = requests.post(
"https://www.myai168.com/nccu/api/openai/v1/chat/completions",
headers={"Authorization": "Bearer YOUR_DEV_KEY"},
json={"model": "gpt-5.6-sol", "messages": [{"role": "user", "content": "Hello"}]},
)
print(r.json())
POST https://www.myai168.com/nccu/api/openai/v1/audio/speech文字轉語音 (TTS),回 audio binary。
curl https://www.myai168.com/nccu/api/openai/v1/audio/speech \
-H "Authorization: Bearer YOUR_DEV_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"tts-1","input":"Hello","voice":"nova"}' \
--output speech.mp3
import requests
r = requests.post(
"https://www.myai168.com/nccu/api/openai/v1/audio/speech",
headers={"Authorization": "Bearer YOUR_DEV_KEY"},
json={"model": "tts-1", "input": "Hello", "voice": "nova"},
)
with open("speech.mp3", "wb") as f:
f.write(r.content)
POST https://www.myai168.com/nccu/api/openai/v1/audio/transcriptions語音轉文字 (STT, multipart upload)。
curl https://www.myai168.com/nccu/api/openai/v1/audio/transcriptions \
-H "Authorization: Bearer YOUR_DEV_KEY" \
-F file=@audio.mp3 \
-F model=gpt-4o-transcribe
import requests
with open("audio.mp3", "rb") as f:
r = requests.post(
"https://www.myai168.com/nccu/api/openai/v1/audio/transcriptions",
headers={"Authorization": "Bearer YOUR_DEV_KEY"},
files={"file": f},
data={"model": "gpt-4o-transcribe"},
)
print(r.json())
POST https://www.myai168.com/nccu/api/openai/v1/audio/translations語音翻譯成英文 (STT + translate)。OpenAI 官方 translations 端點僅支援 whisper-1(gpt-4o-transcribe 僅 transcriptions 可用);範例帶 response_format=verbose_json 取得含時長的完整 JSON。
curl https://www.myai168.com/nccu/api/openai/v1/audio/translations \
-H "Authorization: Bearer YOUR_DEV_KEY" \
-F file=@audio.mp3 \
-F model=whisper-1 \
-F response_format=verbose_json
import requests
with open("audio.mp3", "rb") as f:
r = requests.post(
"https://www.myai168.com/nccu/api/openai/v1/audio/translations",
headers={"Authorization": "Bearer YOUR_DEV_KEY"},
files={"file": f},
data={"model": "whisper-1", "response_format": "verbose_json"},
)
print(r.json())
POST https://www.myai168.com/nccu/api/openai/v1/images/generations文字生圖 (gpt-image-2)。
curl https://www.myai168.com/nccu/api/openai/v1/images/generations \
-H "Authorization: Bearer YOUR_DEV_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-image-2","prompt":"A cute cat","size":"1024x1024"}'
import requests
r = requests.post(
"https://www.myai168.com/nccu/api/openai/v1/images/generations",
headers={"Authorization": "Bearer YOUR_DEV_KEY"},
json={"model": "gpt-image-2", "prompt": "A cute cat", "size": "1024x1024"},
)
print(r.json())
POST https://www.myai168.com/nccu/api/openai/v1/embeddings文字向量 (embeddings,OpenAI 相容格式;受理模型 voyage-4/voyage-4-large,依 input token 計費)。
curl https://www.myai168.com/nccu/api/openai/v1/embeddings \
-H "Authorization: Bearer YOUR_DEV_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"voyage-4-large","input":"Hello"}'
import requests
r = requests.post(
"https://www.myai168.com/nccu/api/openai/v1/embeddings",
headers={"Authorization": "Bearer YOUR_DEV_KEY"},
json={"model": "voyage-4-large", "input": "Hello"},
)
print(r.json())
GET https://www.myai168.com/nccu/api/openai/v1/audio/voices列出可用的 TTS 內建語音 (查詢類,免費)。註:GET 列表屬本站擴充查詢——OpenAI 官方 API 參考僅記載 POST 建立自訂語音,無 GET 列表端點,請勿以官方 SDK 介面對照。
curl https://www.myai168.com/nccu/api/openai/v1/audio/voices \
-H "Authorization: Bearer YOUR_DEV_KEY"
POST https://www.myai168.com/nccu/api/openai/v1/audio/voices自訂語音建立 (聲音複製,multipart upload;欄位:audio_sample 語音樣本檔必填、consent 同意錄音 ID 必填(例 cons_1234——依 OpenAI 官方規格須先完成「同意錄音」上傳取得,不是授權聲明文字)、name 語音名稱)。官方目前僅開放具資格帳號建立自訂語音。
curl https://www.myai168.com/nccu/api/openai/v1/audio/voices \
-H "Authorization: Bearer YOUR_DEV_KEY" \
-F audio_sample=@sample.mp3 \
-F consent="cons_1234" \
-F name="My Voice"
GET https://www.myai168.com/nccu/api/openai/v1/models/GET https://www.myai168.com/nccu/api/openai/v1/models/{model}查詢支援的模型清單/單一模型 (相容 SDK models.list/models.retrieve,查詢類,免費)。
curl https://www.myai168.com/nccu/api/openai/v1/models \
-H "Authorization: Bearer YOUR_DEV_KEY"
curl https://www.myai168.com/nccu/api/openai/v1/models/gpt-5.6-sol \
-H "Authorization: Bearer YOUR_DEV_KEY"
部分 OpenAI SDK 功能經本站中繼時行為不同,接入前請先對照本表,避免踩坑。
GET /v1/models 與 GET /v1/models/{model} —— 支援(相容 SDK models.list/models.retrieve)。回傳的清單就是本中繼實際受理的模型;不在清單內的模型一律回 "No pricing info! Please use other models!"。POST /v1/responses 與 POST /v1/chat/completions —— 支援,含串流。tools: [{"type": "web_search"}],Chat Completions 用 web_search_options。code_interpreter、file_search、image_generation、computer use、hosted MCP)—— 不支援,回 HTTP 400;請改用 client 端 function calling。speech/transcriptions/translations/voices——GET 列出內建語音免費、POST 建立自訂語音)、images/generations 與 embeddings(受理模型 voyage-4/voyage-4-large)—— 支援。X-Cost-Points(本次扣點)與 X-Credits-Remaining(扣後餘額)header;串流回應則在最後一個事件(data: [DONE])之後以 SSE 註解行 : cost=N/: credits-remaining=M 附上相同資訊;也可隨時以 GET https://www.myai168.com/nccu/api/user/get_credits 查詢餘額。請求本體為 JSON,與 OpenAI 官方規格相同。認證帶 Authorization: Bearer YOUR_API_KEY 標頭(金鑰不可放在網址查詢參數)。
| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
model | string | 必填 | 模型代號(例 gpt-5.6-sol)。必須在 GET /v1/models 回傳清單內,否則回 400 與 "No pricing info! Please use other models!"。 |
messages | array | 必填 | 對話訊息陣列。role 支援官方全部角色:developer/system/user/assistant/tool(舊制 function 已棄用但仍受理);content 可為字串,或由文字/圖片/音訊組成的多段內容陣列(官方 content parts 格式)。 |
stream | boolean | 選填 | true 時以 SSE 串流回應(data: {JSON} 逐段,最後 data: [DONE])。 |
web_search_options | object | 選填 | 啟用網頁搜尋(按次計費)。 |
max_tokens/temperature/top_p/tools(function calling)等 | — | 選填 | 其餘官方參數原樣透傳;hosted 工具(code_interpreter 等)不支援、回 400。 |
Responses API(POST /v1/responses)改用 input(string 或 array,必填)與 model(必填),可帶 tools: [{"type": "web_search"}] 啟用搜尋;其餘官方參數原樣透傳。
非串流:官方 JSON——Chat Completions 的文字在 choices[0].message.content、用量在 usage;Responses 的文字要從 output[] 陣列解析(type 為 message 的項目中,content[] 內 type 為 output_text 區塊的 text 欄位)——output_text 是官方 Python/JavaScript SDK 的便利屬性,原始 REST JSON 沒有這個欄位。回應標頭另帶 X-Cost-Points(本次扣點)與 X-Credits-Remaining(扣後餘額)。
串流:SSE 逐段送出,Chat Completions 增量在 choices[0].delta.content,結束為 data: [DONE];結束後以 SSE 註解行 : cost=N/: credits-remaining=M 附上本次扣點與餘額(規範相容的 SSE 解析器與官方 SDK 會自動忽略註解行),也可隨時查 GET https://www.myai168.com/nccu/api/user/get_credits。
curl -N https://www.myai168.com/nccu/api/openai/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-5.6-sol","stream":true,"messages":[{"role":"user","content":"Hello"}]}'
data: {"id":"...","object":"chat.completion.chunk","choices":[{"delta":{"content":"Hi"},"index":0}]}
data: {"id":"...","object":"chat.completion.chunk","choices":[{"delta":{},"finish_reason":"stop","index":0}]}
data: [DONE]
| HTTP 狀態 | 意義 |
|---|---|
401 | 金鑰缺漏或無效(同 IP 連續失敗會被暫時封鎖)。 |
402 | 點數不足(請先儲值)。 |
400 | 請求本體格式錯誤、模型不在支援清單("No pricing info! Please use other models!"),或帶了不支援的 hosted 工具。 |
502 | 上游供應商錯誤——一律不扣點。 |
任何錯誤(含供應商未回用量資訊)一律不扣點。