QUICKSTART

連線指南

設定連線位址、API 金鑰及模型名稱,即可開始使用。

OPENAI COMPATIBLE

OpenAI 格式 / Codex

https://api.ai.portomo.com/v1

請在 Base URL 中包含 /v1 。

ANTHROPIC COMPATIBLE

Anthropic 格式 / Claude Code

https://api.ai.portomo.com

請勿在 Base URL 加上 /v1 。

OPENAI COMPATIBLE

Cursor

https://api.ai.portomo.com/v1

請在 Base URL 中包含 /v1 。

可直接使用的連線範例

YOUR_API_KEY 請替換為您核發的金鑰。

Terminal · bash / zsh
export AIGATEWAY_API_KEY="YOUR_API_KEY"

curl https://api.ai.portomo.com/v1/chat/completions \
  -H "Authorization: Bearer $AIGATEWAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4.1-flash",
    "messages": [{"role": "user", "content": "你好"}],
    "max_tokens": 256
  }'
DECISION MODELS

決策模型(僅限 API)

根據輸入及問題傳回機率、選項或分數,不會顯示在用戶端的模型選單中。請使用下方各模型對應的 API。

/v1/decisions

gpt-6-luna-decisions 支援文字與圖片,不支援串流。

Terminal · bash / zsh
export AIGATEWAY_API_KEY="YOUR_API_KEY"

curl https://api.ai.portomo.com/v1/decisions \
  -H "Authorization: Bearer $AIGATEWAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-6-luna-decisions",
    "input": "All tests passed; a security review is still pending.",
    "questions": [
      {"type": "predicate", "name": "ready", "instructions": "Is this change ready to deploy without further review?"}
    ]
  }'

請以陣列指定問題,類型為 predicate・choice・score。圖片請在以下欄位的訊息中指定: input ,使用 input_image 及 Base64 data URL。最多 32 個問題,本文上限為 4 MiB。不可傳送至一般 Chat Completions 或 Responses API。

/v1/systemone

clef・clef-flash・jev-latest 需要指定情境(state)及問題物件。

Terminal · bash / zsh
export AIGATEWAY_API_KEY="YOUR_API_KEY"

curl https://api.ai.portomo.com/v1/systemone \
  -H "Authorization: Bearer $AIGATEWAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "clef",
    "state": "All tests passed; a security review is still pending.",
    "questions": {
      "ready": {"type": "noul", "instructions": "Is this change ready to deploy without further review?"},
      "next": {"type": "choice", "instructions": "What should happen next?",
               "criteria": {"deploy": "Deploy now", "review": "Wait for the security review"}},
      "risk": {"type": "score", "instructions": "How risky is deploying now?", "criteria": ["low", "medium", "high"]}
    }
  }'

問題類型包括 noul(是/否機率)、choice(選項)、score(2~10 級評分)。每次請求最多 32 個問題,本文上限為 262,144 位元組。

傳回的機率僅供判斷參考,不應直接視為執行操作的授權。usage.cost 為從餘額扣除的金額(USD)。

疑難排解

遇到 401 或 403,請確認 API 金鑰及餘額;遇到 404,請確認連線位址及 API 路徑。模型名稱請使用「模型與價格」顯示的模型 ID。請勿將 API 金鑰寫入瀏覽器 JavaScript。