身份验证
API 密钥从密钥所属账户扣费。OAuth 让每位连接用户使用自己的积分。
API 密钥#
为自己的账户使用服务器端 API 密钥,为各客户的账户使用 OAuth。切勿将密钥放入提示词或工具参数。
Authorization: Bearer $TONG_API_KEYOAuth 发现#
API 密钥从密钥所属账户扣费。OAuth 让每位连接用户使用自己的积分。
curl 'https://platform.tongai.io/.well-known/oauth-authorization-server'配置
curl --versionGET /.well-known/oauth-protected-resourceGET /.well-known/oauth-protected-resource/mcp授权与同意#
OAuth 使用 S256 PKCE、精确匹配的重定向 URI,以及独立的 REST 或 MCP 资源。授权同意在 Tong 中完成。刷新令牌每次使用后都会轮换。
{ "response_type": "code", "client_id": "https://your-app.example/oauth/client.json", "redirect_uri": "https://your-app.example/oauth/callback", "resource": "https://platform.tongai.io/mcp", "scope": "catalog:read operations:read generation:write quotes:write credits:spend", "code_challenge_method": "S256", "code_challenge": "BASE64URL_SHA256_OF_VERIFIER", "state": "RANDOM_SESSION_STATE"}code_expires_in: 60 secondsaccess_token_expires_in: 300 secondsrefresh_token_expires_in: 30 daystoken_endpoint_auth_method: noneclient_id_metadata_document_supported: true权限#
付费工具还需要 credits:spend 权限。删除权限单独授予。