Platform notice: all DeepSeek models are now live. New users receive trial credits on sign-up.
Api reference

MCP / Agents

Platform MCP tool execution and AI Agent integration: connecting external clients to the MCP server, and how Agents initiate tool executions with approval and billing.

Overview

Through its built-in model gateway, the platform provides capabilities in two directions:

  • MCP server (exposed externally): the gateway's native POST /mcp (JSON-RPC 2.0 + SSE) is the external service endpoint, authenticated with platform API Keys (Authorization: Bearer sk-tp-...). External clients (Claude, Cursor, etc.) simply point their MCP server address at http://<host>:8080/mcp and include the platform key; the tool surface is narrowed by governance configuration.
  • Agent tool execution (platform approval flow): An AI Agent (attached to a platform account, provisioned by an admin with its own API Key) initiates tool executions through the platform proxy endpoint. All executions enter a manual approval queue by default, and once approved the platform executes them on the Agent's behalf and bills per call.

Agent tool execution

Initiating an execution

POST /api/agent-gateway/tools/execute
  • Authentication: Authorization: Bearer <Agent's API Key> (issued by an administrator when provisioning the Agent in the admin console; returned only once)
  • Content-Type: application/json

Request body:

ParameterTypeRequiredDescription
toolNamestringYesTool name (must be within the Agent's tool allowlist)
argsJsonstringNoTool arguments as a JSON string; defaults to '{}'

Behavior: after the allowlist and daily quota checks pass, an approval request is created (PENDING). A tool outside the allowlist returns 403; if the daily quota has been fully charged, returns 429.

Querying execution records

GET /api/agent-gateway/tools/executions

Returns the Agent's 50 most recent approval requests (status, arguments, execution result).

Approval and billing

Tool executions are approved or rejected by a platform administrator on the "Tool approvals" page in the admin console. Once approved, the platform calls the upstream on the Agent's behalf and bills per call:

  • Unit price: configurable per tool (default ¥0.01/call)
  • Billing: costs are recorded to the Agent's attached account (balance, ledger, and usage details are updated together; in usage details, model is tool:<tool name>)
  • Daily quota: each Agent can have a configurable daily charge limit

Error codes

Status codeMeaning
401Invalid API Key, or not an Agent key
403Tool not in the Agent's allowlist, or the Agent is disabled
429The Agent's daily quota is exhausted

On this page