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。