2026-10-14
Praxis 是智能体云平台。API 按服务组织:智能体、模型、沙箱、搜索、自动化,各在自己的前缀下。请求与响应用 JSON,流式响应用 SSE,使用标准的 HTTP 动词与状态码。所有前缀共用一个地址和一个 Key。
https://api.deepraxis.ai使用服务 API 页列出的客户端库。兼容接口使用对应协议的官方 SDK;自动化提供 TypeScript SDK,本地安装方式见自动化 API。
| 服务 | 前缀 | API 页 |
|---|---|---|
| 智能体 | /agent | Agent API |
| 模型 | /model | Model API |
| 沙箱 | /sandbox | Sandbox API |
| 搜索 | /search | Search API |
| 自动化 | /automation | Automation API |
已经在用 OpenAI、Anthropic、Google、E2B 或 Tavily 的代码,不需要改成 Praxis 的接口:平台提供与这些厂商官方 API 一致的兼容前缀,只改地址就能用。
| 厂商 | 前缀 | API 页 |
|---|---|---|
| OpenAI | /openai | OpenAI 兼容 |
| Anthropic | /anthropic | Anthropic 兼容 |
/google | Google 兼容 | |
| E2B | /e2b | E2B 兼容 |
| Tavily | /tavily | Tavily 兼容 |
所有前缀共用在控制台创建的 API Key,随请求放在 Authorization 头里。详见鉴权。
429,响应头告诉你何时可以重试。详见限流。/meta 前缀下。curl https://api.deepraxis.ai/model/v1/chat/completions \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "deepseek-flash", "messages": [{"role": "user", "content": "你好"}]}'所有接口用同一种凭证:在控制台创建的 API Key,随请求放在 Authorization 头里。没有别的鉴权方式,也没有按接口不同的规则。
Authorization: Bearer {key}| 段 | 含义 | 例子 |
|---|---|---|
Bearer | 固定字样 | Bearer |
{key} | 你的 API Key,以 sk-praxis- 开头 | sk-praxis-a1b2… |
一个 Key 通所有前缀下的接口。Key 在控制台 → API Key 创建、轮换和吊销;吊销立即生效。
你不需要自己拼这个头——官方 SDK 会放;我们同时接受各家 SDK 默认使用的头名。
| SDK | 你传什么 | 实际发出的头 |
|---|---|---|
| OpenAI SDK | apiKey | Authorization: Bearer … |
| Anthropic SDK | apiKey | X-API-Key: … |
| Google GenAI SDK | apiKey | x-goog-api-key: … |
| E2B SDK | apiKey | X-API-Key: … |
| Tavily SDK / HTTP | apiKey | Authorization: Bearer … |
curl https://api.deepraxis.ai/model/v1/models \
-H "Authorization: Bearer $PRAXIS_API_KEY"Key 缺失、无效或已吊销,返回 401,错误体按该前缀的格式(见错误)。收到 401 不要重试——换对 Key 再发。
PRAXIS_API_KEY),不要写进代码。出错时,HTTP 状态码告诉你错误属于哪一类;错误体按该前缀的格式给出具体原因;每个错误响应还带四个 x-praxis-problem-* 头和一个 x-praxis-recovery-action(限流错误再多带一个 x-praxis-problem-scope,见限流),不论错误体长什么样,重试逻辑只看头就够。
| 状态码 | 含义 | 你该做什么 |
|---|---|---|
400 | 请求字段或格式不合法 | 修正参数,不要原样重试 |
401 | 缺少或无效的凭证 | 检查 API Key |
402 | 余额或付费额度不足 | 补充余额或联系账户管理员 |
403 | 无权访问该资源或操作 | 核对 Key 权限与资源归属;必要时联系支持 |
404 | 资源、模型或路径不存在 | 检查 ID、模型名和路径 |
408 | 请求超时 | 检查网络后重试;写操作先确认是否已完成 |
409 | 资源状态或并发修改冲突 | 重新读取状态,再调整请求 |
413 | 请求体或文件超过大小限制 | 减小内容或改用端点支持的 URL 输入 |
422 | 请求内容无法处理 | 根据错误详情修正参数或输入 |
429 | 请求速率、并发或模型额度超限 | 按 retry-after 等待;并发超限时等待在途请求结束 |
500 | 平台内部错误 | 稍后重试;持续出现请附 X-Request-Id 联系支持 |
501 | 功能尚未支持 | 换用已支持的端点,不要重试 |
502 | 上游调用失败或返回无效响应 | 退避重试,持续失败时换模型或联系支持 |
503 | 服务或可用线路暂不可用 | 退避重试,或选择其它模型 |
504 | 上游响应超时 | 退避重试;写操作先确认结果,避免重复创建 |
以下是常见的机器可读错误码,不是所有端点的封闭枚举。兼容接口的错误体可能使用协议自己的 code/type;跨协议判断可读取 x-praxis-problem-code,其值可能与错误体 code 不同。大小写按返回值区分。
| code | 什么时候出现、该怎么办 |
|---|---|
AUTHENTICATION_ERROR | Key 缺失或无效;检查并更换凭证。 |
VALIDATION_ERROR | 参数不符合格式、类型或范围要求;按详情改参数。 |
INPUT_NOT_REPRESENTABLE | 所选模型或协议无法表达输入选项;删除该选项或换模型。 |
NOT_FOUND | 资源不存在或对当前账户不可见;核对 ID 与账户。 |
MODEL_NOT_FOUND | 模型不存在或不可见;从模型列表选取可用名称。 |
MODEL_PROTOCOL_NOT_OFFERED | 模型不提供所请求的协议;换用其支持的端点或模型。 |
MODEL_PROTOCOL_LINE_UNAVAILABLE | 支持该协议的合格线路暂不可用;退避重试或换模型。 |
GENERATION_NOT_FOUND | 生成记录不存在或不属于当前账户;核对响应头中的生成 ID 与 Key。 |
RATE_LIMITED | 超过速率或并发限额;按 retry-after 等待并降低速率或并发。 |
UPSTREAM_ERROR | 上游调用失败或响应不合法;按 retryable 退避重试,持续失败时换模型或联系支持。 |
PROVIDER_SELECTION_NOT_ALLOWED | 指定供应商 order/only 时没有携带 BYOK;移除供应商选择或提供自己的上游 Key。 |
not_implemented | 该端点或能力未实现;换用已支持的能力,不要原样重试。 |
model_protocol_not_offered | HTTP 404;模型未声明所请求的协议。查询 GET /model/v1/models 的 supported_apis,改用相应入口,例如声明 Google 协议的模型使用 /google/v1beta/models/{model}:generateContent;不要只换前缀而保留另一协议的请求体。 |
provider_unavailable | HTTP 502;本次请求的可用线路全部失败。退避重试,持续失败时换模型,并附 X-Request-Id 联系支持。 |
thinking_disable_unsupported | HTTP 400;模型不能关闭思考,例如对 glm-5.3 设置 reasoning_effort="none"。移除关闭设置或选择支持的思考等级;需要关闭思考时换模型。 |
insufficient_quota / INSUFFICIENT_BALANCE | HTTP 402;余额不足,错误体或响应头的代码因入口而异。充值或联系账户管理员后再重试,不要立即循环重试。 |
validation_error(response_format) | HTTP 400;例如 Model "deepseek-flash" does not support json_schema on this API.。换用在该入口支持 json_schema 的模型;若只需要合法 JSON,可改用 json_object,但它不保证 schema 约束。 |
validation_error(参数被点名) | HTTP 400;设置 provider.require_parameters=true 时,所选模型仍可能无法支持请求参数,例如 param: "logprobs"、does not support the requested logprobs value。按 param 和消息调整参数或换模型;不要只关闭检查后假定参数已生效。 |
错误体的格式跟着地址第一段走,和成功响应一致——你的 SDK 不需要为错误特殊处理。
厂商前缀(/openai /anthropic /google /e2b /tavily):和该前缀对应的官方 API 错误体一模一样。
// /openai
{ "error": { "code": 401, "message": "Invalid API key." } }// /anthropic
{ "type": "error", "error": { "type": "authentication_error", "message": "Invalid API key." } }Praxis 前缀(/agent /model /sandbox /search /meta):标准的 Problem Details(RFC 9457),Content-Type: application/problem+json。
{
"type": "https://deepraxis.ai/problems/authentication_error",
"title": "authentication_error",
"status": 401,
"detail": "Invalid API key.",
"instance": "problem_eqfnxu",
"code": "AUTHENTICATION_ERROR",
"retryable": false
}| 字段 | 含义 |
|---|---|
type | 错误类型的 URL,稳定,可用来分支 |
title / detail | 给人读的摘要与具体原因 |
status | 同 HTTP 状态码 |
instance | 本次错误的 ID,联系支持时附上 |
code | 机器可读的错误码 |
retryable | 原样重试是否可能成功 |
五个通用头与错误体格式无关;第六个 scope 头仅适用于限流错误:
| 头 | 含义 | 例子 |
|---|---|---|
x-praxis-problem-code | 跨协议分类码;可能与错误体的 code 不同 | AUTHENTICATION_ERROR |
x-praxis-problem-kind | 错误大类——出了什么事 | authentication_failure |
x-praxis-problem-origin | 错误归谁——谁能解决它:user(你的请求或凭证)、platform(我们)、upstream_provider(上游厂商)等 | unknown |
x-praxis-problem-retryable | 原样重试是否可能成功 | false |
x-praxis-problem-scope | 仅限流错误:触发的保护层——platform 平台层、model 模型层 | platform |
x-praxis-recovery-action | 建议的处理动作 | relogin |
retryable 为 true(或状态码 429 502 503):指数退避重试;429 优先按 retry-after。Praxis 的限流分两层:平台层按你的 Key 限每秒请求数和同时进行的请求数;模型层按模型限每分钟请求数(RPM)和每分钟 token 数(TPM)。每个响应——不论成功还是 429——都带三个 x-ratelimit-* 头,写明当前额度和重置时间,你不需要猜,也不需要为读额度多发请求。
| 层 | 按什么计 | 限什么 | 超出的表现 |
|---|---|---|---|
| 平台层 | 你的 Key(没带凭证时按来源 IP) | 每秒请求数、同时进行的请求数 | 429 + retry-after,等待后重试 |
| 模型层 | 模型 × 租户 | 每分钟请求数(RPM)、每分钟 token 数(TPM)、月度预算 | 429,见下文模型层 |
两层的 429 都带同样的三个限流头;是哪一层触发的,看错误体的说明(错误)。
默认每个 API Key 每秒最多 5 个请求,同时最多 4 个在途请求。流式请求在流结束前占用并发槽位。超过任一默认限额返回 429,响应带 ratelimit-limit、ratelimit-remaining、ratelimit-reset 和 retry-after;并发超限须等已有请求结束。
实际限额可能因账户而异;以响应头和并发错误详情为准。
x-ratelimit-limit-requests: 5
x-ratelimit-remaining-requests: 4
x-ratelimit-reset-requests: 850ms| 头 | 含义 |
|---|---|
x-ratelimit-limit-requests | 该凭证每秒的请求上限 |
x-ratelimit-remaining-requests | 本秒还剩多少个请求 |
x-ratelimit-reset-requests | 距离额度重置的时间:不满一秒写作 850ms,一秒及以上写作 1s |
同样的三个数也以 IETF 标准名 RateLimit-Limit / RateLimit-Remaining / RateLimit-Reset(整数秒)同时给出。以上 5 次/秒、4 个并发为默认限额;配置覆盖后的请求速率以响应头显示为准。
一秒内的第 N+1 个请求(N 为该 Key 的每秒上限)返回 429,并带 retry-after(整数秒,通常是 1)。被拒绝的请求不消耗额度:x-ratelimit-remaining-requests 保持 0,等窗口重置即可恢复。
同时进行的请求(包括尚未结束的流式响应——流结束前一直占坑)超过该 Key 的并发上限时,多出的请求返回 429,retry-after 为 1。这种情况下仅等待秒级窗口重置不会释放并发槽位:须等一个进行中的请求结束。是并发还是每秒触发的,错误说明里写得很清楚("Concurrent request limit …" / "Requests per second limit …")。
错误体跟着地址第一段走(见错误)。/model/v1/chat/completions 等原生端点是 Problem Details:
{
"type": "https://deepraxis.ai/problems/rate_limit",
"title": "rate_limited",
"status": 429,
"detail": "Requests per second limit of 5 exceeded for this credential. Retry after the listed wait.",
"instance": "problem_eqfnxu",
"kind": "rate_limit",
"scope": "platform",
"retryable": true
}scope: "platform" 表示是平台层触发的(模型层限额的错误不带此字段或为 model)。/openai/v1/chat/completions 等厂商前缀按该家的错误格式,例如 OpenAI 兼容端点:
{ "error": { "code": 429, "type": "rate_limit_error", "message": "Requests per second limit of 5 exceeded for this credential. Retry after the listed wait." } }公开端点(如 GET /model/v1/models)允许不带 Key 调用,这时按来源 IP 计入一个较小的匿名额度,响应头同样给出。带了 Key 就按 Key 计,与 IP 无关。
GET /meta/v1/health 不限流,探活监控可以任意频率调用。
限额维度是模型 × 租户 × 分钟,不是 API Key:
0 表示不限制。429,type 为 rate_limit_error,Retry-After: 60,problem.details.rateLimit 给出当前值与限额。429 处理。模型另有月度预算:按模型当月累计收入计,超出返回 429,type 为 budget_error(QUOTA_EXHAUSTED),无 Retry-After——等待无效,需要提升该模型的预算。
版本号写在地址里,紧跟第一段;每个前缀各自计版本,没有全站统一的版本号。
https://api.deepraxis.ai/{protocol}/{version}/…| 前缀 | 版本段 | 由谁决定 |
|---|---|---|
/openai /anthropic | v1 | 跟随厂商 |
/google | v1beta | 跟随厂商 |
/e2b /tavily | 无版本段 | 跟随厂商 |
/agent /model /sandbox /search /meta | v1 | Praxis |
厂商前缀下,版本相关的头(如 Anthropic 的 anthropic-version)原样透传给厂商,行为与官方一致。
删字段、改字段类型或含义、改默认值、收紧校验、改错误码含义。加字段、加端点、放宽校验不算。
/model/v2/…),旧版本继续可用。旧版本或端点弃用时:
Deprecation(RFC 9745,何时弃用)与 Sunset(RFC 8594,何时下线),Link 头指向迁移说明;404。Deprecation: @1767225600
Sunset: Sat, 04 Apr 2026 00:00:00 GMT
Link: </docs/changelog>; rel="deprecation"加载中…知识库(16 个操作):创建知识库、添加文件、批量入库与搜索。
以下端点在 /openai/v1 下未提供,调用返回 404。替代流程不等同于原端点。
| 端点 | 替代 |
|---|---|
/v1/moderations | 无替代端点 |
/v1/batches | 逐次调用所需模型端点 |
/v1/fine_tuning | 使用模型目录中已有的模型 |
/v1/assistants | 使用 Responses 与 Conversations 构建会话 |
/v1/completions | 改用 chat/completions |
/v1/audio/translations | 先用 audio/transcriptions 转写,再用 chat/completions 翻译 |
/v1/uploads | 改用 files 上传文件 |
/v1/images/variations | 使用 images/edits 提交图片与编辑提示词 |
参数与字段的权威定义以 OpenAI 官方文档为准。
/openai/v1/chat/completions● 支持X-OpenRouter-Metadatastring可选○ 当前不生效header: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility.
接受但当前不生效;不会返回请求的路由元数据。
messagesarray必填◐ 部分支持List of messages for the conversation
文本、角色、历史和工具往返生效;图片受模型尺寸限制;file_id 可引用 user_data 图片、文本和 PDF;模型读取能力与失败处理见[文件引用指南](/docs/cloud/services/model/guides/files)。
元素按 role 区分(assistant / developer / system / tool / user),此处展开其中一种的形状
configuration_updateobject可选OpenRouter extension. Same as the system message `configuration_update`: changes reasoning effort from this point in the conversation onward without invalidating the prompt cache for the preceding turns.
contentstring | array可选Tool response content
namestring可选Optional name for the assistant
rolestring可选Role of the message author; always tool.
audioobject可选Audio output data or reference
imagesarray可选Generated images from image generation models
modelstring可选Model that generated this assistant message
reasoningstring可选Reasoning output
reasoning_detailsarray可选Reasoning details for extended thinking models
refusalstring可选Refusal message if content was refused
tool_callsarray可选Tool calls made by the assistant
tool_call_idstring可选ID of the assistant message tool call this message responds to
modelstring可选Model to use for completion
主模型;提供非空 models 时可省略,使用列表首项。
streamboolean可选◐ 部分支持Enable streaming response
流式正文和工具增量生效;gemini-2.5-flash 可能缺少结束标记,预算耗尽时 finish_reason 可能不准确。
temperaturenumber可选◐ 部分支持Sampling temperature (0-2)
在 /openai 的 deepseek-v4-flash 观察到效果;其余模型的采样差异无法确认。
max_tokensinteger可选◐ 部分支持Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.
deepseek-v4-flash、glm-5.3-flash 生效;qwen3.8-flash 的小预算可能不生效。与 max_completion_tokens 同传时本字段优先。
top_pnumber可选◐ 部分支持Nucleus sampling parameter (0-1)
仅 /model 的 glm-5.3-flash 观察到效果;其余已测模型或协议面接受但未见效果。
stopstring | array可选◐ 部分支持Stop sequences (up to 4)
qwen3.8-flash 生效;deepseek-v4-flash、glm-5.3-flash 可能截断思考并返回空正文。
toolsarray可选Available tools for function calling
已验证生效。
tool_choicestring | object可选◐ 部分支持Tool choice configuration
auto 生效;deepseek-v4-flash 忽略 none/required/具名函数;qwen3.8-flash 的 required/具名函数在思考模式报错;glm-5.3-flash 的具名函数结果不稳定。
functionobject必填The function the model must call.
typestring必填OpenRouter server-tool type to force (e.g. `openrouter:web_search`, `web_search`, `web_search_preview`).
response_formatobject可选◐ 部分支持Response format configuration
json_object 生效;json_schema 在 deepseek-v4-flash、qwen3.8-flash 生效,glm-5.3-flash 接受但未遵守。
按 type 区分(grammar / json_object / json_schema / python / text),此处展开其中一种的形状
typestring必填Always `python`. Discriminator that marks this object as a ChatFormatPythonConfig in a `type`-tagged union.
json_schemaobject必填JSON Schema configuration object
grammarstring必填Custom grammar for text generation
cache_controlobject可选Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.
ttlstring可选Lifetime of an Anthropic-style cache breakpoint.
typestring必填Always `ephemeral`. Discriminator that marks this object as a AnthropicCacheControlDirective in a `type`-tagged union.
debugobject可选Debug options for inspecting request transformations (streaming only)
echo_upstream_bodyboolean可选○ 当前不生效If true, includes the transformed upstream request body in a debug chunk at the start of the stream. Only works with streaming mode.
接受但当前不生效。流式请求不会回显上游请求体。
frequency_penaltynumber可选◐ 部分支持Frequency penalty (-2.0 to 2.0)
deepseek-v4-flash、glm-5.3-flash 部分请求生效;qwen3.8-flash 在部分取值或协议面返回 400。
image_configobject可选Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details.
logit_biasobject可选Token logit bias adjustments
logprobsboolean可选◐ 部分支持Return log probabilities
qwen3.8-flash 生效;deepseek-v4-flash 仅 /openai 生效,glm-5.3-flash 的两面结果不一致;gemini-2.5-flash 返回 400。
max_completion_tokensinteger可选◐ 部分支持Maximum tokens in completion
deepseek-v4-flash、glm-5.3-flash 生效;qwen3.8-flash 的小预算可能不生效或报超限。
metadataobject可选Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
min_pnumber可选○ 当前不生效Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter.
接受但当前不生效。
modalitiesarray可选Output modalities for the response. Supported values are "text", "image", and "audio".
modelsarray可选Models to use for completion
按顺序回退:主模型不存在、无同协议线路或上游失败均尝试下一项。可只给 models;响应 model 和费用归属最终完成请求的模型。
parallel_tool_callsboolean可选◐ 部分支持Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response.
false 在 qwen3.8-flash 生效;deepseek-v4-flash 接受但不生效;glm-5.3-flash 的两面结果不一致。
pluginsarray可选◐ 部分支持Plugins you want to enable for this request, including their settings.
支持 file-parser(pdf.engine 为 native、mistral-ocr→ocr、ocr、auto)和平台 guardrails。请求覆盖账户默认,锁定设置保留。web 等未实现插件、未知引擎或非法形状返回 400 并点名字段。
元素按 id 区分(auto-beta-router / auto-router / context-compression / file-parser / fusion / moderation / pareto-router / response-healing / web / web-fetch),此处展开其中一种的形状
allowed_modelsarray可选List of model patterns to filter which models the auto-beta-router can route between. Supports wildcards (e.g., "anthropic/*" matches all Anthropic models). Up to 1024 patterns, each at most 1024 characters, with 65536 total characters across all patterns. When not specified, every model ranked for the classified task type is a candidate, falling back to a default model set when rankings are unavailable.
cost_quality_tradeoffinteger可选Deprecated: Use cost_tier instead. Balances routing between cost and quality on a 0-10 scale. The auto-beta-router ranks models for the classified task type by community spend share, then filters candidates by their average cost per generation for that task. Higher values favor cheaper models: 10 keeps only models around the cheapest 10th percentile, while 0 permits models up to the 90th percentile for cost. Defaults to 9 when no cost setting is provided. It remains supported and retains ceiling behavior, but cost_tier takes precedence when both are provided.
cost_tierstring可选Named cost/quality setting. For auto-beta-router, tiers select cost-percentile bands: low = [0, 20), medium = [20, 40), high = [40, 60), xhigh = [60, 80), and max = [80, 100]. Takes precedence over the deprecated numeric cost_quality_tradeoff when both are provided.
enabledboolean可选Set to false to disable Fusion configuration for a run started by the `openrouter/fusion` model slug or `openrouter:fusion` server tool. Defaults to true.
excluded_modelsarray可选List of model patterns to exclude from auto-beta-router selection. Supports wildcards (e.g., "meta-llama/*" excludes all Llama models). Up to 1024 patterns, each at most 1024 characters, with 65536 total characters across all patterns. Applied after allowed_models, so an excluded pattern always wins over an allowed one.
idstring可选Plugin id; always fusion.
pin_modelboolean可选When true, reuses the model from the most recent assistant message's `model` attribute for subsequent turns. Defaults to false.
enginestring可选The compression engine to use. Defaults to "middle-out".
exclude_domainsarray可选A list of domains to exclude from web search results. Supports wildcards (e.g. "*.substack.com") and path filtering (e.g. "openai.com/blog").
include_domainsarray可选A list of domains to restrict web search results to. Supports wildcards (e.g. "*.substack.com") and path filtering (e.g. "openai.com/blog").
max_resultsinteger可选Maximum number of search results to use.
max_usesinteger可选Maximum number of web fetches per request. Once exceeded, the tool returns an error.
modestring可选Engine-native search mode. Exa supports instant, fast, auto (default), deep-lite, deep, and deep-reasoning. Parallel supports turbo, fast, basic (default), and advanced. Modes unsupported by the selected engine are ignored.
search_promptstring可选Prompt that introduces the search results to the model.
user_locationobject可选Approximate user location for location-biased search results.
allowed_domainsarray可选Only fetch from these domains.
blocked_domainsarray可选Never fetch from these domains.
max_content_tokensinteger可选Maximum content length in approximate tokens. Content exceeding this limit is truncated.
pdfobject可选Options for PDF parsing.
max_pricenumber可选Maximum input price in USD per million tokens. When set, quality-tier selection (min_coding_score) is bypassed: the router computes the Pareto frontier over the top coding models and routes to the best-scoring frontier model priced at or below this cap, falling back through cheaper frontier models, then non-frontier models. Enforced against the price source given by price_source. Returns 404 when no candidate satisfies the cap.
min_coding_scorenumber可选Minimum coding quality score between 0 and 1. Maps to internal quality tiers: >= 0.66 → high (top coding models), >= 0.33 → medium (strong modern flagships), < 0.33 → low (capable coders above the median). Omit to default to the highest tier (equivalent to >= 0.66). Not used when max_price is set (price-based selection takes over).
price_sourcestring可选Price source for the Pareto frontier cost axis and for enforcing max_price. "prompt" uses catalog list price (endpoint.pricing.prompt). "weighted_avg" uses traffic-weighted effective input price from ClickHouse, falling back to prompt price for models without traffic data. Defaults to "prompt".
analysis_modelsarray可选For a Fusion run started by the `openrouter/fusion` model slug or `openrouter:fusion` server tool, slugs of models to run in parallel as the "expert panel" the analyst analyzes. Each model receives the same user prompt with web_search + web_fetch enabled. Capped at 8 models to bound cost amplification. When omitted, defaults to the Quality preset from the /labs/fusion UI (~anthropic/claude-opus-latest, ~openai/gpt-sol-latest, ~google/gemini-pro-latest).
max_tool_callsinteger可选For a Fusion run started by the `openrouter/fusion` model slug or `openrouter:fusion` server tool, the maximum number of tool-calling steps each panelist (analysis model) and the analyst model may take during their agentic web-research loop. Models with web_search/web_fetch enabled iterate until they produce a text response or hit this ceiling. Defaults to 4. Capped at 16.
modelstring可选For a Fusion run started by the `openrouter/fusion` model slug or `openrouter:fusion` server tool, the slug of the model that performs both the analyst step (with web_search + web_fetch) and the final synthesis. When omitted, defaults to the first model in the Quality preset.
presetstring可选Configuration for a Fusion run started by the `openrouter/fusion` model slug or `openrouter:fusion` server tool. A curated OpenRouter preset (slugs follow `<task>-<tier>`, e.g. `general-high`). Expands server-side into the preset's analysis_models panel and analyst model, so callers never name individual models. Explicitly provided `analysis_models` / `model` take precedence.
toolsarray可选For a Fusion run started by the `openrouter/fusion` model slug or `openrouter:fusion` server tool, server tools available to panelist and analyst inner calls. Each entry uses the same `{ type, parameters? }` shorthand as the outer Chat Completions request. When omitted, defaults to `[{ type: "openrouter:web_search" }, { type: "openrouter:web_fetch" }]`. Pass an empty array to disable tools entirely (panelists answer from parametric knowledge only).
predictionobject可选Static predicted output content. Supported models can use this to reduce latency when much of the response is known in advance.
contentstring | array必填Predicted output: a string or an array of text parts.
typestring必填Always `content`. Discriminator that marks this object as a Prediction in a `type`-tagged union.
presence_penaltynumber可选◐ 部分支持Presence penalty (-2.0 to 2.0)
deepseek-v4-flash 的 /openai 面观察到效果;qwen3.8-flash 部分请求返回 400,其余不可观测。
prompt_cache_keystring可选prompt_cache_optionsobject可选Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer.
modestring必填Prompt cache mode; explicit caches only the blocks marked with prompt_cache_breakpoint.
ttlstring可选Lifetime of cache entries, for example 30m; null leaves the provider default.
providerobject可选◐ 部分支持When multiple model providers are available, optionally indicate your routing preference.
只有选择具体供应商(order / only / ignore)仅限 BYOK、返回 400;require_parameters 生效,其余选项接受但不生效。
allow_fallbacksboolean可选○ 当前不生效Whether to allow backup providers to serve requests - true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider. - false: use only the primary/custom provider, and return the upstream error if it's unavailable.
接受但当前不生效(不属于供应商选择,平台凭证下可用)。
data_collectionstring可选○ 当前不生效Data collection setting. If no available model provider meets the requirement, your request will return an error. - allow: (default) allow providers which store user data non-transiently and may train on it - deny: use only providers which do not collect user data.
接受但当前不生效(不属于供应商选择,平台凭证下可用)。
enforce_distillable_textboolean可选Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used.
ignorearray可选○ 未支持List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.
选择具体供应商(order / only / ignore)仅限 BYOK,平台凭证下返回 400 PROVIDER_SELECTION_NOT_ALLOWED。
max_priceobject可选○ 当前不生效The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
接受但当前不生效(不属于供应商选择,平台凭证下可用)。
onlyarray可选○ 未支持List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.
选择具体供应商(order / only / ignore)仅限 BYOK,平台凭证下返回 400 PROVIDER_SELECTION_NOT_ALLOWED。
orderarray可选○ 未支持An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.
选择具体供应商(order / only / ignore)仅限 BYOK,平台凭证下返回 400 PROVIDER_SELECTION_NOT_ALLOWED。
preferred_max_latencynumber | object可选Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
preferred_min_throughputnumber | object可选Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
quantizationsarray可选○ 当前不生效A list of quantization levels to filter the provider by.
接受但当前不生效(不属于供应商选择,平台凭证下可用)。
require_parametersboolean可选Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.
只走能表达全部参数的线路;平台凭证下可用。
sortstring | object可选○ 当前不生效The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
接受但当前不生效(不属于供应商选择,平台凭证下可用)。
zdrboolean可选○ 当前不生效Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.
接受但当前不生效(不属于供应商选择,平台凭证下可用)。
reasoningobject可选Configuration options for reasoning models
effortstring可选◐ 部分支持Constrains effort on reasoning for reasoning models
none 仅在 qwen3.8-flash 可靠关闭思考;deepseek-v4-flash 和 glm-5.3-flash 未遵守。
summarystring可选○ 当前不生效How detailed the reasoning summary should be.
接受但当前不生效。deepseek-v4-flash 未返回请求的摘要。
reasoning_effortstring可选◐ 部分支持Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.
none 在 qwen3.8-flash 关闭思考;deepseek-v4-flash 仍思考,glm-5.3-flash 的档位效果不符合预期。
repetition_penaltynumber可选Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter.
routestring可选**DEPRECATED** Use providers.sort.partition instead. Backwards-compatible alias for providers.sort.partition. Accepts legacy values: "fallback" (maps to "model"), "sort" (maps to "none").
seedinteger可选○ 当前不生效Random seed for deterministic outputs
接受但当前不生效。deepseek-v4-flash、glm-5.3-flash、qwen3.8-flash 同 seed 不能复现输出。
service_tierstring可选The service tier to use for processing this request. `fast` is accepted as an alias for `priority`.
session_idstring可选A unique identifier for grouping related requests (e.g., a conversation or agent workflow). When provided, OpenRouter uses it as the sticky routing key, routing all requests in the session to the same provider to maximize prompt cache hits. Also used for observability grouping. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters.
stop_server_tools_whenarray可选Stop conditions for the server-tool agent loop. Any condition firing halts the loop (OR logic). When set, this overrides `max_tool_calls`. When a condition fires while the model is still emitting tool calls, the pending tool calls are executed and one final turn is made with tool calls disabled so the response ends with a natural-language answer instead of an unfinished tool call.
元素按 type 区分(finish_reason_is / has_tool_call / max_cost / max_tokens_used / step_count_is),此处展开其中一种的形状
step_countinteger可选Number of steps after which the loop stops.
typestring可选Always `finish_reason_is`. Discriminator that marks this object as a StopServerToolsWhenFinishReasonIs in a `type`-tagged union.
tool_namestring可选Name of the tool whose call stops the loop.
max_tokensinteger可选Cumulative token count after which the loop stops.
max_cost_in_dollarsnumber可选Cumulative cost in USD after which the loop stops.
reasonstring可选Finish reason that stops the loop.
stream_optionsobject可选Streaming configuration options
include_usageboolean可选○ 当前不生效Deprecated: This field has no effect. Full usage details are always included.
接受但当前不生效。无论 true、false 或省略,流末尾都会返回 usage。
top_anumber可选○ 当前不生效Consider only tokens with "sufficiently high" probabilities based on the probability of the most likely token. Not all providers support this parameter.
接受但当前不生效。
top_kinteger可选◐ 部分支持Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter.
已测模型接受但未见采样效果;/model 的 deepseek-v4-flash 返回错误。
top_logprobsinteger可选◐ 部分支持Number of top log probabilities to return (0-20)
需与 logprobs=true 同传;支持度随 logprobs 和所选模型而异。
traceobject可选Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
generation_namestring可选Name of this generation in the trace.
parent_span_idstring可选Id of the parent span in the trace.
span_namestring可选Name of this request's span in the trace.
trace_idstring可选Id that groups several requests into one trace.
trace_namestring可选Name of the trace.
userstring可选Per-end-user identifier for abuse isolation. Use a stable ID, hash, or pseudonym. When a provider requires a user identity, OpenRouter folds it into the hashed identity sent upstream and never forwards it raw. If omitted, requests use an account-level identity, so provider policy blocks can affect the whole account.
storeboolean可选○ 当前不生效接受但当前不生效。此结论仅适用于 Chat Completions。
max_output_tokensinteger可选○ 当前不生效接受但当前不生效。此结论仅适用于 Chat Completions。
thinkingobject可选○ 当前不生效接受但当前不生效。此结论仅适用于 Chat Completions。
web_search_optionsobject可选○ 当前不生效接受但当前不生效。此结论仅适用于 Chat Completions。
functionsarray可选○ 当前不生效接受但当前不生效。此结论仅适用于 Chat Completions。
audioobject可选○ 当前不生效接受但当前不生效。此结论仅适用于 Chat Completions。
ninteger可选◐ 部分支持glm-5.3-flash 生效;deepseek-v4-flash 接受但当前不生效;qwen3.8-flash 返回错误。
usageobject可选○ 当前不生效接受并忽略;用量默认始终返回,include 不改变行为。
transformsarray可选○ 当前不生效接受并忽略;不执行 middle-out 或其他消息变换,保留原消息。
deferred_toolsobject可选○ 当前不生效接受并忽略;尚未实现 OpenRouter 延迟工具协议。
promptstring可选○ 当前不生效接受并忽略;Chat 仍须提供 messages,本字段不替代消息。
structured_outputsboolean可选○ 当前不生效接受并忽略此开关;结构化输出使用 response_format,支持度见该字段。
include_reasoningboolean可选○ 当前不生效接受并忽略此旧别名;思考配置使用 reasoning,支持度见该字段。
safe_promptboolean可选○ 当前不生效接受并忽略;未实现 Mistral 的 safe_prompt 开关。
raw_modeboolean可选○ 当前不生效接受并忽略;未实现 Hyperbolic 的 raw_mode 开关。
200 chat.completion
stream=true 时以 SSE 增量返回(text/event-stream)。
未知顶层字段原样转发给同协议上游,由上游决定是否接受;已声明字段的类型与取值范围仍会校验,不合法时返回 400 并点名字段。
错误按 OpenAI 格式返回,参见 错误码
Successful chat completion response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| choices | array<object> | List of completion choices |
| choices[].finish_reason | string | null | |
| choices[].index | integer | Choice index |
| choices[].logprobs | object | null | Log probabilities for the completion |
| choices[].message | object | Assistant message for requests and responses |
| created | integer | Unix timestamp of creation |
| id | string | Unique completion identifier |
| model | string | Model used for completion |
| object | string | |
| openrouter_metadata | object | Routing report: what was requested, how the router chose, and what was attempted. |
| openrouter_metadata.attempt | integer | Number of the attempt that served the request, starting at 1. |
| openrouter_metadata.attempts | array<object> | Every attempt that was made, in order. |
| openrouter_metadata.endpoints | object | Which endpoints were available and which one was chosen. |
| openrouter_metadata.generation_time | integer | Milliseconds measured for the generation, from dispatching the upstream request until its response body ended. Divide the completion token count by this for throughput. Absent when no upstream request was dispatched. |
| openrouter_metadata.is_byok | boolean | Whether the request used a key supplied by the caller. |
| openrouter_metadata.params | object | Router parameters that applied to the request. |
| openrouter_metadata.pipeline | array<object> | Stages the request went through before and after the model call. |
| openrouter_metadata.region | string | null | Region that served the request; null when unknown. |
| openrouter_metadata.requested | string | The model or alias the request asked for. |
| openrouter_metadata.strategy | string | How the router picked the model or provider for this request. |
| openrouter_metadata.summary | string | One-line summary of the routing decision. |
| service_tier | string | null | The service tier used by the upstream provider for this request |
| system_fingerprint | string | null | System fingerprint |
| usage | object | Token usage statistics |
| usage.completion_tokens | integer | Number of tokens in the completion |
| usage.completion_tokens_details | object | null | Detailed completion token usage |
| usage.cost | number | null | Cost of the completion |
| usage.cost_details | object | null | Breakdown of upstream inference costs |
| usage.is_byok | boolean | Whether a request was made using a Bring Your Own Key configuration |
| usage.prompt_tokens | integer | Number of tokens in the prompt |
| usage.prompt_tokens_details | object | null | Detailed prompt token usage |
| usage.server_tool_use_details | object | null | Usage for server-side tool execution (e.g., web search) |
| usage.total_tokens | integer | Total number of tokens |
text/event-stream — chunk / 事件对象
| 名称 | 类型 | 说明 |
|---|---|---|
| data | object | Streaming chat completion chunk |
| data.choices | array<object> | List of streaming chunk choices |
| data.created | integer | Unix timestamp of creation |
| data.error | object | Error information |
| data.id | string | Unique chunk identifier |
| data.model | string | Model used for completion |
| data.object | string | |
| data.openrouter_metadata | object | Routing report: what was requested, how the router chose, and what was attempted. |
| data.service_tier | string | null | The service tier used by the upstream provider for this request |
| data.system_fingerprint | string | System fingerprint |
| data.usage | object | Token usage statistics |
/openai/v1/responses● 支持modelstring必填◐ 部分支持已验证支持 glm-5.3-flash、deepseek-flash;没有 Responses 协议的模型返回 404。
streamboolean可选◐ 部分支持deepseek-flash 生效;glm-5.3-flash 返回 400。
temperaturenumber可选◐ 部分支持glm-5.3-flash 部分生效,2 可能返回空文本或乱码;deepseek-flash 的效果不可观测。
top_pnumber可选◐ 部分支持glm-5.3-flash 观察到采样变化;deepseek-flash 不可观测。
toolsarray可选◐ 部分支持function 生效;web_search、code_interpreter、image_generation、mcp、computer_use 接受但当前不生效;file_search 返回 404。
tool_choicestring | object可选◐ 部分支持How the model picks tools: a mode string or a specific tool.
auto 生效;deepseek-flash 的 required/具名函数需 reasoning.effort=none;allowed_tools 在 glm-5.3-flash 被忽略,在 deepseek-flash 返回 422。
namestring必填Name of the function or tool the model must call.
typestring必填Kind of tool the model must call.
modestring必填auto lets the model pick among the allowed tools or none; required forces a call to one of them.
toolsarray必填The allowed tools, each as a tool reference such as {type: function, name}.
backgroundboolean可选◐ 部分支持是否让模型在后台生成响应。仅当路由到的模型具备 Router 自建后台能力时可用——Router 会立即返回 status queued,随后自行以流式方式调用上游、跑到终态并恰好一次结算用量, 客户端通过 GET /v1/responses/{id} 轮询(这不代表上游原生支持 OpenAI 的 background 参数)。不具备该能力的 provider 设置为 true 仍返回 400(错误码 native_responses_background_unsupported)。取消(POST /v1/responses/{id}/cancel) 只能停止我方对上游流的继续读取,不能保证已发往上游的算力停止计算;用量按实际收到的 部分结算,未收到用量时按平台通用的"上游未报用量"规则处理。
deepseek-flash 生效;glm-5.3-flash 返回 400。background 与 stream 同传时返回 JSON。
includearray可选◐ 部分支持原样转发给上游模型;只对该模型具备的能力生效(例如推理内容、联网搜索来源),模型不具备的项会被忽略。
deepseek-flash 返回 logprobs;reasoning.encrypted_content 仅为占位串。glm-5.3-flash 接受但当前不生效。
inputstring | array可选◐ 部分支持Input for a response request - can be a string or array of items
字符串、消息数组、input_text、input_image 和函数往返生效;input_file 在 glm-5.3-flash 报错、deepseek-flash 忽略;托管文件引用返回 400。
instructionsstring可选已验证生效。
max_output_tokensinteger可选正数控制输出预算;0 返回 400。
metadataobject可选◐ 部分支持Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed.
glm-5.3-flash 回显;deepseek-flash 接受但当前不生效,响应及读取均为空对象。
parallel_tool_callsboolean可选◐ 部分支持true 可返回多个调用;false 接受但当前不生效,仍可能返回多个调用。
previous_response_idany可选要续接的上一条响应 ID。仅所有者可续接,续接时可以省略 model 字段;平台会展开保存的历史后再请求上游。
平台将祖先的输入与输出和本轮 input 合并,发往上游前移除 previous_response_id;没有活副本或不属于当前租户时返回 404 previous_response_not_found。
promptobject可选○ 未支持引用一个已保存的提示词模板及其变量。我方目前没有 Prompts(提示词模板)资源,传入任何 id 都会返回 404 object_not_found。
当前没有可引用的提示词模板;传入模板 id 返回 404。
idstring必填Id of the stored prompt template.
variablesobject可选Values for the template variables, keyed by variable name; a value is a string or an input text, image or file part.
prompt_cache_keystring可选prompt_cache_optionsobject可选Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer.
modestring必填Prompt cache mode; explicit caches only the blocks marked with prompt_cache_breakpoint.
ttlstring可选Lifetime of cache entries, for example 30m; null leaves the provider default.
reasoningobject可选Configuration for reasoning mode in the response
contextstring可选Controls which reasoning is available to the model. `auto` uses the model default (same as omitting); `all_turns` includes reasoning from earlier turns passed in input; `current_turn` limits to the current turn only. Only supported by OpenAI GPT-5.6 and newer.
effortstring可选◐ 部分支持How much reasoning the model should spend.
deepseek-flash 的 none 可关闭思考,其余档位不保证单调;glm-5.3-flash 接受但当前不生效,none 仍思考。
modestring可选Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer.
summarystring可选◐ 部分支持How detailed the reasoning summary should be.
glm-5.3-flash 的 concise 偶发有摘要,auto/detailed 未见;deepseek-flash 接受但当前不生效。
enabledboolean可选max_tokensinteger可选safety_identifierstring可选建议为终端用户设置的稳定标识符,用于滥用隔离。使用稳定的 ID、哈希值或化名。若上游 provider 需要用户身份,我们会把它折算进转发的哈希身份、不会原样转发;省略时请求使用账号级身份,滥用处置可能影响整个账号。
service_tierstring可选请求使用的服务档位;当前效果不可观测。
storeboolean可选是否在服务端保存这条响应,以便之后通过 previous_response_id 读取或续接。默认 true;传 false 可关闭保存。
true 保存响应供读取;false 不保存,读取返回 404。
textobject可选Text output configuration including format and verbosity
formatobject可选◐ 部分支持Text response format configuration
json_object、json_schema 生效(预算需足够);text 在 glm-5.3-flash 偶发 400,在 deepseek-flash 生效。
verbositystring可选○ 当前不生效接受但当前不生效。glm-5.3-flash、deepseek-flash 均未观察到长度变化。
top_logprobsinteger可选◐ 部分支持deepseek-flash 生效,允许 0–20;glm-5.3-flash 返回空 logprobs。
truncationstring可选How to handle input that exceeds the context window.
userstring可选A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 256 characters.
conversationstring可选该响应所属的对话(会话 id 字符串,或 `{id}` 对象)。发往上游前,我们会把这个对话里已有的条目拼接到本次 input 前面;响应完成后,本次的输入与输出条目会被追加回这个对话。只有对话的所有者可以引用它,否则返回 404 object_not_found;不能和 previous_response_id 同时使用,同传返回 400。
会话历史进入本次输入,响应条目追加到会话;不能与 previous_response_id 同传。
context_managementarray可选本次请求的上下文管理配置(例如输入超过阈值时自动压缩)。
moderationobject可选对本次响应的输入和输出运行审核(moderation)的配置。
prompt_cache_retentionstring可选提示词缓存的保留策略;设为 24h 可以让缓存前缀存活更久,最长 24 小时。
stream_optionsobject可选流式响应的附加选项,只在 stream=true 时生效(例如流末尾是否附带用量统计)。
access_programsobject可选○ 未支持已识别的官方字段;平台未实现访问计划,传入返回 400 并明确说明不支持。
200 response
stream=true 时以 SSE 增量返回(text/event-stream)。
未知顶层字段原样转发给同协议上游,由上游决定是否接受;已声明字段的类型与取值范围仍会校验,不合法时返回 400 并点名字段。
错误按 OpenAI 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| background | boolean | null | Whether the response was started in background mode. |
| completed_at | integer | null | Unix time in seconds at which the response finished; null while it has not finished. |
| created_at | integer | Unix time in seconds at which the response was created. |
| error | object | null | Error information returned from the API |
| error.code | string | Machine-readable error code. |
| error.message | string | Human-readable error message. |
| frequency_penalty | number | null | The frequency penalty that applied to the request, if any. |
| id | string | Unique id of the response; use it as response_id to retrieve, cancel or delete it, or as previous_response_id to continue the conversation. |
| incomplete_details | object | null | Why the response stopped before finishing; null for complete responses. |
| incomplete_details.reason | string | Why the response is incomplete. |
| instructions | string | array<object> | null | Input of the request: a string or an array of input items. |
| max_output_tokens | integer | null | Upper bound on generated tokens that applied to the request; null when none was set. |
| max_tool_calls | integer | null | Upper bound on built-in tool calls that applied to the request; null when none was set. |
| metadata | object | null | Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed. |
| model | string | Model that produced the response. |
| object | string | Object type; always `response`. |
| output | array<object> | Items the model produced, in order: messages, reasoning, tool calls and tool results. |
| output[].content | array<object> | array | null | string | Content parts of the message: output text or refusal. / Reasoning text parts, when the provider returns them. / Text content of the fetched page. |
| output[].id | string | Id of the message item. / Id of the reasoning item. / Id of the function call item. / Id of the web search call item. / Id of the file search call item. / Id of the image generation call item. / Id of the code interpreter call item. / Id of the computer call item. / Id of the datetime server tool item. / Id of the web search server tool item. / Id of the code interpreter server tool item. / Id of the file search server tool item. / Id of the image generation server tool item. / Id of the browser use server tool item. / Id of the bash server tool item. / Id of the text editor server tool item. / Id of the apply_patch server tool item. / Id of the apply_patch call item. / Id of the shell call item. / Id of the shell call output item. / Id of the shell server tool item. / Id of the web fetch server tool item. / Id of the tool search server tool item. / Id of the memory server tool item. / Id of the MCP server tool item. / Id of the model search server tool item. / Id of the fusion server tool item. / Id of the advisor server tool item. / Id of the subagent server tool item. / Id of the files server tool item. / Id of the custom tool call item. |
| output[].phase | string | null | The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages. |
| output[].role | string | Role of the author; always assistant. |
| output[].status | string | Status of the message item. / Status of the reasoning item. / Status of the function call item. / Status of a web search call. / Status of a web search call. / Status of an image generation call. / Status of the code interpreter call. / Status of the computer call item. / Status of a tool call. / Status of a tool call. / Status of a tool call. / Status of a tool call. / Status of a tool call. / Status of a tool call. / Status of a tool call that can fail. / Status of a tool call. / Status of a tool call. / Lifecycle state of an `apply_patch_call` output item. / Status of a shell call or its output. / Status of a shell call or its output. / Status of a tool call that can fail. / Status of a tool call. / Status of a tool call. / Status of a tool call. / Status of a tool call. / Status of a tool call. / Status of a tool call. / Status of a tool call that can fail. / Status of a tool call that can fail. / Status of a tool call. / Status of the custom tool call item. |
| output[].type | string | Always `message`. Discriminator that marks this object as a OutputMessage in a `type`-tagged union. / Always `reasoning`. Discriminator that marks this object as a OutputItemReasoning in a `type`-tagged union. / Always `function_call`. Discriminator that marks this object as a OutputItemFunctionCall in a `type`-tagged union. / Always `web_search_call`. Discriminator that marks this object as a OutputItemWebSearchCall in a `type`-tagged union. / Always `file_search_call`. Discriminator that marks this object as a OutputItemFileSearchCall in a `type`-tagged union. / Always `image_generation_call`. Discriminator that marks this object as a OutputItemImageGenerationCall in a `type`-tagged union. / Always `code_interpreter_call`. Discriminator that marks this object as a OutputItemCodeInterpreterCall in a `type`-tagged union. / Always `computer_call`. Discriminator that marks this object as a OutputComputerCallItem in a `type`-tagged union. / Always `openrouter:datetime`. Discriminator that marks this object as a OutputDatetimeItem in a `type`-tagged union. / Always `openrouter:web_search`. Discriminator that marks this object as a OutputWebSearchServerToolItem in a `type`-tagged union. / Always `openrouter:code_interpreter`. Discriminator that marks this object as a OutputCodeInterpreterServerToolItem in a `type`-tagged union. / Always `openrouter:file_search`. Discriminator that marks this object as a OutputFileSearchServerToolItem in a `type`-tagged union. / Always `openrouter:image_generation`. Discriminator that marks this object as a OutputImageGenerationServerToolItem in a `type`-tagged union. / Always `openrouter:browser_use`. Discriminator that marks this object as a OutputBrowserUseServerToolItem in a `type`-tagged union. / Always `openrouter:bash`. Discriminator that marks this object as a OutputBashServerToolItem in a `type`-tagged union. / Always `openrouter:text_editor`. Discriminator that marks this object as a OutputTextEditorServerToolItem in a `type`-tagged union. / Always `openrouter:apply_patch`. Discriminator that marks this object as a OutputApplyPatchServerToolItem in a `type`-tagged union. / Always `apply_patch_call`. Discriminator that marks this object as a OutputApplyPatchCallItem in a `type`-tagged union. / Always `shell_call`. Discriminator that marks this object as a OutputShellCallItem in a `type`-tagged union. / Always `shell_call_output`. Discriminator that marks this object as a OutputShellCallOutputItem in a `type`-tagged union. / Always `openrouter:shell`. Discriminator that marks this object as a OutputShellServerToolItem in a `type`-tagged union. / Always `openrouter:web_fetch`. Discriminator that marks this object as a OutputWebFetchServerToolItem in a `type`-tagged union. / Always `openrouter:tool_search`. Discriminator that marks this object as a OutputToolSearchServerToolItem in a `type`-tagged union. / Always `openrouter:memory`. Discriminator that marks this object as a OutputMemoryServerToolItem in a `type`-tagged union. / Always `openrouter:mcp`. Discriminator that marks this object as a OutputMcpServerToolItem in a `type`-tagged union. / Always `openrouter:experimental__search_models`. Discriminator that marks this object as a OutputSearchModelsServerToolItem in a `type`-tagged union. / Always `openrouter:fusion`. Discriminator that marks this object as a OutputFusionServerToolItem in a `type`-tagged union. / Always `openrouter:advisor`. Discriminator that marks this object as a OutputAdvisorServerToolItem in a `type`-tagged union. / Always `openrouter:subagent`. Discriminator that marks this object as a OutputSubagentServerToolItem in a `type`-tagged union. / Always `openrouter:files`. Discriminator that marks this object as a OutputFilesServerToolItem in a `type`-tagged union. / Always `custom_tool_call`. Discriminator that marks this object as a OutputCustomToolCallItem in a `type`-tagged union. |
| output[].encrypted_content | string | null | Opaque encrypted reasoning; send it back unchanged to let the model continue its reasoning on the next turn. |
| output[].summary | array<object> | Summary parts of the reasoning. |
| output[].format | string | null | Wire format of the reasoning details, which names the provider family that produced them. |
| output[].signature | string | null | A signature for the reasoning content, used for verification |
| output[].arguments | string | string | null | string | null | string | null | string | string | null | JSON-encoded arguments the model produced for the function. / The raw tool-call arguments string as emitted by the model. / The raw tool-call arguments string as emitted by the model. Echo back unchanged when replaying history; used verbatim to preserve provider prompt-cache prefixes. / The raw tool-call arguments string as emitted by the model. / The JSON arguments submitted to the search tool (e.g. {"query":"Claude"}) / The raw tool-call arguments string as emitted by the model. |
| output[].async | boolean | True when the model called a tool declared with `async: true` and may continue its turn before the output is returned. Return the result in a later request as a `function_call_output` with this `call_id`. |
| output[].call_id | string | string | null | string | string | string | string | string | null | string | string | null | string | Id of the call; the function_call_output item that answers it repeats it as call_id. / Id of the call; the computer_call_output item that answers it repeats it as call_id. / The model-generated tool call id from the originating turn. / Id of the apply_patch tool call. / Id of the call; the apply_patch_call_output item that answers it repeats it as call_id. / Id of the call; the shell_call_output item that answers it repeats it as call_id. / Id of the shell call this output answers. / The model-generated tool call id from the originating turn. / EXPERIMENTAL — subject to change without notice. The `call_id` of the tool call that spawned this subagent. This id will also be included as the `subagent_id` on any `function_call` items created by the subagent. This must be returned in the request so the `function_call` can be matched with the correct subagent. A suspended `in_progress` item is announced once and never re-emitted or terminally closed — completion arrives as a new item with the same `call_id`. / The model-generated tool call id from the originating turn. / Id of the call; the custom_tool_call_output item that answers it repeats it as call_id. |
| output[].name | string | Name of the function being called. / Configured name of the subagent that executed the task (the `name` on its tool entry). Present only for named subagents; omitted for an unnamed (default) subagent. / Name of the custom tool being called. |
| output[].namespace | string | Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server) |
| output[].subagent_id | string | EXPERIMENTAL — subject to change without notice. String id that matches the `call_id` of the `openrouter:subagent` server tool call that spawned the subagent. Present on every `function_call` item the subagent projects; absent on ordinary function calls. |
| output[].subagent_items | array<object> | EXPERIMENTAL — subject to change without notice. The subagent's output items produced on this turn. Treat this as an opaque object; you must replay it in the request so that the subagent can continue execution of the tool with the same context. If a subagent created multiple parallel tool calls, only the first tool call will have this field. The other tool calls will only have `subagent_id`. Present only if the tool call originates from a subagent spawned by the `openrouter:subagent` server tool. |
| output[].action | object | any | object | string | object | object | string | The search action the model took: a search, opening a page, or finding a pattern in a page. / The action the model asks the client to perform on the computer. / The search action performed, matching OpenAI web_search_call.action shape. Includes the query the model issued and optional source URLs returned by the search provider. / The browser action that was performed. / The commands the model asks the client to run. / The commands that were run. / Memory action that was performed. |
| output[].queries | array<string> | Queries the model ran against the vector stores. / Queries that ran against the vector stores. |
| output[].result | string | null | string | Base64-encoded generated image; null while generation has not finished. / The generated image as a base64-encoded string or URL, matching OpenAI image_generation_call format / JSON-serialized result of the file operation. |
| output[].prompt | string | The prompt (possibly rewritten) that the image was generated from. / The prompt the executor sent to the advisor. |
| output[].code | string | null | string | The code the interpreter ran; null while it is still being written. / The code that ran. |
| output[].container_id | string | Id of the container the code ran in. / The canonical container id the command ran under — the `{container_id}` for the Container Files API, reusable as a `container_reference` in later requests. Present on every sandbox-executed call, even when no files changed. / The canonical container id the command ran under — the `{container_id}` for the Container Files API, reusable as a `container_reference` in later requests. Present on every sandbox-executed call, even when no files changed. / The canonical container id the command ran under — the `{container_id}` for the Container Files API, reusable as a `container_reference` in later requests. Present on every sandbox-executed call, even when no files changed. |
| output[].outputs | array | null | Outputs of the run: logs and images; null while the run has not finished. |
| output[].pending_safety_checks | array<object> | Safety checks that must be acknowledged before the action is performed. |
| output[].datetime | string | ISO 8601 datetime string |
| output[].timezone | string | IANA timezone name |
| output[].exitCode | integer | Exit code of the run; 0 means success. / Exit code of the command; 0 means success. |
| output[].language | string | Language of the code that ran. |
| output[].stderr | string | Standard error output of the code. / Standard error output of the command. |
| output[].stdout | string | Standard output of the code. / Standard output of the command. |
| output[].imageB64 | string | Base64-encoded generated image. |
| output[].imageUrl | string | URL of the generated image. |
| output[].revisedPrompt | string | Prompt after the image model rewrote it. |
| output[].screenshotB64 | string | Base64-encoded screenshot taken after the action. |
| output[].command | string | The bash command that ran. / Editor command that ran. |
| output[].error | string | The error message when the sandbox call failed before producing a result (for example, the per-user container limit was reached). Set together with `status: 'failed'`; absent on a successful call. A non-zero `exitCode` is a command failure, not a tool failure. / The error message when the sandbox call failed before producing a result (for example, the per-user container limit was reached). Set together with `status: 'incomplete'` and an empty `output`; absent on a successful call. / The error message when the sandbox call failed before producing a result (for example, the per-user container limit was reached). Set together with `status: 'failed'`; absent on a successful call. `output` is omitted when `error` is set. / The error message if the fetch failed. / Error message when the fusion run did not produce an analysis result. / Error message when the advisor call did not produce advice. Set together with `status: 'failed'` on the terminal item. / Error message when the subagent task did not produce an outcome. Set together with `status: 'failed'` on the terminal item. / Error message when the file operation failed. |
| output[].files | array<object> | Citations for the files the sandbox command created or modified, most-recently-touched first (at most 10). Retrieve them via the Container Files API. |
| output[].filePath | string | Path of the file the command worked on. |
| output[].operation | object | string | The patch operation requested by an `apply_patch_call`. `create_file` and `update_file` carry a V4A diff; `delete_file` omits it. / The file operation performed (list, read, write, or edit). |
| output[].max_output_length | integer | null | Maximum number of characters of output that was kept; null for no limit. |
| output[].output | array<object> | Output of each command, in the order the commands ran. |
| output[].httpStatus | integer | The HTTP status code returned by the upstream URL fetch. |
| output[].title | string | Title of the fetched page. |
| output[].url | string | URL that was fetched. |
| output[].query | string | The tool search query. / The model search query. |
| output[].key | string | Key of the memory entry. |
| output[].value | any | Value of the memory entry; absent for reads that found nothing and for deletes. |
| output[].serverLabel | string | Label of the MCP server. |
| output[].toolName | string | Name of the MCP tool that was called. |
| output[].analysis | object | Structured analysis produced by the fusion analyst model. |
| output[].failed_models | array<object> | Models that were requested as part of the analysis panel but did not produce a response. Present when at least one requested analysis model failed. The fusion result is still usable but was produced from a degraded panel. |
| output[].failure_reason | string | Typed failure reason when the fusion run failed. Possible values include: all_panels_failed, insufficient_credits, rate_limited, invalid_model, judge_not_valid_json, judge_schema_mismatch, judge_upstream_error, judge_empty_completion. The four analysis-stage codes keep their pre-rename `judge_` spelling so existing consumers keep matching. The consumer-cancellation code is `cancelled`. |
| output[].responses | array<object> | Analysis models that produced a response in this fusion run, with each model's full panel content. |
| output[].sources | array<object> | Web pages the analysis panels and analyst retrieved via web search during this fusion run, deduplicated by URL across the whole run. Present when at least one model cited a source. |
| output[].advice | string | The advisor model's response (the advice text returned to the executor). |
| output[].instance_name | string | Provider-safe function name of the specific advisor instance that produced this item (e.g. `openrouter_advisor__1`). Present only when more than one advisor tool is configured; omitted for the default single advisor. Echo this field back unchanged so the advisor's cross-request memory stays namespaced to the correct instance. This identity is positional: it is derived from the index of the advisor entry in the request `tools` array, so clients must keep the order of advisor tool entries stable across requests in a conversation. Reordering or inserting advisor entries shifts these names and causes each advisor's cross-request memory to be attributed to the wrong instance. / Provider-safe function name of the specific subagent instance that produced this item (e.g. `openrouter_subagent__1`). Present only on items from non-default instances — the second and later subagent entries in the request `tools` array. The first (default) instance omits it, even when multiple subagents are configured. When a replayed item echoes this field back, the transcript rehydrates the call under that instance's tool. This identity is positional: it is derived from the index of the subagent entry in the request `tools` array, so keep the order of subagent entries stable across requests in a conversation. |
| output[].model | string | Slug of the advisor model that was consulted. / Slug of the worker model that executed the task. |
| output[].outcome | string | The worker model's result (the outcome text returned to the delegating model). |
| output[].task_description | string | The task description the delegating model sent to the worker. |
| output[].task_name | string | The short task identifier the delegating model supplied. |
| output[].file_id | string | The target file id supplied in the tool-call arguments. |
| output[].filename | string | The target filename supplied in the tool-call arguments. |
| output[].input | string | Free-form input the model produced for the custom tool. |
| output_text | string | Convenience concatenation of all output text of the response. |
| parallel_tool_calls | boolean | Whether the model was allowed to call several tools in one turn. |
| presence_penalty | number | null | The presence penalty that applied to the request, if any. |
| previous_response_id | string | null | Id of the response this one continued; null when it started a new conversation. |
| prompt | object | null | Reference to a stored prompt template with its variables. |
| prompt.id | string | Id of the stored prompt template. |
| prompt.variables | object | null | Values for the template variables, keyed by variable name; a value is a string or an input text, image or file part. |
| prompt_cache_key | string | null | Cache key the request supplied to improve prompt cache hits; null when none was set. |
| prompt_cache_options | object | null | Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. |
| prompt_cache_options.mode | string | Prompt cache mode; explicit caches only the blocks marked with prompt_cache_breakpoint. |
| prompt_cache_options.ttl | string | null | Lifetime of cache entries, for example 30m; null leaves the provider default. |
| reasoning | object | null | Reasoning settings that applied: effort, summary verbosity, mode and context. |
| reasoning.context | string | null | Controls which reasoning is available to the model. `auto` uses the model default (same as omitting); `all_turns` includes reasoning from earlier turns passed in input; `current_turn` limits to the current turn only. Only supported by OpenAI GPT-5.6 and newer. |
| reasoning.effort | string | null | How much reasoning the model should spend. |
| reasoning.mode | string | null | Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer. |
| reasoning.summary | string | null | How detailed the reasoning summary should be. |
| safety_identifier | string | null | End-user identifier the request supplied for abuse monitoring; null when none was set. |
| service_tier | string | null | Service tier the provider used for the response; null when not reported. |
| status | string | Lifecycle status of the response. |
| store | boolean | Whether the response is stored so it can be retrieved later. |
| temperature | number | null | Sampling temperature that applied to the request, if any. |
| text | object | Text output configuration including format and verbosity |
| text.format | object | Text response format configuration |
| text.verbosity | string | null | How long the answer should be. |
| tool_choice | string | object | How the model picks tools: a mode string or a specific tool. |
| tool_choice.name | string | Name of the function or tool the model must call. |
| tool_choice.type | string | Kind of tool the model must call. / Always `allowed_tools`. Discriminator that marks this object as a ToolChoiceAllowed in a `type`-tagged union. / Kind of tool the model must call. / Kind of tool the model must call. |
| tool_choice.mode | string | auto lets the model pick among the allowed tools or none; required forces a call to one of them. |
| tool_choice.tools | array<object> | The allowed tools, each as a tool reference such as {type: function, name}. |
| tools | array<object> | Tools that were available to the model for this response. |
| tools[].description | string | null | string | string | What the function does and when to use it; the model reads this to decide whether to call it. / What the custom tool does and when to use it. / What the group of tools is for. |
| tools[].name | string | Name of the function; the model uses it in function_call items. / Name of the custom tool. / Name of the namespace that groups the tools. |
| tools[].parameters | object | null | JSON Schema of the function arguments; null when the function takes none. |
| tools[].strict | boolean | null | Whether to enforce strict argument validation against the schema; null leaves the provider default. |
| tools[].type | string | Always `function`. Discriminator that marks this object as a FunctionTool in a `type`-tagged union. / Always `web_search_preview`. Discriminator that marks this object as a Preview_WebSearchServerTool in a `type`-tagged union. / Always `web_search_preview_2025_03_11`. Discriminator that marks this object as a Preview_20250311_WebSearchServerTool in a `type`-tagged union. / Always `web_search`. Discriminator that marks this object as a Legacy_WebSearchServerTool in a `type`-tagged union. / Always `web_search_2025_08_26`. Discriminator that marks this object as a WebSearchServerTool in a `type`-tagged union. / Comparison operator. / Always `computer_use_preview`. Discriminator that marks this object as a ComputerUseServerTool in a `type`-tagged union. / Always `code_interpreter`. Discriminator that marks this object as a CodeInterpreterServerTool in a `type`-tagged union. / Always `mcp`. Discriminator that marks this object as a McpServerTool in a `type`-tagged union. / Always `image_generation`. Discriminator that marks this object as a ImageGenerationServerTool in a `type`-tagged union. / Always `local_shell`. Discriminator that marks this object as a CodexLocalShellTool in a `type`-tagged union. / Always `shell`. Discriminator that marks this object as a ShellServerTool in a `type`-tagged union. / Always `apply_patch`. Discriminator that marks this object as a ApplyPatchServerTool in a `type`-tagged union. / Always `custom`. Discriminator that marks this object as a CustomTool in a `type`-tagged union. / Always `namespace`. Discriminator that marks this object as a NamespaceTool in a `type`-tagged union. |
| tools[].async | boolean | Lets the model keep working after calling this tool instead of waiting for its output. The tool is still executed by the client; return the result in a later request as a `function_call_output` with the original `call_id`. Only honored by providers whose Responses API supports async tools; ignored elsewhere. |
| tools[].defer_loading | boolean | Withhold this tool from the model until `openrouter:tool_search` finds it. Requires the tool search server tool; at least one tool must remain non-deferred. |
| tools[].engine | string | Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses Firecrawl (requires BYOK). "parallel" uses the Parallel search API. "perplexity" uses the Perplexity Search API (raw ranked results). |
| tools[].filters | object | null | Restricts web search by domain. / Attribute filter applied to the search: a comparison or a compound filter. |
| tools[].max_results | integer | Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped. |
| tools[].max_uses | integer | Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it. |
| tools[].mode | string | Engine-native search mode. Exa supports instant, fast, auto (default), deep-lite, deep, and deep-reasoning. Parallel supports turbo, fast, basic (default), and advanced. Modes unsupported by the selected engine are ignored. |
| tools[].search_context_size | string | Size of the search context for web search tools |
| tools[].user_location | object | null | Approximate location of the user, used to bias web search results. / User location information for web search / User location information for web search |
| tools[].max_num_results | integer | Maximum number of results to return, between 1 and 50. |
| tools[].ranking_options | object | Ranking options for the search. |
| tools[].vector_store_ids | array<string> | Ids of the vector stores to search. |
| tools[].display_height | integer | Height of the computer display in pixels. |
| tools[].display_width | integer | Width of the computer display in pixels. |
| tools[].environment | string | Kind of environment that is controlled. |
| tools[].container | string | object | Container for the code to run in: a container id or an automatic container with files. |
| tools[].allowed_tools | array<string> | object | null | Tools of the server the model may use: a list of names or a filter. |
| tools[].authorization | string | OAuth access token for the MCP server. |
| tools[].connector_id | string | Id of a built-in connector; give this or server_url. |
| tools[].headers | object | null | HTTP headers sent to the MCP server; null for none. |
| tools[].require_approval | object | string | null | Whether tool calls need approval before they run: always, never, or a filter per tool. |
| tools[].server_description | string | What the MCP server is for, which helps the model decide when to use it. |
| tools[].server_label | string | Label that names the MCP server in the conversation. |
| tools[].server_url | string | URL of the MCP server; give this or connector_id. |
| tools[].background | string | Background of the generated image. |
| tools[].input_fidelity | string | null | How closely to preserve details of input images; null uses the default. |
| tools[].input_image_mask | object | Mask that marks the region of the input image to edit. |
| tools[].model | string | Image model to use. |
| tools[].moderation | string | Moderation level applied to the generated image. |
| tools[].output_compression | integer | Compression level from 0 to 100 for jpeg and webp output. |
| tools[].output_format | string | File format of the generated image. |
| tools[].partial_images | integer | Number of partial images to stream while generating, from 0 to 3. |
| tools[].quality | string | Quality of the generated image. |
| tools[].size | string | Size of the generated image; auto lets the model choose. |
| tools[].format | object | Format of the tool input: free text or a grammar. |
| tools[].tools | array<object> | Function tools in the namespace. |
| top_logprobs | integer | Number of most likely tokens whose log probabilities were requested per position. |
| top_p | number | null | Nucleus sampling value that applied to the request, if any. |
| truncation | string | null | How to handle input that exceeds the context window. |
| usage | object | null | Token usage information for the response |
| usage.input_tokens | integer | Number of input tokens, cached tokens included. |
| usage.input_tokens_details | object | Breakdown of the input tokens. |
| usage.output_tokens | integer | Number of output tokens, reasoning tokens included. |
| usage.output_tokens_details | object | Breakdown of the output tokens. |
| usage.total_tokens | integer | Input plus output tokens. |
| usage.cost | number | null | Cost of the completion |
| usage.cost_details | object | Breakdown of the upstream inference cost. |
| usage.is_byok | boolean | Whether a request was made using a Bring Your Own Key configuration |
| usage.server_tool_use_details | object | null | Usage for server-side tool execution (e.g., web search) |
| user | string | null | End-user identifier the request supplied; null when none was set. |
| error_type | string | Canonical OpenRouter error type, stable across all API formats |
| openrouter_metadata | object | Routing report: what was requested, how the router chose, and what was attempted. |
| openrouter_metadata.attempt | integer | Number of the attempt that served the request, starting at 1. |
| openrouter_metadata.attempts | array<object> | Every attempt that was made, in order. |
| openrouter_metadata.endpoints | object | Which endpoints were available and which one was chosen. |
| openrouter_metadata.generation_time | integer | Milliseconds measured for the generation, from dispatching the upstream request until its response body ended. Divide the completion token count by this for throughput. Absent when no upstream request was dispatched. |
| openrouter_metadata.is_byok | boolean | Whether the request used a key supplied by the caller. |
| openrouter_metadata.params | object | Router parameters that applied to the request. |
| openrouter_metadata.pipeline | array<object> | Stages the request went through before and after the model call. |
| openrouter_metadata.region | string | null | Region that served the request; null when unknown. |
| openrouter_metadata.requested | string | The model or alias the request asked for. |
| openrouter_metadata.strategy | string | How the router picked the model or provider for this request. |
| openrouter_metadata.summary | string | One-line summary of the routing decision. |
text/event-stream — chunk / 事件对象
| 名称 | 类型 | 说明 |
|---|---|---|
| data | object | Union of all possible event types emitted during response streaming |
| data.response | object | Complete non-streaming response from the Responses API |
| data.sequence_number | integer | Position of this event in the stream. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream. |
| data.type | string | Always `response.created`. Discriminator that marks this object as a CreatedEvent in a `type`-tagged union. / Always `response.in_progress`. Discriminator that marks this object as a InProgressEvent in a `type`-tagged union. / Always `response.completed`. Discriminator that marks this object as a CompletedEvent in a `type`-tagged union. / Always `response.incomplete`. Discriminator that marks this object as a IncompleteEvent in a `type`-tagged union. / Always `response.failed`. Discriminator that marks this object as a FailedEvent in a `type`-tagged union. / Always `error`. Discriminator that marks this object as a BaseErrorEvent in a `type`-tagged union. / Always `response.output_item.added`. Discriminator that marks this object as a OutputItemAddedEvent in a `type`-tagged union. / Always `response.output_item.done`. Discriminator that marks this object as a OutputItemDoneEvent in a `type`-tagged union. / Always `response.content_part.added`. Discriminator that marks this object as a BaseContentPartAddedEvent in a `type`-tagged union. / Always `response.content_part.done`. Discriminator that marks this object as a BaseContentPartDoneEvent in a `type`-tagged union. / Always `response.output_text.delta`. Discriminator that marks this object as a BaseTextDeltaEvent in a `type`-tagged union. / Always `response.output_text.done`. Discriminator that marks this object as a BaseTextDoneEvent in a `type`-tagged union. / Always `response.refusal.delta`. Discriminator that marks this object as a BaseRefusalDeltaEvent in a `type`-tagged union. / Always `response.refusal.done`. Discriminator that marks this object as a BaseRefusalDoneEvent in a `type`-tagged union. / Always `response.output_text.annotation.added`. Discriminator that marks this object as a BaseAnnotationAddedEvent in a `type`-tagged union. / Always `response.function_call_arguments.delta`. Discriminator that marks this object as a BaseFunctionCallArgsDeltaEvent in a `type`-tagged union. / Always `response.function_call_arguments.done`. Discriminator that marks this object as a BaseFunctionCallArgsDoneEvent in a `type`-tagged union. / Always `response.reasoning_text.delta`. Discriminator that marks this object as a BaseReasoningDeltaEvent in a `type`-tagged union. / Always `response.reasoning_text.done`. Discriminator that marks this object as a BaseReasoningDoneEvent in a `type`-tagged union. / Always `response.reasoning_summary_part.added`. Discriminator that marks this object as a BaseReasoningSummaryPartAddedEvent in a `type`-tagged union. / Always `response.reasoning_summary_part.done`. Discriminator that marks this object as a BaseReasoningSummaryPartDoneEvent in a `type`-tagged union. / Always `response.reasoning_summary_text.delta`. Discriminator that marks this object as a BaseReasoningSummaryTextDeltaEvent in a `type`-tagged union. / Always `response.reasoning_summary_text.done`. Discriminator that marks this object as a BaseReasoningSummaryTextDoneEvent in a `type`-tagged union. / Always `response.image_generation_call.in_progress`. Discriminator that marks this object as a OpenAIResponsesImageGenCallInProgress in a `type`-tagged union. / Always `response.image_generation_call.generating`. Discriminator that marks this object as a OpenAIResponsesImageGenCallGenerating in a `type`-tagged union. / Always `response.image_generation_call.partial_image`. Discriminator that marks this object as a OpenAIResponsesImageGenCallPartialImage in a `type`-tagged union. / Always `response.image_generation_call.completed`. Discriminator that marks this object as a OpenAIResponsesImageGenCallCompleted in a `type`-tagged union. / Always `response.code_interpreter_call.in_progress`. Discriminator that marks this object as a OpenAIResponsesCodeInterpreterCallInProgress in a `type`-tagged union. / Always `response.code_interpreter_call.interpreting`. Discriminator that marks this object as a OpenAIResponsesCodeInterpreterCallInterpreting in a `type`-tagged union. / Always `response.code_interpreter_call.completed`. Discriminator that marks this object as a OpenAIResponsesCodeInterpreterCallCompleted in a `type`-tagged union. / Always `response.code_interpreter_call_code.delta`. Discriminator that marks this object as a OpenAIResponsesCodeInterpreterCallCodeDelta in a `type`-tagged union. / Always `response.code_interpreter_call_code.done`. Discriminator that marks this object as a OpenAIResponsesCodeInterpreterCallCodeDone in a `type`-tagged union. / Always `response.web_search_call.in_progress`. Discriminator that marks this object as a OpenAIResponsesWebSearchCallInProgress in a `type`-tagged union. / Always `response.web_search_call.searching`. Discriminator that marks this object as a OpenAIResponsesWebSearchCallSearching in a `type`-tagged union. / Always `response.web_search_call.completed`. Discriminator that marks this object as a OpenAIResponsesSearchCompleted in a `type`-tagged union. / Always `response.custom_tool_call_input.delta`. Discriminator that marks this object as a BaseCustomToolCallInputDeltaEvent in a `type`-tagged union. / Always `response.custom_tool_call_input.done`. Discriminator that marks this object as a BaseCustomToolCallInputDoneEvent in a `type`-tagged union. / Always `response.apply_patch_call_operation_diff.delta`. Discriminator that marks this object as a ApplyPatchCallOperationDiffDeltaEvent in a `type`-tagged union. / Always `response.apply_patch_call_operation_diff.done`. Discriminator that marks this object as a ApplyPatchCallOperationDiffDoneEvent in a `type`-tagged union. / Always `response.fusion_call.in_progress`. Discriminator that marks this object as a FusionCallInProgressEvent in a `type`-tagged union. / Always `response.fusion_call.panel.added`. Discriminator that marks this object as a FusionCallPanelAddedEvent in a `type`-tagged union. / Always `response.fusion_call.panel.delta`. Discriminator that marks this object as a FusionCallPanelDeltaEvent in a `type`-tagged union. / Always `response.fusion_call.panel.reasoning.delta`. Discriminator that marks this object as a FusionCallPanelReasoningDeltaEvent in a `type`-tagged union. / Always `response.fusion_call.panel.completed`. Discriminator that marks this object as a FusionCallPanelCompletedEvent in a `type`-tagged union. / Always `response.fusion_call.panel.failed`. Discriminator that marks this object as a FusionCallPanelFailedEvent in a `type`-tagged union. / Always `response.fusion_call.analysis.in_progress`. Discriminator that marks this object as a FusionCallAnalysisInProgressEvent in a `type`-tagged union. / Always `response.fusion_call.analysis.completed`. Discriminator that marks this object as a FusionCallAnalysisCompletedEvent in a `type`-tagged union. / Always `response.fusion_call.completed`. Discriminator that marks this object as a FusionCallCompletedEvent in a `type`-tagged union. / Always `response.debug`. Discriminator that marks this object as a DebugEvent in a `type`-tagged union. |
| data.code | string | null | string | Error code; null when the upstream gave none. / The complete code the interpreter runs. |
| data.message | string | Human-readable error message. |
| data.param | string | null | Name of the request parameter the error is about; null when it is not about a parameter. |
| data.item | object | An output item from the response |
| data.output_index | integer | Index of the item in the response output array that this event belongs to. |
| data.content_index | integer | Index of the content part inside the output item that this event belongs to. |
| data.item_id | string | Id of the output item this event belongs to; it equals the id of that item in the response output. |
| data.part | object | The content part as it starts: output text or refusal. / The content part in its final form: output text or refusal. / A reasoning summary part. / A reasoning summary part. |
| data.delta | string | Text fragment to append to the output text of this content part. / Refusal text fragment to append. / Fragment of the JSON-encoded function arguments to append. / Reasoning text fragment to append. / Reasoning summary text fragment to append. / Fragment of the code the interpreter will run, to append. / Fragment of the custom tool call input to append. / Fragment of the patch diff to append. / Text fragment the panel model produced. / Reasoning text fragment the panel model produced. |
| data.logprobs | array<object> | Log probabilities of the tokens in this fragment, when requested. / Log probabilities of the tokens in the complete text, when requested. |
| data.text | string | The complete output text of this content part. / The complete reasoning text of this content part. / The complete reasoning summary text of this part. |
| data.refusal | string | The complete refusal text. |
| data.annotation | object | Annotation attached to output text: a file citation, URL citation or file path. |
| data.annotation_index | integer | Index of the new annotation inside the content part's annotations array. |
| data.arguments | string | The complete JSON-encoded arguments of the function call. |
| data.name | string | Name of the function being called. |
| data.summary_index | integer | Index of the reasoning summary part inside the reasoning item that this event belongs to. |
| data.partial_image_b64 | string | Base64-encoded partial image produced while generation is still running. |
| data.partial_image_index | integer | Zero-based index of this partial image among the partial images of the call. |
| data.input | string | The complete input of the custom tool call. |
| data.diff | string | The complete patch diff. |
| data.model | string | Slug of the panel model that started. / Slug of the panel model that produced the fragment. / Slug of the panel model that produced the fragment. / Slug of the panel model that finished. / Slug of the panel model that failed. |
| data.content | string | The complete answer of the panel model. |
| data.error | string | Error message that explains why the panel model failed. |
| data.status_code | integer | HTTP status code of the failed upstream call, when one is available. |
| data.analyst_model | string | Slug of the model producing the structured analysis. |
| data.judge_model | string | Deprecated alias of `analyst_model`, kept so existing consumers keep working. Always carries the same value. Use `analyst_model`. |
| data.analysis | object | Structured analysis produced by the fusion analyst model. |
| data.debug | object | Debug information. |
先调用「生成响应」,用返回的 ID 替换 resp_123。
/openai/v1/responses/{response_id}● 支持response_idstring必填path:
200 response
按 ID 读取一条已保存的响应。如果创建时 store 为 false,我们不会保存这次响应,读取会返回 404 response_not_found;超过保留期(默认 30 天)后读取也会返回同样的 404。
错误按 OpenAI 格式返回,参见 错误码
Native Responses API response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | object |
先调用「生成响应」,用返回的 ID 替换 resp_123。
/openai/v1/responses/{response_id}/cancel◐ 部分支持response_idstring必填path:
200 response
仅对以 background:true 创建、且路由到具备后台生成能力的模型的响应可用:取消是 幂等的,重复调用返回同一个终态响应;我方的取消只能停止我方对上游流的继续读取, 不能保证已发往上游的算力停止计算,用量按实际收到的部分结算。对一个非后台 (同步)响应调用 cancel:如果这个响应 id 不存在(未持久化、已过期或 id 有误), 返回 404 object_not_found;如果响应存在但其来源 provider 没有声明支持 cancel 操作(我们目前没有接入任何为同步响应声明该能力的上游),返回 400 native_responses_operation_unsupported。这两种情况都不是尚未实现的 501 gate。
错误按 OpenAI 格式返回,参见 错误码
Native Responses API cancel response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | object |
先调用「生成响应」,用返回的 ID 替换 resp_123。
/openai/v1/responses/{response_id}/input_items● 支持response_idstring必填path:
200 list
列出一条已保存响应的输入项。支持 limit(1–100,默认 20)、order(asc/desc, 默认 desc,与官方一致)与基于条目 id 的 after 游标分页;has_more/first_id/ last_id 均与实际返回页一致,可据此翻页且不重不漏。每个条目都带服务端签发的 id(message 为 msg_ 前缀,function_call/function_call_output/reasoning 各自 对应前缀),本次上线前已保存、尚无服务端 id 的旧数据在读取时按确定性规则补 id,不做破坏性迁移,同一游标反复读取保持稳定。以 previous_response_id 续接 创建的响应,其输入项列出解析后的完整输入:前序响应链已有的输入与输出条目 再加本轮自己提交的输入;若该祖先响应在我方平台未保存(例如创建时 store 为 false)或已过期删除,则只列出本轮自己提交的输入。如果创建时 store 为 false,我们不会保存这次响应,列出会返回 404 response_not_found。
错误按 OpenAI 格式返回,参见 错误码
Native Responses API input item list
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | object |
/openai/v1/responses/compact○ 未支持501 平台还没有实现这个端点;调用会得到下面这个响应:
把响应的输入压缩成摘要,依赖 OpenAI Responses 官方的服务端存储(store)语义,我们目前还没有实现;调用会返回 501(message 为 “This platform has not implemented … yet.”,响应头 x-should-retry 为 false),不产生副作用,官方 SDK 不会重试。
错误按 OpenAI 格式返回,参见 错误码
Native Responses API compact response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | object |
/openai/v1/responses/input_tokens○ 未支持501 平台还没有实现这个端点;调用会得到下面这个响应:
只统计请求输入会消耗的 token 数、不生成内容,依赖 OpenAI Responses 官方的服务端存储(store)语义,我们目前还没有实现;调用会返回 501(message 为 “This platform has not implemented … yet.”,响应头 x-should-retry 为 false),不产生副作用,官方 SDK 不会重试。
错误按 OpenAI 格式返回,参见 错误码
Native Responses API input token count
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | object |
/openai/v1/conversations● 支持itemsarray可选已验证生效。
metadataobject可选已验证生效。
200 conversation
创建一个会话,可选携带初始 items(一次最多 20 条)与 metadata。会话按租户分区,创建者是唯一能引用它的租户。
错误按 OpenAI 格式返回,参见 错误码
The created conversation
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Id of the conversation, such as `conv_...`; use it as `conversation_id` in conversation calls and as `conversation` in createResponse. |
| object | string | Object type; always `conversation`. |
| created_at | integer | Unix time in seconds at which the conversation was created. |
| metadata | object | Up to 16 string key/value pairs; keys at most 64 characters and values at most 512. |
先调用「创建对话」拿到 conv_ 开头的 ID,替换 conv_123。
/openai/v1/conversations/{conversation_id}● 支持conversation_idstring必填path:
200 conversation
按 ID 读取一个会话。不存在或属于其他租户都返回 404 conversation_not_found。
错误按 OpenAI 格式返回,参见 错误码
The conversation
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Id of the conversation, such as `conv_...`; use it as `conversation_id` in conversation calls and as `conversation` in createResponse. |
| object | string | Object type; always `conversation`. |
| created_at | integer | Unix time in seconds at which the conversation was created. |
| metadata | object | Up to 16 string key/value pairs; keys at most 64 characters and values at most 512. |
先调用「创建对话」拿到 conv_ 开头的 ID,替换 conv_123。
/openai/v1/conversations/{conversation_id}● 支持conversation_idstring必填path:
metadataobject必填已验证生效。
200 conversation
更新一个会话的 metadata——整体替换,不与已有 metadata 合并。
错误按 OpenAI 格式返回,参见 错误码
The updated conversation
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Id of the conversation, such as `conv_...`; use it as `conversation_id` in conversation calls and as `conversation` in createResponse. |
| object | string | Object type; always `conversation`. |
| created_at | integer | Unix time in seconds at which the conversation was created. |
| metadata | object | Up to 16 string key/value pairs; keys at most 64 characters and values at most 512. |
先调用「创建对话」拿到 conv_ 开头的 ID,替换 conv_123。
/openai/v1/conversations/{conversation_id}● 支持conversation_idstring必填path:
200 conversation.deleted
删除一个会话。删除后该会话与其 items 都不能再被引用(包括作为 Responses create 的 conversation 参数)。
错误按 OpenAI 格式返回,参见 错误码
Deletion confirmation
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| object | string | |
| deleted | boolean |
先调用「创建对话」拿到 conv_ 开头的 ID,替换 conv_123。
/openai/v1/conversations/{conversation_id}/items● 支持conversation_idstring必填path:
itemsarray必填已验证生效。
200 list
向一个会话追加 items(一次最多 20 条),返回刚追加的这些 items。
错误按 OpenAI 格式返回,参见 错误码
The items just added
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| object | string | Object type; always `list`. |
| data | array<object> | Items of the conversation, in the order the list requested. |
| first_id | string | Id of the first item of this page; null for an empty page. |
| last_id | string | Id of the last item of this page; null for an empty page. |
| has_more | boolean | Whether more items exist beyond this page; pass `last_id` as `after` to read them. |
先调用「创建对话」拿到 conv_ 开头的 ID,替换 conv_123。
/openai/v1/conversations/{conversation_id}/items● 支持conversation_idstring必填path:
limitinteger可选query: Maximum items per page (values above 100 are clamped).
afterstring可选query: Item ID from the previous page; returns items after this cursor.
orderstring可选query: Sort by stored creation order.
200 list
按创建顺序列出会话的 items,支持 limit/after/order 分页参数。
错误按 OpenAI 格式返回,参见 错误码
The conversation's items
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| object | string | Object type; always `list`. |
| data | array<object> | Items of the conversation, in the order the list requested. |
| first_id | string | Id of the first item of this page; null for an empty page. |
| last_id | string | Id of the last item of this page; null for an empty page. |
| has_more | boolean | Whether more items exist beyond this page; pass `last_id` as `after` to read them. |
先调用「创建对话」拿到 conv_ 开头的 ID,替换 conv_123。 条目 ID 取自「添加对话条目」或「列出对话条目」,替换 item_123。
/openai/v1/conversations/{conversation_id}/items/{item_id}● 支持conversation_idstring必填path:
item_idstring必填path:
200 conversation
删除会话里的单条 item,返回该会话对象(不是被删除的 item)。
错误按 OpenAI 格式返回,参见 错误码
The conversation, with the item removed
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Id of the conversation, such as `conv_...`; use it as `conversation_id` in conversation calls and as `conversation` in createResponse. |
| object | string | Object type; always `conversation`. |
| created_at | integer | Unix time in seconds at which the conversation was created. |
| metadata | object | Up to 16 string key/value pairs; keys at most 64 characters and values at most 512. |
/openai/v1/images/generations● 支持modelstring必填已验证生效。
response_formatstring可选○ 未支持Omit for GPT Image models, which return native base64 data. Only send for models that explicitly support response_format; platform hosting is a separate Image extension.
gpt-image-2 传 b64_json 或 url 均返回 400;请省略此字段。
promptstring必填已验证生效。
ninteger可选控制图片数量,0 返回 400,允许 1–10。
sizestring可选◐ 部分支持gpt-image-2 已验证 1024x1024、1024x1536;512x512 返回 400。
qualitystring可选已验证生效。
backgroundstring可选gpt-image-2 的 transparent 返回透明 PNG。
output_formatstring可选gpt-image-2 的 jpeg 返回 JPEG。
200
错误按 OpenAI 格式返回,参见 错误码
Image generation response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| created | integer | |
| data | array<object> | |
| data[].url | string | |
| data[].b64_json | string | |
| data[].revised_prompt | string |
/openai/v1/models● 支持offsetinteger可选query: Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned
已验证生效。
limitinteger可选query: Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned
已验证生效。
categorystring可选○ 当前不生效query: Filter models by use case category
接受但当前不生效。当前不会按此条件过滤或排序模型。
supported_parametersstring可选○ 当前不生效query: Filter models by supported parameter (comma-separated)
接受但当前不生效。当前不会按此条件过滤或排序模型。
output_modalitiesstring可选query: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or "all" to include all models. When omitted, all models are included; comma-separated modalities match any output.
已验证生效。
sortstring可选query: Sort by newest creation date or lowest declared USD unit rate (not estimated request cost). Unpriced models sort last; ties retain catalog order.
已验证生效。
qstring可选query: Free-text search by model name or slug.
已验证生效。
input_modalitiesstring可选○ 当前不生效query: Filter models by input modality. Comma-separated list of: text, image, audio, file.
接受但当前不生效。当前不会按此条件过滤或排序模型。
contextinteger可选○ 当前不生效query: Minimum context length (tokens). Models with smaller context are excluded.
接受但当前不生效。当前不会按此条件过滤或排序模型。
min_pricenumber可选○ 当前不生效query: Minimum prompt price in $/M tokens.
接受但当前不生效。当前不会按此条件过滤或排序模型。
max_pricenumber可选○ 当前不生效query: Maximum prompt price in $/M tokens.
接受但当前不生效。当前不会按此条件过滤或排序模型。
archstring可选○ 当前不生效query: Filter models by architecture/model family (e.g. GPT, Claude, Gemini, Llama).
接受但当前不生效。当前不会按此条件过滤或排序模型。
model_authorsstring可选○ 当前不生效query: Filter models by the organization that created the model. Comma-separated list of author slugs.
接受但当前不生效。当前不会按此条件过滤或排序模型。
providersstring可选○ 当前不生效query: Filter models by hosting provider. Comma-separated list of provider names.
接受但当前不生效。当前不会按此条件过滤或排序模型。
distillablestring可选○ 当前不生效query: Filter by distillation capability. "true" returns only distillable models, "false" excludes them.
接受但当前不生效。当前不会按此条件过滤或排序模型。
zdrstring可选○ 当前不生效query: When set to "true", return only models with zero data retention endpoints.
接受但当前不生效。当前不会按此条件过滤或排序模型。
regionstring可选○ 当前不生效query: Filter to models with endpoints in the given data region ("eu" or "us").
接受但当前不生效。当前不会按此条件过滤或排序模型。
min_output_pricenumber可选○ 当前不生效query: Minimum completion (output) price in $/M tokens.
接受但当前不生效。当前不会按此条件过滤或排序模型。
max_output_pricenumber可选○ 当前不生效query: Maximum completion (output) price in $/M tokens.
接受但当前不生效。当前不会按此条件过滤或排序模型。
min_age_daysinteger可选○ 当前不生效query: Minimum model age in days since its creation date.
接受但当前不生效。当前不会按此条件过滤或排序模型。
max_age_daysinteger可选○ 当前不生效query: Maximum model age in days since its creation date.
接受但当前不生效。当前不会按此条件过滤或排序模型。
min_intelligence_indexnumber可选○ 当前不生效query: Minimum Artificial Analysis intelligence index.
接受但当前不生效。当前不会按此条件过滤或排序模型。
max_intelligence_indexnumber可选○ 当前不生效query: Maximum Artificial Analysis intelligence index.
接受但当前不生效。当前不会按此条件过滤或排序模型。
min_coding_indexnumber可选○ 当前不生效query: Minimum Artificial Analysis coding index.
接受但当前不生效。当前不会按此条件过滤或排序模型。
max_coding_indexnumber可选○ 当前不生效query: Maximum Artificial Analysis coding index.
接受但当前不生效。当前不会按此条件过滤或排序模型。
min_agentic_indexnumber可选○ 当前不生效query: Minimum Artificial Analysis agentic index.
接受但当前不生效。当前不会按此条件过滤或排序模型。
max_agentic_indexnumber可选○ 当前不生效query: Maximum Artificial Analysis agentic index.
接受但当前不生效。当前不会按此条件过滤或排序模型。
min_tool_success_ratenumber可选○ 当前不生效query: Minimum tool-calling success rate, as a fraction in [0, 1] (e.g. 0.9 = 90% of requests finishing with a tool_calls finish reason).
接受但当前不生效。当前不会按此条件过滤或排序模型。
max_tool_success_ratenumber可选○ 当前不生效query: Maximum tool-calling success rate, as a fraction in [0, 1].
接受但当前不生效。当前不会按此条件过滤或排序模型。
apiarray可选query: Match any comma-separated API family: chat selects openai.chat.completions; responses selects openai.responses; embeddings selects openai.embeddings; images selects openai.images.*; audio selects openai.audio.*; videos selects openai.videos. Omitted or empty includes all OpenAI-offered models. Other filters combine using AND, before pagination. Invalid values return 400 with all legal values.
按声明的 OpenAI 协议筛选,逗号分隔匹配任一协议族,在分页前生效。
200 list
错误按 OpenAI 格式返回,参见 错误码
Returns a list of models or RSS feed
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | List of available models |
| data[].alias_target | object | Concrete model targeted by this tilde-latest alias, when applicable |
| data[].architecture | object | Model architecture information |
| data[].benchmarks | object | Third-party benchmark rankings for this model. Omitted when no benchmark data is available. |
| data[].canonical_slug | string | Canonical slug for the model |
| data[].context_length | integer | null | Maximum context length in tokens |
| data[].created | integer | Unix timestamp of when the model was created |
| data[].default_parameters | object | null | Default parameters for this model |
| data[].description | string | Description of the model |
| data[].expiration_date | string | null | The date after which the model may be removed. ISO 8601 date string (YYYY-MM-DD) or null if no expiration. |
| data[].hugging_face_id | string | null | Hugging Face model identifier, if applicable |
| data[].id | string | Unique identifier for the model |
| data[].knowledge_cutoff | string | null | The date up to which the model was trained on data. ISO 8601 date string (YYYY-MM-DD) or null if unknown. |
| data[].links | object | Related API endpoints and resources for this model. |
| data[].name | string | Display name of the model |
| data[].per_request_limits | object | null | Per-request token limits |
| data[].pricing | object | Pricing information for the model |
| data[].reasoning | object | Reasoning effort configuration. Omitted for non-reasoning models and dynamic router models. |
| data[].supported_parameters | array<string> | List of supported parameters for this model |
| data[].supported_voices | array | null | List of supported voice identifiers for TTS models. Null for non-TTS models. |
| data[].top_provider | object | Information about the top provider for this model |
| links | object | Pagination links |
| links.next | string | null | URL for the next page of results, or null if this is the last page |
| total_count | integer | Total number of models matching the query |
/openai/v1/models/{model}● 支持modelstring必填path: Model ID from GET /openai/v1/models, including any publisher prefix.
200 model
返回与列表中同一条目相同的模型对象。只有声明了 OpenAI 协议的模型可见;模型 ID 可以带斜杠分隔的发布方前缀。不存在或没有声明 OpenAI 协议的模型返回 404。
错误按 OpenAI 格式返回,参见 错误码
The matching OpenRouter model list entry.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| alias_target | object | Concrete model targeted by this tilde-latest alias, when applicable |
| alias_target.name | string | Human-readable name of the concrete model targeted by this alias |
| alias_target.slug | string | Routable model ID of the concrete target, matching that model row's id |
| architecture | object | Model architecture information |
| architecture.input_modalities | array<string> | Supported input modalities |
| architecture.instruct_type | string | null | Instruction format type |
| architecture.modality | string | null | Primary modality of the model |
| architecture.output_modalities | array<string> | Supported output modalities |
| architecture.tokenizer | string | Tokenizer type used by the model |
| benchmarks | object | Third-party benchmark rankings for this model. Omitted when no benchmark data is available. |
| benchmarks.artificial_analysis | object | Artificial Analysis benchmark index scores. |
| benchmarks.design_arena | array<object> | Design Arena ELO rankings across arena+category pairs. |
| canonical_slug | string | Canonical slug for the model |
| context_length | integer | null | Maximum context length in tokens |
| created | integer | Unix timestamp of when the model was created |
| default_parameters | object | null | Default parameters for this model |
| default_parameters.frequency_penalty | number | null | |
| default_parameters.presence_penalty | number | null | |
| default_parameters.repetition_penalty | number | null | |
| default_parameters.temperature | number | null | |
| default_parameters.top_k | integer | null | |
| default_parameters.top_p | number | null | |
| description | string | Description of the model |
| expiration_date | string | null | The date after which the model may be removed. ISO 8601 date string (YYYY-MM-DD) or null if no expiration. |
| hugging_face_id | string | null | Hugging Face model identifier, if applicable |
| id | string | Unique identifier for the model |
| knowledge_cutoff | string | null | The date up to which the model was trained on data. ISO 8601 date string (YYYY-MM-DD) or null if unknown. |
| links | object | Related API endpoints and resources for this model. |
| links.details | string | URL for the model details/endpoints API |
| name | string | Display name of the model |
| per_request_limits | object | null | Per-request token limits |
| per_request_limits.completion_tokens | number | Maximum completion tokens per request |
| per_request_limits.prompt_tokens | number | Maximum prompt tokens per request |
| pricing | object | Pricing information for the model |
| pricing.audio | string | Price in USD per audio input token |
| pricing.audio_output | string | Price in USD per audio output token |
| pricing.completion | string | Price in USD per token for completion (output) generation |
| pricing.discount | number | Fractional discount applied to this endpoint's pricing; the price is multiplied by (1 - discount) (0 = no discount, 1 = free) |
| pricing.image | string | Price in USD per image; present only for a flat registry price |
| pricing.image_output | string | Price in USD per output image |
| pricing.image_token | string | Price in USD per image token |
| pricing.input_audio_cache | string | Price in USD per cached audio input token |
| pricing.input_cache_read | string | Price in USD per cached input token (read) |
| pricing.input_cache_write | string | Price per cache-write token, in USD per token. For providers with multiple cache TTLs (e.g. Anthropic), this is the default (5-minute) cache-write rate. |
| pricing.input_cache_write_1h | string | Price per 1-hour cache-write token, in USD per token. Only present for providers that price an extended (1-hour) cache TTL separately, such as Anthropic. |
| pricing.internal_reasoning | string | Price in USD per internal reasoning token |
| pricing.overrides | array<object> | Conditional overrides of the base pricing (e.g. long-context or time-based pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions. |
| pricing.prompt | string | Price in USD per token for prompt (input) processing |
| pricing.request | string | Price in USD per request |
| pricing.web_search | string | Price in USD per web search |
| pricing.video_second | string | Praxis extension: USD per second of output video. |
| pricing.audio_input_minute | string | Praxis extension: USD per minute of input audio. |
| pricing.audio_output_minute | string | Praxis extension: USD per minute of output audio. |
| pricing.input_character | string | Praxis extension: USD per input character. |
| pricing.page | string | Praxis extension: USD per OCR page. |
| reasoning | object | Reasoning effort configuration. Omitted for non-reasoning models and dynamic router models. |
| reasoning.default_effort | string | null | Default reasoning effort when the client enables reasoning without specifying effort. Maps to `reasoning.effort` in chat requests. When `"none"`, prefer omitting effort unless the user explicitly disables reasoning. |
| reasoning.default_enabled | boolean | Default reasoning enabled state when the client does not set `reasoning.enabled`. |
| reasoning.mandatory | boolean | When true, reasoning cannot be disabled and effort "none" is rejected. |
| reasoning.supported_efforts | array | null | Allowed reasoning effort values for this model, in descending effort order (highest first). Null means no allowlist — all gateway effort values are accepted. |
| reasoning.supports_max_tokens | boolean | Present and `true` when the model accepts `reasoning.max_tokens` in requests (Anthropic-style) instead of or in addition to `reasoning.effort`. Omitted otherwise. |
| supported_parameters | array<string> | List of supported parameters for this model |
| supported_voices | array | null | List of supported voice identifiers for TTS models. Null for non-TTS models. |
| top_provider | object | Information about the top provider for this model |
| top_provider.context_length | integer | null | Context length from the top provider |
| top_provider.is_moderated | boolean | Whether the top provider moderates content |
| top_provider.max_completion_tokens | integer | null | Maximum completion tokens from the top provider. Input and output tokens share the context window, so the effective maximum output for a request is further limited by the context remaining after input tokens. |
/openai/v1/embeddings● 支持modelstring必填The model to use for embeddings
已验证生效。
dimensionsinteger可选◐ 部分支持The number of dimensions for the output embeddings
仅 text-embedding-3-small、qwen3-vl-embedding 支持已测的 256 维;text-embedding-3-small 也支持 512,100 返回 400。bge-m3、qwen3-embedding-0.6b、doubao-embedding-vision 的 256 维返回 400。
encoding_formatstring可选The format of the output embeddings
float 与 base64 均支持;base64 为向量的二进制编码。
inputstring | array必填◐ 部分支持Text, token, or multimodal input(s) to embed
文本及文本数组生效;token 整数数组返回 400。图片仅 qwen3-vl-embedding、doubao-embedding-vision 支持;text-embedding-3-small 的 16 条批量返回 400。
input_typestring可选◐ 部分支持The type of input (e.g. search_query, search_document)
query/document 在 bge-m3、qwen3-embedding-0.6b 生效;search_query 返回 400;text-embedding-3-small 接受但当前不生效。
providerobject可选◐ 部分支持Provider routing preferences for the request.
bge-m3、qwen3-embedding-0.6b 返回 400;text-embedding-3-small 接受,但效果不可观测。
allow_fallbacksboolean可选Whether to allow backup providers to serve requests - true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider. - false: use only the primary/custom provider, and return the upstream error if it's unavailable.
data_collectionstring可选Data collection setting. If no available model provider meets the requirement, your request will return an error. - allow: (default) allow providers which store user data non-transiently and may train on it - deny: use only providers which do not collect user data.
enforce_distillable_textboolean可选Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used.
ignorearray可选List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.
max_priceobject可选The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
onlyarray可选List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.
orderarray可选An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.
preferred_max_latencynumber | object可选Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
preferred_min_throughputnumber | object可选Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
quantizationsarray可选A list of quantization levels to filter the provider by.
require_parametersboolean可选Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.
sortstring | object可选The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
zdrboolean可选Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.
session_idstring可选◐ 部分支持A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters.
bge-m3、qwen3-embedding-0.6b 返回 400;text-embedding-3-small 接受,但效果不可观测。
traceobject可选◐ 部分支持Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
bge-m3、qwen3-embedding-0.6b 返回 400;text-embedding-3-small 接受,但效果不可观测。
generation_namestring可选Name of this generation in the trace.
parent_span_idstring可选Id of the parent span in the trace.
span_namestring可选Name of this request's span in the trace.
trace_idstring可选Id that groups several requests into one trace.
trace_namestring可选Name of the trace.
userstring可选◐ 部分支持A unique identifier for the end-user
bge-m3、qwen3-embedding-0.6b 返回 400;text-embedding-3-small 接受,但效果不可观测。
200 list
转发方式与对话(chat completions)一致,用量算在同一份计费里。 未知顶层字段原样转发给同协议上游,由上游决定是否接受;已声明字段的类型与取值范围仍会校验,不合法时返回 400 并点名字段。
错误按 OpenAI 格式返回,参见 错误码
Embedding response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | List of embedding objects |
| data[].embedding | array<number> | string | Embedding vector as an array of floats or a base64 string |
| data[].index | integer | Index of the embedding in the input list |
| data[].object | string | |
| id | string | Unique identifier for the embeddings response |
| model | string | The model used for embeddings |
| object | string | |
| usage | object | Token usage statistics |
| usage.cost | number | Cost of the request in credits |
| usage.cost_details | object | null | Breakdown of upstream inference costs |
| usage.is_byok | boolean | Whether a request was made using a Bring Your Own Key configuration |
| usage.prompt_tokens | integer | Number of tokens in the input |
| usage.prompt_tokens_details | object | Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included. |
| usage.total_tokens | integer | Total number of tokens used |
text/event-stream — chunk / 事件对象
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | string | Not used for embeddings - embeddings do not support streaming |
/openai/v1/videos● 支持modelstring可选◐ 部分支持Video model id, for example `wan2.7-t2v`; list candidates with listModels?type=video. Router support (partial): Select a registered video model explicitly, for example wan2.7-t2v (size=1280x720, seconds=4). Capability preflight errors are reported before creation.
请显式选择已注册的视频模型,例如 wan2.7-t2v(size=1280x720,seconds=4)。能力预检失败会在创建前报错。
promptstring必填Text description of the video, at least 1 character. Router support (supported): Controls video content; missing or empty values return 400.
控制视频内容;缺失或空值返回 400。
secondsstring | integer可选同时提供时优先于 duration。
已验证 wan2.7-t2v 的时长生效;不合法或超出模型能力的值在预检阶段返回 400。
durationinteger可选Length of the video in whole seconds. `seconds` takes precedence when both are given.
sizestring可选◐ 部分支持Output resolution as `WIDTHxHEIGHT`, for example `1280x720`. Router support (partial): Subject to model capability preflight. Earlier wan2.7-t2v samples always produced 1280x720; accepted sizes are not guaranteed pixel-for-pixel.
受模型能力预检限制;早期 wan2.7-t2v 样本始终输出 1280x720,不保证所有接受的尺寸都会按像素兑现。
input_referencestring | object可选Reference image for image-to-video: a URL or base64 data URL, an object with `image_url`, or an uploaded image file (multipart, at most 20 MiB).
image_urlstring | object必填URL or base64 data URL of the reference image, as a string or an object with `url`.
input_referencesarray可选Several reference images; each entry is a URL or base64 data URL, or an object with `image_url`.
image_urlstring | object可选URL or base64 data URL of the reference image, as a string or an object with `url`.
frame_imagesarray可选Images that pin the first and last frame; at most 2 entries.
typeany可选Always `image_url`. Discriminator of the `type`-tagged union this object belongs to.
frame_typeany必填Frame to constrain with the supplied image: first_frame or last_frame. Each frame type may occur at most once.
image_urlobject必填The image to pin.
resolutionstring可选Output resolution label such as `720p`, for models that take a label instead of `size`.
aspect_ratiostring可选Aspect ratio of the video such as `16:9`.
generate_audioboolean可选Whether the video carries a generated audio track. Router support (supported): false produces no audio track on wan2.7-t2v; the default output includes audio.
wan2.7-t2v 的 false 输出无音轨,默认输出含音轨。
seedinteger可选Seed for reproducible generation, on models that support it.
callback_urlstring可选HTTP or HTTPS callback URL, forwarded to models that support completion callbacks.
qualitystring可选Provider-specific quality setting.
200 video
异步生成视频:创建任务后轮询状态,完成后下载内容。按输出秒数计费,每秒价格见 GET /model/v1/models 的 pricing.video_second(USD/秒)。请显式选择已注册的视频模型,例如 wan2.7-t2v。
错误按 OpenAI 格式返回,参见 错误码
Success
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Id of the video job; pass it as `video_id` to retrieve, download or delete it. |
| object | string | Object type; always `video`. |
| model | string | Model that generates the video. |
| status | string | Lifecycle of the job. Poll until it is `completed` or `failed`. |
| progress | integer | Progress from 0 to 100. It is 0 until the job completes and 100 once it has. |
| created_at | integer | Unix time in seconds at which the job was created. |
| completed_at | integer | null | Unix time in seconds at which the job completed; null until then. |
| expires_at | integer | null | Unix time in seconds after which the output expires; null because outputs currently have no expiry. |
| seconds | string | Length of the video in seconds, as a string; for a completed job it is the delivered length. |
| size | string | Resolution of the video as `WIDTHxHEIGHT`; null when the provider did not report one. |
| prompt | string | null | Prompt the job was created with. |
| remixed_from_video_id | null | Always null; remix is not supported. |
| error | object | null | Why the job failed; null unless status is `failed`. |
| error.code | string | Machine-readable failure code. |
| error.message | string | Human-readable failure message. |
| polling_url | string | Relative URL to poll for the job state; same as retrieveVideo for this job. |
| unsigned_urls | array<string> | Relative URLs of the finished output; empty until the video is ready. Download them with the same API key. |
| usage | object | Cost of the job; present once a price applies. |
| usage.cost | number | Cost of the job in USD: delivered seconds times the per-second price once completed, 0 while running. |
/openai/v1/videos● 支持afterstring可选query: Cursor: the id of the video job after which the page starts, normally the `last_id` of the previous page. It must refer to an existing job of yours, otherwise the call fails.
分页参数生效;limit 为 1–100,order 为 asc/desc,after 必须引用存在的任务。
limitinteger可选query: Maximum number of jobs per page, from 1 to 100; defaults to 20.
分页参数生效;limit 为 1–100,order 为 asc/desc,after 必须引用存在的任务。
orderany可选query: Sort order by creation time: desc (default) lists the newest job first, asc the oldest first.
分页参数生效;limit 为 1–100,order 为 asc/desc,after 必须引用存在的任务。
200 list
列出本账号的视频任务。limit 为 1 到 100,order 为 asc 或 desc,after 必须引用存在的任务。
错误按 OpenAI 格式返回,参见 错误码
Success
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| object | string | Object type; always `list`. |
| data | array<object> | Video jobs of the caller, newest first by default. |
| data[].id | string | Id of the video job; pass it as `video_id` to retrieve, download or delete it. |
| data[].object | string | Object type; always `video`. |
| data[].model | string | Model that generates the video. |
| data[].status | string | Lifecycle of the job. Poll until it is `completed` or `failed`. |
| data[].progress | integer | Progress from 0 to 100. It is 0 until the job completes and 100 once it has. |
| data[].created_at | integer | Unix time in seconds at which the job was created. |
| data[].completed_at | integer | null | Unix time in seconds at which the job completed; null until then. |
| data[].expires_at | integer | null | Unix time in seconds after which the output expires; null because outputs currently have no expiry. |
| data[].seconds | string | Length of the video in seconds, as a string; for a completed job it is the delivered length. |
| data[].size | string | Resolution of the video as `WIDTHxHEIGHT`; null when the provider did not report one. |
| data[].prompt | string | null | Prompt the job was created with. |
| data[].remixed_from_video_id | null | Always null; remix is not supported. |
| data[].error | object | null | Why the job failed; null unless status is `failed`. |
| data[].polling_url | string | Relative URL to poll for the job state; same as retrieveVideo for this job. |
| data[].unsigned_urls | array<string> | Relative URLs of the finished output; empty until the video is ready. Download them with the same API key. |
| data[].usage | object | Cost of the job; present once a price applies. |
| has_more | boolean | Whether more jobs exist beyond this page; pass `last_id` as `after` to read them. |
| first_id | string | null | Id of the first job in this page; null for an empty page. |
| last_id | string | null | Id of the last job in this page; null for an empty page. |
先调用「创建视频」,用返回的 ID 替换 video_123;下载前须轮询至 completed。
/openai/v1/videos/{video_id}● 支持video_idstring必填path: Id of the video job whose output you want, the `id` returned by createVideo. The job must be completed; before that the call answers 400.
200 video
读取任务的当前状态和进度。status 为 queued 或 in_progress 时继续轮询,failed 时查看 error,completed 后才能下载内容。任务不存在返回 404。
错误按 OpenAI 格式返回,参见 错误码
Success
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Id of the video job; pass it as `video_id` to retrieve, download or delete it. |
| object | string | Object type; always `video`. |
| model | string | Model that generates the video. |
| status | string | Lifecycle of the job. Poll until it is `completed` or `failed`. |
| progress | integer | Progress from 0 to 100. It is 0 until the job completes and 100 once it has. |
| created_at | integer | Unix time in seconds at which the job was created. |
| completed_at | integer | null | Unix time in seconds at which the job completed; null until then. |
| expires_at | integer | null | Unix time in seconds after which the output expires; null because outputs currently have no expiry. |
| seconds | string | Length of the video in seconds, as a string; for a completed job it is the delivered length. |
| size | string | Resolution of the video as `WIDTHxHEIGHT`; null when the provider did not report one. |
| prompt | string | null | Prompt the job was created with. |
| remixed_from_video_id | null | Always null; remix is not supported. |
| error | object | null | Why the job failed; null unless status is `failed`. |
| error.code | string | Machine-readable failure code. |
| error.message | string | Human-readable failure message. |
| polling_url | string | Relative URL to poll for the job state; same as retrieveVideo for this job. |
| unsigned_urls | array<string> | Relative URLs of the finished output; empty until the video is ready. Download them with the same API key. |
| usage | object | Cost of the job; present once a price applies. |
| usage.cost | number | Cost of the job in USD: delivered seconds times the per-second price once completed, 0 while running. |
先调用「创建视频」,用返回的 ID 替换 video_123;下载前须轮询至 completed。
/openai/v1/videos/{video_id}/content● 支持video_idstring必填path: Id of the video job whose output you want, the `id` returned by createVideo. The job must be completed; before that the call answers 400.
variantany可选◐ 部分支持query: Spritesheet is not available in this release (400).
video、thumbnail 生效;spritesheet 返回 400。
indexinteger可选◐ 部分支持query: Output index; this release produces index 0. variant takes precedence.
视频仅支持 index=0;大于 0 或负数返回 400。variant=thumbnail 时 index 接受但当前不生效。
200
任务 completed 后下载视频文件(video,MP4)或缩略图(thumbnail);spritesheet 返回 400,index 只支持 0。任务不存在返回 404。
错误按 OpenAI 格式返回,参见 错误码
Video or thumbnail bytes
video/mp4
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | string (binary) |
image/jpeg
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | string (binary) |
先调用「创建视频」,用返回的 ID 替换 video_123;下载前须轮询至 completed。
/openai/v1/videos/{video_id}● 支持video_idstring必填path: Id of the video job whose output you want, the `id` returned by createVideo. The job must be completed; before that the call answers 400.
200 video.deleted
删除任务及其生成的内容。任务不存在返回 404。
错误按 OpenAI 格式返回,参见 错误码
Success
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Id of the deleted video job. |
| object | string | Object type; always `video.deleted`. |
| deleted | boolean | Always true; the job is no longer readable. |
先调用「创建视频」,用返回的 ID 替换 video_123;下载前须轮询至 completed。
/openai/v1/videos/{video_id}/remix○ 未支持video_idstring必填path: Id of the video job whose output you want, the `id` returned by createVideo. The job must be completed; before that the call answers 400.
400 混剪尚未支持,请勿重试。
未支持,调用固定返回 400(invalid_request_error,消息为 Video remix is not supported);不要重试。
错误按 OpenAI 格式返回,参见 错误码
此端点没有声明成功响应。
/openai/v1/audio/transcriptions● 支持modelstring必填已验证生效。
temperaturenumber可选○ 未支持whisper-large-v3-turbo、qwen3-asr-flash 均返回 400。
response_formatstring可选◐ 部分支持json/text 均生效;verbose_json 仅 whisper-large-v3-turbo 支持。srt/vtt 均返回 400。
filestring必填已验证生效。
languagestring可选◐ 部分支持两模型接受 ISO 语言码;qwen3-asr-flash 可能按指定语言翻译输出,whisper-large-v3-turbo 用作输入语言提示。非 ISO 名称可能报 502。
promptstring可选◐ 部分支持仅 whisper-large-v3-turbo 的词表提示已验证生效;qwen3-asr-flash 返回 400。
timestamp_granularities[]array可选◐ 部分支持仅 whisper-large-v3-turbo 在 verbose_json 下支持 segment;word 返回 400;qwen3-asr-flash 不支持时间戳。
200
标准请求字段;不能表达的参数返回 input_not_representable。
错误按 OpenAI 格式返回,参见 错误码
Transcription in the requested format.
text/plain
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | string |
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| text | string | |
| task | string | |
| language | string | |
| duration | number | |
| segments | array<object> | |
| segments[].id | integer | |
| segments[].start | number | |
| segments[].end | number | |
| segments[].text | string | |
| segments[].temperature | number | |
| segments[].avg_logprob | number | |
| segments[].compression_ratio | number | |
| segments[].no_speech_prob | number |
/openai/v1/files◐ 部分支持filestring必填The File object (not file name) to be uploaded.
已验证生效。
purposestring必填◐ 部分支持文件用途:user_data、assistants 或 vision(vision 只接受 PNG、JPEG、GIF、WebP 图片)。OpenAI 的 batch、fine-tune、evals 等其余用途不支持,返回 400 PURPOSE_UNSUPPORTED。
支持 user_data、assistants、vision;batch、fine-tune、evals 等其余值返回 400。
expires_afterobject可选The expiration policy for a file. By default, files with `purpose=batch` expire after 30 days and all other files are persisted until they are manually deleted.
anchor=created_at,seconds=3600–2592000。
anchorstring必填Anchor timestamp after which the expiration policy applies. Supported anchors: `created_at`.
secondsinteger必填The number of seconds after the anchor time that the file will expire. Must be between 3600 (1 hour) and 2592000 (30 days).
200 file
单文件最多 100 MB(104857600 字节);按内容识别 PDF、Office、图片、音频、视频与 UTF-8 文本。purpose 支持 user_data / assistants / vision;其他用途、空文件、不支持类型和超限均返回 400。不支持 Uploads 分片。只接受表单 file、purpose、expires_after[anchor]、expires_after[seconds];其他表单字段或任何查询参数返回 400 invalid_request_error,消息为 "Unrecognized request argument supplied: <字段>",param 为该字段。
错误按 OpenAI 格式返回,参见 错误码
OK
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | The file identifier, which can be referenced in the API endpoints. |
| bytes | integer | The size of the file, in bytes. |
| created_at | integer | The Unix timestamp (in seconds) for when the file was created. |
| expires_at | integer | The Unix timestamp (in seconds) for when the file will expire. |
| filename | string | The name of the file. |
| object | string | The object type, which is always `file`. |
| purpose | string | The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`. |
| status | string | Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`. |
| status_details | string | Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`. |
/openai/v1/files● 支持purposestring可选query: Only return files with the given purpose.
已验证生效。
limitinteger可选query: A limit on the number of objects to be returned. Limit can range between 1 and 10,000, and the default is 10,000.
已验证生效。
orderstring可选query: Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
已验证生效。
afterstring可选query: A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
已验证生效。
200 list
只接受查询参数 after、order、limit、purpose;其他查询参数返回 400 invalid_request_error,消息为 "Unrecognized request argument supplied: <参数>",param 为该参数。
错误按 OpenAI 格式返回,参见 错误码
OK
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| object | string | |
| data | array<object> | |
| data[].id | string | The file identifier, which can be referenced in the API endpoints. |
| data[].bytes | integer | The size of the file, in bytes. |
| data[].created_at | integer | The Unix timestamp (in seconds) for when the file was created. |
| data[].expires_at | integer | The Unix timestamp (in seconds) for when the file will expire. |
| data[].filename | string | The name of the file. |
| data[].object | string | The object type, which is always `file`. |
| data[].purpose | string | The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`. |
| data[].status | string | Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`. |
| data[].status_details | string | Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`. |
| first_id | string | |
| last_id | string | |
| has_more | boolean |
先调用「上传文件」,用返回的文件 ID 替换示例文件 ID。
/openai/v1/files/{file_id}● 支持file_idstring必填path: The ID of the file to use for this request.
200 file
错误按 OpenAI 格式返回,参见 错误码
OK
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | The file identifier, which can be referenced in the API endpoints. |
| bytes | integer | The size of the file, in bytes. |
| created_at | integer | The Unix timestamp (in seconds) for when the file was created. |
| expires_at | integer | The Unix timestamp (in seconds) for when the file will expire. |
| filename | string | The name of the file. |
| object | string | The object type, which is always `file`. |
| purpose | string | The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`. |
| status | string | Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`. |
| status_details | string | Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`. |
官方 openai Python SDK 可直接使用知识库、文件和批次操作。两个地址访问同一份数据。
https://api.deepraxis.ai/openai/v1
搜索按块返回,同一文件可能出现多次;max_num_results 计算块数。rewrite_query 为 true 时先用小模型改写查询(按模型用量计费,失败时回退原查询),改写所用模型只能在原生 API 的 models 中设置,兼容接口传 models 返回 400。搜索 has_more 恒为 false、next_page 恒为 null。description 接受后丢弃。expand=files 与 expand[]=files 为 Praxis 扩展;未知值忽略。
删除知识库后保留 7 天,读取仍可返回 200 completed,但写入和搜索返回 409。恢复、失败重试、分段、事件和混合搜索权重请使用原生 API;兼容接口不返回 praxis、chunk_id、page 或 span。usage_bytes 为抽取文本块的字节数。未知请求字段当前会被忽略。
| 方法 | 路径 | 操作 |
|---|---|---|
| POST | /openai/v1/vector_stores | 创建知识库 |
| GET | /openai/v1/vector_stores | 列出知识库 |
| GET | /openai/v1/vector_stores/{vector_store_id} | 读取知识库 |
| POST | /openai/v1/vector_stores/{vector_store_id} | 更新知识库 |
| DELETE | /openai/v1/vector_stores/{vector_store_id} | 删除知识库 |
| POST | /openai/v1/vector_stores/{vector_store_id}/search | 搜索知识库 |
| POST | /openai/v1/vector_stores/{vector_store_id}/files | 添加文件 |
| GET | /openai/v1/vector_stores/{vector_store_id}/files | 列出文件 |
| GET | /openai/v1/vector_stores/{vector_store_id}/files/{file_id} | 读取文件 |
| POST | /openai/v1/vector_stores/{vector_store_id}/files/{file_id} | 更新文件属性 |
| DELETE | /openai/v1/vector_stores/{vector_store_id}/files/{file_id} | 移除文件 |
| GET | /openai/v1/vector_stores/{vector_store_id}/files/{file_id}/content | 读取抽取内容 |
| POST | /openai/v1/vector_stores/{vector_store_id}/file_batches | 创建文件批次 |
| GET | /openai/v1/vector_stores/{vector_store_id}/file_batches/{batch_id} | 读取文件批次 |
| POST | /openai/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel | 取消文件批次 |
| GET | /openai/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}/files | 列出批次文件 |
POST /openai/v1/vector_stores
创建知识库。可用 file_ids 添加已有 File 并异步入库;后续调用使用返回的 id。最小请求体:{"name":"Refund policies"}。
| 字段 | 类型 | 说明 |
|---|---|---|
| name | string | 可选; 省略时为空字符串;不接受 null。; 最长字符数: 256; 默认: "" |
| metadata | object / null | 可选; 知识库自定义字符串元数据;省略或 null 得到空对象。; 默认: {} |
| expires_after | object / null | 可选; 从最近活动计算的过期策略;省略或 null 表示不自动过期。; 默认: null |
| expires_after (1).anchor | "last_active_at" | 必填; last_active_at 表示从最近活动时间开始计算过期。 |
| expires_after (1).days | integer | 必填; 自最近活动起的天数;添加文件和搜索会刷新活动时间。; 最小: 1; 最大: 365 |
| file_ids | string[] | 可选; 要加入的已有文件 ID;每库最多 10,000 个文件。 |
| chunking_strategy | object / object | 可选; auto 等同于每段 800 token、重叠 400 token。; 默认: {"type":"auto"} |
| chunking_strategy (1).type | "auto" | 必填; auto 使用默认静态分段:800 个估算 token,重叠 400 个。 |
| chunking_strategy (2).type | "static" | 必填; static 表示使用显式分段大小与重叠设置。 |
| chunking_strategy (2).static | object | 必填; 以估算 token 数表示的分段大小与重叠限制。 |
| chunking_strategy (2).static.max_chunk_size_tokens | integer | 必填; 每段的估算 token 数。; 最小: 100; 最大: 4096 |
| chunking_strategy (2).static.chunk_overlap_tokens | integer | 必填; 不得超过 max_chunk_size_tokens 的一半。; 最小: 0; 最大: 2048 |
| description | string | 可选; 不生效: 接受后丢弃,不保存也不返回;当前不校验类型。 |
curl -X POST "https://api.deepraxis.ai/openai/v1/vector_stores" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"name\":\"Refund policies\"}"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必有; 资源 ID。; 最短字符数: 1 |
| object | "vector_store" | 必有; 对象标记;vector_store 表示知识库。 |
| name | string | 必有; 知识库显示名称;空字符串表示未设置名称。; 最长字符数: 256 |
| status | "in_progress" / "completed" / "expired" | 必有; in_progress 表示仍有文件入库中;completed 表示没有入库中的文件,不保证全部成功;expired 表示过期策略已生效。 |
| usage_bytes | integer | 必有; 已完成源文件的字节数之和。; 最小: 0 |
| file_counts | object | 必有; 仍属于该库或批次的附件数量,按入库状态分组。 |
| file_counts.in_progress | integer | 必有; 等待或正在入库的文件数。; 最小: 0 |
| file_counts.completed | integer | 必有; 已完成入库的文件数。; 最小: 0 |
| file_counts.failed | integer | 必有; 入库失败的文件数。; 最小: 0 |
| file_counts.cancelled | integer | 必有; 因批次取消而停止入库的文件数。; 最小: 0 |
| file_counts.total | integer | 必有; 全部入库状态的附件总数。; 最小: 0 |
| created_at | integer | 必有; Unix 时间戳,单位秒。 |
| last_active_at | integer / null | 必有; 最近创建、添加文件或搜索的 Unix 秒时间戳;不可用时为 null。 |
| expires_after | object / null | 必有; 从最近活动开始计算的过期策略;null 表示不自动过期。 |
| expires_after (1).anchor | "last_active_at" | 必有; last_active_at 表示从最近活动时间开始计算过期。 |
| expires_after (1).days | integer | 必有; 自最近活动起的天数;添加文件和搜索会刷新活动时间。; 最小: 1; 最大: 365 |
| expires_at | integer / null | 必有; 预计过期的 Unix 秒时间戳;未设置过期策略时为 null。 |
| metadata | object | 必有; 最多 16 个键;键最多 64 字符;字符串值最多 512 字符。; 最多键数: 16; 键最多 64 字符; 值: string |
GET /openai/v1/vector_stores
列出调用方可见的知识库,默认最新在前。将 last_id 作为 after 读取下一页,例如 ?limit=20。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| after | query: string | 上一页的 ID 游标。 最短字符数: 1 |
| before | query: string | 返回此 ID 之前的条目。 最短字符数: 1 |
| limit | query: integer | 每页条数。 最小: 1; 最大: 100; 默认: 20 |
| order | query: "asc" / "desc" | 知识库和文件默认按创建时间降序;分段默认按序号升序。 默认: "desc" |
curl -X GET "https://api.deepraxis.ai/openai/v1/vector_stores" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| object | "list" | 必有; 对象标记;list 表示游标分页集合。 |
| data | object[] | 必有; 按请求顺序返回的当前页条目。 |
| data[].id | string | 必有; 资源 ID。; 最短字符数: 1 |
| data[].object | "vector_store" | 必有; 对象标记;vector_store 表示知识库。 |
| data[].name | string | 必有; 知识库显示名称;空字符串表示未设置名称。; 最长字符数: 256 |
| data[].status | "in_progress" / "completed" / "expired" | 必有; in_progress 表示仍有文件入库中;completed 表示没有入库中的文件,不保证全部成功;expired 表示过期策略已生效。 |
| data[].usage_bytes | integer | 必有; 已完成源文件的字节数之和。; 最小: 0 |
| data[].file_counts | object | 必有; 仍属于该库或批次的附件数量,按入库状态分组。 |
| data[].file_counts.in_progress | integer | 必有; 等待或正在入库的文件数。; 最小: 0 |
| data[].file_counts.completed | integer | 必有; 已完成入库的文件数。; 最小: 0 |
| data[].file_counts.failed | integer | 必有; 入库失败的文件数。; 最小: 0 |
| data[].file_counts.cancelled | integer | 必有; 因批次取消而停止入库的文件数。; 最小: 0 |
| data[].file_counts.total | integer | 必有; 全部入库状态的附件总数。; 最小: 0 |
| data[].created_at | integer | 必有; Unix 时间戳,单位秒。 |
| data[].last_active_at | integer / null | 必有; 最近创建、添加文件或搜索的 Unix 秒时间戳;不可用时为 null。 |
| data[].expires_after | object / null | 必有; 从最近活动开始计算的过期策略;null 表示不自动过期。 |
| data[].expires_after (1).anchor | "last_active_at" | 必有; last_active_at 表示从最近活动时间开始计算过期。 |
| data[].expires_after (1).days | integer | 必有; 自最近活动起的天数;添加文件和搜索会刷新活动时间。; 最小: 1; 最大: 365 |
| data[].expires_at | integer / null | 必有; 预计过期的 Unix 秒时间戳;未设置过期策略时为 null。 |
| data[].metadata | object | 必有; 最多 16 个键;键最多 64 字符;字符串值最多 512 字符。; 最多键数: 16; 键最多 64 字符; 值: string |
| first_id | string / null | 必有; 本页首项的 ID;空页为 null。 |
| last_id | string / null | 必有; 本页末项的 ID,可作为 after 继续查询;空页为 null。 |
| has_more | boolean | 必有; 当前游标范围内,本页之后是否还有条目。 |
GET /openai/v1/vector_stores/{vector_store_id}
使用创建或列表返回的 id 读取知识库。添加 ?expand=files 可同时返回附件首页。已删除的库返回 404。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| expand | query: "files"[] | 两个地址均支持的 Praxis 扩展:files 附带文件首页;未知值忽略。 |
| expand[] | query: "files"[] | 两个地址均支持的 Praxis 扩展:files 附带文件首页;未知值忽略。 |
curl -X GET "https://api.deepraxis.ai/openai/v1/vector_stores/${VECTOR_STORE_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| (1).id | string | 必有; 资源 ID。; 最短字符数: 1 |
| (1).object | "vector_store" | 必有; 对象标记;vector_store 表示知识库。 |
| (1).name | string | 必有; 知识库显示名称;空字符串表示未设置名称。; 最长字符数: 256 |
| (1).status | "in_progress" / "completed" / "expired" | 必有; in_progress 表示仍有文件入库中;completed 表示没有入库中的文件,不保证全部成功;expired 表示过期策略已生效。 |
| (1).usage_bytes | integer | 必有; 已完成源文件的字节数之和。; 最小: 0 |
| (1).file_counts | object | 必有; 仍属于该库或批次的附件数量,按入库状态分组。 |
| (1).file_counts.in_progress | integer | 必有; 等待或正在入库的文件数。; 最小: 0 |
| (1).file_counts.completed | integer | 必有; 已完成入库的文件数。; 最小: 0 |
| (1).file_counts.failed | integer | 必有; 入库失败的文件数。; 最小: 0 |
| (1).file_counts.cancelled | integer | 必有; 因批次取消而停止入库的文件数。; 最小: 0 |
| (1).file_counts.total | integer | 必有; 全部入库状态的附件总数。; 最小: 0 |
| (1).created_at | integer | 必有; Unix 时间戳,单位秒。 |
| (1).last_active_at | integer / null | 必有; 最近创建、添加文件或搜索的 Unix 秒时间戳;不可用时为 null。 |
| (1).expires_after | object / null | 必有; 从最近活动开始计算的过期策略;null 表示不自动过期。 |
| (1).expires_after (1).anchor | "last_active_at" | 必有; last_active_at 表示从最近活动时间开始计算过期。 |
| (1).expires_after (1).days | integer | 必有; 自最近活动起的天数;添加文件和搜索会刷新活动时间。; 最小: 1; 最大: 365 |
| (1).expires_at | integer / null | 必有; 预计过期的 Unix 秒时间戳;未设置过期策略时为 null。 |
| (1).metadata | object | 必有; 最多 16 个键;键最多 64 字符;字符串值最多 512 字符。; 最多键数: 16; 键最多 64 字符; 值: string |
| (2).files | object | 可选; 仅在 expand=files 时返回文件首页。 |
| (2).files.object | "list" | 必有; 对象标记;list 表示游标分页集合。 |
| (2).files.data | object[] | 必有; 按请求顺序返回的当前页条目。 |
| (2).files.data[].id | string | 必有; 与源文件相同的 ID。; 最短字符数: 1 |
| (2).files.data[].object | "vector_store.file" | 必有; 对象标记;vector_store.file 表示知识库中的附件。 |
| (2).files.data[].vector_store_id | string | 必有; 资源 ID。; 最短字符数: 1 |
| (2).files.data[].status | "in_progress" / "completed" / "cancelled" / "failed" | 必有; in_progress 表示等待或正在入库;completed 表示可检索;failed 表示入库失败;cancelled 表示批次取消已停止入库。 |
| (2).files.data[].last_error | object / null | 必有; 入库失败详情;未失败、成功完成或重新入库时为 null。 |
| (2).files.data[].last_error (1).code | "server_error" / "unsupported_file" / "invalid_file" | 必有; unsupported_file 表示不支持的文件类型;invalid_file 表示加密、空文件或超过解析 token 上限;server_error 表示其它入库失败或超过截止时间。 |
| (2).files.data[].last_error (1).message | string | 必有; 与 code 对应的入库失败说明。 |
| (2).files.data[].usage_bytes | integer | 必有; 完成后计入源文件字节数;处理中、失败或已取消时为零。; 最小: 0 |
| (2).files.data[].created_at | integer | 必有; Unix 时间戳,单位秒。 |
| (2).files.data[].chunking_strategy | object / object | 必有; 此附件已保存的分段策略;auto 输入返回为具体 static 设置。 |
| (2).files.data[].chunking_strategy (1).type | "static" | 必有; static 表示使用显式分段大小与重叠设置。 |
| (2).files.data[].chunking_strategy (1).static | object | 必有; 以估算 token 数表示的分段大小与重叠限制。 |
| (2).files.data[].chunking_strategy (1).static.max_chunk_size_tokens | integer | 必有; 每段的估算 token 数。; 最小: 100; 最大: 4096 |
| (2).files.data[].chunking_strategy (1).static.chunk_overlap_tokens | integer | 必有; 不得超过 max_chunk_size_tokens 的一半。; 最小: 0; 最大: 2048 |
| (2).files.data[].chunking_strategy (2).type | "other" | 必有 |
| (2).files.data[].attributes | object / null | 必有; 用于搜索筛选的文件属性;null 表示未设置。 |
| (2).files.first_id | string / null | 必有; 本页首项的 ID;空页为 null。 |
| (2).files.last_id | string / null | 必有; 本页末项的 ID,可作为 after 继续查询;空页为 null。 |
| (2).files.has_more | boolean | 必有; 当前游标范围内,本页之后是否还有条目。 |
POST /openai/v1/vector_stores/{vector_store_id}
使用返回的 id 修改活跃知识库。省略的字段不变;metadata 替换整个对象。请求体示例:{"name":"Refund policies"}。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| 字段 | 类型 | 说明 |
|---|---|---|
| name | string / null | 可选; null 将名称清空为空字符串;省略的字段不变。 |
| metadata | object / null | 可选; 替换全部元数据;null 清空为一个空对象。 |
| expires_after | object / null | 可选; null 取消自动过期。 |
| expires_after (1).anchor | "last_active_at" | 必填; last_active_at 表示从最近活动时间开始计算过期。 |
| expires_after (1).days | integer | 必填; 自最近活动起的天数;添加文件和搜索会刷新活动时间。; 最小: 1; 最大: 365 |
curl -X POST "https://api.deepraxis.ai/openai/v1/vector_stores/${VECTOR_STORE_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"name\":\"Support policies\"}"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必有; 资源 ID。; 最短字符数: 1 |
| object | "vector_store" | 必有; 对象标记;vector_store 表示知识库。 |
| name | string | 必有; 知识库显示名称;空字符串表示未设置名称。; 最长字符数: 256 |
| status | "in_progress" / "completed" / "expired" | 必有; in_progress 表示仍有文件入库中;completed 表示没有入库中的文件,不保证全部成功;expired 表示过期策略已生效。 |
| usage_bytes | integer | 必有; 已完成源文件的字节数之和。; 最小: 0 |
| file_counts | object | 必有; 仍属于该库或批次的附件数量,按入库状态分组。 |
| file_counts.in_progress | integer | 必有; 等待或正在入库的文件数。; 最小: 0 |
| file_counts.completed | integer | 必有; 已完成入库的文件数。; 最小: 0 |
| file_counts.failed | integer | 必有; 入库失败的文件数。; 最小: 0 |
| file_counts.cancelled | integer | 必有; 因批次取消而停止入库的文件数。; 最小: 0 |
| file_counts.total | integer | 必有; 全部入库状态的附件总数。; 最小: 0 |
| created_at | integer | 必有; Unix 时间戳,单位秒。 |
| last_active_at | integer / null | 必有; 最近创建、添加文件或搜索的 Unix 秒时间戳;不可用时为 null。 |
| expires_after | object / null | 必有; 从最近活动开始计算的过期策略;null 表示不自动过期。 |
| expires_after (1).anchor | "last_active_at" | 必有; last_active_at 表示从最近活动时间开始计算过期。 |
| expires_after (1).days | integer | 必有; 自最近活动起的天数;添加文件和搜索会刷新活动时间。; 最小: 1; 最大: 365 |
| expires_at | integer / null | 必有; 预计过期的 Unix 秒时间戳;未设置过期策略时为 null。 |
| metadata | object | 必有; 最多 16 个键;键最多 64 字符;字符串值最多 512 字符。; 最多键数: 16; 键最多 64 字符; 值: string |
DELETE /openai/v1/vector_stores/{vector_store_id}
删除后读取和重复 DELETE 返回 404 not_found_error,列表不含已删除库;自有面可在 7 天内恢复。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
curl -X DELETE "https://api.deepraxis.ai/openai/v1/vector_stores/${VECTOR_STORE_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必有; 资源 ID。; 最短字符数: 1 |
| object | "vector_store.deleted" | 必有; 对象标记;vector_store.deleted 表示此操作回执。 |
| deleted | true | 必有; 确认兼容面的知识库删除;后续访问返回未找到。 |
POST /openai/v1/vector_stores/{vector_store_id}/search
每文件一条,content 为按分数降序的命中块;max_num_results 计文件,从最多 50 个召回分段聚合。has_more 表示文件结果截断,next_page 仍为 null。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| 字段 | 类型 | 说明 |
|---|---|---|
| query | string / string[] | 必填; 非空白文本;多个查询以换行连接后共同搜索。 |
| filters | object / object / object | 可选; 按类型严格匹配文件属性;根条件以下最多嵌套 20 层。 |
| filters (1).type | "eq" / "ne" / "gt" / "gte" / "lt" / "lte" | 必填; eq 等于,ne 不等于,gt 大于,gte 大于等于,lt 小于,lte 小于等于;属性必须存在且值类型一致。 |
| filters (1).key | string | 必填; 要比较的文件属性原始键名,标点也是键名的一部分。; 最短字符数: 1 |
| filters (1).value | string / number / boolean | 必填; 不进行类型转换的比较值。 |
| filters (2).type | "in" / "nin" | 必填; in 匹配数组中的值;nin 匹配不在数组中的值。属性不存在时均不匹配。 |
| filters (2).key | string | 必填; 要比较的文件属性原始键名,标点也是键名的一部分。; 最短字符数: 1 |
| filters (2).value | string / number[] | 必填; 不进行类型转换的字符串或数值成员列表。 |
| filters (3).type | "and" / "or" | 必填; and 要求所有子条件匹配;or 要求至少一个子条件匹配。 |
| filters (3).filters | object / object / object[] | 必填; 按选定 and/or 运算符组合的非空子条件列表。; 最少条数: 1 |
| filters (3).filters[] | object / object / object | 递归使用同一筛选结构,嵌套上限 20 层。 |
| max_num_results | integer | 可选; 从最多 50 个召回分段聚合后,最多返回的不同文件数。; 最小: 1; 最大: 50; 默认: 10 |
| rewrite_query | boolean | 可选; 支持: 为 true 时,先用该库 query_rewrite 角色的模型把每条查询改写为简洁的检索查询;检索使用改写结果,search_query 返回改写后的查询。每次改写是一次小模型调用,按模型用量计费。改写失败、超时(5 秒)或为空时,该条查询回退为原文,搜索照常完成。省略或为 false 时不调用模型。 |
| next_page | string | 可选; 不生效: 搜索不支持翻页;提供游标不生效。 |
| ranking_options | object | 可选; 控制结果排序与纳入结果的最低分数。 |
| ranking_options.ranker | "none" / "auto" / "default-2024-11-15" | 可选; 只有 default-2024-11-15 请求重排;none、auto 和省略时使用初始排序。尚未单独实测重排效果。 |
| ranking_options.score_threshold | number | 可选; 最低分数;分数不是相关性概率。尚未单独实测阈值效果。; 最小: 0; 最大: 1; 默认: 0 |
| ranking_options.hybrid_search | object | 可选; 不支持: 在 /openai/v1 返回 400 INVALID_PARAMS;设置权重请使用 /knowledge/v1。; Praxis 扩展 |
| ranking_options.hybrid_search.embedding_weight | number | 必填; 语义检索相对权重;零表示禁用语义检索。; 最小: 0; 默认: 0.7 |
| ranking_options.hybrid_search.text_weight | number | 必填; 关键词检索相对权重;零表示禁用关键词检索。; 最小: 0; 默认: 0.3 |
| praxis | object | 可选; 不生效: 兼容响应会删除 praxis,包括搜索解释。 |
| praxis.explain | boolean | 可选; 请求生成解释;兼容响应不返回这些解释。 |
curl -X POST "https://api.deepraxis.ai/openai/v1/vector_stores/${VECTOR_STORE_ID}/search" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"query\":\"When will I receive my refund?\",\"max_num_results\":5}"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| object | "vector_store.search_results.page" | 必有; 对象标记;vector_store.search_results.page 表示搜索结果页。 |
| search_query | string[] | 必有; 实际用于检索的查询,与输入一一对应;rewrite_query 为 true 时为改写后的查询,否则原样返回。 |
| data | object[] | 必有; 每个文件返回一条;content 包含该文件命中的分段。 |
| data[].file_id | string | 必有; 资源 ID。; 最短字符数: 1 |
| data[].filename | string | 必有; 命中文件的源文件名。 |
| data[].score | number | 必有; 该文件命中分段的最高分数。; 最小: 0; 最大: 1 |
| data[].attributes | object / null | 必有; 用于筛选的当前文件属性;未设置时为 null。 |
| data[].content | object[] | 必有; 按分段分数降序排列的命中分段。 |
| data[].content[].type | "text" | 必有; text 表示提取出的文本分段。 |
| data[].content[].text | string | 必有; 命中分段的提取文本,可能与相邻分段重叠。 |
| has_more | boolean | 必有; 过滤后的文件数超过 max_num_results 时为 true;next_page 仍为 null。; 支持: |
| next_page | null | 必有; 不生效: 恒为 null,没有下一页搜索结果。 |
POST /openai/v1/vector_stores/{vector_store_id}/files
异步处理。重复加入同一文件返回已有记录,不应用新的属性或分段策略。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| 字段 | 类型 | 说明 |
|---|---|---|
| file_id | string | 必填; 上传文件返回的已有源 File ID;文件必须对调用方可见。; 最短字符数: 1 |
| attributes | object / null | 可选; 新附件的搜索筛选属性;省略或 null 表示不设置。重复加入已有文件不改变属性。 |
| chunking_strategy | object / object | 可选; auto 等同于每段 800 token、重叠 400 token。; 默认: {"type":"auto"} |
| chunking_strategy (1).type | "auto" | 必填; auto 使用默认静态分段:800 个估算 token,重叠 400 个。 |
| chunking_strategy (2).type | "static" | 必填; static 表示使用显式分段大小与重叠设置。 |
| chunking_strategy (2).static | object | 必填; 以估算 token 数表示的分段大小与重叠限制。 |
| chunking_strategy (2).static.max_chunk_size_tokens | integer | 必填; 每段的估算 token 数。; 最小: 100; 最大: 4096 |
| chunking_strategy (2).static.chunk_overlap_tokens | integer | 必填; 不得超过 max_chunk_size_tokens 的一半。; 最小: 0; 最大: 2048 |
curl -X POST "https://api.deepraxis.ai/openai/v1/vector_stores/${VECTOR_STORE_ID}/files" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"file_id\":\"${FILE_ID}\"}"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必有; 与源文件相同的 ID。; 最短字符数: 1 |
| object | "vector_store.file" | 必有; 对象标记;vector_store.file 表示知识库中的附件。 |
| vector_store_id | string | 必有; 资源 ID。; 最短字符数: 1 |
| status | "in_progress" / "completed" / "cancelled" / "failed" | 必有; in_progress 表示等待或正在入库;completed 表示可检索;failed 表示入库失败;cancelled 表示批次取消已停止入库。 |
| last_error | object / null | 必有; 入库失败详情;未失败、成功完成或重新入库时为 null。 |
| last_error (1).code | "server_error" / "unsupported_file" / "invalid_file" | 必有; unsupported_file 表示不支持的文件类型;invalid_file 表示加密、空文件或超过解析 token 上限;server_error 表示其它入库失败或超过截止时间。 |
| last_error (1).message | string | 必有; 与 code 对应的入库失败说明。 |
| usage_bytes | integer | 必有; 完成后计入源文件字节数;处理中、失败或已取消时为零。; 最小: 0 |
| created_at | integer | 必有; Unix 时间戳,单位秒。 |
| chunking_strategy | object / object | 必有; 此附件已保存的分段策略;auto 输入返回为具体 static 设置。 |
| chunking_strategy (1).type | "static" | 必有; static 表示使用显式分段大小与重叠设置。 |
| chunking_strategy (1).static | object | 必有; 以估算 token 数表示的分段大小与重叠限制。 |
| chunking_strategy (1).static.max_chunk_size_tokens | integer | 必有; 每段的估算 token 数。; 最小: 100; 最大: 4096 |
| chunking_strategy (1).static.chunk_overlap_tokens | integer | 必有; 不得超过 max_chunk_size_tokens 的一半。; 最小: 0; 最大: 2048 |
| chunking_strategy (2).type | "other" | 必有 |
| attributes | object / null | 必有; 用于搜索筛选的文件属性;null 表示未设置。 |
GET /openai/v1/vector_stores/{vector_store_id}/files
列出附件及入库状态,默认最新附件在前。使用 last_id 作为 after 继续查询;?filter=failed 筛选可重新入库的失败文件。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| after | query: string | 上一页的 ID 游标。 最短字符数: 1 |
| before | query: string | 返回此 ID 之前的条目。 最短字符数: 1 |
| limit | query: integer | 每页条数。 最小: 1; 最大: 100; 默认: 20 |
| order | query: "asc" / "desc" | 知识库和文件默认按创建时间降序;分段默认按序号升序。 默认: "desc" |
| filter | query: "in_progress" / "completed" / "failed" / "cancelled" | in_progress 表示等待或正在入库;completed 表示可检索;failed 表示入库失败;cancelled 表示批次取消已停止入库。省略时包含全部状态。 |
curl -X GET "https://api.deepraxis.ai/openai/v1/vector_stores/${VECTOR_STORE_ID}/files" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| object | "list" | 必有; 对象标记;list 表示游标分页集合。 |
| data | object[] | 必有; 按请求顺序返回的当前页条目。 |
| data[].id | string | 必有; 与源文件相同的 ID。; 最短字符数: 1 |
| data[].object | "vector_store.file" | 必有; 对象标记;vector_store.file 表示知识库中的附件。 |
| data[].vector_store_id | string | 必有; 资源 ID。; 最短字符数: 1 |
| data[].status | "in_progress" / "completed" / "cancelled" / "failed" | 必有; in_progress 表示等待或正在入库;completed 表示可检索;failed 表示入库失败;cancelled 表示批次取消已停止入库。 |
| data[].last_error | object / null | 必有; 入库失败详情;未失败、成功完成或重新入库时为 null。 |
| data[].last_error (1).code | "server_error" / "unsupported_file" / "invalid_file" | 必有; unsupported_file 表示不支持的文件类型;invalid_file 表示加密、空文件或超过解析 token 上限;server_error 表示其它入库失败或超过截止时间。 |
| data[].last_error (1).message | string | 必有; 与 code 对应的入库失败说明。 |
| data[].usage_bytes | integer | 必有; 完成后计入源文件字节数;处理中、失败或已取消时为零。; 最小: 0 |
| data[].created_at | integer | 必有; Unix 时间戳,单位秒。 |
| data[].chunking_strategy | object / object | 必有; 此附件已保存的分段策略;auto 输入返回为具体 static 设置。 |
| data[].chunking_strategy (1).type | "static" | 必有; static 表示使用显式分段大小与重叠设置。 |
| data[].chunking_strategy (1).static | object | 必有; 以估算 token 数表示的分段大小与重叠限制。 |
| data[].chunking_strategy (1).static.max_chunk_size_tokens | integer | 必有; 每段的估算 token 数。; 最小: 100; 最大: 4096 |
| data[].chunking_strategy (1).static.chunk_overlap_tokens | integer | 必有; 不得超过 max_chunk_size_tokens 的一半。; 最小: 0; 最大: 2048 |
| data[].chunking_strategy (2).type | "other" | 必有 |
| data[].attributes | object / null | 必有; 用于搜索筛选的文件属性;null 表示未设置。 |
| first_id | string / null | 必有; 本页首项的 ID;空页为 null。 |
| last_id | string / null | 必有; 本页末项的 ID,可作为 after 继续查询;空页为 null。 |
| has_more | boolean | 必有; 当前游标范围内,本页之后是否还有条目。 |
GET /openai/v1/vector_stores/{vector_store_id}/files/{file_id}
使用添加附件或附件列表返回的 id 读取文件。可轮询此操作,直到 status 离开 in_progress 后确认入库结果。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| file_id | path: string | 必填;添加附件或附件列表返回的源 File ID。 最短字符数: 1 |
curl -X GET "https://api.deepraxis.ai/openai/v1/vector_stores/${VECTOR_STORE_ID}/files/${FILE_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必有; 与源文件相同的 ID。; 最短字符数: 1 |
| object | "vector_store.file" | 必有; 对象标记;vector_store.file 表示知识库中的附件。 |
| vector_store_id | string | 必有; 资源 ID。; 最短字符数: 1 |
| status | "in_progress" / "completed" / "cancelled" / "failed" | 必有; in_progress 表示等待或正在入库;completed 表示可检索;failed 表示入库失败;cancelled 表示批次取消已停止入库。 |
| last_error | object / null | 必有; 入库失败详情;未失败、成功完成或重新入库时为 null。 |
| last_error (1).code | "server_error" / "unsupported_file" / "invalid_file" | 必有; unsupported_file 表示不支持的文件类型;invalid_file 表示加密、空文件或超过解析 token 上限;server_error 表示其它入库失败或超过截止时间。 |
| last_error (1).message | string | 必有; 与 code 对应的入库失败说明。 |
| usage_bytes | integer | 必有; 完成后计入源文件字节数;处理中、失败或已取消时为零。; 最小: 0 |
| created_at | integer | 必有; Unix 时间戳,单位秒。 |
| chunking_strategy | object / object | 必有; 此附件已保存的分段策略;auto 输入返回为具体 static 设置。 |
| chunking_strategy (1).type | "static" | 必有; static 表示使用显式分段大小与重叠设置。 |
| chunking_strategy (1).static | object | 必有; 以估算 token 数表示的分段大小与重叠限制。 |
| chunking_strategy (1).static.max_chunk_size_tokens | integer | 必有; 每段的估算 token 数。; 最小: 100; 最大: 4096 |
| chunking_strategy (1).static.chunk_overlap_tokens | integer | 必有; 不得超过 max_chunk_size_tokens 的一半。; 最小: 0; 最大: 2048 |
| chunking_strategy (2).type | "other" | 必有 |
| attributes | object / null | 必有; 用于搜索筛选的文件属性;null 表示未设置。 |
POST /openai/v1/vector_stores/{vector_store_id}/files/{file_id}
替换已有附件的搜索筛选属性,不重新入库。使用附件 id。请求体示例:{"attributes":{"category":"refund"}};null 清空属性。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| file_id | path: string | 必填;添加附件或附件列表返回的源 File ID。 最短字符数: 1 |
| 字段 | 类型 | 说明 |
|---|---|---|
| attributes | object / null | 可选; 替换全部搜索筛选属性;null 清空属性。 |
curl -X POST "https://api.deepraxis.ai/openai/v1/vector_stores/${VECTOR_STORE_ID}/files/${FILE_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"attributes\":{\"category\":\"refund\"}}"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必有; 与源文件相同的 ID。; 最短字符数: 1 |
| object | "vector_store.file" | 必有; 对象标记;vector_store.file 表示知识库中的附件。 |
| vector_store_id | string | 必有; 资源 ID。; 最短字符数: 1 |
| status | "in_progress" / "completed" / "cancelled" / "failed" | 必有; in_progress 表示等待或正在入库;completed 表示可检索;failed 表示入库失败;cancelled 表示批次取消已停止入库。 |
| last_error | object / null | 必有; 入库失败详情;未失败、成功完成或重新入库时为 null。 |
| last_error (1).code | "server_error" / "unsupported_file" / "invalid_file" | 必有; unsupported_file 表示不支持的文件类型;invalid_file 表示加密、空文件或超过解析 token 上限;server_error 表示其它入库失败或超过截止时间。 |
| last_error (1).message | string | 必有; 与 code 对应的入库失败说明。 |
| usage_bytes | integer | 必有; 完成后计入源文件字节数;处理中、失败或已取消时为零。; 最小: 0 |
| created_at | integer | 必有; Unix 时间戳,单位秒。 |
| chunking_strategy | object / object | 必有; 此附件已保存的分段策略;auto 输入返回为具体 static 设置。 |
| chunking_strategy (1).type | "static" | 必有; static 表示使用显式分段大小与重叠设置。 |
| chunking_strategy (1).static | object | 必有; 以估算 token 数表示的分段大小与重叠限制。 |
| chunking_strategy (1).static.max_chunk_size_tokens | integer | 必有; 每段的估算 token 数。; 最小: 100; 最大: 4096 |
| chunking_strategy (1).static.chunk_overlap_tokens | integer | 必有; 不得超过 max_chunk_size_tokens 的一半。; 最小: 0; 最大: 2048 |
| chunking_strategy (2).type | "other" | 必有 |
| attributes | object / null | 必有; 用于搜索筛选的文件属性;null 表示未设置。 |
DELETE /openai/v1/vector_stores/{vector_store_id}/files/{file_id}
返回后立即不再搜索到该文件;不会删除源文件。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| file_id | path: string | 必填;添加附件或附件列表返回的源 File ID。 最短字符数: 1 |
curl -X DELETE "https://api.deepraxis.ai/openai/v1/vector_stores/${VECTOR_STORE_ID}/files/${FILE_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必有; 资源 ID。; 最短字符数: 1 |
| object | "vector_store.file.deleted" | 必有; 对象标记;vector_store.file.deleted 表示此操作回执。 |
| deleted | true | 必有; 确认已从此知识库移出;源 File 未删除。 |
GET /openai/v1/vector_stores/{vector_store_id}/files/{file_id}/content
抽取文本按分段返回,可能重叠。图片内容可能是生成的描述,并非逐字 OCR。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| file_id | path: string | 必填;添加附件或附件列表返回的源 File ID。 最短字符数: 1 |
curl -X GET "https://api.deepraxis.ai/openai/v1/vector_stores/${VECTOR_STORE_ID}/files/${FILE_ID}/content" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| object | "vector_store.file_content.page" | 必有; 对象标记;vector_store.file_content.page 表示提取的文件内容。 |
| data | object[] | 必有; 按分段序号排列的全部现存文本分段;相邻分段可能重叠。 |
| data[].type | "text" | 必有; text 表示提取出的文本分段。 |
| data[].text | string | 必有; 此分段的提取文本;可能与相邻分段重叠。 |
| has_more | false | 必有; 恒为 false;此响应返回全部现存分段。 |
| next_page | null | 必有; 恒为 null;提取内容不分页。 |
POST /openai/v1/vector_stores/{vector_store_id}/file_batches
批量添加已有 File 并异步入库。file_ids 与 files 必须且只能提供一个;files 支持逐文件设置。已有附件直接复用。使用返回的批次 id 查询进度。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
file_ids 与 files 必须且只能提供一个。已有文件直接复用,不修改属性或分段策略。
| 字段 | 类型 | 说明 |
|---|---|---|
| (1).file_ids | string[] | 必填; 使用共同属性和分段设置的已有 File ID 列表。file_ids 与 files 二选一。; 最少条数: 1; 最多条数: 500 |
| (1).attributes | object / null | 可选; 用于每个新附件的搜索筛选属性;省略或 null 表示不设置。 |
| (1).chunking_strategy | object / object | 可选; auto 等同于每段 800 token、重叠 400 token。; 默认: {"type":"auto"} |
| (1).chunking_strategy (1).type | "auto" | 必填; auto 使用默认静态分段:800 个估算 token,重叠 400 个。 |
| (1).chunking_strategy (2).type | "static" | 必填; static 表示使用显式分段大小与重叠设置。 |
| (1).chunking_strategy (2).static | object | 必填; 以估算 token 数表示的分段大小与重叠限制。 |
| (1).chunking_strategy (2).static.max_chunk_size_tokens | integer | 必填; 每段的估算 token 数。; 最小: 100; 最大: 4096 |
| (1).chunking_strategy (2).static.chunk_overlap_tokens | integer | 必填; 不得超过 max_chunk_size_tokens 的一半。; 最小: 0; 最大: 2048 |
| (2).files | object[] | 必填; 分别指定属性和分段设置的附件列表;忽略顶层 attributes 与 chunking_strategy。; 最少条数: 1; 最多条数: 500 |
| (2).files[].file_id | string | 必填; 上传文件返回的已有源 File ID;文件必须对调用方可见。; 最短字符数: 1 |
| (2).files[].attributes | object | 可选; 用于搜索筛选的文件属性。最多 16 个键,键最多 64 字符,字符串值最多 512 字符。; 最多键数: 16; 键最多 64 字符; 值: string / number / boolean |
| (2).files[].chunking_strategy | object / object | 可选; auto 等同于每段 800 token、重叠 400 token。; 默认: {"type":"auto"} |
| (2).files[].chunking_strategy (1).type | "auto" | 必填; auto 使用默认静态分段:800 个估算 token,重叠 400 个。 |
| (2).files[].chunking_strategy (2).type | "static" | 必填; static 表示使用显式分段大小与重叠设置。 |
| (2).files[].chunking_strategy (2).static | object | 必填; 以估算 token 数表示的分段大小与重叠限制。 |
| (2).files[].chunking_strategy (2).static.max_chunk_size_tokens | integer | 必填; 每段的估算 token 数。; 最小: 100; 最大: 4096 |
| (2).files[].chunking_strategy (2).static.chunk_overlap_tokens | integer | 必填; 不得超过 max_chunk_size_tokens 的一半。; 最小: 0; 最大: 2048 |
| (2).attributes | JSON | 可选; 不生效: 使用 files 时不生效。 |
| (2).chunking_strategy | JSON | 可选; 不生效: 使用 files 时不生效。 |
curl -X POST "https://api.deepraxis.ai/openai/v1/vector_stores/${VECTOR_STORE_ID}/file_batches" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"file_ids\":[\"${FILE_ID}\"]}"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必有; 资源 ID。; 最短字符数: 1 |
| object | "vector_store.files_batch" | 必有; 对象标记;vector_store.files_batch 表示批量附件。 |
| vector_store_id | string | 必有; 资源 ID。; 最短字符数: 1 |
| status | "in_progress" / "completed" / "cancelled" / "failed" | 必有; cancelled 表示批次已取消;否则 in_progress 表示仍有成员入库中,failed 表示入库结束且有失败成员,completed 表示无入库中或失败成员。取消终态批次不会改变它。 |
| file_counts | object | 必有; 仍属于该库或批次的附件数量,按入库状态分组。 |
| file_counts.in_progress | integer | 必有; 等待或正在入库的文件数。; 最小: 0 |
| file_counts.completed | integer | 必有; 已完成入库的文件数。; 最小: 0 |
| file_counts.failed | integer | 必有; 入库失败的文件数。; 最小: 0 |
| file_counts.cancelled | integer | 必有; 因批次取消而停止入库的文件数。; 最小: 0 |
| file_counts.total | integer | 必有; 全部入库状态的附件总数。; 最小: 0 |
| created_at | integer | 必有; Unix 时间戳,单位秒。 |
GET /openai/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}
读取此知识库中创建的批次,包括当前状态和文件计数。使用创建批次返回的 id 监测入库结果。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| batch_id | path: string | 必填;此知识库创建批次时返回的文件批次 ID。 最短字符数: 1 |
curl -X GET "https://api.deepraxis.ai/openai/v1/vector_stores/${VECTOR_STORE_ID}/file_batches/${BATCH_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必有; 资源 ID。; 最短字符数: 1 |
| object | "vector_store.files_batch" | 必有; 对象标记;vector_store.files_batch 表示批量附件。 |
| vector_store_id | string | 必有; 资源 ID。; 最短字符数: 1 |
| status | "in_progress" / "completed" / "cancelled" / "failed" | 必有; cancelled 表示批次已取消;否则 in_progress 表示仍有成员入库中,failed 表示入库结束且有失败成员,completed 表示无入库中或失败成员。取消终态批次不会改变它。 |
| file_counts | object | 必有; 仍属于该库或批次的附件数量,按入库状态分组。 |
| file_counts.in_progress | integer | 必有; 等待或正在入库的文件数。; 最小: 0 |
| file_counts.completed | integer | 必有; 已完成入库的文件数。; 最小: 0 |
| file_counts.failed | integer | 必有; 入库失败的文件数。; 最小: 0 |
| file_counts.cancelled | integer | 必有; 因批次取消而停止入库的文件数。; 最小: 0 |
| file_counts.total | integer | 必有; 全部入库状态的附件总数。; 最小: 0 |
| created_at | integer | 必有; Unix 时间戳,单位秒。 |
POST /openai/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel
只取消处理中的批次和文件。已完成、失败或已取消的批次原样返回(200,幂等),计数不变。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| batch_id | path: string | 必填;此知识库创建批次时返回的文件批次 ID。 最短字符数: 1 |
curl -X POST "https://api.deepraxis.ai/openai/v1/vector_stores/${VECTOR_STORE_ID}/file_batches/${BATCH_ID}/cancel" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必有; 资源 ID。; 最短字符数: 1 |
| object | "vector_store.files_batch" | 必有; 对象标记;vector_store.files_batch 表示批量附件。 |
| vector_store_id | string | 必有; 资源 ID。; 最短字符数: 1 |
| status | "in_progress" / "completed" / "cancelled" / "failed" | 必有; cancelled 表示批次已取消;否则 in_progress 表示仍有成员入库中,failed 表示入库结束且有失败成员,completed 表示无入库中或失败成员。取消终态批次不会改变它。 |
| file_counts | object | 必有; 仍属于该库或批次的附件数量,按入库状态分组。 |
| file_counts.in_progress | integer | 必有; 等待或正在入库的文件数。; 最小: 0 |
| file_counts.completed | integer | 必有; 已完成入库的文件数。; 最小: 0 |
| file_counts.failed | integer | 必有; 入库失败的文件数。; 最小: 0 |
| file_counts.cancelled | integer | 必有; 因批次取消而停止入库的文件数。; 最小: 0 |
| file_counts.total | integer | 必有; 全部入库状态的附件总数。; 最小: 0 |
| created_at | integer | 必有; Unix 时间戳,单位秒。 |
GET /openai/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}/files
列出指定批次仍在库中的附件,默认最新附件在前。使用批次创建返回的 id;?filter=failed 查看失败文件,last_id 可作为下一页 after。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| batch_id | path: string | 必填;此知识库创建批次时返回的文件批次 ID。 最短字符数: 1 |
| after | query: string | 上一页的 ID 游标。 最短字符数: 1 |
| before | query: string | 返回此 ID 之前的条目。 最短字符数: 1 |
| limit | query: integer | 每页条数。 最小: 1; 最大: 100; 默认: 20 |
| order | query: "asc" / "desc" | 知识库和文件默认按创建时间降序;分段默认按序号升序。 默认: "desc" |
| filter | query: "in_progress" / "completed" / "failed" / "cancelled" | in_progress 表示等待或正在入库;completed 表示可检索;failed 表示入库失败;cancelled 表示批次取消已停止入库。省略时包含全部状态。 |
curl -X GET "https://api.deepraxis.ai/openai/v1/vector_stores/${VECTOR_STORE_ID}/file_batches/${BATCH_ID}/files" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| object | "list" | 必有; 对象标记;list 表示游标分页集合。 |
| data | object[] | 必有; 按请求顺序返回的当前页条目。 |
| data[].id | string | 必有; 与源文件相同的 ID。; 最短字符数: 1 |
| data[].object | "vector_store.file" | 必有; 对象标记;vector_store.file 表示知识库中的附件。 |
| data[].vector_store_id | string | 必有; 资源 ID。; 最短字符数: 1 |
| data[].status | "in_progress" / "completed" / "cancelled" / "failed" | 必有; in_progress 表示等待或正在入库;completed 表示可检索;failed 表示入库失败;cancelled 表示批次取消已停止入库。 |
| data[].last_error | object / null | 必有; 入库失败详情;未失败、成功完成或重新入库时为 null。 |
| data[].last_error (1).code | "server_error" / "unsupported_file" / "invalid_file" | 必有; unsupported_file 表示不支持的文件类型;invalid_file 表示加密、空文件或超过解析 token 上限;server_error 表示其它入库失败或超过截止时间。 |
| data[].last_error (1).message | string | 必有; 与 code 对应的入库失败说明。 |
| data[].usage_bytes | integer | 必有; 完成后计入源文件字节数;处理中、失败或已取消时为零。; 最小: 0 |
| data[].created_at | integer | 必有; Unix 时间戳,单位秒。 |
| data[].chunking_strategy | object / object | 必有; 此附件已保存的分段策略;auto 输入返回为具体 static 设置。 |
| data[].chunking_strategy (1).type | "static" | 必有; static 表示使用显式分段大小与重叠设置。 |
| data[].chunking_strategy (1).static | object | 必有; 以估算 token 数表示的分段大小与重叠限制。 |
| data[].chunking_strategy (1).static.max_chunk_size_tokens | integer | 必有; 每段的估算 token 数。; 最小: 100; 最大: 4096 |
| data[].chunking_strategy (1).static.chunk_overlap_tokens | integer | 必有; 不得超过 max_chunk_size_tokens 的一半。; 最小: 0; 最大: 2048 |
| data[].chunking_strategy (2).type | "other" | 必有 |
| data[].attributes | object / null | 必有; 用于搜索筛选的文件属性;null 表示未设置。 |
| first_id | string / null | 必有; 本页首项的 ID;空页为 null。 |
| last_id | string / null | 必有; 本页末项的 ID,可作为 after 继续查询;空页为 null。 |
| has_more | boolean | 必有; 当前游标范围内,本页之后是否还有条目。 |
加载中…| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| POST | /v1/messages | 发送消息 | ● 支持 |
| POST | /v1/messages/count_tokens | 统计 token | ◐ 部分支持 |
| GET | /v1/models | 列出模型 | ● 支持 |
| POST | /v1/files | 上传文件 | ● 支持 |
| GET | /v1/files | 列出文件 | ● 支持 |
| GET | /v1/files/{file_id} | 读取文件信息 | ● 支持 |
| DELETE | /v1/files/{file_id} | 删除文件 | ● 支持 |
| GET | /v1/files/{file_id}/content | 下载文件内容 | ● 支持 |
参数与字段的权威定义以 Anthropic 官方文档为准。
/anthropic/v1/messages● 支持modelstring必填◐ 部分支持Body param: The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.
deepseek-v4-pro、glm-5.3-flash、qwen3.8-flash、claude-opus-5 可调用;deepseek-v4-flash 在此协议面返回 400。
max_tokensnumber必填Body param: The maximum number of tokens to generate before stopping. Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate. Set to `0` to populate the [prompt cache](https://platform.claude.com/docs/en/build-with-claude/prompt-caching#pre-warming-the-cache) without generating a response. Different models have different maximum values for this parameter. See [models](https://platform.claude.com/docs/en/about-claude/models/overview) for details.
限制输出 token,思考也占用预算。
messagesarray必填◐ 部分支持Body param: Input messages. Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn. Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages. If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response. Example with a single `user` message: ```json [{ "role": "user", "content": "Hello, Claude" }] ``` Example with multiple conversational turns: ```json [ { "role": "user", "content": "Hello there." }, { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" }, { "role": "user", "content": "Can you explain LLMs in plain English?" } ] ``` Example with a partially-filled response from Claude: ```json [ { "role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun" }, { "role": "assistant", "content": "The best answer is (" } ] ``` Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent: ```json { "role": "user", "content": "Hello, Claude" } ``` ```json { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] } ``` See [input examples](https://platform.claude.com/docs/en/build-with-claude/working-with-messages). Note that if you want to include a [system prompt](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. There is a limit of 100,000 messages in a single request.
文本和工具往返生效;document 的托管 file_id 返回 400,qwen3.8-flash 可读取内联 PDF;图片有模型尺寸限制。
contentstring | array必填Message content: a plain string (shorthand for one text block) or an array of content blocks such as text, image, document, tool_use and tool_result.
rolestring必填Who produced the message. Use user for your turns and assistant to replay earlier model turns; system-role messages are accepted by the shape but system instructions normally go in the top-level system field.
streamboolean可选◐ 部分支持Body param: Whether to incrementally stream the response using server-sent events. See [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming) for details.
流式正文和工具事件可用;可能在正文前出现额外 message_delta,message_start 的用量为 0。
systemstring | array可选Body param: System prompt. A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role).
已验证生效。
temperaturenumber可选top_pnumber可选top_knumber可选stop_sequencesarray可选◐ 部分支持Body param: Custom text sequences that will cause the model to stop generating. Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`. If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence.
deepseek-v4-pro、qwen3.8-flash 生效;glm-5.3-flash 文本截断但 stop_reason 和 stop_sequence 未准确反映。
toolsarray可选Body param: Definitions of tools that the model may use. If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks. There are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool)). Each tool definition includes: - `name`: Name of the tool. - `description`: Optional, but strongly-recommended description of the tool. - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks. For example, if you defined `tools` as: ```json [ { "name": "get_stock_price", "description": "Get the current stock price for a given ticker symbol.", "input_schema": { "type": "object", "properties": { "ticker": { "type": "string", "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." } }, "required": ["ticker"] } } ] ``` And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this: ```json [ { "type": "tool_use", "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", "name": "get_stock_price", "input": { "ticker": "^GSPC" } } ] ``` You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message: ```json [ { "type": "tool_result", "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", "content": "259.75 USD" } ] ``` Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output. See our [guide](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview) for more details.
已验证生效。
tool_choiceobject可选◐ 部分支持Body param: How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all.
qwen3.8-flash 四种模式生效;deepseek-v4-pro 忽略 any/tool/none;glm-5.3-flash 忽略 none。
typestring必填disable_parallel_tool_useboolean可选○ 当前不生效Whether to disable parallel tool use. Defaults to `false`. If set to `true`, the model will output exactly one tool use.
接受但当前不生效。true 仍可能返回多个工具调用。
namestring必填The name of the tool to use.
metadataobject可选◐ 部分支持Body param: An object describing metadata about the request.
接受 metadata;metadata.user_id 由同协议线路传递,不承诺上游回显。
user_idstring可选An external identifier for the user who is associated with the request. This should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number.
cache_controlobject可选◐ 部分支持Body param: Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request.
deepseek-v4-pro、qwen3.8-flash、glm-5.3-flash 有隐式缓存命中,但不能据此确认标记生效;claude-opus-5 未命中缓存,ttl=1h 未见效果。
typestring必填Always `ephemeral`. Discriminator that marks this object as a CacheControlEphemeral in a `type`-tagged union.
ttlstring可选The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
containerstring | object可选○ 当前不生效接受并忽略 container;平台尚未实现此能力。
idstring可选Container id
skillsarray可选List of skills to load in the container
inference_geostring可选○ 当前不生效接受并忽略 inference_geo;平台尚未实现此能力。
output_configobject可选Body param: Configuration options for the model's output, such as the output format.
effortstring可选◐ 部分支持All possible effort levels.
deepseek-v4-pro 仅 high/xhigh 可用,其余返回 400;qwen3.8-flash 全档返回 400;glm-5.3-flash 接受各档但消耗不随档位单调变化。
formatobject可选◐ 部分支持A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
json_schema 在 deepseek-v4-pro、qwen3.8-flash 生效;glm-5.3-flash 与 thinking 同传返回 400。
service_tierstring可选○ 当前不生效接受并忽略 service_tier;平台尚未实现此能力。
thinkingobject可选◐ 部分支持Body param: Configuration for enabling Claude's extended thinking. When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit. See [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) for details.
disabled 在 deepseek-v4-pro、qwen3.8-flash 生效;glm-5.3-flash 携带任何 thinking 都返回 400。adaptive 在已测的 deepseek-v4-pro、qwen3.8-flash 也返回 400。
budget_tokensnumber必填◐ 部分支持Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality. Must be ≥1024 and less than `max_tokens`. See [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) for details.
deepseek-v4-pro、qwen3.8-flash 接受,但预算不构成可靠上限;glm-5.3-flash 返回 400。
typestring必填displaystring可选○ 当前不生效Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`.
接受但当前不生效。omitted 仍返回完整思考内容。
context_managementobject可选○ 当前不生效接受并忽略 context_management;平台尚未实现此能力。
diagnosticsobject可选○ 当前不生效接受并忽略 diagnostics;平台尚未实现此能力。
mcp_serversarray可选○ 当前不生效接受并忽略 mcp_servers;平台尚未实现此能力。
speedstring可选○ 当前不生效接受并忽略 speed;平台尚未实现此能力。
output_formatobject可选○ 当前不生效接受并忽略此旧字段;结构化输出使用 output_config.format。
compactionobject可选○ 未支持已识别 compaction;尚未实现,传入返回 400 并明确说明不支持。
fallback_credit_tokenstring可选○ 未支持已识别 fallback_credit_token;尚未实现,传入返回 400 并明确说明不支持。
fallbacksstring可选○ 未支持已识别 fallbacks;尚未实现,传入返回 400 并明确说明不支持。
200
stream=true 时以 SSE 增量返回(text/event-stream)。
支持顶层 cache_control、top_k、metadata.user_id、output_config.format、thinking.display 与 anthropic-user-profile-id。仅原生 Anthropic 能表达的选项会限制路由;没有可保真供应时返回参数错误。anthropic-workspace-id 尚未支持,非空值返回 400。container、inference_geo 与 service_tier 接受并忽略;其他扩展见字段支持标注。 未知顶层字段原样转发给同协议上游,由上游决定是否接受;已声明字段的类型与取值范围仍会校验,不合法时返回 400 并点名字段。
错误按 Anthropic 格式返回,参见 错误码
Message created
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique object identifier. The format and length of IDs may change over time. |
| container | null | object | Information about the container used in the request (for the code execution tool) |
| container.id | string | Identifier for the container used in this request |
| container.expires_at | string | The time at which the container will expire. |
| container.skills | null | array<object> | Skills loaded in the container |
| content | array<object> | Content generated by the model. This is an array of content blocks, each of which has a `type` that determines its shape. Example: ```json [{ "type": "text", "text": "Hi, I'm Claude." }] ``` If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. For example, if the input `messages` were: ```json [ { "role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun" }, { "role": "assistant", "content": "The best answer is (" } ] ``` Then the response `content` might be: ```json [{ "type": "text", "text": "B)" }] ``` |
| content[].citations | null | array<object> | Citations supporting the text block. The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. |
| content[].text | string | The text generated by the model. |
| content[].type | string | Always `text`. Discriminator that marks this object as a TextBlock in a `type`-tagged union. / Always `thinking`. Discriminator that marks this object as a ThinkingBlock in a `type`-tagged union. / Always `redacted_thinking`. Discriminator that marks this object as a RedactedThinkingBlock in a `type`-tagged union. / Always `tool_use`. Discriminator that marks this object as a ToolUseBlock in a `type`-tagged union. / Always `server_tool_use`. Discriminator that marks this object as a ServerToolUseBlock in a `type`-tagged union. / Always `web_search_tool_result`. Discriminator that marks this object as a WebSearchToolResultBlock in a `type`-tagged union. / Always `web_fetch_tool_result`. Discriminator that marks this object as a WebFetchToolResultBlock in a `type`-tagged union. / Always `code_execution_tool_result`. Discriminator that marks this object as a CodeExecutionToolResultBlock in a `type`-tagged union. / Always `bash_code_execution_tool_result`. Discriminator that marks this object as a BashCodeExecutionToolResultBlock in a `type`-tagged union. / Always `text_editor_code_execution_tool_result`. Discriminator that marks this object as a TextEditorCodeExecutionToolResultBlock in a `type`-tagged union. / Always `tool_search_tool_result`. Discriminator that marks this object as a ToolSearchToolResultBlock in a `type`-tagged union. / Always `container_upload`. Discriminator that marks this object as a ContainerUploadBlock in a `type`-tagged union. |
| content[].signature | string | A value used to verify that this thinking block was generated by Claude when it is passed back to the API. This is an opaque field and should not be interpreted or parsed. When passing thinking blocks back to the API (required when using tools with extended thinking), pass them back exactly as received, with this field intact. See extended thinking for details. |
| content[].thinking | string | The text of Claude's thinking process for this block. |
| content[].data | string | The contents of this redacted thinking block, returned when portions of the model's thinking were safety-redacted. This field is opaque and encrypted, with no readable content. Pass `redacted_thinking` blocks back to the API unchanged when continuing a multi-turn conversation. See extended thinking for details. |
| content[].id | string | Id of the tool call; send it back as tool_use_id in the tool_result block that answers it. / Id of the server tool call; the matching result block repeats it as tool_use_id. |
| content[].caller | object | Which party invoked the tool: the model directly or a code execution tool. / Which party invoked the server tool: the model directly or a code execution tool. / Which party invoked the search: the model directly or a code execution tool. / Which party invoked the fetch: the model directly or a code execution tool. |
| content[].input | any | Arguments the model chose, as a JSON object that follows the tool's input_schema. / Arguments the model passed to the server tool, as a JSON object. |
| content[].name | string | Name of the tool the model wants to call. / Name of the server tool the model called, such as web_search, web_fetch or code_execution. |
| content[].toolset_name | null | string | For a toolset member tool_use, the toolset family. |
| content[].content | object | array<object> | object | object | object | object | object | Search results (array of web_search_result blocks) or an error object. / The fetched document or an error object. / Result of the code execution: a result block, an encrypted result block, or an error object. / Result of the bash command: a result block or an error object. / Result of the text editor command: a view, create or str_replace result block, or an error object. / Result of the tool search: a search result block that lists tool references, or an error object. |
| content[].tool_use_id | string | Id of the web_search server tool call this result belongs to. / Id of the web_fetch server tool call this result belongs to. / Id of the code_execution server tool call this result belongs to. / Id of the bash_code_execution server tool call this result belongs to. / Id of the text_editor_code_execution server tool call this result belongs to. / Id of the tool search server tool call this result belongs to. |
| content[].file_id | string | Id of the file that was uploaded into the code execution container. |
| model | string | The model that will complete your prompt. See models for additional details and options. |
| role | string | Conversational role of the generated message. This will always be `"assistant"`. |
| stop_details | null | object | Structured information about a refusal. |
| stop_details.category | null | string | The policy category that triggered a refusal. - `cyber` - The request could enable cyber harm, such as malware or exploit development. Benign cybersecurity work can also trigger this category. - `bio` - The request could enable biological harm, such as dangerous lab methods. Beneficial life sciences work can also trigger this category. - `frontier_llm` - The request could assist the development of competing AI models, which is restricted under Anthropic's commercial terms. Benign machine learning work can also trigger this category. - `reasoning_extraction` - The request asks the model to reproduce its internal reasoning in the response text. To get reasoning in a structured form instead, use adaptive thinking. - `general_harms` - The request could be related to an area that was determined as harmful. Benign work might sometimes trigger this category. |
| stop_details.explanation | null | string | Human-readable explanation of the refusal. This text is not guaranteed to be stable. `null` when no explanation is available for the category. |
| stop_details.type | string | Always `refusal`. Discriminator that marks this object as a RefusalStopDetails in a `type`-tagged union. |
| stop_reason | null | string | The reason that we stopped. This may be one the following values: - `"end_turn"`: the model reached a natural stopping point - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated - `"tool_use"`: the model invoked one or more tools - `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. - `"refusal"`: when streaming classifiers intervene to handle potential policy violations - `"model_context_window_exceeded"`: we exceeded the model's context window In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. |
| stop_sequence | null | string | Which custom stop sequence was generated, if any. This value will be a non-null string if one of your custom stop sequences was generated. |
| type | string | Object type. For Messages, this is always `"message"`. |
| usage | object | Billing and rate-limit usage. Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. For example, `output_tokens` will be non-zero, even for an empty string response from Claude. Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. |
| usage.cache_creation | null | object | Breakdown of cached tokens by TTL |
| usage.cache_creation_input_tokens | null | number | The number of input tokens used to create the cache entry. |
| usage.cache_read_input_tokens | null | number | The number of input tokens read from the cache. |
| usage.inference_geo | null | string | The geographic region where inference was performed for this request. |
| usage.input_tokens | number | The number of input tokens which were used. |
| usage.output_tokens | number | The number of output tokens which were used. |
| usage.output_tokens_details | null | object | Breakdown of output tokens by category. `output_tokens` remains the inclusive, authoritative total used for billing. This object provides a read-only decomposition for observability — for example, how many of the billed output tokens were spent on internal reasoning that may have been summarized before being returned to you. |
| usage.server_tool_use | null | object | The number of server tool requests. |
| usage.service_tier | null | string | If the request used the priority, standard, or batch tier. |
text/event-stream — chunk / 事件对象
| 名称 | 类型 | 说明 |
|---|---|---|
| delta | object | Final fields of the message sent with message_delta: why generation stopped and the container. / The incremental change to the content block at index. |
| delta.container | null | object | Information about the container used in the request (for the code execution tool) |
| delta.stop_details | null | object | Structured information about a refusal. |
| delta.stop_reason | null | string | Why the model stopped; null while the message is still generating. |
| delta.stop_sequence | null | string | The custom stop sequence that was matched; null unless stop_reason is stop_sequence. |
| delta.text | string | Text fragment to append to the text block. |
| delta.type | string | Always `text_delta`. Discriminator that marks this object as a TextDelta in a `type`-tagged union. / Always `input_json_delta`. Discriminator that marks this object as a InputJSONDelta in a `type`-tagged union. / Always `citations_delta`. Discriminator that marks this object as a CitationsDelta in a `type`-tagged union. / Always `thinking_delta`. Discriminator that marks this object as a ThinkingDelta in a `type`-tagged union. / Always `signature_delta`. Discriminator that marks this object as a SignatureDelta in a `type`-tagged union. |
| delta.partial_json | string | Fragment of the tool input JSON string; concatenate all fragments of a block and parse the result when the block stops. |
| delta.citation | object | The citation to attach to the text block being streamed. |
| delta.thinking | string | The incremental `thinking` text for this content block. Concatenate the `thinking` values of successive `thinking_delta` events to assemble the block's full `thinking` value. |
| delta.signature | string | The `signature` for this thinking block: an opaque value used to verify that the block was generated by Claude when it is passed back to the API. Delivered in a `signature_delta` event just before the block's `content_block_stop` event. |
| type | string | Always `message_delta`. Discriminator that marks this object as a RawMessageDeltaEvent in a `type`-tagged union. / Always `content_block_delta`. Discriminator that marks this object as a RawContentBlockDeltaEvent in a `type`-tagged union. / Always `message_start`. Discriminator that marks this object as a RawMessageStartEvent in a `type`-tagged union. / Always `message_stop`. Discriminator that marks this object as a RawMessageStopEvent in a `type`-tagged union. / Always `content_block_start`. Discriminator that marks this object as a RawContentBlockStartEvent in a `type`-tagged union. / Always `content_block_stop`. Discriminator that marks this object as a RawContentBlockStopEvent in a `type`-tagged union. |
| usage | object | Billing and rate-limit usage. Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. For example, `output_tokens` will be non-zero, even for an empty string response from Claude. Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. |
| usage.cache_creation_input_tokens | null | number | The cumulative number of input tokens used to create the cache entry. |
| usage.cache_read_input_tokens | null | number | The cumulative number of input tokens read from the cache. |
| usage.input_tokens | null | number | The cumulative number of input tokens which were used. |
| usage.output_tokens | number | The cumulative number of output tokens which were used. |
| usage.output_tokens_details | null | object | Breakdown of output tokens by category. `output_tokens` remains the inclusive, authoritative total used for billing. This object provides a read-only decomposition for observability — for example, how many of the billed output tokens were spent on internal reasoning that may have been summarized before being returned to you. |
| usage.server_tool_use | null | object | The number of server tool requests. |
| index | number | Zero-based index of the content block this delta applies to. / Zero-based index of the content block that starts. / Zero-based index of the content block that ends. |
| message | object | The complete Message object being started; its content is empty at message_start and filled by the following content_block events. |
| message.id | string | Unique object identifier. The format and length of IDs may change over time. |
| message.container | null | object | Information about the container used in the request (for the code execution tool) |
| message.content | array<object> | Content generated by the model. This is an array of content blocks, each of which has a `type` that determines its shape. Example: ```json [{ "type": "text", "text": "Hi, I'm Claude." }] ``` If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. For example, if the input `messages` were: ```json [ { "role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun" }, { "role": "assistant", "content": "The best answer is (" } ] ``` Then the response `content` might be: ```json [{ "type": "text", "text": "B)" }] ``` |
| message.model | string | The model that will complete your prompt. See models for additional details and options. |
| message.role | string | Conversational role of the generated message. This will always be `"assistant"`. |
| message.stop_details | null | object | Structured information about a refusal. |
| message.stop_reason | null | string | The reason that we stopped. This may be one the following values: - `"end_turn"`: the model reached a natural stopping point - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated - `"tool_use"`: the model invoked one or more tools - `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. - `"refusal"`: when streaming classifiers intervene to handle potential policy violations - `"model_context_window_exceeded"`: we exceeded the model's context window In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. |
| message.stop_sequence | null | string | Which custom stop sequence was generated, if any. This value will be a non-null string if one of your custom stop sequences was generated. |
| message.type | string | Object type. For Messages, this is always `"message"`. |
| message.usage | object | Billing and rate-limit usage. Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. For example, `output_tokens` will be non-zero, even for an empty string response from Claude. Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. |
| content_block | object | The content block as it starts, with empty text or input to be filled by deltas. |
| content_block.citations | null | array<object> | Citations supporting the text block. The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. |
| content_block.text | string | The text generated by the model. |
| content_block.type | string | Always `text`. Discriminator that marks this object as a TextBlock in a `type`-tagged union. / Always `thinking`. Discriminator that marks this object as a ThinkingBlock in a `type`-tagged union. / Always `redacted_thinking`. Discriminator that marks this object as a RedactedThinkingBlock in a `type`-tagged union. / Always `tool_use`. Discriminator that marks this object as a ToolUseBlock in a `type`-tagged union. / Always `server_tool_use`. Discriminator that marks this object as a ServerToolUseBlock in a `type`-tagged union. / Always `web_search_tool_result`. Discriminator that marks this object as a WebSearchToolResultBlock in a `type`-tagged union. / Always `web_fetch_tool_result`. Discriminator that marks this object as a WebFetchToolResultBlock in a `type`-tagged union. / Always `code_execution_tool_result`. Discriminator that marks this object as a CodeExecutionToolResultBlock in a `type`-tagged union. / Always `bash_code_execution_tool_result`. Discriminator that marks this object as a BashCodeExecutionToolResultBlock in a `type`-tagged union. / Always `text_editor_code_execution_tool_result`. Discriminator that marks this object as a TextEditorCodeExecutionToolResultBlock in a `type`-tagged union. / Always `tool_search_tool_result`. Discriminator that marks this object as a ToolSearchToolResultBlock in a `type`-tagged union. / Always `container_upload`. Discriminator that marks this object as a ContainerUploadBlock in a `type`-tagged union. |
| content_block.signature | string | A value used to verify that this thinking block was generated by Claude when it is passed back to the API. This is an opaque field and should not be interpreted or parsed. When passing thinking blocks back to the API (required when using tools with extended thinking), pass them back exactly as received, with this field intact. See extended thinking for details. |
| content_block.thinking | string | The text of Claude's thinking process for this block. |
| content_block.data | string | The contents of this redacted thinking block, returned when portions of the model's thinking were safety-redacted. This field is opaque and encrypted, with no readable content. Pass `redacted_thinking` blocks back to the API unchanged when continuing a multi-turn conversation. See extended thinking for details. |
| content_block.id | string | Id of the tool call; send it back as tool_use_id in the tool_result block that answers it. / Id of the server tool call; the matching result block repeats it as tool_use_id. |
| content_block.caller | object | Which party invoked the tool: the model directly or a code execution tool. / Which party invoked the server tool: the model directly or a code execution tool. / Which party invoked the search: the model directly or a code execution tool. / Which party invoked the fetch: the model directly or a code execution tool. |
| content_block.input | any | Arguments the model chose, as a JSON object that follows the tool's input_schema. / Arguments the model passed to the server tool, as a JSON object. |
| content_block.name | string | Name of the tool the model wants to call. / Name of the server tool the model called, such as web_search, web_fetch or code_execution. |
| content_block.toolset_name | null | string | For a toolset member tool_use, the toolset family. |
| content_block.content | object | array<object> | object | object | object | object | object | Search results (array of web_search_result blocks) or an error object. / The fetched document or an error object. / Result of the code execution: a result block, an encrypted result block, or an error object. / Result of the bash command: a result block or an error object. / Result of the text editor command: a view, create or str_replace result block, or an error object. / Result of the tool search: a search result block that lists tool references, or an error object. |
| content_block.tool_use_id | string | Id of the web_search server tool call this result belongs to. / Id of the web_fetch server tool call this result belongs to. / Id of the code_execution server tool call this result belongs to. / Id of the bash_code_execution server tool call this result belongs to. / Id of the text_editor_code_execution server tool call this result belongs to. / Id of the tool search server tool call this result belongs to. |
| content_block.file_id | string | Id of the file that was uploaded into the code execution container. |
/anthropic/v1/messages/count_tokens◐ 部分支持modelstring必填Body param: The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.
必填并校验存在性,用于选择原生线路和本地分词器。
messagesarray必填◐ 部分支持Body param: Input messages. Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn. Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages. If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response. Example with a single `user` message: ```json [{ "role": "user", "content": "Hello, Claude" }] ``` Example with multiple conversational turns: ```json [ { "role": "user", "content": "Hello there." }, { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" }, { "role": "user", "content": "Can you explain LLMs in plain English?" } ] ``` Example with a partially-filled response from Claude: ```json [ { "role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun" }, { "role": "assistant", "content": "The best answer is (" } ] ``` Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent: ```json { "role": "user", "content": "Hello, Claude" } ``` ```json { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] } ``` See [input examples](https://platform.claude.com/docs/en/build-with-claude/working-with-messages). Note that if you want to include a [system prompt](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. There is a limit of 100,000 messages in a single request.
原生路径保留消息;本地使用 o200k 或按模型族校准的估算,图片按已知模型规则估算,未知尺寸使用近似额度;不下载图片 URL。
contentstring | array必填Message content: a plain string (shorthand for one text block) or an array of content blocks such as text, image, document, tool_use and tool_result.
rolestring必填Who produced the message. Use user for your turns and assistant to replay earlier model turns; system-role messages are accepted by the shape but system instructions normally go in the top-level system field.
systemstring | array可选◐ 部分支持Body param: System prompt. A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role).
原生透传;本地计入估算。
toolsarray可选◐ 部分支持Body param: Definitions of tools that the model may use. If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks. There are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool)). Each tool definition includes: - `name`: Name of the tool. - `description`: Optional, but strongly-recommended description of the tool. - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks. For example, if you defined `tools` as: ```json [ { "name": "get_stock_price", "description": "Get the current stock price for a given ticker symbol.", "input_schema": { "type": "object", "properties": { "ticker": { "type": "string", "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." } }, "required": ["ticker"] } } ] ``` And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this: ```json [ { "type": "tool_use", "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", "name": "get_stock_price", "input": { "ticker": "^GSPC" } } ] ``` You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message: ```json [ { "type": "tool_result", "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", "content": "259.75 USD" } ] ``` Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output. See our [guide](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview) for more details.
原生透传;本地计入定义与包装的估算。
tool_choiceobject可选◐ 部分支持Body param: How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all.
原生透传;本地计入估算。
typestring必填Disable tool calls for this request.
disable_parallel_tool_useboolean可选Whether to disable parallel tool use. Defaults to `false`. If set to `true`, the model will output exactly one tool use.
namestring必填The name of the tool to use.
cache_controlobject可选◐ 部分支持Body param: Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request.
原生路径保留消息内标记;计数不能预测缓存命中或计费。
typestring必填Always `ephemeral`. Discriminator that marks this object as a CacheControlEphemeral in a `type`-tagged union.
ttlstring可选The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
output_configobject可选◐ 部分支持Body param: Configuration options for the model's output, such as the output format.
原生路径透传;本地不承诺其附加模板的精确计数。
effortstring可选All possible effort levels.
formatobject可选A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
thinkingobject可选◐ 部分支持Body param: Configuration for enabling Claude's extended thinking. When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit. See [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) for details.
原生路径透传;本地不承诺思考模板精确计数。
budget_tokensnumber必填Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality. Must be ≥1024 and less than `max_tokens`. See [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) for details.
typestring必填Let the model choose its reasoning budget, subject to output_config.effort when supplied.
displaystring可选Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`.
200
按模型族校准的估算值(包括中文和工具定义),响应头为 x-praxis-token-count: estimated;不能用作精确用量或计费依据。
错误按 Anthropic 格式返回,参见 错误码
Token count
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| input_tokens | number | The total number of tokens across the provided list of messages, system prompt, and tools. |
/anthropic/v1/models● 支持limitnumber可选query: Number of items per page.
已验证生效。
before_idstring可选query:
已验证生效。
after_idstring可选query:
已验证生效。
200
始终返回 capabilities、max_input_tokens、max_tokens;目录无法确定的值为 null,不将总上下文窗口冒充独立输入上限。非空 anthropic-workspace-id 返回 400;尚不按 anthropic-beta 选择目录版本。
错误按 Anthropic 格式返回,参见 错误码
Models listed
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | |
| data[].id | string | Unique model identifier. |
| data[].capabilities | null | object | Model capability information. |
| data[].created_at | string | RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown. |
| data[].display_name | string | A human-readable name for the model. |
| data[].max_input_tokens | null | number | Maximum input context window size in tokens for this model. |
| data[].max_tokens | null | number | Maximum value for the `max_tokens` parameter when using this model. |
| data[].type | string | Object type. For Models, this is always `"model"`. |
| has_more | boolean | |
| first_id | null | string | |
| last_id | null | string |
/anthropic/v1/files● 支持filestring必填◐ 部分支持Body param: The file to upload. Only the final path component of the part's `filename` is kept; an absent or empty `filename` is replaced with `unnamed` plus the extension for the file's stored `mime_type`, when known.
支持文本、PDF 和 PNG;按文件内容识别类型,不支持任意二进制。
expires_in_secondsnumber可选◐ 部分支持Body param: Seconds from upload until the file expires and its bytes become permanently unavailable. Must be between 3600 (one hour) and 7776000 (ninety days).
表单字段支持 3600–7776000 秒;作为查询参数传入返回 400,提示改放表单。
200
SDK 0.128.0 上传参数为表单 file 和可选的表单 expires_in_seconds(3600–7776000 秒)。其他表单字段(包括 purpose)返回 400 invalid_request_error,消息形如 "purpose: Extra inputs are not permitted";查询参数只接受 SDK 自带的 beta,其他查询参数返回 400,查询参数 expires_in_seconds 会提示改放表单。平台将上传文件记为 user_data;不支持 anthropic-workspace-id,请求携带该头时返回 400。
错误按 Anthropic 格式返回,参见 错误码
File uploaded
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique object identifier. The format and length of IDs may change over time. |
| created_at | string | RFC 3339 datetime string representing when the file was created. |
| filename | string | Original filename of the uploaded file. |
| mime_type | string | MIME type of the file. |
| size_bytes | number | Size of the file in bytes. |
| type | string | Object type. For files, this is always `"file"`. |
| downloadable | boolean | Whether the file can be downloaded. |
| expires_at | null | string | RFC 3339 datetime string representing when the file will expire and become unavailable for download. Null if the file does not expire. For files uploaded with `expires_in_seconds`, this is the upload time plus that value. |
| scope | null | object | The scope of this file, indicating the context in which it was created (e.g., a session). |
| scope.id | string | The ID of the scoping resource (e.g., the session ID). |
| scope.type | string | The type of scope (e.g., `"session"`). |
/anthropic/v1/files● 支持idsarray可选query: Query param: Restrict the result set to Files whose `id` is in this list. At most 100 entries (after de-duplication). Mutually exclusive with `page` and `limit`. When supplied, the response is always a single page (`next_page` is null). IDs that do not resolve to a visible File — including deleted Files — are silently omitted.
已验证生效。
scope_idstring可选◐ 部分支持query: Query param: Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID).
需要 anthropic-beta: managed-agents-2026-04-01。非法 scope_id 返回 400,不存在的会话范围返回 404。
limitnumber可选query: Number of items per page.
已验证生效。
pagestring可选query:
已验证生效。
after_idstring可选query: Return the page of files immediately after this file id (older files).
返回该文件之后(更早创建)的一页;不能与 before_id 或 page 同时使用。
before_idstring可选query: Return the page of files immediately before this file id (newer files).
返回该文件之前(更新创建)的一页;不能与 after_id 或 page 同时使用。
200
按创建时间从新到旧排列。用 after_id / before_id 与 limit 分页(两者同时给返回 400),也可以用 page 游标(next_page);三者只能选一个。响应包含 data、has_more、first_id、last_id 与 next_page。ids(最多 100 个去重 ID)与 page、after_id、before_id、limit 互斥。scope_id 需要 anthropic-beta: managed-agents-2026-04-01 请求头;缺少该头返回 400,不存在的会话范围返回 404。anthropic-workspace-id 返回 400。
错误按 Anthropic 格式返回,参见 错误码
Files listed
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | |
| data[].id | string | Unique object identifier. The format and length of IDs may change over time. |
| data[].created_at | string | RFC 3339 datetime string representing when the file was created. |
| data[].filename | string | Original filename of the uploaded file. |
| data[].mime_type | string | MIME type of the file. |
| data[].size_bytes | number | Size of the file in bytes. |
| data[].type | string | Object type. For files, this is always `"file"`. |
| data[].downloadable | boolean | Whether the file can be downloaded. |
| data[].expires_at | null | string | RFC 3339 datetime string representing when the file will expire and become unavailable for download. Null if the file does not expire. For files uploaded with `expires_in_seconds`, this is the upload time plus that value. |
| data[].scope | null | object | The scope of this file, indicating the context in which it was created (e.g., a session). |
| next_page | null | string |
先调用「上传文件」,用返回的文件 ID 替换示例文件 ID。
Metadata
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique object identifier. The format and length of IDs may change over time. |
| created_at | string | RFC 3339 datetime string representing when the file was created. |
| filename | string | Original filename of the uploaded file. |
| mime_type | string | MIME type of the file. |
| size_bytes | number | Size of the file in bytes. |
| type | string | Object type. For files, this is always `"file"`. |
| downloadable | boolean | Whether the file can be downloaded. |
| expires_at | null | string | RFC 3339 datetime string representing when the file will expire and become unavailable for download. Null if the file does not expire. For files uploaded with `expires_in_seconds`, this is the upload time plus that value. |
| scope | null | object | The scope of this file, indicating the context in which it was created (e.g., a session). |
| scope.id | string | The ID of the scoping resource (e.g., the session ID). |
| scope.type | string | The type of scope (e.g., `"session"`). |
加载中…agent_… ID。agent 替换为该 ID,保存 sesn_… ID。agent.message 后等待 session.status_idle;也可查询历史事件。SDK 基础地址就是上面的基础地址。每个请求均需 API Key、anthropic-version: 2023-06-01 和 anthropic-beta: managed-agents-2026-04-01。在线试调会自动带上这些协议头,资源 ID 需自行替换。
官方 95 个操作已全部声明:其中 41 个已支持或部分支持(见端点清单徽标);其余 54 个平台尚未实现,调用如实返回 501(not_implemented_error,响应带 x-should-retry: false),不产生任何副作用、不计费。各项能力与凭据库的具体限制见端点说明。
| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| POST | /v1/agents | 创建智能体 | ◐ 部分支持 |
| GET | /v1/agents | 列出智能体 | ● 支持 |
| GET | /v1/agents/{agent_id} | 读取智能体 | ● 支持 |
| POST | /v1/agents/{agent_id} | 更新智能体 | ◐ 部分支持 |
| GET | /v1/agents/{agent_id}/versions | 列出版本 | ● 支持 |
| POST | /v1/agents/{agent_id}/archive | 归档智能体 | ● 支持 |
| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| POST | /v1/sessions | 创建会话 | ◐ 部分支持 |
| GET | /v1/sessions | 列出会话 | ◐ 部分支持 |
| GET | /v1/sessions/{session_id} | 读取会话 | ● 支持 |
| POST | /v1/sessions/{session_id}/events | 发送事件 | ◐ 部分支持 |
| GET | /v1/sessions/{session_id}/events | 列出事件 | ● 支持 |
| GET | /v1/sessions/{session_id}/events/stream | 订阅事件 | ◐ 部分支持 |
| POST | /v1/sessions/{session_id} | 更新会话 | ◐ 部分支持 |
| DELETE | /v1/sessions/{session_id} | 删除会话 | ○ 未支持 |
| POST | /v1/sessions/{session_id}/archive | 归档会话 | ● 支持 |
| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| GET | /v1/deployment_runs | 列出部署运行 | ○ 未支持 |
| GET | /v1/deployment_runs/{deployment_run_id} | 读取部署运行 | ○ 未支持 |
| GET | /v1/deployments | 列出部署 | ○ 未支持 |
| POST | /v1/deployments | 创建部署 | ○ 未支持 |
| GET | /v1/deployments/{deployment_id} | 读取部署 | ○ 未支持 |
| POST | /v1/deployments/{deployment_id} | 更新部署 | ○ 未支持 |
| POST | /v1/deployments/{deployment_id}/archive | 归档部署 | ○ 未支持 |
| POST | /v1/deployments/{deployment_id}/pause | 暂停部署 | ○ 未支持 |
| POST | /v1/deployments/{deployment_id}/run | 运行部署 | ○ 未支持 |
| POST | /v1/deployments/{deployment_id}/unpause | 恢复部署 | ○ 未支持 |
| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| GET | /v1/environments | 列出环境 | ◐ 部分支持 |
| POST | /v1/environments | 创建环境 | ◐ 部分支持 |
| DELETE | /v1/environments/{environment_id} | 删除环境 | ○ 未支持 |
| GET | /v1/environments/{environment_id} | 读取环境 | ◐ 部分支持 |
| POST | /v1/environments/{environment_id} | 更新环境 | ◐ 部分支持 |
| POST | /v1/environments/{environment_id}/archive | 归档环境 | ◐ 部分支持 |
| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| GET | /v1/environments/{environment_id}/work | 列出工作项 | ○ 未支持 |
| GET | /v1/environments/{environment_id}/work/{work_id} | 读取工作项 | ○ 未支持 |
| POST | /v1/environments/{environment_id}/work/{work_id} | 更新工作项 | ○ 未支持 |
| POST | /v1/environments/{environment_id}/work/{work_id}/ack | 确认工作项 | ○ 未支持 |
| POST | /v1/environments/{environment_id}/work/{work_id}/heartbeat | 工作项心跳 | ○ 未支持 |
| POST | /v1/environments/{environment_id}/work/{work_id}/stop | 停止工作项 | ○ 未支持 |
| GET | /v1/environments/{environment_id}/work/poll | 轮询工作项 | ○ 未支持 |
| GET | /v1/environments/{environment_id}/work/stats | 工作项统计 | ○ 未支持 |
| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| GET | /v1/memory_stores | 列出记忆库 | ○ 未支持 |
| POST | /v1/memory_stores | 创建记忆库 | ○ 未支持 |
| DELETE | /v1/memory_stores/{memory_store_id} | 删除记忆库 | ○ 未支持 |
| GET | /v1/memory_stores/{memory_store_id} | 读取记忆库 | ○ 未支持 |
| POST | /v1/memory_stores/{memory_store_id} | 更新记忆库 | ○ 未支持 |
| POST | /v1/memory_stores/{memory_store_id}/archive | 归档记忆库 | ○ 未支持 |
| GET | /v1/memory_stores/{memory_store_id}/memories | 列出记忆 | ○ 未支持 |
| POST | /v1/memory_stores/{memory_store_id}/memories | 创建记忆 | ○ 未支持 |
| DELETE | /v1/memory_stores/{memory_store_id}/memories/{memory_id} | 删除记忆 | ○ 未支持 |
| GET | /v1/memory_stores/{memory_store_id}/memories/{memory_id} | 读取记忆 | ○ 未支持 |
| POST | /v1/memory_stores/{memory_store_id}/memories/{memory_id} | 更新记忆 | ○ 未支持 |
| GET | /v1/memory_stores/{memory_store_id}/memory_versions | 列出记忆版本 | ○ 未支持 |
| GET | /v1/memory_stores/{memory_store_id}/memory_versions/{memory_version_id} | 读取记忆版本 | ○ 未支持 |
| POST | /v1/memory_stores/{memory_store_id}/memory_versions/{memory_version_id}/redact | 抹除记忆版本 | ○ 未支持 |
| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| GET | /v1/sessions/{session_id}/resources | 列出会话资源 | ◐ 部分支持 |
| POST | /v1/sessions/{session_id}/resources | 添加会话资源 | ◐ 部分支持 |
| DELETE | /v1/sessions/{session_id}/resources/{resource_id} | 删除会话资源 | ◐ 部分支持 |
| GET | /v1/sessions/{session_id}/resources/{resource_id} | 读取会话资源 | ◐ 部分支持 |
| POST | /v1/sessions/{session_id}/resources/{resource_id} | 更新会话资源 | ○ 未支持 |
| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| GET | /v1/sessions/{session_id}/threads | 列出线程 | ◐ 部分支持 |
| GET | /v1/sessions/{session_id}/threads/{thread_id} | 读取线程 | ◐ 部分支持 |
| POST | /v1/sessions/{session_id}/threads/{thread_id}/archive | 归档线程 | ◐ 部分支持 |
| GET | /v1/sessions/{session_id}/threads/{thread_id}/events | 列出线程事件 | ◐ 部分支持 |
| GET | /v1/sessions/{session_id}/threads/{thread_id}/stream | 订阅线程事件 | ◐ 部分支持 |
| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| GET | /v1/skills | 列出技能 | ○ 未支持 |
| POST | /v1/skills | 创建技能 | ○ 未支持 |
| DELETE | /v1/skills/{skill_id} | 删除技能 | ○ 未支持 |
| GET | /v1/skills/{skill_id} | 读取技能 | ○ 未支持 |
| GET | /v1/skills/{skill_id}/versions | 列出技能版本 | ○ 未支持 |
| POST | /v1/skills/{skill_id}/versions | 创建技能版本 | ○ 未支持 |
| DELETE | /v1/skills/{skill_id}/versions/{version} | 删除技能版本 | ○ 未支持 |
| GET | /v1/skills/{skill_id}/versions/{version} | 读取技能版本 | ○ 未支持 |
| GET | /v1/skills/{skill_id}/versions/{version}/content | 下载技能版本内容 | ○ 未支持 |
| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| GET | /v1/tunnels | 列出隧道 | ○ 未支持 |
| POST | /v1/tunnels | 创建隧道 | ○ 未支持 |
| GET | /v1/tunnels/{tunnel_id} | 读取隧道 | ○ 未支持 |
| POST | /v1/tunnels/{tunnel_id}/archive | 归档隧道 | ○ 未支持 |
| GET | /v1/tunnels/{tunnel_id}/certificates | 列出隧道证书 | ○ 未支持 |
| POST | /v1/tunnels/{tunnel_id}/certificates | 创建隧道证书 | ○ 未支持 |
| GET | /v1/tunnels/{tunnel_id}/certificates/{certificate_id} | 读取隧道证书 | ○ 未支持 |
| POST | /v1/tunnels/{tunnel_id}/certificates/{certificate_id}/archive | 归档隧道证书 | ○ 未支持 |
| POST | /v1/tunnels/{tunnel_id}/reveal_token | 显示隧道令牌 | ○ 未支持 |
| POST | /v1/tunnels/{tunnel_id}/rotate_token | 轮换隧道令牌 | ○ 未支持 |
| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| GET | /v1/vaults | 列出凭据库 | ● 支持 |
| POST | /v1/vaults | 创建凭据库 | ● 支持 |
| DELETE | /v1/vaults/{vault_id} | 删除凭据库 | ● 支持 |
| GET | /v1/vaults/{vault_id} | 读取凭据库 | ● 支持 |
| POST | /v1/vaults/{vault_id} | 更新凭据库 | ● 支持 |
| POST | /v1/vaults/{vault_id}/archive | 归档凭据库 | ● 支持 |
| GET | /v1/vaults/{vault_id}/credentials | 列出凭据 | ◐ 部分支持 |
| POST | /v1/vaults/{vault_id}/credentials | 创建凭据 | ◐ 部分支持 |
| DELETE | /v1/vaults/{vault_id}/credentials/{credential_id} | 删除凭据 | ◐ 部分支持 |
| GET | /v1/vaults/{vault_id}/credentials/{credential_id} | 读取凭据 | ◐ 部分支持 |
| POST | /v1/vaults/{vault_id}/credentials/{credential_id} | 更新凭据 | ◐ 部分支持 |
| POST | /v1/vaults/{vault_id}/credentials/{credential_id}/archive | 归档凭据 | ◐ 部分支持 |
| POST | /v1/vaults/{vault_id}/credentials/{credential_id}/mcp_oauth_validate | 校验凭据 MCP OAuth | ◐ 部分支持 |
参数与字段的权威定义以 Claude Managed Agents 官方文档为准。
/anthropic/v1/agents◐ 部分支持namestring必填智能体名称,1–255 个字符,工作区内可读。
modelstring | object必填智能体使用的模型:直接写模型名字符串(如 claude-opus-5),或传对象做附加配置(见子字段)。
idstring必填模型名字符串,如 claude-opus-5。
effortstring | object可选每次推理的思考力度:可传级别字符串(如 high)或 {type: high} 对象。创建时省略取该模型的默认值;更新时省略保持不变。
inference_geostring可选模型推理的地理区域;不传沿用工作区默认。model 是整体替换字段,更新时省略子字段即清除该项。
speedstring可选推理速度模式:fast 出字显著更快但按溢价计费;并非所有模型都支持,不支持的组合在创建时被拒。
systemstring可选智能体的系统提示词。
descriptionstring可选智能体的用途说明。
mcp_serversarray可选○ 未支持智能体连接的 MCP 服务器列表,最多 20 个,名称必须唯一;每个服务器都要被 tools 里的 mcp_toolset 引用,否则整笔请求被拒。
namestring必填MCP 服务器在本列表内的唯一名称,1–255 个字符,供 mcp_toolset 配置引用。
typestring必填服务器类型,目前只支持 url。
urlstring必填MCP 服务器的端点地址。
metadataobject可选自定义元数据键值对,最多 16 个键、每个值最长 512 字符。
multiagentobject可选多智能体协作拓扑:会话主线程作为协调者,从 agents 名单派生会话线程执行工作。
agentsarray必填协调者可以派生为会话线程的智能体名单,1–20 项;支持 ID 字符串、{type: agent, id, version?} 和最多一个 {type: self}。创建/更新时固定版本。成员须唯一、存在且未归档,不能自身带 multiagent。每个 coordinator 最多一个 advisor,模型须可用且不同于智能体模型;仅主会话可咨询,每次咨询为独立 advisor 线程,建议以 agent.thread_message_received 返回。
typestring必填拓扑类型,目前只有 coordinator。
skillsarray可选○ 未支持智能体可用的 Skill 列表。
toolsarray可选智能体可用的工具配置,所有工具合计最多 128 个。
200
支持文本提示词、模型、元数据与内置工具。MCP、Skills 及额外模型控制尚不支持,传入会返回 400。 multiagent 接受 null 或 coordinator 名册,1–20 项:智能体 ID、{type:"agent",id,version?} 或最多一个 {type:"self"}。创建/更新时固定版本;成员去重且须存在、未归档、不能自身带 multiagent。兼容 API 只提供 bash、edit、glob、grep、read、write、web_search、web_fetch 这 8 个官方工具;configs 不接受其他工具名,经此入口创建的会话不提供后台任务、Monitor 或子智能体。完整原生工具请使用 /agent/v1。每个 coordinator 最多一个 advisor,模型须可用且不同于智能体模型;仅主会话可咨询,每次咨询为独立 advisor 线程,建议以 agent.thread_message_received 返回。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| description | null | string | |
| mcp_servers | array<object> | |
| mcp_servers[].name | string | |
| mcp_servers[].type | string | |
| mcp_servers[].url | string | |
| metadata | object | |
| model | object | Model identifier and configuration. |
| model.id | string | The model that will power your agent. See models for additional details and options. |
| model.effort | object | How hard Claude works on each turn. Sets `output_config.effort` on every Messages call the session makes. |
| model.inference_geo | string | Geographic region for model inference. When unset, requests fall through to the workspace's default_inference_geo. |
| model.speed | string | Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. |
| multiagent | null | object | Resolved coordinator topology with a concrete agent roster. |
| multiagent.agents | array<object> | Agents the coordinator may spawn as session threads, each resolved to a specific version. |
| multiagent.type | string | |
| name | string | |
| skills | array<object> | |
| skills[].skill_id | string | |
| skills[].type | string | |
| skills[].version | string | |
| system | null | string | |
| tools | array<object> | |
| tools[].configs | array<object> | |
| tools[].default_config | object | Resolved default configuration for agent tools. / Resolved default configuration for all tools from an MCP server. |
| tools[].type | string | |
| tools[].mcp_server_name | string | |
| tools[].description | string | |
| tools[].input_schema | object | JSON Schema for custom tool input parameters. |
| tools[].name | string | |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| version | number | The agent's current version. Starts at 1 and increments when the agent is modified. |
/anthropic/v1/agents● 支持created_at[gte]string可选query: 只返回不早于该时间创建的记录。
created_at[lte]string可选query: 只返回不晚于该时间创建的记录。
include_archivedboolean可选query: 是否包含已归档的记录。
limitnumber可选query: 每页返回的条数上限。
pagestring可选query: 分页游标,取自上一页响应的 next_page。
200
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | |
| data[].id | string | |
| data[].archived_at | null | string | A timestamp in RFC 3339 format |
| data[].created_at | string | A timestamp in RFC 3339 format |
| data[].description | null | string | |
| data[].mcp_servers | array<object> | |
| data[].metadata | object | |
| data[].model | object | Model identifier and configuration. |
| data[].multiagent | null | object | Resolved coordinator topology with a concrete agent roster. |
| data[].name | string | |
| data[].skills | array<object> | |
| data[].system | null | string | |
| data[].tools | array<object> | |
| data[].type | string | |
| data[].updated_at | string | A timestamp in RFC 3339 format |
| data[].version | number | The agent's current version. Starts at 1 and increments when the agent is modified. |
| next_page | string | null |
先调用「创建智能体」,用返回的智能体 ID 替换示例 ID。
/anthropic/v1/agents/{agent_id}● 支持agent_idstring必填path: 按智能体 ID 过滤结果。
versionnumber可选query: 路径参数:版本号。
200
将示例中的资源 ID 替换成你创建的资源 ID。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| description | null | string | |
| mcp_servers | array<object> | |
| mcp_servers[].name | string | |
| mcp_servers[].type | string | |
| mcp_servers[].url | string | |
| metadata | object | |
| model | object | Model identifier and configuration. |
| model.id | string | The model that will power your agent. See models for additional details and options. |
| model.effort | object | How hard Claude works on each turn. Sets `output_config.effort` on every Messages call the session makes. |
| model.inference_geo | string | Geographic region for model inference. When unset, requests fall through to the workspace's default_inference_geo. |
| model.speed | string | Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. |
| multiagent | null | object | Resolved coordinator topology with a concrete agent roster. |
| multiagent.agents | array<object> | Agents the coordinator may spawn as session threads, each resolved to a specific version. |
| multiagent.type | string | |
| name | string | |
| skills | array<object> | |
| skills[].skill_id | string | |
| skills[].type | string | |
| skills[].version | string | |
| system | null | string | |
| tools | array<object> | |
| tools[].configs | array<object> | |
| tools[].default_config | object | Resolved default configuration for agent tools. / Resolved default configuration for all tools from an MCP server. |
| tools[].type | string | |
| tools[].mcp_server_name | string | |
| tools[].description | string | |
| tools[].input_schema | object | JSON Schema for custom tool input parameters. |
| tools[].name | string | |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| version | number | The agent's current version. Starts at 1 and increments when the agent is modified. |
先调用「创建智能体」,用返回的智能体 ID 替换示例 ID。
/anthropic/v1/agents/{agent_id}◐ 部分支持agent_idstring必填path: 按智能体 ID 过滤结果。
namestring可选智能体名称;省略保持不变,不能传空串清除。
modelstring | object可选智能体使用的模型:直接写模型名字符串(如 claude-opus-5),或传对象做附加配置(见子字段)。
idstring必填模型名字符串,如 claude-opus-5。
effortstring | object可选每次推理的思考力度:可传级别字符串(如 high)或 {type: high} 对象。创建时省略取该模型的默认值;更新时省略保持不变。
inference_geostring可选模型推理的地理区域;不传沿用工作区默认。model 是整体替换字段,更新时省略子字段即清除该项。
speedstring可选推理速度模式:fast 出字显著更快但按溢价计费;并非所有模型都支持,不支持的组合在创建时被拒。
systemstring可选系统提示词;省略保持不变,传空串或 null 清除。
descriptionstring可选用途说明;省略保持不变,传空串或 null 清除。
mcp_serversarray可选○ 未支持整体替换的 MCP 服务器列表;省略保持不变,传空数组或 null 清除。
metadataobject可选元数据补丁:键设为字符串即写入,设为 null 即删除;省略该字段保持不变。存储上限 16 个键、每个值 512 字符。
multiagentobject可选多智能体协作拓扑:会话主线程作为协调者,从 agents 名单派生会话线程执行工作。
agentsarray必填协调者可以派生为会话线程的智能体名单,1–20 项;支持 ID 字符串、{type: agent, id, version?} 和最多一个 {type: self}。创建/更新时固定版本。成员须唯一、存在且未归档,不能自身带 multiagent。每个 coordinator 最多一个 advisor,模型须可用且不同于智能体模型;仅主会话可咨询,每次咨询为独立 advisor 线程,建议以 agent.thread_message_received 返回。
typestring必填拓扑类型,目前只有 coordinator。
skillsarray可选○ 未支持整体替换的 Skill 列表;省略保持不变,传空数组或 null 清除。
toolsarray可选整体替换的工具配置;省略保持不变,传空数组或 null 清除。
versionnumber可选智能体当前版本号,用于并发保护:必须与最近一次创建/读取返回的版本一致,否则返回冲突。
200
version 可用于乐观并发控制,版本冲突返回 409;无变化的更新不增加版本。MCP、Skills 尚不支持。 multiagent 接受 null 或 coordinator 名册,1–20 项:智能体 ID、{type:"agent",id,version?} 或最多一个 {type:"self"}。创建/更新时固定版本;成员去重且须存在、未归档、不能自身带 multiagent。兼容 API 只提供 bash、edit、glob、grep、read、write、web_search、web_fetch 这 8 个官方工具;configs 不接受其他工具名,经此入口创建的会话不提供后台任务、Monitor 或子智能体。完整原生工具请使用 /agent/v1。每个 coordinator 最多一个 advisor,模型须可用且不同于智能体模型;仅主会话可咨询,每次咨询为独立 advisor 线程,建议以 agent.thread_message_received 返回。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| description | null | string | |
| mcp_servers | array<object> | |
| mcp_servers[].name | string | |
| mcp_servers[].type | string | |
| mcp_servers[].url | string | |
| metadata | object | |
| model | object | Model identifier and configuration. |
| model.id | string | The model that will power your agent. See models for additional details and options. |
| model.effort | object | How hard Claude works on each turn. Sets `output_config.effort` on every Messages call the session makes. |
| model.inference_geo | string | Geographic region for model inference. When unset, requests fall through to the workspace's default_inference_geo. |
| model.speed | string | Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. |
| multiagent | null | object | Resolved coordinator topology with a concrete agent roster. |
| multiagent.agents | array<object> | Agents the coordinator may spawn as session threads, each resolved to a specific version. |
| multiagent.type | string | |
| name | string | |
| skills | array<object> | |
| skills[].skill_id | string | |
| skills[].type | string | |
| skills[].version | string | |
| system | null | string | |
| tools | array<object> | |
| tools[].configs | array<object> | |
| tools[].default_config | object | Resolved default configuration for agent tools. / Resolved default configuration for all tools from an MCP server. |
| tools[].type | string | |
| tools[].mcp_server_name | string | |
| tools[].description | string | |
| tools[].input_schema | object | JSON Schema for custom tool input parameters. |
| tools[].name | string | |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| version | number | The agent's current version. Starts at 1 and increments when the agent is modified. |
先调用「创建智能体」,用返回的智能体 ID 替换示例 ID。
/anthropic/v1/agents/{agent_id}/versions● 支持agent_idstring必填path: 按智能体 ID 过滤结果。
limitnumber可选query: 每页返回的条数上限。
pagestring可选query: 分页游标,取自上一页响应的 next_page。
200
将示例中的资源 ID 替换成你创建的资源 ID。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | |
| data[].id | string | |
| data[].archived_at | null | string | A timestamp in RFC 3339 format |
| data[].created_at | string | A timestamp in RFC 3339 format |
| data[].description | null | string | |
| data[].mcp_servers | array<object> | |
| data[].metadata | object | |
| data[].model | object | Model identifier and configuration. |
| data[].multiagent | null | object | Resolved coordinator topology with a concrete agent roster. |
| data[].name | string | |
| data[].skills | array<object> | |
| data[].system | null | string | |
| data[].tools | array<object> | |
| data[].type | string | |
| data[].updated_at | string | A timestamp in RFC 3339 format |
| data[].version | number | The agent's current version. Starts at 1 and increments when the agent is modified. |
| next_page | string | null |
先调用「创建智能体」,用返回的智能体 ID 替换示例 ID。
/anthropic/v1/agents/{agent_id}/archive● 支持agent_idstring必填path: 按智能体 ID 过滤结果。
200
归档后保留查询与历史版本,不能继续更新。请只归档自己的测试智能体。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| description | null | string | |
| mcp_servers | array<object> | |
| mcp_servers[].name | string | |
| mcp_servers[].type | string | |
| mcp_servers[].url | string | |
| metadata | object | |
| model | object | Model identifier and configuration. |
| model.id | string | The model that will power your agent. See models for additional details and options. |
| model.effort | object | How hard Claude works on each turn. Sets `output_config.effort` on every Messages call the session makes. |
| model.inference_geo | string | Geographic region for model inference. When unset, requests fall through to the workspace's default_inference_geo. |
| model.speed | string | Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. |
| multiagent | null | object | Resolved coordinator topology with a concrete agent roster. |
| multiagent.agents | array<object> | Agents the coordinator may spawn as session threads, each resolved to a specific version. |
| multiagent.type | string | |
| name | string | |
| skills | array<object> | |
| skills[].skill_id | string | |
| skills[].type | string | |
| skills[].version | string | |
| system | null | string | |
| tools | array<object> | |
| tools[].configs | array<object> | |
| tools[].default_config | object | Resolved default configuration for agent tools. / Resolved default configuration for all tools from an MCP server. |
| tools[].type | string | |
| tools[].mcp_server_name | string | |
| tools[].description | string | |
| tools[].input_schema | object | JSON Schema for custom tool input parameters. |
| tools[].name | string | |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| version | number | The agent's current version. Starts at 1 and increments when the agent is modified. |
先调用「创建智能体」,用返回的智能体 ID 替换示例 ID。
/anthropic/v1/sessions◐ 部分支持agentstring | object必填会话要运行的智能体:直接写智能体 ID 字符串(固定用最新版本),或传对象指定 id 与 version(见子字段)。
idstring必填会话要运行的智能体 ID。
typestring必填引用类型,目前只有 agent。
versionnumber可选固定使用的智能体版本;省略用最新版本。
mcp_serversarray可选替换本会话的 MCP 服务器列表:传入的数组整体生效;传空数组清除,省略沿用智能体的配置。
modelstring | object可选替换本会话的模型:模型名字符串(如 claude-opus-5)或配置对象;省略沿用智能体自身的模型。
skillsarray可选替换本会话的 Skill 列表;传空数组清除,省略沿用智能体的配置。
systemstring可选替换本会话的系统提示词,最长 100,000 字符;传 null 清除,省略沿用智能体的。
toolsarray可选替换本会话的工具配置;传空数组清除,省略沿用智能体的配置。
environment_idstring必填会话运行所在的环境 ID,决定容器的基础环境。
budgetobject可选○ 未支持会话的预算上限设置。
max_list_costobject必填预算内列表类调用的花费上限。
typestring必填预算类型,目前只有 max_list_cost。
initial_eventsarray可选创建时按顺序发给会话的初始事件,支持 user.message 与 user.define_outcome,一次最多 50 条。
metadataobject可选会话的自定义元数据键值对。
resourcesarray可选◐ 部分支持要挂载进会话容器的资源(如代码仓库、文件)。
titlestring可选会话标题,便于在控制台辨认。
vault_idsarray可选○ 未支持保险库 ID 列表:会话里智能体可以使用这些已存凭据。
200
先创建智能体,将示例 agent_123 换成返回的 id。Anthropic 兼容 API 的 environment_id 必填,可用 node22 或租户自建 cloud 环境;/agent/v1 可省略 environment_id 得到轻量机器。不支持内联智能体覆盖、预算与凭据库。 支持 file 类型资源的持久化、查询和解除关联,单会话最多 500 条。文件须属于当前租户且有效。默认路径为 /mnt/session/uploads/<file_id>,自定义路径归一到该目录,拒绝父目录遍历。不修改文件内容;本批尚不将资源同步到沙箱。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| agent | object | Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. |
| agent.id | string | |
| agent.description | null | string | |
| agent.mcp_servers | array<object> | |
| agent.model | object | Model identifier and configuration. |
| agent.multiagent | null | object | Resolved coordinator topology with full agent definitions for each roster member. |
| agent.name | string | |
| agent.skills | array<object> | |
| agent.system | null | string | |
| agent.tools | array<object> | |
| agent.type | string | |
| agent.version | number | |
| archived_at | null | string | A timestamp in RFC 3339 format |
| budget | null | object | A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`. |
| budget.max_list_cost | object | A monetary amount in a specific currency. |
| budget.type | string | |
| created_at | string | A timestamp in RFC 3339 format |
| environment_id | string | |
| metadata | object | |
| outcome_evaluations | array<object> | Per-outcome evaluation state. One entry per `define_outcome` event sent to the session. |
| outcome_evaluations[].completed_at | null | string | A timestamp in RFC 3339 format |
| outcome_evaluations[].description | string | What the agent should produce. |
| outcome_evaluations[].explanation | null | string | Grader's verdict text from the most recent evaluation. For `satisfied`, explains why criteria are met; for `needs_revision` (intermediate), what's missing; for `failed`, why unrecoverable. |
| outcome_evaluations[].iteration | number | 0-indexed revision cycle the outcome is currently on. |
| outcome_evaluations[].outcome_id | string | Server-generated outc_ ID for this outcome. |
| outcome_evaluations[].result | string | Current evaluation state. `pending` before the agent begins work; `running` while producing or revising; `evaluating` while the grader scores; `satisfied`/`max_iterations_reached`/`failed`/`interrupted` are terminal. |
| outcome_evaluations[].type | string | |
| resources | array<object> | |
| resources[].id | string | |
| resources[].created_at | string | A timestamp in RFC 3339 format |
| resources[].mount_path | string | null | string | Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only. |
| resources[].type | string | |
| resources[].updated_at | string | A timestamp in RFC 3339 format |
| resources[].url | string | |
| resources[].checkout | null | object | |
| resources[].file_id | string | |
| resources[].memory_store_id | string | The memory store ID (memstore_...). Must belong to the caller's organization and workspace. |
| resources[].access | null | string | Access mode for an attached memory store. |
| resources[].description | string | Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description. |
| resources[].instructions | null | string | Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars. |
| resources[].name | null | string | Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource. |
| stats | object | Timing statistics for a session. |
| stats.active_seconds | number | Cumulative time in seconds the session spent in `running` status. Excludes idle time. |
| stats.duration_seconds | number | Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. |
| status | string | SessionStatus enum - `rescheduling` - Transient error occurred, retrying automatically. - `running` - Agent is actively executing. - `idle` - Agent is waiting for input, including user messages or tool confirmations. Sessions start in idle. - `terminated` - Session has ended, either due to an error or completion. |
| title | null | string | |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| usage | object | Cumulative token usage for a session across all turns. |
| usage.active_seconds | number | Cumulative time in seconds during which the session had at least one thread in running status. Overlapping activity from concurrent threads is counted once, unlike `stats.active_seconds`, which sums each thread's own active time. This is the duration the session's runtime cost is priced on. |
| usage.cache_creation | object | Prompt-cache creation token usage broken down by cache lifetime. |
| usage.cache_read_input_tokens | number | Total tokens read from prompt cache. |
| usage.input_tokens | number | Total input tokens consumed across all turns. |
| usage.list_cost | null | object | A monetary amount in a specific currency. |
| usage.output_tokens | number | Total output tokens generated across all turns. |
| usage.server_tool_use | null | object | Cumulative count of server-executed tool invocations, broken down by tool. |
| vault_ids | array<string> | Vault IDs attached to the session at creation. Empty when no vaults were supplied. |
| deployment_id | null | string | Deployment ID when the session was created from a deployment reference. Null otherwise. |
/anthropic/v1/sessions◐ 部分支持agent_idstring可选query: 按智能体 ID 过滤结果。
agent_versionnumber可选query: 按智能体版本过滤;仅在同时设置 agent_id 时生效。
created_at[gt]string可选query: 只返回严格晚于该时间创建的记录。
created_at[gte]string可选query: 只返回不早于该时间创建的记录。
created_at[lt]string可选query: 只返回严格早于该时间创建的记录。
created_at[lte]string可选query: 只返回不晚于该时间创建的记录。
deployment_idstring可选query: 部署 ID(路径或查询参数)。
include_archivedboolean可选query: 是否包含已归档的记录。
memory_store_idstring可选query: 记忆库 ID(路径或查询参数)。
orderstring可选query: 按创建时间排序:asc 从旧到新,desc 从新到旧(默认)。
statusesarray可选query: 按会话状态过滤,可重复该参数匹配多种状态。
limitnumber可选query: 每页返回的条数上限。
pagestring可选query: 分页游标,取自上一页响应的 next_page。
200
支持 limit、page 与 agent_id;agent_version、时间范围、deployment_id、memory_store_id、include_archived、order、statuses 尚不支持,传入返回 400。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | |
| data[].id | string | |
| data[].agent | object | Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. |
| data[].archived_at | null | string | A timestamp in RFC 3339 format |
| data[].budget | null | object | A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`. |
| data[].created_at | string | A timestamp in RFC 3339 format |
| data[].environment_id | string | |
| data[].metadata | object | |
| data[].outcome_evaluations | array<object> | Per-outcome evaluation state. One entry per `define_outcome` event sent to the session. |
| data[].resources | array<object> | |
| data[].stats | object | Timing statistics for a session. |
| data[].status | string | SessionStatus enum - `rescheduling` - Transient error occurred, retrying automatically. - `running` - Agent is actively executing. - `idle` - Agent is waiting for input, including user messages or tool confirmations. Sessions start in idle. - `terminated` - Session has ended, either due to an error or completion. |
| data[].title | null | string | |
| data[].type | string | |
| data[].updated_at | string | A timestamp in RFC 3339 format |
| data[].usage | object | Cumulative token usage for a session across all turns. |
| data[].vault_ids | array<string> | Vault IDs attached to the session at creation. Empty when no vaults were supplied. |
| data[].deployment_id | null | string | Deployment ID when the session was created from a deployment reference. Null otherwise. |
| next_page | string | null |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/anthropic/v1/sessions/{session_id}● 支持session_idstring必填path: 会话 ID(路径或查询参数)。
200
将示例中的资源 ID 替换成你创建的资源 ID。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| agent | object | Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. |
| agent.id | string | |
| agent.description | null | string | |
| agent.mcp_servers | array<object> | |
| agent.model | object | Model identifier and configuration. |
| agent.multiagent | null | object | Resolved coordinator topology with full agent definitions for each roster member. |
| agent.name | string | |
| agent.skills | array<object> | |
| agent.system | null | string | |
| agent.tools | array<object> | |
| agent.type | string | |
| agent.version | number | |
| archived_at | null | string | A timestamp in RFC 3339 format |
| budget | null | object | A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`. |
| budget.max_list_cost | object | A monetary amount in a specific currency. |
| budget.type | string | |
| created_at | string | A timestamp in RFC 3339 format |
| environment_id | string | |
| metadata | object | |
| outcome_evaluations | array<object> | Per-outcome evaluation state. One entry per `define_outcome` event sent to the session. |
| outcome_evaluations[].completed_at | null | string | A timestamp in RFC 3339 format |
| outcome_evaluations[].description | string | What the agent should produce. |
| outcome_evaluations[].explanation | null | string | Grader's verdict text from the most recent evaluation. For `satisfied`, explains why criteria are met; for `needs_revision` (intermediate), what's missing; for `failed`, why unrecoverable. |
| outcome_evaluations[].iteration | number | 0-indexed revision cycle the outcome is currently on. |
| outcome_evaluations[].outcome_id | string | Server-generated outc_ ID for this outcome. |
| outcome_evaluations[].result | string | Current evaluation state. `pending` before the agent begins work; `running` while producing or revising; `evaluating` while the grader scores; `satisfied`/`max_iterations_reached`/`failed`/`interrupted` are terminal. |
| outcome_evaluations[].type | string | |
| resources | array<object> | |
| resources[].id | string | |
| resources[].created_at | string | A timestamp in RFC 3339 format |
| resources[].mount_path | string | null | string | Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only. |
| resources[].type | string | |
| resources[].updated_at | string | A timestamp in RFC 3339 format |
| resources[].url | string | |
| resources[].checkout | null | object | |
| resources[].file_id | string | |
| resources[].memory_store_id | string | The memory store ID (memstore_...). Must belong to the caller's organization and workspace. |
| resources[].access | null | string | Access mode for an attached memory store. |
| resources[].description | string | Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description. |
| resources[].instructions | null | string | Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars. |
| resources[].name | null | string | Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource. |
| stats | object | Timing statistics for a session. |
| stats.active_seconds | number | Cumulative time in seconds the session spent in `running` status. Excludes idle time. |
| stats.duration_seconds | number | Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. |
| status | string | SessionStatus enum - `rescheduling` - Transient error occurred, retrying automatically. - `running` - Agent is actively executing. - `idle` - Agent is waiting for input, including user messages or tool confirmations. Sessions start in idle. - `terminated` - Session has ended, either due to an error or completion. |
| title | null | string | |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| usage | object | Cumulative token usage for a session across all turns. |
| usage.active_seconds | number | Cumulative time in seconds during which the session had at least one thread in running status. Overlapping activity from concurrent threads is counted once, unlike `stats.active_seconds`, which sums each thread's own active time. This is the duration the session's runtime cost is priced on. |
| usage.cache_creation | object | Prompt-cache creation token usage broken down by cache lifetime. |
| usage.cache_read_input_tokens | number | Total tokens read from prompt cache. |
| usage.input_tokens | number | Total input tokens consumed across all turns. |
| usage.list_cost | null | object | A monetary amount in a specific currency. |
| usage.output_tokens | number | Total output tokens generated across all turns. |
| usage.server_tool_use | null | object | Cumulative count of server-executed tool invocations, broken down by tool. |
| vault_ids | array<string> | Vault IDs attached to the session at creation. Empty when no vaults were supplied. |
| deployment_id | null | string | Deployment ID when the session was created from a deployment reference. Null otherwise. |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/anthropic/v1/sessions/{session_id}/events◐ 部分支持session_idstring必填path: 会话 ID(路径或查询参数)。
eventsarray必填要发送给会话的事件列表。
200
将 sesn_123 换成创建会话返回的 id。每条 user.message 只接受一个非空文本块。支持文本 user.message、user.interrupt 和工具确认;其它事件变体尚不支持。返回的是已接纳事件;模型回复从事件历史或订阅读取。会话等待工具授权时发送的 user.message 会排队:返回的事件 processed_at 为 null,授权处理完成后按发送顺序执行。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | Sent events |
| data[].id | string | Unique identifier for this event. |
| data[].content | array<object> | Array of content blocks comprising the user message. / The result content returned by the tool. / The result content returned by the tool. / System content blocks. Text-only. |
| data[].type | string | |
| data[].processed_at | null | string | string | null | string | null | string | A timestamp in RFC 3339 format |
| data[].session_thread_id | null | string | If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread. / Set by the server to the subagent thread this confirmation was routed to. Omitted when it was routed to the primary thread. / Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread. / Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread. |
| data[].result | string | UserToolConfirmationResult enum |
| data[].tool_use_id | string | The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field. / The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field. |
| data[].deny_message | null | string | Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. |
| data[].custom_tool_use_id | string | The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field. |
| data[].is_error | null | boolean | Whether the tool execution resulted in an error. |
| data[].description | string | What the agent should produce. Copied from the input event. |
| data[].max_iterations | null | number | Evaluate-then-revise cycles before giving up. Default 3, max 20. |
| data[].outcome_id | string | Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list. |
| data[].rubric | object | Rubric for grading the quality of an outcome. |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/anthropic/v1/sessions/{session_id}/events● 支持session_idstring必填path: 会话 ID(路径或查询参数)。
created_at[gt]string可选query: 只返回严格晚于该时间创建的记录。
created_at[gte]string可选query: 只返回不早于该时间创建的记录。
created_at[lt]string可选query: 只返回严格早于该时间创建的记录。
created_at[lte]string可选query: 只返回不晚于该时间创建的记录。
orderstring可选query: 按事件处理时间排序:asc 从早到晚(默认),desc 相反。
typesarray可选query: 按事件类型过滤,取值与返回事件的 type 字段一致(如 user.message、agent.tool_use);不传返回全部类型。
limitnumber可选query: 每页返回的条数上限。
pagestring可选query: 分页游标,取自上一页响应的 next_page。
200
先发送消息再读取历史;处理完成前可能只看到已接纳的输入。支持分页、事件类型和时间过滤。会话等待工具授权时停在 session.status_idle,stop_reason 为 requires_action,event_ids 列出待确认的 agent.tool_use;运行失败时先出现 session.error,再出现 session.status_terminated。agent.thinking 与官方一致,是不带内容的进度信号。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | |
| data[].id | string | Unique identifier for this event. |
| data[].content | array<object> | Array of content blocks comprising the user message. / The result content returned by the tool. / Array of text blocks comprising the agent response. / The result content returned by the tool. / The result content returned by the tool. / Message content blocks. / Message content blocks. / The result content returned by the tool. / System content blocks. Text-only. |
| data[].type | string | |
| data[].processed_at | null | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | null | string | string | string | null | string | string | A timestamp in RFC 3339 format |
| data[].session_thread_id | null | string | string | string | string | string | null | string | string | If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread. / Set by the server to the subagent thread this confirmation was routed to. Omitted when it was routed to the primary thread. / Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread. / When set, this event was cross-posted from a subagent's thread to surface its custom tool use on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.custom_tool_result` by `custom_tool_use_id`, so clients do not send it back. / When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.tool_confirmation` by `tool_use_id`, so clients do not send it back. / When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.tool_confirmation` or `user.tool_result` by `tool_use_id`, so clients do not send it back. / Public `sthr_` ID of the newly created thread. / Public sthr_ ID of the thread that started running. / Public sthr_ ID of the thread that went idle. / Public sthr_ ID of the thread that terminated. / Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread. / Public sthr_ ID of the thread that is retrying. |
| data[].result | string | UserToolConfirmationResult enum / Evaluation verdict. 'satisfied': criteria met, session goes idle. 'needs_revision': criteria not met, another revision cycle follows. 'max_iterations_reached': evaluation budget exhausted with criteria still unmet — one final acknowledgment turn follows before the session goes idle, but no further evaluation runs. 'failed': grader determined the rubric does not apply to the deliverables. 'interrupted': user sent an interrupt while evaluation was in progress. |
| data[].tool_use_id | string | The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field. / The id of the `agent.tool_use` event this result corresponds to. / The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field. |
| data[].deny_message | null | string | Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. |
| data[].custom_tool_use_id | string | The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field. |
| data[].is_error | null | boolean | Whether the tool execution resulted in an error. / Whether the model request resulted in an error. / Whether the tool execution resulted in an error. |
| data[].input | object | Input parameters for the tool call. |
| data[].name | string | Name of the custom tool being called. / Name of the MCP tool being used. / Name of the agent tool being used. |
| data[].mcp_server_name | string | Name of the MCP server providing the tool. |
| data[].evaluated_permission | string | AgentEvaluatedPermission enum |
| data[].evaluation | object | Names the resolved permission_policy that produced evaluated_permission, and under auto carries the judgement. Open union: clients must tolerate unknown variants. |
| data[].mcp_tool_use_id | string | The id of the `agent.mcp_tool_use` event this result corresponds to. |
| data[].from_session_thread_id | string | Public `sthr_` ID of the thread that sent the message. |
| data[].from_agent_name | null | string | Name of the callable agent this message came from. Absent when received from the primary agent. |
| data[].to_session_thread_id | string | Public `sthr_` ID of the thread the message was sent to. |
| data[].to_agent_name | null | string | Name of the callable agent this message was sent to. Absent when sent to the primary agent. |
| data[].error | object | |
| data[].stop_reason | object | |
| data[].agent_name | string | Name of the callable agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. |
| data[].iteration | number | 0-indexed revision cycle. 0 is the first evaluation; 1 is the re-evaluation after the first revision; etc. / 0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`. / 0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`. |
| data[].outcome_id | string | The `outc_` ID of the outcome being evaluated. / Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list. |
| data[].explanation | string | Human-readable explanation of the verdict. For `needs_revision`, describes which criteria failed and why. |
| data[].outcome_evaluation_start_id | string | The id of the corresponding `span.outcome_evaluation_start` event. |
| data[].usage | object | Token usage for a single model request. / Point-in-time snapshot of a session's cumulative usage. |
| data[].model_request_start_id | string | The id of the corresponding `span.model_request_start` event. |
| data[].model_usage | object | Token usage for a single model request. |
| data[].description | string | What the agent should produce. Copied from the input event. |
| data[].max_iterations | null | number | Evaluate-then-revise cycles before giving up. Default 3, max 20. |
| data[].rubric | object | Rubric for grading the quality of an outcome. |
| data[].agent | null | object | Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. |
| data[].budget | null | object | A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`. |
| data[].metadata | object | The session's full metadata bag after the update. Present when the update set non-empty metadata; absent when metadata was unchanged or cleared to empty. |
| data[].title | null | string | The session's new title. Present only when the update changed it. |
| next_page | string | null |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/anthropic/v1/sessions/{session_id}/events/stream◐ 部分支持session_idstring必填path: 会话 ID(路径或查询参数)。
event_deltasarray可选query: 设置后连接同时接收流式增量事件。
200
保持 SSE 连接以接收事件;请求不会像普通 JSON 接口一样立刻结束。先创建会话并替换 sesn_123,再从另一请求发送消息;停止按钮只断开订阅,不会停止智能体。SDK 0.124.0 会过滤 session.usage,完整用量请读历史。传 event_deltas[]=agent.message 可在最终事件到达前收到逐段文本预览;agent.thinking 与官方一致,只有 event_start。
错误按 Claude Managed Agents 格式返回,参见 错误码
Server-sent events
text/event-stream — chunk / 事件对象
未声明字段结构。
/anthropic/v1/deployment_runs○ 未支持created_at[gt]string可选query: 只返回严格晚于该时间创建的记录。
created_at[gte]string可选query: 只返回不早于该时间创建的记录。
created_at[lt]string可选query: 只返回严格早于该时间创建的记录。
created_at[lte]string可选query: 只返回不晚于该时间创建的记录。
deployment_idstring可选query: 部署 ID(路径或查询参数)。
has_errorboolean可选query: 按是否出错过滤部署运行。
trigger_typestring可选query: 按触发类型过滤部署运行。
limitnumber可选query: 每页返回的条数上限。
pagestring可选query: 分页游标,取自上一页响应的 next_page。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还不能按计划或触发条件自动运行智能体。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | |
| data[].id | string | Unique identifier for this run (`drun_...`). |
| data[].agent | object | A resolved agent reference with a concrete version. |
| data[].created_at | string | A timestamp in RFC 3339 format |
| data[].deployment_id | string | ID of the deployment that produced this run. |
| data[].error | null | object | Why the run failed to create a session. The type identifies the failure; message is human-readable detail. |
| data[].session_id | null | string | Populated on success. Null on creation failure. Exactly one of `session_id` or `error` is non-null. |
| data[].trigger_context | object | Describes what triggered a deployment run, with trigger-specific metadata. |
| data[].type | string | |
| next_page | string | null |
/anthropic/v1/deployment_runs/{deployment_run_id}○ 未支持deployment_run_idstring必填path: 路径参数:部署运行 ID。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还不能按计划或触发条件自动运行智能体。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for this run (`drun_...`). |
| agent | object | A resolved agent reference with a concrete version. |
| agent.id | string | |
| agent.type | string | |
| agent.version | number | |
| created_at | string | A timestamp in RFC 3339 format |
| deployment_id | string | ID of the deployment that produced this run. |
| error | null | object | Why the run failed to create a session. The type identifies the failure; message is human-readable detail. |
| error.message | string | Human-readable error description. |
| error.type | string | |
| session_id | null | string | Populated on success. Null on creation failure. Exactly one of `session_id` or `error` is non-null. |
| trigger_context | object | Describes what triggered a deployment run, with trigger-specific metadata. |
| trigger_context.scheduled_at | string | A timestamp in RFC 3339 format |
| trigger_context.type | string | |
| type | string |
/anthropic/v1/deployments○ 未支持agent_idstring可选query: 按智能体 ID 过滤结果。
created_at[gte]string可选query: 只返回不早于该时间创建的记录。
created_at[lte]string可选query: 只返回不晚于该时间创建的记录。
include_archivedboolean可选query: 是否包含已归档的记录。
statusstring可选query: 按状态过滤:active 或 paused。
limitnumber可选query: 每页返回的条数上限。
pagestring可选query: 分页游标,取自上一页响应的 next_page。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还不能按计划或触发条件自动运行智能体。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | |
| data[].id | string | Unique identifier for this deployment. |
| data[].agent | object | A resolved agent reference with a concrete version. |
| data[].archived_at | null | string | A timestamp in RFC 3339 format |
| data[].created_at | string | A timestamp in RFC 3339 format |
| data[].description | null | string | Description of what the deployment does. |
| data[].environment_id | string | ID of the `environment` where sessions run. |
| data[].initial_events | array<object> | Events sent to each session immediately after creation. |
| data[].metadata | object | Arbitrary key-value metadata. Maximum 16 pairs. |
| data[].name | string | Human-readable name. |
| data[].paused_reason | null | object | Why a deployment is paused. Non-null exactly when `status` is `paused`. |
| data[].resources | array<object> | Resources attached to sessions created from this deployment. Echoes the input minus write-only credentials. |
| data[].schedule | null | object | 5-field POSIX cron schedule with computed runtime timestamps. |
| data[].status | string | Lifecycle status of a deployment. |
| data[].type | string | |
| data[].updated_at | string | A timestamp in RFC 3339 format |
| data[].vault_ids | array<string> | Vault IDs supplying stored credentials for sessions created from this deployment. |
| data[].budget | null | object | A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`. |
| next_page | string | null |
/anthropic/v1/deployments○ 未支持namestring必填Human-readable name for the deployment.
agentstring | object必填Agent to deploy. Accepts the `agent` ID string, which pins the latest version, or an `agent` object with both id and version specified. The agent must exist and not be archived.
idstring必填The `agent` ID.
typestring必填versionnumber可选The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified.
environment_idstring必填ID of the `environment` defining the container configuration for sessions created from this deployment.
initial_eventsarray必填Events to send to each session immediately after creation. At least 1, maximum 50.
budgetobject可选A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.
max_list_costobject必填A monetary amount in a specific currency.
typestring必填descriptionstring可选Description of what the deployment does.
metadataobject可选Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars.
resourcesarray可选Resources (e.g. repositories, files) to mount into each session's container. Maximum 500.
scheduleobject可选5-field POSIX cron schedule. Literal wall-clock matching in the configured timezone.
expressionstring必填5-field POSIX cron expression: minute hour day-of-month month day-of-week (e.g., "0 9 \* \* 1-5" for weekdays at 9am). Day-of-week is 0-7 where 0 and 7 both mean Sunday. Extended cron syntax - seconds or year fields, and the special characters L, W, #, and ? - is not supported, nor are predefined shortcuts (@daily).
timezonestring必填Required. IANA timezone identifier (e.g., "America/Los_Angeles", "UTC"). Validated against the IANA timezone database.
typestring必填vault_idsarray可选Vault IDs for stored credentials the agent can use during sessions created from this deployment. Maximum 50.
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还不能按计划或触发条件自动运行智能体。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for this deployment. |
| agent | object | A resolved agent reference with a concrete version. |
| agent.id | string | |
| agent.type | string | |
| agent.version | number | |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| description | null | string | Description of what the deployment does. |
| environment_id | string | ID of the `environment` where sessions run. |
| initial_events | array<object> | Events sent to each session immediately after creation. |
| initial_events[].content | array<object> | Array of content blocks for the user message. / System content blocks to append. Text-only. |
| initial_events[].type | string | |
| initial_events[].description | string | What the agent should produce. This is the task specification. |
| initial_events[].rubric | object | Rubric for grading the quality of an outcome. |
| initial_events[].max_iterations | null | number | Eval→revision cycles before giving up. Default 3, max 20. |
| metadata | object | Arbitrary key-value metadata. Maximum 16 pairs. |
| name | string | Human-readable name. |
| paused_reason | null | object | Why a deployment is paused. Non-null exactly when `status` is `paused`. |
| paused_reason.type | string | |
| paused_reason.error | object | The error that triggered an auto-pause. Matches the failed run's `error.type`. |
| resources | array<object> | Resources attached to sessions created from this deployment. Echoes the input minus write-only credentials. |
| resources[].type | string | |
| resources[].url | string | Github URL of the repository |
| resources[].checkout | null | object | Branch or commit to check out. Defaults to the repository's default branch. |
| resources[].mount_path | null | string | Mount path in the container. Defaults to `/workspace/<repo-name>`. / Mount path in the container. Defaults to `/mnt/session/uploads/<file_id>`. |
| resources[].file_id | string | ID of a previously uploaded file. |
| resources[].memory_store_id | string | The memory store ID (memstore_...). Must belong to the caller's organization and workspace. |
| resources[].access | null | string | Access mode for an attached memory store. |
| resources[].instructions | null | string | Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars. |
| schedule | null | object | 5-field POSIX cron schedule with computed runtime timestamps. |
| schedule.expression | string | 5-field POSIX cron expression: minute hour day-of-month month day-of-week (e.g., "0 9 * * 1-5" for weekdays at 9am). Day-of-week is 0-7 where 0 and 7 both mean Sunday. Extended cron syntax - seconds or year fields, and the special characters L, W, #, and ? - is not supported, nor are predefined shortcuts (@daily). |
| schedule.timezone | string | IANA timezone identifier (e.g., "America/Los_Angeles", "UTC"). |
| schedule.type | string | |
| schedule.last_run_at | null | string | A timestamp in RFC 3339 format |
| schedule.upcoming_runs_at | array<string> | Up to 5 timestamps of upcoming cron occurrences. Non-empty for active and paused deployments (reflects what the schedule would do if unpaused); empty once the deployment is archived (`archived_at` set). Each fire is offset by a small per-schedule jitter, so a run will actually start at or shortly after its listed time. |
| status | string | Lifecycle status of a deployment. |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| vault_ids | array<string> | Vault IDs supplying stored credentials for sessions created from this deployment. |
| budget | null | object | A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`. |
| budget.max_list_cost | object | A monetary amount in a specific currency. |
| budget.type | string |
/anthropic/v1/deployments/{deployment_id}○ 未支持deployment_idstring必填path: 部署 ID(路径或查询参数)。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还不能按计划或触发条件自动运行智能体。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for this deployment. |
| agent | object | A resolved agent reference with a concrete version. |
| agent.id | string | |
| agent.type | string | |
| agent.version | number | |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| description | null | string | Description of what the deployment does. |
| environment_id | string | ID of the `environment` where sessions run. |
| initial_events | array<object> | Events sent to each session immediately after creation. |
| initial_events[].content | array<object> | Array of content blocks for the user message. / System content blocks to append. Text-only. |
| initial_events[].type | string | |
| initial_events[].description | string | What the agent should produce. This is the task specification. |
| initial_events[].rubric | object | Rubric for grading the quality of an outcome. |
| initial_events[].max_iterations | null | number | Eval→revision cycles before giving up. Default 3, max 20. |
| metadata | object | Arbitrary key-value metadata. Maximum 16 pairs. |
| name | string | Human-readable name. |
| paused_reason | null | object | Why a deployment is paused. Non-null exactly when `status` is `paused`. |
| paused_reason.type | string | |
| paused_reason.error | object | The error that triggered an auto-pause. Matches the failed run's `error.type`. |
| resources | array<object> | Resources attached to sessions created from this deployment. Echoes the input minus write-only credentials. |
| resources[].type | string | |
| resources[].url | string | Github URL of the repository |
| resources[].checkout | null | object | Branch or commit to check out. Defaults to the repository's default branch. |
| resources[].mount_path | null | string | Mount path in the container. Defaults to `/workspace/<repo-name>`. / Mount path in the container. Defaults to `/mnt/session/uploads/<file_id>`. |
| resources[].file_id | string | ID of a previously uploaded file. |
| resources[].memory_store_id | string | The memory store ID (memstore_...). Must belong to the caller's organization and workspace. |
| resources[].access | null | string | Access mode for an attached memory store. |
| resources[].instructions | null | string | Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars. |
| schedule | null | object | 5-field POSIX cron schedule with computed runtime timestamps. |
| schedule.expression | string | 5-field POSIX cron expression: minute hour day-of-month month day-of-week (e.g., "0 9 * * 1-5" for weekdays at 9am). Day-of-week is 0-7 where 0 and 7 both mean Sunday. Extended cron syntax - seconds or year fields, and the special characters L, W, #, and ? - is not supported, nor are predefined shortcuts (@daily). |
| schedule.timezone | string | IANA timezone identifier (e.g., "America/Los_Angeles", "UTC"). |
| schedule.type | string | |
| schedule.last_run_at | null | string | A timestamp in RFC 3339 format |
| schedule.upcoming_runs_at | array<string> | Up to 5 timestamps of upcoming cron occurrences. Non-empty for active and paused deployments (reflects what the schedule would do if unpaused); empty once the deployment is archived (`archived_at` set). Each fire is offset by a small per-schedule jitter, so a run will actually start at or shortly after its listed time. |
| status | string | Lifecycle status of a deployment. |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| vault_ids | array<string> | Vault IDs supplying stored credentials for sessions created from this deployment. |
| budget | null | object | A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`. |
| budget.max_list_cost | object | A monetary amount in a specific currency. |
| budget.type | string |
/anthropic/v1/deployments/{deployment_id}○ 未支持deployment_idstring必填path: 部署 ID(路径或查询参数)。
namestring可选Human-readable name. Must be non-empty. Omit to preserve. Cannot be cleared.
agentstring | object可选Agent to deploy. Accepts the `agent` ID string, which re-pins to the latest version, or an `agent` object with both id and version specified. Omit to preserve. Cannot be cleared.
idstring必填The `agent` ID.
typestring必填versionnumber可选The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified.
environment_idstring可选ID of the `environment` where sessions run. Omit to preserve. Cannot be cleared.
budgetobject可选A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.
max_list_costobject必填A monetary amount in a specific currency.
typestring必填descriptionstring可选Description. Omit to preserve; send empty string or null to clear.
initial_eventsarray可选Initial events. Full replacement. Omit to preserve. Cannot be cleared. At least 1, maximum 50.
metadataobject可选Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars.
resourcesarray可选Session resources. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 500.
scheduleobject可选5-field POSIX cron schedule. Literal wall-clock matching in the configured timezone.
expressionstring必填5-field POSIX cron expression: minute hour day-of-month month day-of-week (e.g., "0 9 \* \* 1-5" for weekdays at 9am). Day-of-week is 0-7 where 0 and 7 both mean Sunday. Extended cron syntax - seconds or year fields, and the special characters L, W, #, and ? - is not supported, nor are predefined shortcuts (@daily).
timezonestring必填Required. IANA timezone identifier (e.g., "America/Los_Angeles", "UTC"). Validated against the IANA timezone database.
typestring必填vault_idsarray可选Vault IDs. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 50.
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还不能按计划或触发条件自动运行智能体。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for this deployment. |
| agent | object | A resolved agent reference with a concrete version. |
| agent.id | string | |
| agent.type | string | |
| agent.version | number | |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| description | null | string | Description of what the deployment does. |
| environment_id | string | ID of the `environment` where sessions run. |
| initial_events | array<object> | Events sent to each session immediately after creation. |
| initial_events[].content | array<object> | Array of content blocks for the user message. / System content blocks to append. Text-only. |
| initial_events[].type | string | |
| initial_events[].description | string | What the agent should produce. This is the task specification. |
| initial_events[].rubric | object | Rubric for grading the quality of an outcome. |
| initial_events[].max_iterations | null | number | Eval→revision cycles before giving up. Default 3, max 20. |
| metadata | object | Arbitrary key-value metadata. Maximum 16 pairs. |
| name | string | Human-readable name. |
| paused_reason | null | object | Why a deployment is paused. Non-null exactly when `status` is `paused`. |
| paused_reason.type | string | |
| paused_reason.error | object | The error that triggered an auto-pause. Matches the failed run's `error.type`. |
| resources | array<object> | Resources attached to sessions created from this deployment. Echoes the input minus write-only credentials. |
| resources[].type | string | |
| resources[].url | string | Github URL of the repository |
| resources[].checkout | null | object | Branch or commit to check out. Defaults to the repository's default branch. |
| resources[].mount_path | null | string | Mount path in the container. Defaults to `/workspace/<repo-name>`. / Mount path in the container. Defaults to `/mnt/session/uploads/<file_id>`. |
| resources[].file_id | string | ID of a previously uploaded file. |
| resources[].memory_store_id | string | The memory store ID (memstore_...). Must belong to the caller's organization and workspace. |
| resources[].access | null | string | Access mode for an attached memory store. |
| resources[].instructions | null | string | Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars. |
| schedule | null | object | 5-field POSIX cron schedule with computed runtime timestamps. |
| schedule.expression | string | 5-field POSIX cron expression: minute hour day-of-month month day-of-week (e.g., "0 9 * * 1-5" for weekdays at 9am). Day-of-week is 0-7 where 0 and 7 both mean Sunday. Extended cron syntax - seconds or year fields, and the special characters L, W, #, and ? - is not supported, nor are predefined shortcuts (@daily). |
| schedule.timezone | string | IANA timezone identifier (e.g., "America/Los_Angeles", "UTC"). |
| schedule.type | string | |
| schedule.last_run_at | null | string | A timestamp in RFC 3339 format |
| schedule.upcoming_runs_at | array<string> | Up to 5 timestamps of upcoming cron occurrences. Non-empty for active and paused deployments (reflects what the schedule would do if unpaused); empty once the deployment is archived (`archived_at` set). Each fire is offset by a small per-schedule jitter, so a run will actually start at or shortly after its listed time. |
| status | string | Lifecycle status of a deployment. |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| vault_ids | array<string> | Vault IDs supplying stored credentials for sessions created from this deployment. |
| budget | null | object | A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`. |
| budget.max_list_cost | object | A monetary amount in a specific currency. |
| budget.type | string |
/anthropic/v1/deployments/{deployment_id}/archive○ 未支持deployment_idstring必填path: 部署 ID(路径或查询参数)。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还不能按计划或触发条件自动运行智能体。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for this deployment. |
| agent | object | A resolved agent reference with a concrete version. |
| agent.id | string | |
| agent.type | string | |
| agent.version | number | |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| description | null | string | Description of what the deployment does. |
| environment_id | string | ID of the `environment` where sessions run. |
| initial_events | array<object> | Events sent to each session immediately after creation. |
| initial_events[].content | array<object> | Array of content blocks for the user message. / System content blocks to append. Text-only. |
| initial_events[].type | string | |
| initial_events[].description | string | What the agent should produce. This is the task specification. |
| initial_events[].rubric | object | Rubric for grading the quality of an outcome. |
| initial_events[].max_iterations | null | number | Eval→revision cycles before giving up. Default 3, max 20. |
| metadata | object | Arbitrary key-value metadata. Maximum 16 pairs. |
| name | string | Human-readable name. |
| paused_reason | null | object | Why a deployment is paused. Non-null exactly when `status` is `paused`. |
| paused_reason.type | string | |
| paused_reason.error | object | The error that triggered an auto-pause. Matches the failed run's `error.type`. |
| resources | array<object> | Resources attached to sessions created from this deployment. Echoes the input minus write-only credentials. |
| resources[].type | string | |
| resources[].url | string | Github URL of the repository |
| resources[].checkout | null | object | Branch or commit to check out. Defaults to the repository's default branch. |
| resources[].mount_path | null | string | Mount path in the container. Defaults to `/workspace/<repo-name>`. / Mount path in the container. Defaults to `/mnt/session/uploads/<file_id>`. |
| resources[].file_id | string | ID of a previously uploaded file. |
| resources[].memory_store_id | string | The memory store ID (memstore_...). Must belong to the caller's organization and workspace. |
| resources[].access | null | string | Access mode for an attached memory store. |
| resources[].instructions | null | string | Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars. |
| schedule | null | object | 5-field POSIX cron schedule with computed runtime timestamps. |
| schedule.expression | string | 5-field POSIX cron expression: minute hour day-of-month month day-of-week (e.g., "0 9 * * 1-5" for weekdays at 9am). Day-of-week is 0-7 where 0 and 7 both mean Sunday. Extended cron syntax - seconds or year fields, and the special characters L, W, #, and ? - is not supported, nor are predefined shortcuts (@daily). |
| schedule.timezone | string | IANA timezone identifier (e.g., "America/Los_Angeles", "UTC"). |
| schedule.type | string | |
| schedule.last_run_at | null | string | A timestamp in RFC 3339 format |
| schedule.upcoming_runs_at | array<string> | Up to 5 timestamps of upcoming cron occurrences. Non-empty for active and paused deployments (reflects what the schedule would do if unpaused); empty once the deployment is archived (`archived_at` set). Each fire is offset by a small per-schedule jitter, so a run will actually start at or shortly after its listed time. |
| status | string | Lifecycle status of a deployment. |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| vault_ids | array<string> | Vault IDs supplying stored credentials for sessions created from this deployment. |
| budget | null | object | A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`. |
| budget.max_list_cost | object | A monetary amount in a specific currency. |
| budget.type | string |
/anthropic/v1/deployments/{deployment_id}/pause○ 未支持deployment_idstring必填path: 部署 ID(路径或查询参数)。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还不能按计划或触发条件自动运行智能体。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for this deployment. |
| agent | object | A resolved agent reference with a concrete version. |
| agent.id | string | |
| agent.type | string | |
| agent.version | number | |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| description | null | string | Description of what the deployment does. |
| environment_id | string | ID of the `environment` where sessions run. |
| initial_events | array<object> | Events sent to each session immediately after creation. |
| initial_events[].content | array<object> | Array of content blocks for the user message. / System content blocks to append. Text-only. |
| initial_events[].type | string | |
| initial_events[].description | string | What the agent should produce. This is the task specification. |
| initial_events[].rubric | object | Rubric for grading the quality of an outcome. |
| initial_events[].max_iterations | null | number | Eval→revision cycles before giving up. Default 3, max 20. |
| metadata | object | Arbitrary key-value metadata. Maximum 16 pairs. |
| name | string | Human-readable name. |
| paused_reason | null | object | Why a deployment is paused. Non-null exactly when `status` is `paused`. |
| paused_reason.type | string | |
| paused_reason.error | object | The error that triggered an auto-pause. Matches the failed run's `error.type`. |
| resources | array<object> | Resources attached to sessions created from this deployment. Echoes the input minus write-only credentials. |
| resources[].type | string | |
| resources[].url | string | Github URL of the repository |
| resources[].checkout | null | object | Branch or commit to check out. Defaults to the repository's default branch. |
| resources[].mount_path | null | string | Mount path in the container. Defaults to `/workspace/<repo-name>`. / Mount path in the container. Defaults to `/mnt/session/uploads/<file_id>`. |
| resources[].file_id | string | ID of a previously uploaded file. |
| resources[].memory_store_id | string | The memory store ID (memstore_...). Must belong to the caller's organization and workspace. |
| resources[].access | null | string | Access mode for an attached memory store. |
| resources[].instructions | null | string | Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars. |
| schedule | null | object | 5-field POSIX cron schedule with computed runtime timestamps. |
| schedule.expression | string | 5-field POSIX cron expression: minute hour day-of-month month day-of-week (e.g., "0 9 * * 1-5" for weekdays at 9am). Day-of-week is 0-7 where 0 and 7 both mean Sunday. Extended cron syntax - seconds or year fields, and the special characters L, W, #, and ? - is not supported, nor are predefined shortcuts (@daily). |
| schedule.timezone | string | IANA timezone identifier (e.g., "America/Los_Angeles", "UTC"). |
| schedule.type | string | |
| schedule.last_run_at | null | string | A timestamp in RFC 3339 format |
| schedule.upcoming_runs_at | array<string> | Up to 5 timestamps of upcoming cron occurrences. Non-empty for active and paused deployments (reflects what the schedule would do if unpaused); empty once the deployment is archived (`archived_at` set). Each fire is offset by a small per-schedule jitter, so a run will actually start at or shortly after its listed time. |
| status | string | Lifecycle status of a deployment. |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| vault_ids | array<string> | Vault IDs supplying stored credentials for sessions created from this deployment. |
| budget | null | object | A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`. |
| budget.max_list_cost | object | A monetary amount in a specific currency. |
| budget.type | string |
/anthropic/v1/deployments/{deployment_id}/run○ 未支持deployment_idstring必填path: 部署 ID(路径或查询参数)。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还不能按计划或触发条件自动运行智能体。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for this run (`drun_...`). |
| agent | object | A resolved agent reference with a concrete version. |
| agent.id | string | |
| agent.type | string | |
| agent.version | number | |
| created_at | string | A timestamp in RFC 3339 format |
| deployment_id | string | ID of the deployment that produced this run. |
| error | null | object | Why the run failed to create a session. The type identifies the failure; message is human-readable detail. |
| error.message | string | Human-readable error description. |
| error.type | string | |
| session_id | null | string | Populated on success. Null on creation failure. Exactly one of `session_id` or `error` is non-null. |
| trigger_context | object | Describes what triggered a deployment run, with trigger-specific metadata. |
| trigger_context.scheduled_at | string | A timestamp in RFC 3339 format |
| trigger_context.type | string | |
| type | string |
/anthropic/v1/deployments/{deployment_id}/unpause○ 未支持deployment_idstring必填path: 部署 ID(路径或查询参数)。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还不能按计划或触发条件自动运行智能体。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for this deployment. |
| agent | object | A resolved agent reference with a concrete version. |
| agent.id | string | |
| agent.type | string | |
| agent.version | number | |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| description | null | string | Description of what the deployment does. |
| environment_id | string | ID of the `environment` where sessions run. |
| initial_events | array<object> | Events sent to each session immediately after creation. |
| initial_events[].content | array<object> | Array of content blocks for the user message. / System content blocks to append. Text-only. |
| initial_events[].type | string | |
| initial_events[].description | string | What the agent should produce. This is the task specification. |
| initial_events[].rubric | object | Rubric for grading the quality of an outcome. |
| initial_events[].max_iterations | null | number | Eval→revision cycles before giving up. Default 3, max 20. |
| metadata | object | Arbitrary key-value metadata. Maximum 16 pairs. |
| name | string | Human-readable name. |
| paused_reason | null | object | Why a deployment is paused. Non-null exactly when `status` is `paused`. |
| paused_reason.type | string | |
| paused_reason.error | object | The error that triggered an auto-pause. Matches the failed run's `error.type`. |
| resources | array<object> | Resources attached to sessions created from this deployment. Echoes the input minus write-only credentials. |
| resources[].type | string | |
| resources[].url | string | Github URL of the repository |
| resources[].checkout | null | object | Branch or commit to check out. Defaults to the repository's default branch. |
| resources[].mount_path | null | string | Mount path in the container. Defaults to `/workspace/<repo-name>`. / Mount path in the container. Defaults to `/mnt/session/uploads/<file_id>`. |
| resources[].file_id | string | ID of a previously uploaded file. |
| resources[].memory_store_id | string | The memory store ID (memstore_...). Must belong to the caller's organization and workspace. |
| resources[].access | null | string | Access mode for an attached memory store. |
| resources[].instructions | null | string | Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars. |
| schedule | null | object | 5-field POSIX cron schedule with computed runtime timestamps. |
| schedule.expression | string | 5-field POSIX cron expression: minute hour day-of-month month day-of-week (e.g., "0 9 * * 1-5" for weekdays at 9am). Day-of-week is 0-7 where 0 and 7 both mean Sunday. Extended cron syntax - seconds or year fields, and the special characters L, W, #, and ? - is not supported, nor are predefined shortcuts (@daily). |
| schedule.timezone | string | IANA timezone identifier (e.g., "America/Los_Angeles", "UTC"). |
| schedule.type | string | |
| schedule.last_run_at | null | string | A timestamp in RFC 3339 format |
| schedule.upcoming_runs_at | array<string> | Up to 5 timestamps of upcoming cron occurrences. Non-empty for active and paused deployments (reflects what the schedule would do if unpaused); empty once the deployment is archived (`archived_at` set). Each fire is offset by a small per-schedule jitter, so a run will actually start at or shortly after its listed time. |
| status | string | Lifecycle status of a deployment. |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| vault_ids | array<string> | Vault IDs supplying stored credentials for sessions created from this deployment. |
| budget | null | object | A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`. |
| budget.max_list_cost | object | A monetary amount in a specific currency. |
| budget.type | string |
/anthropic/v1/environments◐ 部分支持include_archivedboolean可选query: 是否包含已归档的记录。
limitnumber可选query: 每页返回的条数上限。
pagestring可选query: 分页游标,取自上一页响应的 next_page。
200
支持租户自建 cloud 环境、配置更新与软归档;内置环境只读。列表支持 limit、page 和 include_archived。limited 网络在沙箱创建时生效;安装失败会终止会话,错误码为 ENVIRONMENT_PACKAGE_INSTALL_FAILED。self_hosted、scope 和跨会话包缓存尚不支持。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | |
| data[].id | string | Environment identifier (e.g., 'env_...') |
| data[].archived_at | null | string | RFC 3339 timestamp when environment was archived, or null if not archived |
| data[].config | object | Environment configuration (either Anthropic Cloud or self-hosted) |
| data[].created_at | string | RFC 3339 timestamp when environment was created |
| data[].description | null | string | User-provided description for the environment; null when unset |
| data[].metadata | object | User-provided metadata key-value pairs |
| data[].name | string | Human-readable name for the environment |
| data[].type | string | The type of object (always 'environment') |
| data[].updated_at | string | RFC 3339 timestamp when environment was last updated |
| data[].scope | string | The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account. |
| next_page | string | null |
/anthropic/v1/environments◐ 部分支持namestring必填Human-readable name for the environment
configobject可选Environment configuration
typestring必填Environment type
networkingobject可选Network configuration policy. Omit on update to preserve the existing value.
packagesobject可选Specify packages (and optionally their versions) available in this environment. When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. Under `limited` networking, requires `networking.allow_package_managers` to be `true`.
descriptionstring可选Optional description of the environment
metadataobject可选User-provided metadata key-value pairs
scopestring可选The visibility scope for this environment. 'organization' makes the environment visible to all accounts. 'account' restricts visibility to the owning account only. API organizations support only 'organization'; 'account' is rejected. If not specified, defaults based on organization type.
501
支持租户自建 cloud 环境、配置更新与软归档;内置环境只读。列表支持 limit、page 和 include_archived。limited 网络在沙箱创建时生效;安装失败会终止会话,错误码为 ENVIRONMENT_PACKAGE_INSTALL_FAILED。self_hosted、scope 和跨会话包缓存尚不支持。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Environment identifier (e.g., 'env_...') |
| archived_at | null | string | RFC 3339 timestamp when environment was archived, or null if not archived |
| config | object | Environment configuration (either Anthropic Cloud or self-hosted) |
| config.networking | object | Network configuration policy. |
| config.packages | object | Package manager configuration. |
| config.type | string | Environment type |
| created_at | string | RFC 3339 timestamp when environment was created |
| description | null | string | User-provided description for the environment; null when unset |
| metadata | object | User-provided metadata key-value pairs |
| name | string | Human-readable name for the environment |
| type | string | The type of object (always 'environment') |
| updated_at | string | RFC 3339 timestamp when environment was last updated |
| scope | string | The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account. |
/anthropic/v1/environments/{environment_id}○ 未支持environment_idstring必填path: 环境 ID(路径或查询参数)。
501 平台还没有实现这个端点;调用会得到下面这个响应:
会话目前统一使用平台内置环境,还不能自定义创建或管理环境。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Environment identifier |
| type | string | The type of response |
/anthropic/v1/environments/{environment_id}◐ 部分支持environment_idstring必填path: 环境 ID(路径或查询参数)。
200
支持租户自建 cloud 环境、配置更新与软归档;内置环境只读。列表支持 limit、page 和 include_archived。limited 网络在沙箱创建时生效;安装失败会终止会话,错误码为 ENVIRONMENT_PACKAGE_INSTALL_FAILED。self_hosted、scope 和跨会话包缓存尚不支持。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Environment identifier (e.g., 'env_...') |
| archived_at | null | string | RFC 3339 timestamp when environment was archived, or null if not archived |
| config | object | Environment configuration (either Anthropic Cloud or self-hosted) |
| config.networking | object | Network configuration policy. |
| config.packages | object | Package manager configuration. |
| config.type | string | Environment type |
| created_at | string | RFC 3339 timestamp when environment was created |
| description | null | string | User-provided description for the environment; null when unset |
| metadata | object | User-provided metadata key-value pairs |
| name | string | Human-readable name for the environment |
| type | string | The type of object (always 'environment') |
| updated_at | string | RFC 3339 timestamp when environment was last updated |
| scope | string | The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account. |
/anthropic/v1/environments/{environment_id}◐ 部分支持environment_idstring必填path: 环境 ID(路径或查询参数)。
namestring可选Updated name for the environment
configobject可选Updated environment configuration
typestring必填Environment type
networkingobject可选Network configuration policy. Omit on update to preserve the existing value.
packagesobject可选Specify packages (and optionally their versions) available in this environment. When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. Under `limited` networking, requires `networking.allow_package_managers` to be `true`.
descriptionstring可选Updated description of the environment. Omit to preserve; null clears to null; an empty string is stored as an empty string.
metadataobject可选User-provided metadata key-value pairs. Set a value to null or empty string to delete the key.
scopestring可选The visibility scope for this environment. 'organization' makes the environment visible to all accounts. 'account' restricts visibility to the owning account only.
501
支持租户自建 cloud 环境、配置更新与软归档;内置环境只读。列表支持 limit、page 和 include_archived。limited 网络在沙箱创建时生效;安装失败会终止会话,错误码为 ENVIRONMENT_PACKAGE_INSTALL_FAILED。self_hosted、scope 和跨会话包缓存尚不支持。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Environment identifier (e.g., 'env_...') |
| archived_at | null | string | RFC 3339 timestamp when environment was archived, or null if not archived |
| config | object | Environment configuration (either Anthropic Cloud or self-hosted) |
| config.networking | object | Network configuration policy. |
| config.packages | object | Package manager configuration. |
| config.type | string | Environment type |
| created_at | string | RFC 3339 timestamp when environment was created |
| description | null | string | User-provided description for the environment; null when unset |
| metadata | object | User-provided metadata key-value pairs |
| name | string | Human-readable name for the environment |
| type | string | The type of object (always 'environment') |
| updated_at | string | RFC 3339 timestamp when environment was last updated |
| scope | string | The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account. |
/anthropic/v1/environments/{environment_id}/archive◐ 部分支持environment_idstring必填path: 环境 ID(路径或查询参数)。
501
支持租户自建 cloud 环境、配置更新与软归档;内置环境只读。列表支持 limit、page 和 include_archived。limited 网络在沙箱创建时生效;安装失败会终止会话,错误码为 ENVIRONMENT_PACKAGE_INSTALL_FAILED。self_hosted、scope 和跨会话包缓存尚不支持。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Environment identifier (e.g., 'env_...') |
| archived_at | null | string | RFC 3339 timestamp when environment was archived, or null if not archived |
| config | object | Environment configuration (either Anthropic Cloud or self-hosted) |
| config.networking | object | Network configuration policy. |
| config.packages | object | Package manager configuration. |
| config.type | string | Environment type |
| created_at | string | RFC 3339 timestamp when environment was created |
| description | null | string | User-provided description for the environment; null when unset |
| metadata | object | User-provided metadata key-value pairs |
| name | string | Human-readable name for the environment |
| type | string | The type of object (always 'environment') |
| updated_at | string | RFC 3339 timestamp when environment was last updated |
| scope | string | The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account. |
/anthropic/v1/environments/{environment_id}/work○ 未支持environment_idstring必填path: 环境 ID(路径或查询参数)。
limitnumber可选query: 每页返回的条数上限。
pagestring可选query: 分页游标,取自上一页响应的 next_page。
501 平台还没有实现这个端点;调用会得到下面这个响应:
这是自托管执行器领取任务的协议;平台的智能体都在平台上执行,不支持自托管执行器。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | |
| data[].id | string | Work identifier (e.g., 'work_...') |
| data[].acknowledged_at | null | string | RFC 3339 timestamp when work was acknowledged by Environment Manager |
| data[].created_at | string | RFC 3339 timestamp when work was created |
| data[].data | object | The actual work to be performed (session or health check) |
| data[].environment_id | string | Environment identifier this work belongs to (e.g., `env_...`) |
| data[].latest_heartbeat_at | null | string | RFC 3339 timestamp of the most recent heartbeat |
| data[].metadata | object | User-provided metadata key-value pairs associated with this work item |
| data[].secret | null | string | Credential payload used by the environment worker to execute this work item. May be populated when polling for work; null on all other retrieval paths. |
| data[].started_at | null | string | RFC 3339 timestamp when work execution started |
| data[].state | string | Current state of the work item |
| data[].stop_requested_at | null | string | RFC 3339 timestamp when stop was requested |
| data[].stopped_at | null | string | RFC 3339 timestamp when work execution stopped |
| data[].type | string | The type of object (always 'work') |
| next_page | string | null |
/anthropic/v1/environments/{environment_id}/work/{work_id}○ 未支持environment_idstring必填path: 环境 ID(路径或查询参数)。
work_idstring必填path: 路径参数:任务 ID。
environment_idstring必填query: 环境 ID(路径或查询参数)。
501 平台还没有实现这个端点;调用会得到下面这个响应:
这是自托管执行器领取任务的协议;平台的智能体都在平台上执行,不支持自托管执行器。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Work identifier (e.g., 'work_...') |
| acknowledged_at | null | string | RFC 3339 timestamp when work was acknowledged by Environment Manager |
| created_at | string | RFC 3339 timestamp when work was created |
| data | object | The actual work to be performed (session or health check) |
| data.id | string | Session identifier (e.g., 'session_...') / Health check identifier |
| data.type | string | Type of work data |
| environment_id | string | Environment identifier this work belongs to (e.g., `env_...`) |
| latest_heartbeat_at | null | string | RFC 3339 timestamp of the most recent heartbeat |
| metadata | object | User-provided metadata key-value pairs associated with this work item |
| secret | null | string | Credential payload used by the environment worker to execute this work item. May be populated when polling for work; null on all other retrieval paths. |
| started_at | null | string | RFC 3339 timestamp when work execution started |
| state | string | Current state of the work item |
| stop_requested_at | null | string | RFC 3339 timestamp when stop was requested |
| stopped_at | null | string | RFC 3339 timestamp when work execution stopped |
| type | string | The type of object (always 'work') |
/anthropic/v1/environments/{environment_id}/work/{work_id}○ 未支持environment_idstring必填path: 环境 ID(路径或查询参数)。
work_idstring必填path: 路径参数:任务 ID。
environment_idstring必填query: 环境 ID(路径或查询参数)。
metadataobject必填Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve existing metadata.
501 平台还没有实现这个端点;调用会得到下面这个响应:
这是自托管执行器领取任务的协议;平台的智能体都在平台上执行,不支持自托管执行器。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Work identifier (e.g., 'work_...') |
| acknowledged_at | null | string | RFC 3339 timestamp when work was acknowledged by Environment Manager |
| created_at | string | RFC 3339 timestamp when work was created |
| data | object | The actual work to be performed (session or health check) |
| data.id | string | Session identifier (e.g., 'session_...') / Health check identifier |
| data.type | string | Type of work data |
| environment_id | string | Environment identifier this work belongs to (e.g., `env_...`) |
| latest_heartbeat_at | null | string | RFC 3339 timestamp of the most recent heartbeat |
| metadata | object | User-provided metadata key-value pairs associated with this work item |
| secret | null | string | Credential payload used by the environment worker to execute this work item. May be populated when polling for work; null on all other retrieval paths. |
| started_at | null | string | RFC 3339 timestamp when work execution started |
| state | string | Current state of the work item |
| stop_requested_at | null | string | RFC 3339 timestamp when stop was requested |
| stopped_at | null | string | RFC 3339 timestamp when work execution stopped |
| type | string | The type of object (always 'work') |
/anthropic/v1/environments/{environment_id}/work/{work_id}/ack○ 未支持environment_idstring必填path: 环境 ID(路径或查询参数)。
work_idstring必填path: 路径参数:任务 ID。
environment_idstring必填query: 环境 ID(路径或查询参数)。
501 平台还没有实现这个端点;调用会得到下面这个响应:
这是自托管执行器领取任务的协议;平台的智能体都在平台上执行,不支持自托管执行器。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Work identifier (e.g., 'work_...') |
| acknowledged_at | null | string | RFC 3339 timestamp when work was acknowledged by Environment Manager |
| created_at | string | RFC 3339 timestamp when work was created |
| data | object | The actual work to be performed (session or health check) |
| data.id | string | Session identifier (e.g., 'session_...') / Health check identifier |
| data.type | string | Type of work data |
| environment_id | string | Environment identifier this work belongs to (e.g., `env_...`) |
| latest_heartbeat_at | null | string | RFC 3339 timestamp of the most recent heartbeat |
| metadata | object | User-provided metadata key-value pairs associated with this work item |
| secret | null | string | Credential payload used by the environment worker to execute this work item. May be populated when polling for work; null on all other retrieval paths. |
| started_at | null | string | RFC 3339 timestamp when work execution started |
| state | string | Current state of the work item |
| stop_requested_at | null | string | RFC 3339 timestamp when stop was requested |
| stopped_at | null | string | RFC 3339 timestamp when work execution stopped |
| type | string | The type of object (always 'work') |
/anthropic/v1/environments/{environment_id}/work/{work_id}/heartbeat○ 未支持environment_idstring必填path: 环境 ID(路径或查询参数)。
work_idstring必填path: 路径参数:任务 ID。
environment_idstring必填query: 环境 ID(路径或查询参数)。
desired_ttl_secondsnumber可选query: 期望的任务租约有效期(秒)。
expected_last_heartbeatstring可选query: 期望的最后心跳时间,用于并发保护。
501 平台还没有实现这个端点;调用会得到下面这个响应:
这是自托管执行器领取任务的协议;平台的智能体都在平台上执行,不支持自托管执行器。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| last_heartbeat | string | RFC 3339 timestamp of the actual heartbeat from DB |
| lease_extended | boolean | Whether the heartbeat succeeded in extending the lease |
| state | string | Current state of the work item (active/stopping/stopped) |
| ttl_seconds | number | Effective TTL applied to the lease |
| type | string | The type of response |
/anthropic/v1/environments/{environment_id}/work/{work_id}/stop○ 未支持environment_idstring必填path: 环境 ID(路径或查询参数)。
work_idstring必填path: 路径参数:任务 ID。
environment_idstring必填query: 环境 ID(路径或查询参数)。
forceboolean可选If true, immediately stop work without graceful shutdown
501 平台还没有实现这个端点;调用会得到下面这个响应:
这是自托管执行器领取任务的协议;平台的智能体都在平台上执行,不支持自托管执行器。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Work identifier (e.g., 'work_...') |
| acknowledged_at | null | string | RFC 3339 timestamp when work was acknowledged by Environment Manager |
| created_at | string | RFC 3339 timestamp when work was created |
| data | object | The actual work to be performed (session or health check) |
| data.id | string | Session identifier (e.g., 'session_...') / Health check identifier |
| data.type | string | Type of work data |
| environment_id | string | Environment identifier this work belongs to (e.g., `env_...`) |
| latest_heartbeat_at | null | string | RFC 3339 timestamp of the most recent heartbeat |
| metadata | object | User-provided metadata key-value pairs associated with this work item |
| secret | null | string | Credential payload used by the environment worker to execute this work item. May be populated when polling for work; null on all other retrieval paths. |
| started_at | null | string | RFC 3339 timestamp when work execution started |
| state | string | Current state of the work item |
| stop_requested_at | null | string | RFC 3339 timestamp when stop was requested |
| stopped_at | null | string | RFC 3339 timestamp when work execution stopped |
| type | string | The type of object (always 'work') |
/anthropic/v1/environments/{environment_id}/work/poll○ 未支持environment_idstring必填path: 环境 ID(路径或查询参数)。
block_msnumber可选query: 没有可领任务时最多等待的毫秒数(1–999)。
reclaim_older_than_msnumber可选query: 回收租约早于该毫秒数的任务。
Anthropic-Worker-IDstring可选query: 发起轮询的自托管执行器实例 ID,用于在控制台聚合环境级任务指标。
501 平台还没有实现这个端点;调用会得到下面这个响应:
这是自托管执行器领取任务的协议;平台的智能体都在平台上执行,不支持自托管执行器。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Work identifier (e.g., 'work_...') |
| acknowledged_at | null | string | RFC 3339 timestamp when work was acknowledged by Environment Manager |
| created_at | string | RFC 3339 timestamp when work was created |
| data | object | The actual work to be performed (session or health check) |
| data.id | string | Session identifier (e.g., 'session_...') / Health check identifier |
| data.type | string | Type of work data |
| environment_id | string | Environment identifier this work belongs to (e.g., `env_...`) |
| latest_heartbeat_at | null | string | RFC 3339 timestamp of the most recent heartbeat |
| metadata | object | User-provided metadata key-value pairs associated with this work item |
| secret | null | string | Credential payload used by the environment worker to execute this work item. May be populated when polling for work; null on all other retrieval paths. |
| started_at | null | string | RFC 3339 timestamp when work execution started |
| state | string | Current state of the work item |
| stop_requested_at | null | string | RFC 3339 timestamp when stop was requested |
| stopped_at | null | string | RFC 3339 timestamp when work execution stopped |
| type | string | The type of object (always 'work') |
/anthropic/v1/environments/{environment_id}/work/stats○ 未支持environment_idstring必填path: 环境 ID(路径或查询参数)。
501 平台还没有实现这个端点;调用会得到下面这个响应:
这是自托管执行器领取任务的协议;平台的智能体都在平台上执行,不支持自托管执行器。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| depth | number | Number of work items waiting to be picked up (lag from consumer group) |
| oldest_queued_at | null | string | RFC 3339 timestamp of oldest item in the work stream (includes both queued and pending items), null if stream empty |
| pending | number | Number of work items being processed (polled but not acknowledged) |
| type | string | The type of object |
| workers_polling | null | number | Number of workers that have polled for work in the last 30 seconds. Requires worker_id to be sent with poll requests. |
/anthropic/v1/memory_stores○ 未支持created_at[gte]string可选query: 只返回不早于该时间创建的记录。
created_at[lte]string可选query: 只返回不晚于该时间创建的记录。
include_archivedboolean可选query: 是否包含已归档的记录。
limitnumber可选query: 每页返回的条数上限。
pagestring可选query: 分页游标,取自上一页响应的 next_page。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | |
| data[].id | string | Unique identifier for the memory store (a `memstore_...` tagged ID). Use this when attaching the store to a session, or in the `{memory_store_id}` path parameter of subsequent calls. |
| data[].created_at | string | A timestamp in RFC 3339 format |
| data[].name | string | Human-readable name for the store. 1–255 characters. The store's mount-path slug under `/mnt/memory/` is derived from this name. |
| data[].type | string | |
| data[].updated_at | string | A timestamp in RFC 3339 format |
| data[].archived_at | null | string | A timestamp in RFC 3339 format |
| data[].description | string | Free-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent. Empty string when unset. |
| data[].metadata | object | Arbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Returned on retrieve/list but not filterable. |
| next_page | string | null |
/anthropic/v1/memory_stores○ 未支持namestring必填Human-readable name for the store. Required; 1–255 characters; no control characters. The mount-path slug under `/mnt/memory/` is derived from this name (lowercased, non-alphanumeric runs collapsed to a hyphen). Names need not be unique within a workspace.
descriptionstring可选Free-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent.
metadataobject可选Arbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Not visible to the agent.
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for the memory store (a `memstore_...` tagged ID). Use this when attaching the store to a session, or in the `{memory_store_id}` path parameter of subsequent calls. |
| created_at | string | A timestamp in RFC 3339 format |
| name | string | Human-readable name for the store. 1–255 characters. The store's mount-path slug under `/mnt/memory/` is derived from this name. |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| archived_at | null | string | A timestamp in RFC 3339 format |
| description | string | Free-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent. Empty string when unset. |
| metadata | object | Arbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Returned on retrieve/list but not filterable. |
/anthropic/v1/memory_stores/{memory_store_id}○ 未支持memory_store_idstring必填path: 记忆库 ID(路径或查询参数)。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | ID of the deleted memory store (a `memstore_...` identifier). The store and all its memories and versions are no longer retrievable. |
| type | string |
/anthropic/v1/memory_stores/{memory_store_id}○ 未支持memory_store_idstring必填path: 记忆库 ID(路径或查询参数)。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for the memory store (a `memstore_...` tagged ID). Use this when attaching the store to a session, or in the `{memory_store_id}` path parameter of subsequent calls. |
| created_at | string | A timestamp in RFC 3339 format |
| name | string | Human-readable name for the store. 1–255 characters. The store's mount-path slug under `/mnt/memory/` is derived from this name. |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| archived_at | null | string | A timestamp in RFC 3339 format |
| description | string | Free-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent. Empty string when unset. |
| metadata | object | Arbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Returned on retrieve/list but not filterable. |
/anthropic/v1/memory_stores/{memory_store_id}○ 未支持memory_store_idstring必填path: 记忆库 ID(路径或查询参数)。
namestring可选New human-readable name for the store. 1–255 characters; no control characters. Renaming changes the slug used for the store's `mount_path` in sessions created after the update.
descriptionstring可选New description for the store, up to 1024 characters. Pass an empty string to clear it.
metadataobject可选Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars.
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for the memory store (a `memstore_...` tagged ID). Use this when attaching the store to a session, or in the `{memory_store_id}` path parameter of subsequent calls. |
| created_at | string | A timestamp in RFC 3339 format |
| name | string | Human-readable name for the store. 1–255 characters. The store's mount-path slug under `/mnt/memory/` is derived from this name. |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| archived_at | null | string | A timestamp in RFC 3339 format |
| description | string | Free-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent. Empty string when unset. |
| metadata | object | Arbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Returned on retrieve/list but not filterable. |
/anthropic/v1/memory_stores/{memory_store_id}/archive○ 未支持memory_store_idstring必填path: 记忆库 ID(路径或查询参数)。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for the memory store (a `memstore_...` tagged ID). Use this when attaching the store to a session, or in the `{memory_store_id}` path parameter of subsequent calls. |
| created_at | string | A timestamp in RFC 3339 format |
| name | string | Human-readable name for the store. 1–255 characters. The store's mount-path slug under `/mnt/memory/` is derived from this name. |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| archived_at | null | string | A timestamp in RFC 3339 format |
| description | string | Free-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent. Empty string when unset. |
| metadata | object | Arbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Returned on retrieve/list but not filterable. |
/anthropic/v1/memory_stores/{memory_store_id}/memories○ 未支持memory_store_idstring必填path: 记忆库 ID(路径或查询参数)。
depthnumber可选query: 子节点回溯深度:0(默认)递归返回全部后代,1 只返回直接子节点。
path_prefixstring可选query: 按路径前缀过滤(需以 / 结尾并对齐分段)。
viewstring可选query: 返回投影:basic 省略内容,full 附带完整内容。
limitnumber可选query: 每页返回的条数上限。
pagestring可选query: 分页游标,取自上一页响应的 next_page。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | |
| data[].id | string | Unique identifier for this memory (a `mem_...` value). Stable across renames; use this ID, not the path, to read, update, or delete the memory. |
| data[].content_sha256 | string | Lowercase hex SHA-256 digest of the UTF-8 `content` bytes (64 characters). The server applies no normalization, so clients can compute the same hash locally for staleness checks and as the value for a `content_sha256` precondition on update. Always populated, regardless of `view`. |
| data[].content_size_bytes | number | Size of `content` in bytes (the UTF-8 plaintext length). Always populated, regardless of `view`. |
| data[].created_at | string | A timestamp in RFC 3339 format |
| data[].memory_store_id | string | ID of the memory store this memory belongs to (a `memstore_...` value). |
| data[].memory_version_id | string | ID of the `memory_version` representing this memory's current content (a `memver_...` value). This is the authoritative head pointer; `memory_version` objects do not carry an `is_latest` flag, so compare against this field instead. Enumerate the history via List memory versions. |
| data[].path | string | Hierarchical path of the memory within the store, e.g. `/projects/foo/notes.md`. Always starts with `/`. Paths are case-sensitive and unique within a store. Maximum 1,024 bytes. / The rolled-up path prefix, including a trailing `/` (e.g. `/projects/foo/`). Pass this value as `path_prefix` on a subsequent list call to drill into the directory. |
| data[].type | string | |
| data[].updated_at | string | A timestamp in RFC 3339 format |
| data[].content | null | string | The memory's UTF-8 text content. Populated when `view=full`; `null` when `view=basic`. Maximum 100 kB (102,400 bytes). |
| next_page | string | null |
/anthropic/v1/memory_stores/{memory_store_id}/memories○ 未支持memory_store_idstring必填path: 记忆库 ID(路径或查询参数)。
viewstring可选query: 返回投影:basic 省略内容,full 附带完整内容。
contentstring必填UTF-8 text content for the new memory. Maximum 100 kB (102,400 bytes). Required; pass `""` explicitly to create an empty memory.
pathstring必填Hierarchical path for the new memory, e.g. `/projects/foo/notes.md`. Must start with `/`, contain at least one non-empty segment, and be at most 1,024 bytes. Must not contain empty segments, `.` or `..` segments, control or format characters, or the Unicode line and paragraph separators (U+2028, U+2029), and must be NFC-normalized. Paths are case-sensitive.
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for this memory (a `mem_...` value). Stable across renames; use this ID, not the path, to read, update, or delete the memory. |
| content_sha256 | string | Lowercase hex SHA-256 digest of the UTF-8 `content` bytes (64 characters). The server applies no normalization, so clients can compute the same hash locally for staleness checks and as the value for a `content_sha256` precondition on update. Always populated, regardless of `view`. |
| content_size_bytes | number | Size of `content` in bytes (the UTF-8 plaintext length). Always populated, regardless of `view`. |
| created_at | string | A timestamp in RFC 3339 format |
| memory_store_id | string | ID of the memory store this memory belongs to (a `memstore_...` value). |
| memory_version_id | string | ID of the `memory_version` representing this memory's current content (a `memver_...` value). This is the authoritative head pointer; `memory_version` objects do not carry an `is_latest` flag, so compare against this field instead. Enumerate the history via List memory versions. |
| path | string | Hierarchical path of the memory within the store, e.g. `/projects/foo/notes.md`. Always starts with `/`. Paths are case-sensitive and unique within a store. Maximum 1,024 bytes. |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| content | null | string | The memory's UTF-8 text content. Populated when `view=full`; `null` when `view=basic`. Maximum 100 kB (102,400 bytes). |
/anthropic/v1/memory_stores/{memory_store_id}/memories/{memory_id}○ 未支持memory_store_idstring必填path: 记忆库 ID(路径或查询参数)。
memory_idstring必填path: 记忆 ID(路径或查询参数)。
memory_store_idstring必填query: 记忆库 ID(路径或查询参数)。
expected_content_sha256string可选query: 期望的内容 SHA-256,用于并发修改保护。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | ID of the deleted memory (a `mem_...` value). |
| type | string |
/anthropic/v1/memory_stores/{memory_store_id}/memories/{memory_id}○ 未支持memory_store_idstring必填path: 记忆库 ID(路径或查询参数)。
memory_idstring必填path: 记忆 ID(路径或查询参数)。
memory_store_idstring必填query: 记忆库 ID(路径或查询参数)。
viewstring可选query: 返回投影:basic 省略内容,full 附带完整内容。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for this memory (a `mem_...` value). Stable across renames; use this ID, not the path, to read, update, or delete the memory. |
| content_sha256 | string | Lowercase hex SHA-256 digest of the UTF-8 `content` bytes (64 characters). The server applies no normalization, so clients can compute the same hash locally for staleness checks and as the value for a `content_sha256` precondition on update. Always populated, regardless of `view`. |
| content_size_bytes | number | Size of `content` in bytes (the UTF-8 plaintext length). Always populated, regardless of `view`. |
| created_at | string | A timestamp in RFC 3339 format |
| memory_store_id | string | ID of the memory store this memory belongs to (a `memstore_...` value). |
| memory_version_id | string | ID of the `memory_version` representing this memory's current content (a `memver_...` value). This is the authoritative head pointer; `memory_version` objects do not carry an `is_latest` flag, so compare against this field instead. Enumerate the history via List memory versions. |
| path | string | Hierarchical path of the memory within the store, e.g. `/projects/foo/notes.md`. Always starts with `/`. Paths are case-sensitive and unique within a store. Maximum 1,024 bytes. |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| content | null | string | The memory's UTF-8 text content. Populated when `view=full`; `null` when `view=basic`. Maximum 100 kB (102,400 bytes). |
/anthropic/v1/memory_stores/{memory_store_id}/memories/{memory_id}○ 未支持memory_store_idstring必填path: 记忆库 ID(路径或查询参数)。
memory_idstring必填path: 记忆 ID(路径或查询参数)。
memory_store_idstring必填query: 记忆库 ID(路径或查询参数)。
viewstring可选query: 返回投影:basic 省略内容,full 附带完整内容。
contentstring可选New UTF-8 text content for the memory. Maximum 100 kB (102,400 bytes). Omit to leave the content unchanged (e.g., for a rename-only update).
pathstring可选New path for the memory (a rename). Must start with `/`, contain at least one non-empty segment, and be at most 1,024 bytes. Must not contain empty segments, `.` or `..` segments, control or format characters, or the Unicode line and paragraph separators (U+2028, U+2029), and must be NFC-normalized. Paths are case-sensitive. The memory's `id` is preserved across renames. Omit to leave the path unchanged.
preconditionobject可选Optimistic-concurrency precondition: the update applies only if the memory's stored `content_sha256` equals the supplied value. On mismatch, the request returns `memory_precondition_failed_error` (HTTP 409); re-read the memory and retry against the fresh state. If the precondition fails but the stored state already exactly matches the requested `content` and `path`, the server returns 200 instead of 409.
typestring必填content_sha256string可选Expected `content_sha256` of the stored memory (64 lowercase hexadecimal characters). Typically the `content_sha256` returned by a prior read or list call. Because the server applies no content normalization, clients can also compute this locally as the SHA-256 of the UTF-8 content bytes.
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for this memory (a `mem_...` value). Stable across renames; use this ID, not the path, to read, update, or delete the memory. |
| content_sha256 | string | Lowercase hex SHA-256 digest of the UTF-8 `content` bytes (64 characters). The server applies no normalization, so clients can compute the same hash locally for staleness checks and as the value for a `content_sha256` precondition on update. Always populated, regardless of `view`. |
| content_size_bytes | number | Size of `content` in bytes (the UTF-8 plaintext length). Always populated, regardless of `view`. |
| created_at | string | A timestamp in RFC 3339 format |
| memory_store_id | string | ID of the memory store this memory belongs to (a `memstore_...` value). |
| memory_version_id | string | ID of the `memory_version` representing this memory's current content (a `memver_...` value). This is the authoritative head pointer; `memory_version` objects do not carry an `is_latest` flag, so compare against this field instead. Enumerate the history via List memory versions. |
| path | string | Hierarchical path of the memory within the store, e.g. `/projects/foo/notes.md`. Always starts with `/`. Paths are case-sensitive and unique within a store. Maximum 1,024 bytes. |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| content | null | string | The memory's UTF-8 text content. Populated when `view=full`; `null` when `view=basic`. Maximum 100 kB (102,400 bytes). |
/anthropic/v1/memory_stores/{memory_store_id}/memory_versions○ 未支持memory_store_idstring必填path: 记忆库 ID(路径或查询参数)。
api_key_idstring可选query: 只返回用该 API Key 写入的版本。
created_at[gte]string可选query: 只返回不早于该时间创建的记录。
created_at[lte]string可选query: 只返回不晚于该时间创建的记录。
memory_idstring可选query: 记忆 ID(路径或查询参数)。
operationstring可选query: 只返回记录该类变更的版本。
service_account_idstring可选query: 只返回该服务账号写入的版本。
session_idstring可选query: 会话 ID(路径或查询参数)。
viewstring可选query: 返回投影:basic 省略内容,full 附带完整内容。
limitnumber可选query: 每页返回的条数上限。
pagestring可选query: 分页游标,取自上一页响应的 next_page。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | |
| data[].id | string | Unique identifier for this version (a `memver_...` value). |
| data[].created_at | string | A timestamp in RFC 3339 format |
| data[].memory_id | string | ID of the memory this version snapshots (a `mem_...` value). Remains valid after the memory is deleted; pass it as `memory_id` to List memory versions to retrieve the memory's retained versions, including the `deleted` row while the lineage is retained. |
| data[].memory_store_id | string | ID of the memory store this version belongs to (a `memstore_...` value). |
| data[].operation | string | The kind of mutation a `memory_version` records. Every non-no-op mutation to a memory appends exactly one version row with one of these values. |
| data[].type | string | |
| data[].content | null | string | The memory's UTF-8 text content as of this version. `null` when `view=basic`, when `operation` is `deleted`, or when `redacted_at` is set. |
| data[].content_sha256 | null | string | Lowercase hex SHA-256 digest of `content` as of this version (64 characters). `null` when `redacted_at` is set or `operation` is `deleted`. Populated regardless of `view` otherwise. |
| data[].content_size_bytes | null | number | Size of `content` in bytes as of this version. `null` when `redacted_at` is set or `operation` is `deleted`. Populated regardless of `view` otherwise. |
| data[].created_by | object | Identifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the Sessions API. |
| data[].path | null | string | The memory's path at the time of this write. `null` if and only if `redacted_at` is set. |
| data[].redacted_at | null | string | A timestamp in RFC 3339 format |
| data[].redacted_by | object | Identifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the Sessions API. |
| next_page | string | null |
/anthropic/v1/memory_stores/{memory_store_id}/memory_versions/{memory_version_id}○ 未支持memory_store_idstring必填path: 记忆库 ID(路径或查询参数)。
memory_version_idstring必填path: 路径参数:记忆版本 ID。
memory_store_idstring必填query: 记忆库 ID(路径或查询参数)。
viewstring可选query: 返回投影:basic 省略内容,full 附带完整内容。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for this version (a `memver_...` value). |
| created_at | string | A timestamp in RFC 3339 format |
| memory_id | string | ID of the memory this version snapshots (a `mem_...` value). Remains valid after the memory is deleted; pass it as `memory_id` to List memory versions to retrieve the memory's retained versions, including the `deleted` row while the lineage is retained. |
| memory_store_id | string | ID of the memory store this version belongs to (a `memstore_...` value). |
| operation | string | The kind of mutation a `memory_version` records. Every non-no-op mutation to a memory appends exactly one version row with one of these values. |
| type | string | |
| content | null | string | The memory's UTF-8 text content as of this version. `null` when `view=basic`, when `operation` is `deleted`, or when `redacted_at` is set. |
| content_sha256 | null | string | Lowercase hex SHA-256 digest of `content` as of this version (64 characters). `null` when `redacted_at` is set or `operation` is `deleted`. Populated regardless of `view` otherwise. |
| content_size_bytes | null | number | Size of `content` in bytes as of this version. `null` when `redacted_at` is set or `operation` is `deleted`. Populated regardless of `view` otherwise. |
| created_by | object | Identifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the Sessions API. |
| created_by.session_id | string | ID of the session that performed the write (a `sesn_...` value). Look up the session via Retrieve a session for further provenance. |
| created_by.type | string | |
| created_by.api_key_id | string | ID of the API key that performed the write. This identifies the key, not the secret. |
| created_by.user_id | string | ID of the user who performed the write (a `user_...` value). |
| created_by.service_account_id | string | ID of the service account that performed the write (a `svac_...` value). |
| path | null | string | The memory's path at the time of this write. `null` if and only if `redacted_at` is set. |
| redacted_at | null | string | A timestamp in RFC 3339 format |
| redacted_by | object | Identifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the Sessions API. |
| redacted_by.session_id | string | ID of the session that performed the write (a `sesn_...` value). Look up the session via Retrieve a session for further provenance. |
| redacted_by.type | string | |
| redacted_by.api_key_id | string | ID of the API key that performed the write. This identifies the key, not the secret. |
| redacted_by.user_id | string | ID of the user who performed the write (a `user_...` value). |
| redacted_by.service_account_id | string | ID of the service account that performed the write (a `svac_...` value). |
/anthropic/v1/memory_stores/{memory_store_id}/memory_versions/{memory_version_id}/redact○ 未支持memory_store_idstring必填path: 记忆库 ID(路径或查询参数)。
memory_version_idstring必填path: 路径参数:记忆版本 ID。
memory_store_idstring必填query: 记忆库 ID(路径或查询参数)。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for this version (a `memver_...` value). |
| created_at | string | A timestamp in RFC 3339 format |
| memory_id | string | ID of the memory this version snapshots (a `mem_...` value). Remains valid after the memory is deleted; pass it as `memory_id` to List memory versions to retrieve the memory's retained versions, including the `deleted` row while the lineage is retained. |
| memory_store_id | string | ID of the memory store this version belongs to (a `memstore_...` value). |
| operation | string | The kind of mutation a `memory_version` records. Every non-no-op mutation to a memory appends exactly one version row with one of these values. |
| type | string | |
| content | null | string | The memory's UTF-8 text content as of this version. `null` when `view=basic`, when `operation` is `deleted`, or when `redacted_at` is set. |
| content_sha256 | null | string | Lowercase hex SHA-256 digest of `content` as of this version (64 characters). `null` when `redacted_at` is set or `operation` is `deleted`. Populated regardless of `view` otherwise. |
| content_size_bytes | null | number | Size of `content` in bytes as of this version. `null` when `redacted_at` is set or `operation` is `deleted`. Populated regardless of `view` otherwise. |
| created_by | object | Identifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the Sessions API. |
| created_by.session_id | string | ID of the session that performed the write (a `sesn_...` value). Look up the session via Retrieve a session for further provenance. |
| created_by.type | string | |
| created_by.api_key_id | string | ID of the API key that performed the write. This identifies the key, not the secret. |
| created_by.user_id | string | ID of the user who performed the write (a `user_...` value). |
| created_by.service_account_id | string | ID of the service account that performed the write (a `svac_...` value). |
| path | null | string | The memory's path at the time of this write. `null` if and only if `redacted_at` is set. |
| redacted_at | null | string | A timestamp in RFC 3339 format |
| redacted_by | object | Identifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the Sessions API. |
| redacted_by.session_id | string | ID of the session that performed the write (a `sesn_...` value). Look up the session via Retrieve a session for further provenance. |
| redacted_by.type | string | |
| redacted_by.api_key_id | string | ID of the API key that performed the write. This identifies the key, not the secret. |
| redacted_by.user_id | string | ID of the user who performed the write (a `user_...` value). |
| redacted_by.service_account_id | string | ID of the service account that performed the write (a `svac_...` value). |
/anthropic/v1/sessions/{session_id}○ 未支持session_idstring必填path: 会话 ID(路径或查询参数)。
501 平台还没有实现这个端点;调用会得到下面这个响应:
会话目前支持创建、读取、列出、更新与归档;删除还没有实现。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| type | string |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/anthropic/v1/sessions/{session_id}◐ 部分支持session_idstring必填path: 会话 ID(路径或查询参数)。
agentobject可选会话要运行的智能体:直接写智能体 ID 字符串(固定用最新版本),或传对象指定 id 与 version(见子字段)。
mcp_serversarray可选替换本会话的 MCP 服务器列表:传入的数组整体生效;传空数组清除,省略沿用智能体的配置。
toolsarray可选替换本会话的工具配置;传空数组清除,省略沿用智能体的配置。
budgetobject可选A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.
max_list_costobject必填预算内列表类调用的花费上限。
typestring必填预算类型,目前只有 max_list_cost。
metadataobject可选Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve.
titlestring可选Human-readable session title.
vault_idsarray可选Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use.
200
支持 title 与 metadata(官方补丁语义:字符串值写入、null 删除该键、整包 null 清空,未提及的键保留)。官方的 agent 覆盖(tools/mcp_servers)、budget 与 vault_ids 不支持,传入返回 400 并点名字段。归档后的会话更新返回 409。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| agent | object | Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. |
| agent.id | string | |
| agent.description | null | string | |
| agent.mcp_servers | array<object> | |
| agent.model | object | Model identifier and configuration. |
| agent.multiagent | null | object | Resolved coordinator topology with full agent definitions for each roster member. |
| agent.name | string | |
| agent.skills | array<object> | |
| agent.system | null | string | |
| agent.tools | array<object> | |
| agent.type | string | |
| agent.version | number | |
| archived_at | null | string | A timestamp in RFC 3339 format |
| budget | null | object | A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`. |
| budget.max_list_cost | object | A monetary amount in a specific currency. |
| budget.type | string | |
| created_at | string | A timestamp in RFC 3339 format |
| environment_id | string | |
| metadata | object | |
| outcome_evaluations | array<object> | Per-outcome evaluation state. One entry per `define_outcome` event sent to the session. |
| outcome_evaluations[].completed_at | null | string | A timestamp in RFC 3339 format |
| outcome_evaluations[].description | string | What the agent should produce. |
| outcome_evaluations[].explanation | null | string | Grader's verdict text from the most recent evaluation. For `satisfied`, explains why criteria are met; for `needs_revision` (intermediate), what's missing; for `failed`, why unrecoverable. |
| outcome_evaluations[].iteration | number | 0-indexed revision cycle the outcome is currently on. |
| outcome_evaluations[].outcome_id | string | Server-generated outc_ ID for this outcome. |
| outcome_evaluations[].result | string | Current evaluation state. `pending` before the agent begins work; `running` while producing or revising; `evaluating` while the grader scores; `satisfied`/`max_iterations_reached`/`failed`/`interrupted` are terminal. |
| outcome_evaluations[].type | string | |
| resources | array<object> | |
| resources[].id | string | |
| resources[].created_at | string | A timestamp in RFC 3339 format |
| resources[].mount_path | string | null | string | Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only. |
| resources[].type | string | |
| resources[].updated_at | string | A timestamp in RFC 3339 format |
| resources[].url | string | |
| resources[].checkout | null | object | |
| resources[].file_id | string | |
| resources[].memory_store_id | string | The memory store ID (memstore_...). Must belong to the caller's organization and workspace. |
| resources[].access | null | string | Access mode for an attached memory store. |
| resources[].description | string | Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description. |
| resources[].instructions | null | string | Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars. |
| resources[].name | null | string | Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource. |
| stats | object | Timing statistics for a session. |
| stats.active_seconds | number | Cumulative time in seconds the session spent in `running` status. Excludes idle time. |
| stats.duration_seconds | number | Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. |
| status | string | SessionStatus enum - `rescheduling` - Transient error occurred, retrying automatically. - `running` - Agent is actively executing. - `idle` - Agent is waiting for input, including user messages or tool confirmations. Sessions start in idle. - `terminated` - Session has ended, either due to an error or completion. |
| title | null | string | |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| usage | object | Cumulative token usage for a session across all turns. |
| usage.active_seconds | number | Cumulative time in seconds during which the session had at least one thread in running status. Overlapping activity from concurrent threads is counted once, unlike `stats.active_seconds`, which sums each thread's own active time. This is the duration the session's runtime cost is priced on. |
| usage.cache_creation | object | Prompt-cache creation token usage broken down by cache lifetime. |
| usage.cache_read_input_tokens | number | Total tokens read from prompt cache. |
| usage.input_tokens | number | Total input tokens consumed across all turns. |
| usage.list_cost | null | object | A monetary amount in a specific currency. |
| usage.output_tokens | number | Total output tokens generated across all turns. |
| usage.server_tool_use | null | object | Cumulative count of server-executed tool invocations, broken down by tool. |
| vault_ids | array<string> | Vault IDs attached to the session at creation. Empty when no vaults were supplied. |
| deployment_id | null | string | Deployment ID when the session was created from a deployment reference. Null otherwise. |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/anthropic/v1/sessions/{session_id}/archive● 支持session_idstring必填path: 会话 ID(路径或查询参数)。
200
归档后的会话拒绝新消息(400 invalid_request_error,写明会话已归档),读取与事件历史仍可用;重复归档幂等,archived_at 保持首次归档时间。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| agent | object | Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. |
| agent.id | string | |
| agent.description | null | string | |
| agent.mcp_servers | array<object> | |
| agent.model | object | Model identifier and configuration. |
| agent.multiagent | null | object | Resolved coordinator topology with full agent definitions for each roster member. |
| agent.name | string | |
| agent.skills | array<object> | |
| agent.system | null | string | |
| agent.tools | array<object> | |
| agent.type | string | |
| agent.version | number | |
| archived_at | null | string | A timestamp in RFC 3339 format |
| budget | null | object | A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`. |
| budget.max_list_cost | object | A monetary amount in a specific currency. |
| budget.type | string | |
| created_at | string | A timestamp in RFC 3339 format |
| environment_id | string | |
| metadata | object | |
| outcome_evaluations | array<object> | Per-outcome evaluation state. One entry per `define_outcome` event sent to the session. |
| outcome_evaluations[].completed_at | null | string | A timestamp in RFC 3339 format |
| outcome_evaluations[].description | string | What the agent should produce. |
| outcome_evaluations[].explanation | null | string | Grader's verdict text from the most recent evaluation. For `satisfied`, explains why criteria are met; for `needs_revision` (intermediate), what's missing; for `failed`, why unrecoverable. |
| outcome_evaluations[].iteration | number | 0-indexed revision cycle the outcome is currently on. |
| outcome_evaluations[].outcome_id | string | Server-generated outc_ ID for this outcome. |
| outcome_evaluations[].result | string | Current evaluation state. `pending` before the agent begins work; `running` while producing or revising; `evaluating` while the grader scores; `satisfied`/`max_iterations_reached`/`failed`/`interrupted` are terminal. |
| outcome_evaluations[].type | string | |
| resources | array<object> | |
| resources[].id | string | |
| resources[].created_at | string | A timestamp in RFC 3339 format |
| resources[].mount_path | string | null | string | Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only. |
| resources[].type | string | |
| resources[].updated_at | string | A timestamp in RFC 3339 format |
| resources[].url | string | |
| resources[].checkout | null | object | |
| resources[].file_id | string | |
| resources[].memory_store_id | string | The memory store ID (memstore_...). Must belong to the caller's organization and workspace. |
| resources[].access | null | string | Access mode for an attached memory store. |
| resources[].description | string | Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description. |
| resources[].instructions | null | string | Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars. |
| resources[].name | null | string | Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource. |
| stats | object | Timing statistics for a session. |
| stats.active_seconds | number | Cumulative time in seconds the session spent in `running` status. Excludes idle time. |
| stats.duration_seconds | number | Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. |
| status | string | SessionStatus enum - `rescheduling` - Transient error occurred, retrying automatically. - `running` - Agent is actively executing. - `idle` - Agent is waiting for input, including user messages or tool confirmations. Sessions start in idle. - `terminated` - Session has ended, either due to an error or completion. |
| title | null | string | |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| usage | object | Cumulative token usage for a session across all turns. |
| usage.active_seconds | number | Cumulative time in seconds during which the session had at least one thread in running status. Overlapping activity from concurrent threads is counted once, unlike `stats.active_seconds`, which sums each thread's own active time. This is the duration the session's runtime cost is priced on. |
| usage.cache_creation | object | Prompt-cache creation token usage broken down by cache lifetime. |
| usage.cache_read_input_tokens | number | Total tokens read from prompt cache. |
| usage.input_tokens | number | Total input tokens consumed across all turns. |
| usage.list_cost | null | object | A monetary amount in a specific currency. |
| usage.output_tokens | number | Total output tokens generated across all turns. |
| usage.server_tool_use | null | object | Cumulative count of server-executed tool invocations, broken down by tool. |
| vault_ids | array<string> | Vault IDs attached to the session at creation. Empty when no vaults were supplied. |
| deployment_id | null | string | Deployment ID when the session was created from a deployment reference. Null otherwise. |
/anthropic/v1/sessions/{session_id}/resources◐ 部分支持session_idstring必填path: 会话 ID(路径或查询参数)。
limitnumber可选query: 每页返回的条数上限。
pagestring可选query: 分页游标,取自上一页响应的 next_page。
501
支持 file 类型资源的持久化、查询和解除关联,单会话最多 500 条。文件须属于当前租户且有效。默认路径为 /mnt/session/uploads/<file_id>,自定义路径归一到该目录,拒绝父目录遍历。不修改文件内容;本批尚不将资源同步到沙箱。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | |
| data[].id | string | |
| data[].created_at | string | A timestamp in RFC 3339 format |
| data[].mount_path | string | null | string | Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only. |
| data[].type | string | |
| data[].updated_at | string | A timestamp in RFC 3339 format |
| data[].url | string | |
| data[].checkout | null | object | |
| data[].file_id | string | |
| data[].memory_store_id | string | The memory store ID (memstore_...). Must belong to the caller's organization and workspace. |
| data[].access | null | string | Access mode for an attached memory store. |
| data[].description | string | Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description. |
| data[].instructions | null | string | Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars. |
| data[].name | null | string | Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource. |
| next_page | string | null |
/anthropic/v1/sessions/{session_id}/resources◐ 部分支持session_idstring必填path: 会话 ID(路径或查询参数)。
typestring必填query: 要新增的资源在请求体里对应的字段名。
file_idstring必填ID of a previously uploaded file.
mount_pathstring可选Mount path in the container. Defaults to `/mnt/session/uploads/<file_id>`.
501
支持 file 类型资源的持久化、查询和解除关联,单会话最多 500 条。文件须属于当前租户且有效。默认路径为 /mnt/session/uploads/<file_id>,自定义路径归一到该目录,拒绝父目录遍历。不修改文件内容;本批尚不将资源同步到沙箱。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| created_at | string | A timestamp in RFC 3339 format |
| file_id | string | |
| mount_path | string | |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
/anthropic/v1/sessions/{session_id}/resources/{resource_id}◐ 部分支持session_idstring必填path: 会话 ID(路径或查询参数)。
resource_idstring必填path: 路径参数:会话资源 ID。
session_idstring必填query: 会话 ID(路径或查询参数)。
501
支持 file 类型资源的持久化、查询和解除关联,单会话最多 500 条。文件须属于当前租户且有效。默认路径为 /mnt/session/uploads/<file_id>,自定义路径归一到该目录,拒绝父目录遍历。不修改文件内容;本批尚不将资源同步到沙箱。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| type | string |
/anthropic/v1/sessions/{session_id}/resources/{resource_id}◐ 部分支持session_idstring必填path: 会话 ID(路径或查询参数)。
resource_idstring必填path: 路径参数:会话资源 ID。
session_idstring必填query: 会话 ID(路径或查询参数)。
501
支持 file 类型资源的持久化、查询和解除关联,单会话最多 500 条。文件须属于当前租户且有效。默认路径为 /mnt/session/uploads/<file_id>,自定义路径归一到该目录,拒绝父目录遍历。不修改文件内容;本批尚不将资源同步到沙箱。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| created_at | string | A timestamp in RFC 3339 format |
| mount_path | string | null | string | Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only. |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| url | string | |
| checkout | null | object | |
| checkout.name | string | Branch name to check out. |
| checkout.type | string | |
| checkout.sha | string | Full commit SHA to check out. |
| file_id | string | |
| memory_store_id | string | The memory store ID (memstore_...). Must belong to the caller's organization and workspace. |
| access | null | string | Access mode for an attached memory store. |
| description | string | Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description. |
| instructions | null | string | Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars. |
| name | null | string | Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource. |
/anthropic/v1/sessions/{session_id}/resources/{resource_id}○ 未支持session_idstring必填path: 会话 ID(路径或查询参数)。
resource_idstring必填path: 路径参数:会话资源 ID。
session_idstring必填query: 会话 ID(路径或查询参数)。
authorization_tokenstring必填New authorization token for the resource. Currently only `github_repository` resources support token rotation.
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还不能给会话挂载额外资源(文件、代码仓库等)。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| created_at | string | A timestamp in RFC 3339 format |
| mount_path | string | null | string | Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only. |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| url | string | |
| checkout | null | object | |
| checkout.name | string | Branch name to check out. |
| checkout.type | string | |
| checkout.sha | string | Full commit SHA to check out. |
| file_id | string | |
| memory_store_id | string | The memory store ID (memstore_...). Must belong to the caller's organization and workspace. |
| access | null | string | Access mode for an attached memory store. |
| description | string | Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description. |
| instructions | null | string | Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars. |
| name | null | string | Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource. |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/anthropic/v1/sessions/{session_id}/threads◐ 部分支持session_idstring必填path: 会话 ID(路径或查询参数)。
limitnumber可选query: 每页返回的条数上限。
pagestring可选query: 分页游标,取自上一页响应的 next_page。
200
按 created_at 升序返回主线程及全部子线程。线程 id 为 sthr_ 加所属会话 id 的后缀;子线程的 parent_thread_id 指向主线程,session_id 始终为父会话。agent 是实际运行的定义,内置类型的 name 为类型名,未注册的 id/version 为 null。归档子线程的 status 为 terminated,archived_at 为归档时间;stats/usage 无线程级追踪时如实为 null。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | |
| data[].id | string | Unique identifier for this thread. |
| data[].agent | object | The resolved agent a `session_thread` runs. |
| data[].archived_at | null | string | A timestamp in RFC 3339 format |
| data[].created_at | string | A timestamp in RFC 3339 format |
| data[].parent_thread_id | null | string | Parent thread that spawned this thread. Null for the primary thread. |
| data[].session_id | string | The session this thread belongs to. |
| data[].stats | null | object | Timing statistics for a session thread. |
| data[].status | string | SessionThreadStatus enum |
| data[].type | string | |
| data[].updated_at | string | A timestamp in RFC 3339 format |
| data[].usage | null | object | Cumulative token usage for a session thread across all turns. |
| next_page | string | null |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/anthropic/v1/sessions/{session_id}/threads/{thread_id}◐ 部分支持session_idstring必填path: 会话 ID(路径或查询参数)。
thread_idstring必填path: 路径参数:线程 ID。
session_idstring必填query: 会话 ID(路径或查询参数)。
200
返回本会话的主线程或子线程,与列表项逐字段一致。其他会话的线程、未知线程或非 sthr_ id 一律返回 404,不泄露其存在性。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for this thread. |
| agent | object | The resolved agent a `session_thread` runs. |
| agent.model | string | object | The advisor model id. / Model identifier and configuration. |
| agent.type | string | |
| agent.id | string | |
| agent.description | null | string | |
| agent.mcp_servers | array<object> | |
| agent.name | string | |
| agent.skills | array<object> | |
| agent.system | null | string | |
| agent.tools | array<object> | |
| agent.version | number | |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| parent_thread_id | null | string | Parent thread that spawned this thread. Null for the primary thread. |
| session_id | string | The session this thread belongs to. |
| stats | null | object | Timing statistics for a session thread. |
| stats.active_seconds | number | Cumulative time in seconds the thread spent actively running. Excludes idle time. |
| stats.duration_seconds | number | Elapsed time since thread creation in seconds. For archived threads, frozen at the final update. |
| stats.startup_seconds | number | Time in seconds for the thread to begin running. Zero for child threads, which start immediately. |
| status | string | SessionThreadStatus enum |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| usage | null | object | Cumulative token usage for a session thread across all turns. |
| usage.active_seconds | number | Cumulative time in seconds this thread spent in running status. Equal to `stats.active_seconds`; surfaced here so a thread's usage carries every quantity its cost is priced on. |
| usage.cache_creation | object | Prompt-cache creation token usage broken down by cache lifetime. |
| usage.cache_read_input_tokens | number | Total tokens read from prompt cache. |
| usage.input_tokens | number | Total input tokens consumed across all turns. |
| usage.list_cost | null | object | A monetary amount in a specific currency. |
| usage.output_tokens | number | Total output tokens generated across all turns. |
| usage.server_tool_use | null | object | Cumulative count of server-executed tool invocations, broken down by tool. |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/anthropic/v1/sessions/{session_id}/threads/{thread_id}/archive◐ 部分支持session_idstring必填path: 会话 ID(路径或查询参数)。
thread_idstring必填path: 路径参数:线程 ID。
session_idstring必填query: 会话 ID(路径或查询参数)。
200
主线程沿用会话归档动作;子线程仅归档对应子会话,不归档父会话或其他子线程。子线程归档后 status 为 terminated,带 archived_at;历史事件仍可读。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for this thread. |
| agent | object | The resolved agent a `session_thread` runs. |
| agent.model | string | object | The advisor model id. / Model identifier and configuration. |
| agent.type | string | |
| agent.id | string | |
| agent.description | null | string | |
| agent.mcp_servers | array<object> | |
| agent.name | string | |
| agent.skills | array<object> | |
| agent.system | null | string | |
| agent.tools | array<object> | |
| agent.version | number | |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| parent_thread_id | null | string | Parent thread that spawned this thread. Null for the primary thread. |
| session_id | string | The session this thread belongs to. |
| stats | null | object | Timing statistics for a session thread. |
| stats.active_seconds | number | Cumulative time in seconds the thread spent actively running. Excludes idle time. |
| stats.duration_seconds | number | Elapsed time since thread creation in seconds. For archived threads, frozen at the final update. |
| stats.startup_seconds | number | Time in seconds for the thread to begin running. Zero for child threads, which start immediately. |
| status | string | SessionThreadStatus enum |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| usage | null | object | Cumulative token usage for a session thread across all turns. |
| usage.active_seconds | number | Cumulative time in seconds this thread spent in running status. Equal to `stats.active_seconds`; surfaced here so a thread's usage carries every quantity its cost is priced on. |
| usage.cache_creation | object | Prompt-cache creation token usage broken down by cache lifetime. |
| usage.cache_read_input_tokens | number | Total tokens read from prompt cache. |
| usage.input_tokens | number | Total input tokens consumed across all turns. |
| usage.list_cost | null | object | A monetary amount in a specific currency. |
| usage.output_tokens | number | Total output tokens generated across all turns. |
| usage.server_tool_use | null | object | Cumulative count of server-executed tool invocations, broken down by tool. |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/anthropic/v1/sessions/{session_id}/threads/{thread_id}/events◐ 部分支持session_idstring必填path: 会话 ID(路径或查询参数)。
thread_idstring必填path: 路径参数:线程 ID。
session_idstring必填query: 会话 ID(路径或查询参数)。
limitnumber可选query: 每页返回的条数上限。
pagestring可选query: 分页游标,取自上一页响应的 next_page。
200
读取所选线程自己的事件记录:主线程读主会话,子线程读对应子会话。沿用会话事件接口的查询参数、公开事件类型和 data + next_page 信封。使用网页工具时,两个接口均返回 search_result 块;回答 citations 为 /agent/v1 扩展,/anthropic 将引用显示为正文 [n]。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | |
| data[].id | string | Unique identifier for this event. |
| data[].content | array<object> | Array of content blocks comprising the user message. / The result content returned by the tool. / Array of text blocks comprising the agent response. / The result content returned by the tool. / The result content returned by the tool. / Message content blocks. / Message content blocks. / The result content returned by the tool. / System content blocks. Text-only. |
| data[].type | string | |
| data[].processed_at | null | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | null | string | string | string | null | string | string | A timestamp in RFC 3339 format |
| data[].session_thread_id | null | string | string | string | string | string | null | string | string | If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread. / Set by the server to the subagent thread this confirmation was routed to. Omitted when it was routed to the primary thread. / Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread. / When set, this event was cross-posted from a subagent's thread to surface its custom tool use on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.custom_tool_result` by `custom_tool_use_id`, so clients do not send it back. / When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.tool_confirmation` by `tool_use_id`, so clients do not send it back. / When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.tool_confirmation` or `user.tool_result` by `tool_use_id`, so clients do not send it back. / Public `sthr_` ID of the newly created thread. / Public sthr_ ID of the thread that started running. / Public sthr_ ID of the thread that went idle. / Public sthr_ ID of the thread that terminated. / Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread. / Public sthr_ ID of the thread that is retrying. |
| data[].result | string | UserToolConfirmationResult enum / Evaluation verdict. 'satisfied': criteria met, session goes idle. 'needs_revision': criteria not met, another revision cycle follows. 'max_iterations_reached': evaluation budget exhausted with criteria still unmet — one final acknowledgment turn follows before the session goes idle, but no further evaluation runs. 'failed': grader determined the rubric does not apply to the deliverables. 'interrupted': user sent an interrupt while evaluation was in progress. |
| data[].tool_use_id | string | The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field. / The id of the `agent.tool_use` event this result corresponds to. / The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field. |
| data[].deny_message | null | string | Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. |
| data[].custom_tool_use_id | string | The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field. |
| data[].is_error | null | boolean | Whether the tool execution resulted in an error. / Whether the model request resulted in an error. / Whether the tool execution resulted in an error. |
| data[].input | object | Input parameters for the tool call. |
| data[].name | string | Name of the custom tool being called. / Name of the MCP tool being used. / Name of the agent tool being used. |
| data[].mcp_server_name | string | Name of the MCP server providing the tool. |
| data[].evaluated_permission | string | AgentEvaluatedPermission enum |
| data[].evaluation | object | Names the resolved permission_policy that produced evaluated_permission, and under auto carries the judgement. Open union: clients must tolerate unknown variants. |
| data[].mcp_tool_use_id | string | The id of the `agent.mcp_tool_use` event this result corresponds to. |
| data[].from_session_thread_id | string | Public `sthr_` ID of the thread that sent the message. |
| data[].from_agent_name | null | string | Name of the callable agent this message came from. Absent when received from the primary agent. |
| data[].to_session_thread_id | string | Public `sthr_` ID of the thread the message was sent to. |
| data[].to_agent_name | null | string | Name of the callable agent this message was sent to. Absent when sent to the primary agent. |
| data[].error | object | |
| data[].stop_reason | object | |
| data[].agent_name | string | Name of the callable agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. |
| data[].iteration | number | 0-indexed revision cycle. 0 is the first evaluation; 1 is the re-evaluation after the first revision; etc. / 0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`. / 0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`. |
| data[].outcome_id | string | The `outc_` ID of the outcome being evaluated. / Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list. |
| data[].explanation | string | Human-readable explanation of the verdict. For `needs_revision`, describes which criteria failed and why. |
| data[].outcome_evaluation_start_id | string | The id of the corresponding `span.outcome_evaluation_start` event. |
| data[].usage | object | Token usage for a single model request. / Point-in-time snapshot of a session's cumulative usage. |
| data[].model_request_start_id | string | The id of the corresponding `span.model_request_start` event. |
| data[].model_usage | object | Token usage for a single model request. |
| data[].description | string | What the agent should produce. Copied from the input event. |
| data[].max_iterations | null | number | Evaluate-then-revise cycles before giving up. Default 3, max 20. |
| data[].rubric | object | Rubric for grading the quality of an outcome. |
| data[].agent | null | object | Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. |
| data[].budget | null | object | A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`. |
| data[].metadata | object | The session's full metadata bag after the update. Present when the update set non-empty metadata; absent when metadata was unchanged or cleared to empty. |
| data[].title | null | string | The session's new title. Present only when the update changed it. |
| next_page | string | null |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/anthropic/v1/sessions/{session_id}/threads/{thread_id}/stream◐ 部分支持session_idstring必填path: 会话 ID(路径或查询参数)。
thread_idstring必填path: 路径参数:线程 ID。
session_idstring必填query: 会话 ID(路径或查询参数)。
event_deltasarray可选query: 设置后连接同时接收流式增量事件。
200
订阅所选线程自己的实时事件流。复用会话 SSE 实现;/agent 接口支持同址只读 WebSocket。主会话流同时包含子线程创建、状态和消息事件,子线程审批带 session_thread_id 上浮;确认或中断携带该字段时路由到所属子线程。
错误按 Claude Managed Agents 格式返回,参见 错误码
Server-sent events
text/event-stream — chunk / 事件对象
未声明字段结构。
/anthropic/v1/skills○ 未支持sourcestring可选query: 按来源过滤 Skill:custom 或官方来源。
limitnumber可选query: 每页返回的条数上限。
pagestring可选query: 分页游标,取自上一页响应的 next_page。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还不支持上传和管理 Skills;创建智能体时传入 skills 会返回 400。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | |
| data[].id | string | Unique identifier for the skill. The format and length of IDs may change over time. |
| data[].created_at | string | ISO 8601 timestamp of when the skill was created. |
| data[].display_name | string | Human-readable, single-line label for the Skill. Maximum 255 characters. Always set: derived from the SKILL.md frontmatter `name` when omitted at creation. Not unique. |
| data[].latest_version_id | string | ID of the newest Skill Version — what `latest` references resolve to. Always set: a Skill holds at least one version. |
| data[].source | object | Where the Skill comes from. Possible values: - `"custom"`: authored by the platform user; private to their workspace - `"anthropic"`: published by Anthropic; shared and read-only - `"anthropic_example"`: Anthropic-published sample Skill - `"plugin"`: resolved from an installed plugin |
| data[].type | string | Object type. For Skills, this is always `"skill"`. |
| data[].updated_at | string | ISO 8601 timestamp of when the skill was last updated. |
| next_page | string | null |
/anthropic/v1/skills○ 未支持filesarray必填Files to upload for the skill. All files must be in the same top-level directory and must include a SKILL.md file at the root of that directory.
display_namestring可选Human-readable, single-line label for the Skill. Maximum 255 characters. Always set: derived from the SKILL.md frontmatter `name` when omitted at creation. Not unique.
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还不支持上传和管理 Skills;创建智能体时传入 skills 会返回 400。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
multipart/form-data
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for the skill. The format and length of IDs may change over time. |
| created_at | string | ISO 8601 timestamp of when the skill was created. |
| display_name | string | Human-readable, single-line label for the Skill. Maximum 255 characters. Always set: derived from the SKILL.md frontmatter `name` when omitted at creation. Not unique. |
| latest_version_id | string | ID of the newest Skill Version — what `latest` references resolve to. Always set: a Skill holds at least one version. |
| source | object | Where the Skill comes from. Possible values: - `"custom"`: authored by the platform user; private to their workspace - `"anthropic"`: published by Anthropic; shared and read-only - `"anthropic_example"`: Anthropic-published sample Skill - `"plugin"`: resolved from an installed plugin |
| source.type | string | Where the Skill comes from. Possible values: - `"custom"`: authored by the platform user; private to their workspace - `"anthropic"`: published by Anthropic; shared and read-only - `"anthropic_example"`: Anthropic-published sample Skill - `"plugin"`: resolved from an installed plugin |
| type | string | Object type. For Skills, this is always `"skill"`. |
| updated_at | string | ISO 8601 timestamp of when the skill was last updated. |
/anthropic/v1/skills/{skill_id}○ 未支持skill_idstring必填path: Skill ID(路径或查询参数)。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还不支持上传和管理 Skills;创建智能体时传入 skills 会返回 400。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for the skill. The format and length of IDs may change over time. |
| type | string | Deleted object type. For Skills, this is always `"skill_deleted"`. |
/anthropic/v1/skills/{skill_id}○ 未支持skill_idstring必填path: Skill ID(路径或查询参数)。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还不支持上传和管理 Skills;创建智能体时传入 skills 会返回 400。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for the skill. The format and length of IDs may change over time. |
| created_at | string | ISO 8601 timestamp of when the skill was created. |
| display_name | string | Human-readable, single-line label for the Skill. Maximum 255 characters. Always set: derived from the SKILL.md frontmatter `name` when omitted at creation. Not unique. |
| latest_version_id | string | ID of the newest Skill Version — what `latest` references resolve to. Always set: a Skill holds at least one version. |
| source | object | Where the Skill comes from. Possible values: - `"custom"`: authored by the platform user; private to their workspace - `"anthropic"`: published by Anthropic; shared and read-only - `"anthropic_example"`: Anthropic-published sample Skill - `"plugin"`: resolved from an installed plugin |
| source.type | string | Where the Skill comes from. Possible values: - `"custom"`: authored by the platform user; private to their workspace - `"anthropic"`: published by Anthropic; shared and read-only - `"anthropic_example"`: Anthropic-published sample Skill - `"plugin"`: resolved from an installed plugin |
| type | string | Object type. For Skills, this is always `"skill"`. |
| updated_at | string | ISO 8601 timestamp of when the skill was last updated. |
/anthropic/v1/skills/{skill_id}/versions○ 未支持skill_idstring必填path: Skill ID(路径或查询参数)。
limitnumber可选query: 每页返回的条数上限。
pagestring可选query: 分页游标,取自上一页响应的 next_page。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还不支持上传和管理 Skills;创建智能体时传入 skills 会返回 400。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | |
| data[].id | string | Unique identifier for this Skill Version. The id addresses the version in paths and pins it in references. |
| data[].created_at | string | ISO 8601 timestamp of when the skill was created. |
| data[].description | string | Description of the skill version. This is extracted from the SKILL.md file in the skill upload. |
| data[].name | string | The Skill's immutable kebab-case slug, set at creation from the first upload's SKILL.md frontmatter `name` (or its enclosing directory). Every later upload must resolve to the same value. Also the top-level directory of the Skill's mounted files and the base name of a downloaded archive. |
| data[].skill_id | string | Unique identifier for the skill. The format and length of IDs may change over time. |
| data[].type | string | Object type. For Skill Versions, this is always `"skill_version"`. |
| next_page | string | null |
/anthropic/v1/skills/{skill_id}/versions○ 未支持skill_idstring必填path: Skill ID(路径或查询参数)。
filesarray必填Files to upload for the skill. All files must be in the same top-level directory and must include a SKILL.md file at the root of that directory.
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还不支持上传和管理 Skills;创建智能体时传入 skills 会返回 400。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
multipart/form-data
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for this Skill Version. The id addresses the version in paths and pins it in references. |
| created_at | string | ISO 8601 timestamp of when the skill was created. |
| description | string | Description of the skill version. This is extracted from the SKILL.md file in the skill upload. |
| name | string | The Skill's immutable kebab-case slug, set at creation from the first upload's SKILL.md frontmatter `name` (or its enclosing directory). Every later upload must resolve to the same value. Also the top-level directory of the Skill's mounted files and the base name of a downloaded archive. |
| skill_id | string | Unique identifier for the skill. The format and length of IDs may change over time. |
| type | string | Object type. For Skill Versions, this is always `"skill_version"`. |
/anthropic/v1/skills/{skill_id}/versions/{version}○ 未支持skill_idstring必填path: Skill ID(路径或查询参数)。
versionstring必填path: 路径参数:版本号。
skill_idstring必填query: Skill ID(路径或查询参数)。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还不支持上传和管理 Skills;创建智能体时传入 skills 会返回 400。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for this Skill Version. The id addresses the version in paths and pins it in references. |
| type | string | Deleted object type. For Skill Versions, this is always `"skill_version_deleted"`. |
/anthropic/v1/skills/{skill_id}/versions/{version}○ 未支持skill_idstring必填path: Skill ID(路径或查询参数)。
versionstring必填path: 路径参数:版本号。
skill_idstring必填query: Skill ID(路径或查询参数)。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还不支持上传和管理 Skills;创建智能体时传入 skills 会返回 400。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for this Skill Version. The id addresses the version in paths and pins it in references. |
| created_at | string | ISO 8601 timestamp of when the skill was created. |
| description | string | Description of the skill version. This is extracted from the SKILL.md file in the skill upload. |
| name | string | The Skill's immutable kebab-case slug, set at creation from the first upload's SKILL.md frontmatter `name` (or its enclosing directory). Every later upload must resolve to the same value. Also the top-level directory of the Skill's mounted files and the base name of a downloaded archive. |
| skill_id | string | Unique identifier for the skill. The format and length of IDs may change over time. |
| type | string | Object type. For Skill Versions, this is always `"skill_version"`. |
/anthropic/v1/skills/{skill_id}/versions/{version}/content○ 未支持skill_idstring必填path: Skill ID(路径或查询参数)。
versionstring必填path: 路径参数:版本号。
skill_idstring必填query: Skill ID(路径或查询参数)。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还不支持上传和管理 Skills;创建智能体时传入 skills 会返回 400。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Binary response body
application/octet-stream
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | string (binary) |
/anthropic/v1/tunnels○ 未支持include_archivedboolean可选query: 是否包含已归档的记录。
limitnumber可选query: 每页返回的条数上限。
pagestring可选query: 分页游标,取自上一页响应的 next_page。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还没有提供把智能体接入你自有网络的隧道。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | |
| data[].id | string | Unique identifier for the tunnel, prefixed with `tnl_`. |
| data[].archived_at | null | string | A timestamp in RFC 3339 format |
| data[].created_at | string | A timestamp in RFC 3339 format |
| data[].display_name | null | string | Human-readable name for the tunnel (1-255 characters). Null if unset. |
| data[].domain | string | Anthropic-assigned hostname for the tunnel. MCP server URLs whose host is a subdomain of this value are routed through the tunnel. Globally unique and never reused, even after the tunnel is archived. |
| data[].type | string | |
| next_page | string | null |
/anthropic/v1/tunnels○ 未支持display_namestring可选Optional human-readable name for the tunnel (1-255 characters).
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还没有提供把智能体接入你自有网络的隧道。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for the tunnel, prefixed with `tnl_`. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| display_name | null | string | Human-readable name for the tunnel (1-255 characters). Null if unset. |
| domain | string | Anthropic-assigned hostname for the tunnel. MCP server URLs whose host is a subdomain of this value are routed through the tunnel. Globally unique and never reused, even after the tunnel is archived. |
| type | string |
/anthropic/v1/tunnels/{tunnel_id}○ 未支持tunnel_idstring必填path: 隧道 ID(路径或查询参数)。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还没有提供把智能体接入你自有网络的隧道。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for the tunnel, prefixed with `tnl_`. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| display_name | null | string | Human-readable name for the tunnel (1-255 characters). Null if unset. |
| domain | string | Anthropic-assigned hostname for the tunnel. MCP server URLs whose host is a subdomain of this value are routed through the tunnel. Globally unique and never reused, even after the tunnel is archived. |
| type | string |
/anthropic/v1/tunnels/{tunnel_id}/archive○ 未支持tunnel_idstring必填path: 隧道 ID(路径或查询参数)。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还没有提供把智能体接入你自有网络的隧道。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for the tunnel, prefixed with `tnl_`. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| display_name | null | string | Human-readable name for the tunnel (1-255 characters). Null if unset. |
| domain | string | Anthropic-assigned hostname for the tunnel. MCP server URLs whose host is a subdomain of this value are routed through the tunnel. Globally unique and never reused, even after the tunnel is archived. |
| type | string |
/anthropic/v1/tunnels/{tunnel_id}/certificates○ 未支持tunnel_idstring必填path: 隧道 ID(路径或查询参数)。
include_archivedboolean可选query: 是否包含已归档的记录。
limitnumber可选query: 每页返回的条数上限。
pagestring可选query: 分页游标,取自上一页响应的 next_page。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还没有提供把智能体接入你自有网络的隧道。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | |
| data[].id | string | Unique identifier for the certificate, prefixed with `tcrt_`. |
| data[].archived_at | null | string | A timestamp in RFC 3339 format |
| data[].created_at | string | A timestamp in RFC 3339 format |
| data[].expires_at | null | string | A timestamp in RFC 3339 format |
| data[].fingerprint | string | Lowercase hex SHA-256 fingerprint of the certificate's DER encoding. |
| data[].tunnel_id | string | ID of the tunnel the certificate is registered against. |
| data[].type | string | |
| next_page | string | null |
/anthropic/v1/tunnels/{tunnel_id}/certificates○ 未支持tunnel_idstring必填path: 隧道 ID(路径或查询参数)。
ca_certificate_pemstring必填PEM-encoded X.509 CA certificate. Must contain exactly one certificate and no private-key material. Maximum 8KB.
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还没有提供把智能体接入你自有网络的隧道。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for the certificate, prefixed with `tcrt_`. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| expires_at | null | string | A timestamp in RFC 3339 format |
| fingerprint | string | Lowercase hex SHA-256 fingerprint of the certificate's DER encoding. |
| tunnel_id | string | ID of the tunnel the certificate is registered against. |
| type | string |
/anthropic/v1/tunnels/{tunnel_id}/certificates/{certificate_id}○ 未支持tunnel_idstring必填path: 隧道 ID(路径或查询参数)。
certificate_idstring必填path: 路径参数:客户端证书 ID。
tunnel_idstring必填query: 隧道 ID(路径或查询参数)。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还没有提供把智能体接入你自有网络的隧道。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for the certificate, prefixed with `tcrt_`. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| expires_at | null | string | A timestamp in RFC 3339 format |
| fingerprint | string | Lowercase hex SHA-256 fingerprint of the certificate's DER encoding. |
| tunnel_id | string | ID of the tunnel the certificate is registered against. |
| type | string |
/anthropic/v1/tunnels/{tunnel_id}/certificates/{certificate_id}/archive○ 未支持tunnel_idstring必填path: 隧道 ID(路径或查询参数)。
certificate_idstring必填path: 路径参数:客户端证书 ID。
tunnel_idstring必填query: 隧道 ID(路径或查询参数)。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还没有提供把智能体接入你自有网络的隧道。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for the certificate, prefixed with `tcrt_`. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| expires_at | null | string | A timestamp in RFC 3339 format |
| fingerprint | string | Lowercase hex SHA-256 fingerprint of the certificate's DER encoding. |
| tunnel_id | string | ID of the tunnel the certificate is registered against. |
| type | string |
/anthropic/v1/tunnels/{tunnel_id}/reveal_token○ 未支持tunnel_idstring必填path: 隧道 ID(路径或查询参数)。
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还没有提供把智能体接入你自有网络的隧道。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Stable identifier for the current token value. Changes when the token is rotated. |
| tunnel_token | string | The connector token used to run the tunnel. Treat as a credential. |
| type | string |
/anthropic/v1/tunnels/{tunnel_id}/rotate_token○ 未支持tunnel_idstring必填path: 隧道 ID(路径或查询参数)。
reasonstring可选Optional free-text reason for the rotation, recorded for audit.
501 平台还没有实现这个端点;调用会得到下面这个响应:
平台还没有提供把智能体接入你自有网络的隧道。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Stable identifier for the current token value. Changes when the token is rotated. |
| tunnel_token | string | The connector token used to run the tunnel. Treat as a credential. |
| type | string |
/anthropic/v1/vaults● 支持include_archivedboolean可选query: 是否包含已归档的记录。
limitnumber可选query: 每页返回的条数上限。
pagestring可选query: 分页游标,取自上一页响应的 next_page。
200
支持创建、列出、读取、更新、归档与删除。列表支持 limit、page 和 include_archived。归档会同时归档库内全部凭据并清除凭据的值;删除会一并删除全部凭据,不可恢复。以 anthropic. 开头的 metadata 键由平台保留,不能写入。同一个库也可以通过原生接口 /vault/v1 管理。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | |
| data[].id | string | Unique identifier for the vault. |
| data[].archived_at | null | string | A timestamp in RFC 3339 format |
| data[].created_at | string | A timestamp in RFC 3339 format |
| data[].display_name | string | Human-readable name for the vault. |
| data[].metadata | object | Arbitrary key-value metadata attached to the vault. |
| data[].type | string | |
| data[].updated_at | string | A timestamp in RFC 3339 format |
| next_page | string | null |
/anthropic/v1/vaults● 支持display_namestring必填Human-readable name for the vault. 1-255 characters.
metadataobject可选Arbitrary key-value metadata to attach to the vault. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars.
200
支持创建、列出、读取、更新、归档与删除。列表支持 limit、page 和 include_archived。归档会同时归档库内全部凭据并清除凭据的值;删除会一并删除全部凭据,不可恢复。以 anthropic. 开头的 metadata 键由平台保留,不能写入。同一个库也可以通过原生接口 /vault/v1 管理。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for the vault. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| display_name | string | Human-readable name for the vault. |
| metadata | object | Arbitrary key-value metadata attached to the vault. |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
/anthropic/v1/vaults/{vault_id}● 支持vault_idstring必填path: 保险库 ID(路径或查询参数)。
200
支持创建、列出、读取、更新、归档与删除。列表支持 limit、page 和 include_archived。归档会同时归档库内全部凭据并清除凭据的值;删除会一并删除全部凭据,不可恢复。以 anthropic. 开头的 metadata 键由平台保留,不能写入。同一个库也可以通过原生接口 /vault/v1 管理。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier of the deleted vault. |
| type | string |
/anthropic/v1/vaults/{vault_id}● 支持vault_idstring必填path: 保险库 ID(路径或查询参数)。
200
支持创建、列出、读取、更新、归档与删除。列表支持 limit、page 和 include_archived。归档会同时归档库内全部凭据并清除凭据的值;删除会一并删除全部凭据,不可恢复。以 anthropic. 开头的 metadata 键由平台保留,不能写入。同一个库也可以通过原生接口 /vault/v1 管理。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for the vault. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| display_name | string | Human-readable name for the vault. |
| metadata | object | Arbitrary key-value metadata attached to the vault. |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
/anthropic/v1/vaults/{vault_id}● 支持vault_idstring必填path: 保险库 ID(路径或查询参数)。
display_namestring可选Updated human-readable name for the vault. 1-255 characters.
metadataobject可选Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved.
200
支持创建、列出、读取、更新、归档与删除。列表支持 limit、page 和 include_archived。归档会同时归档库内全部凭据并清除凭据的值;删除会一并删除全部凭据,不可恢复。以 anthropic. 开头的 metadata 键由平台保留,不能写入。同一个库也可以通过原生接口 /vault/v1 管理。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for the vault. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| display_name | string | Human-readable name for the vault. |
| metadata | object | Arbitrary key-value metadata attached to the vault. |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
/anthropic/v1/vaults/{vault_id}/archive● 支持vault_idstring必填path: 保险库 ID(路径或查询参数)。
200
支持创建、列出、读取、更新、归档与删除。列表支持 limit、page 和 include_archived。归档会同时归档库内全部凭据并清除凭据的值;删除会一并删除全部凭据,不可恢复。以 anthropic. 开头的 metadata 键由平台保留,不能写入。同一个库也可以通过原生接口 /vault/v1 管理。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for the vault. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| display_name | string | Human-readable name for the vault. |
| metadata | object | Arbitrary key-value metadata attached to the vault. |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
/anthropic/v1/vaults/{vault_id}/credentials◐ 部分支持vault_idstring必填path: 保险库 ID(路径或查询参数)。
include_archivedboolean可选query: 是否包含已归档的记录。
limitnumber可选query: 每页返回的条数上限。
pagestring可选query: 分页游标,取自上一页响应的 next_page。
200
支持 environment_variable 与 static_bearer。environment_variable 的 networking 只支持 limited,传 unrestricted 返回 400;secret_name 只能使用大写字母、数字和下划线,且不能以数字开头;injection_location 的默认值与官方一致。static_bearer 的令牌只在 mcp_server_url 所在主机上可用。创建或更新 mcp_oauth 返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试;需要 OAuth 令牌时请使用 /vault/v1/authorizations 一键授权。每个库最多 20 个有效凭据。以 anthropic. 开头的 metadata 键由平台保留,不能写入。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | |
| data[].id | string | Unique identifier for the credential. |
| data[].archived_at | null | string | A timestamp in RFC 3339 format |
| data[].auth | object | Authentication details for a credential. |
| data[].created_at | string | A timestamp in RFC 3339 format |
| data[].metadata | object | Arbitrary key-value metadata attached to the credential. |
| data[].type | string | |
| data[].updated_at | string | A timestamp in RFC 3339 format |
| data[].vault_id | string | Identifier of the vault this credential belongs to. |
| data[].display_name | null | string | Human-readable name for the credential. |
| next_page | string | null |
/anthropic/v1/vaults/{vault_id}/credentials◐ 部分支持vault_idstring必填path: 保险库 ID(路径或查询参数)。
authobject必填Authentication details for creating a credential.
access_tokenstring必填OAuth access token.
mcp_server_urlstring必填URL of the MCP server this credential authenticates against.
typestring必填expires_atstring可选A timestamp in RFC 3339 format
refreshobject可选OAuth refresh token parameters for creating a credential with refresh support.
tokenstring必填Static bearer token value.
networkingobject必填Outbound hosts the secret value is substituted on.
secret_namestring必填Name of the environment variable. Immutable after create.
secret_valuestring必填Secret value. Write-only; never returned in responses.
injection_locationobject可选Where in the outbound request the secret value may be substituted.
display_namestring可选Human-readable name for the credential. Up to 255 characters.
metadataobject可选Arbitrary key-value metadata to attach to the credential. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars.
200
支持 environment_variable 与 static_bearer。environment_variable 的 networking 只支持 limited,传 unrestricted 返回 400;secret_name 只能使用大写字母、数字和下划线,且不能以数字开头;injection_location 的默认值与官方一致。static_bearer 的令牌只在 mcp_server_url 所在主机上可用。创建或更新 mcp_oauth 返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试;需要 OAuth 令牌时请使用 /vault/v1/authorizations 一键授权。每个库最多 20 个有效凭据。以 anthropic. 开头的 metadata 键由平台保留,不能写入。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for the credential. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| auth | object | Authentication details for a credential. |
| auth.mcp_server_url | string | URL of the MCP server this credential authenticates against. |
| auth.type | string | |
| auth.expires_at | null | string | A timestamp in RFC 3339 format |
| auth.refresh | null | object | OAuth refresh token configuration returned in credential responses. |
| auth.injection_location | object | Where in the outbound request the secret value is substituted. |
| auth.networking | object | Outbound hosts the secret value is substituted on. |
| auth.secret_name | string | Name of the environment variable. |
| created_at | string | A timestamp in RFC 3339 format |
| metadata | object | Arbitrary key-value metadata attached to the credential. |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| vault_id | string | Identifier of the vault this credential belongs to. |
| display_name | null | string | Human-readable name for the credential. |
上面的示例创建 environment_variable 凭据。创建 mcp_oauth 仍返回 501,不会创建凭据;更新已有 mcp_oauth 凭据也不支持。以下为创建请求的实测错误响应。
{
"type": "error",
"error": {
"type": "not_implemented_error",
"message": "Not implemented: creating mcp_oauth credentials is not available on this platform yet; use static_bearer or environment_variable."
},
"request_id": "4c1dcdba-97bb-46ce-aad0-0a7d8753357c"
}/anthropic/v1/vaults/{vault_id}/credentials/{credential_id}◐ 部分支持vault_idstring必填path: 保险库 ID(路径或查询参数)。
credential_idstring必填path: 路径参数:凭据 ID。
vault_idstring必填query: 保险库 ID(路径或查询参数)。
200
支持 environment_variable 与 static_bearer。environment_variable 的 networking 只支持 limited,传 unrestricted 返回 400;secret_name 只能使用大写字母、数字和下划线,且不能以数字开头;injection_location 的默认值与官方一致。static_bearer 的令牌只在 mcp_server_url 所在主机上可用。创建或更新 mcp_oauth 返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试;需要 OAuth 令牌时请使用 /vault/v1/authorizations 一键授权。每个库最多 20 个有效凭据。以 anthropic. 开头的 metadata 键由平台保留,不能写入。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier of the deleted credential. |
| type | string |
/anthropic/v1/vaults/{vault_id}/credentials/{credential_id}◐ 部分支持vault_idstring必填path: 保险库 ID(路径或查询参数)。
credential_idstring必填path: 路径参数:凭据 ID。
vault_idstring必填query: 保险库 ID(路径或查询参数)。
200
支持 environment_variable 与 static_bearer。environment_variable 的 networking 只支持 limited,传 unrestricted 返回 400;secret_name 只能使用大写字母、数字和下划线,且不能以数字开头;injection_location 的默认值与官方一致。static_bearer 的令牌只在 mcp_server_url 所在主机上可用。创建或更新 mcp_oauth 返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试;需要 OAuth 令牌时请使用 /vault/v1/authorizations 一键授权。每个库最多 20 个有效凭据。以 anthropic. 开头的 metadata 键由平台保留,不能写入。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for the credential. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| auth | object | Authentication details for a credential. |
| auth.mcp_server_url | string | URL of the MCP server this credential authenticates against. |
| auth.type | string | |
| auth.expires_at | null | string | A timestamp in RFC 3339 format |
| auth.refresh | null | object | OAuth refresh token configuration returned in credential responses. |
| auth.injection_location | object | Where in the outbound request the secret value is substituted. |
| auth.networking | object | Outbound hosts the secret value is substituted on. |
| auth.secret_name | string | Name of the environment variable. |
| created_at | string | A timestamp in RFC 3339 format |
| metadata | object | Arbitrary key-value metadata attached to the credential. |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| vault_id | string | Identifier of the vault this credential belongs to. |
| display_name | null | string | Human-readable name for the credential. |
/anthropic/v1/vaults/{vault_id}/credentials/{credential_id}◐ 部分支持vault_idstring必填path: 保险库 ID(路径或查询参数)。
credential_idstring必填path: 路径参数:凭据 ID。
vault_idstring必填query: 保险库 ID(路径或查询参数)。
authobject可选Updated authentication details for a credential.
typestring必填access_tokenstring可选Updated OAuth access token.
expires_atstring可选A timestamp in RFC 3339 format
refreshobject可选Parameters for updating OAuth refresh token configuration.
tokenstring可选Updated static bearer token value.
injection_locationobject可选Updated injection location.
networkingobject可选Updated networking scope. Full replacement.
secret_valuestring可选Updated secret value.
display_namestring可选Updated human-readable name for the credential. 1-255 characters.
metadataobject可选Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved.
200
支持 environment_variable 与 static_bearer。environment_variable 的 networking 只支持 limited,传 unrestricted 返回 400;secret_name 只能使用大写字母、数字和下划线,且不能以数字开头;injection_location 的默认值与官方一致。static_bearer 的令牌只在 mcp_server_url 所在主机上可用。创建或更新 mcp_oauth 返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试;需要 OAuth 令牌时请使用 /vault/v1/authorizations 一键授权。每个库最多 20 个有效凭据。以 anthropic. 开头的 metadata 键由平台保留,不能写入。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for the credential. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| auth | object | Authentication details for a credential. |
| auth.mcp_server_url | string | URL of the MCP server this credential authenticates against. |
| auth.type | string | |
| auth.expires_at | null | string | A timestamp in RFC 3339 format |
| auth.refresh | null | object | OAuth refresh token configuration returned in credential responses. |
| auth.injection_location | object | Where in the outbound request the secret value is substituted. |
| auth.networking | object | Outbound hosts the secret value is substituted on. |
| auth.secret_name | string | Name of the environment variable. |
| created_at | string | A timestamp in RFC 3339 format |
| metadata | object | Arbitrary key-value metadata attached to the credential. |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| vault_id | string | Identifier of the vault this credential belongs to. |
| display_name | null | string | Human-readable name for the credential. |
/anthropic/v1/vaults/{vault_id}/credentials/{credential_id}/archive◐ 部分支持vault_idstring必填path: 保险库 ID(路径或查询参数)。
credential_idstring必填path: 路径参数:凭据 ID。
vault_idstring必填query: 保险库 ID(路径或查询参数)。
200
支持 environment_variable 与 static_bearer。environment_variable 的 networking 只支持 limited,传 unrestricted 返回 400;secret_name 只能使用大写字母、数字和下划线,且不能以数字开头;injection_location 的默认值与官方一致。static_bearer 的令牌只在 mcp_server_url 所在主机上可用。创建或更新 mcp_oauth 返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试;需要 OAuth 令牌时请使用 /vault/v1/authorizations 一键授权。每个库最多 20 个有效凭据。以 anthropic. 开头的 metadata 键由平台保留,不能写入。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for the credential. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| auth | object | Authentication details for a credential. |
| auth.mcp_server_url | string | URL of the MCP server this credential authenticates against. |
| auth.type | string | |
| auth.expires_at | null | string | A timestamp in RFC 3339 format |
| auth.refresh | null | object | OAuth refresh token configuration returned in credential responses. |
| auth.injection_location | object | Where in the outbound request the secret value is substituted. |
| auth.networking | object | Outbound hosts the secret value is substituted on. |
| auth.secret_name | string | Name of the environment variable. |
| created_at | string | A timestamp in RFC 3339 format |
| metadata | object | Arbitrary key-value metadata attached to the credential. |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| vault_id | string | Identifier of the vault this credential belongs to. |
| display_name | null | string | Human-readable name for the credential. |
/anthropic/v1/vaults/{vault_id}/credentials/{credential_id}/mcp_oauth_validate◐ 部分支持vault_idstring必填path: 保险库 ID(路径或查询参数)。
credential_idstring必填path: 路径参数:凭据 ID。
vault_idstring必填query: 保险库 ID(路径或查询参数)。
400
只适用于 OAuth 凭据,对其他类型返回 400。结果总是 HTTP 200,status 为 valid、invalid 或 unknown;mcp_probe 只在未通过时给出失败的一步,refresh 只在尝试了续期时给出。
错误按 Claude Managed Agents 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| credential_id | string | Unique identifier of the credential that was validated. |
| has_refresh_token | boolean | Whether the credential has a refresh token configured. |
| mcp_probe | null | object | The failing step of an MCP validation probe. |
| mcp_probe.http_response | null | object | An HTTP response captured during a credential validation probe. |
| mcp_probe.method | string | The MCP method that failed (for example `initialize` or `tools/list`). |
| refresh | null | object | Outcome of a refresh-token exchange attempted during credential validation. |
| refresh.http_response | null | object | An HTTP response captured during a credential validation probe. |
| refresh.status | string | Outcome of a refresh-token exchange attempted during credential validation. - `succeeded` - The token endpoint returned a new access token. - `failed` - The token endpoint returned an error response. See `http_response` for detail. - `connect_error` - The token endpoint could not be reached (DNS, TLS, or connection error). - `no_refresh_token` - No refresh token is stored for the credential, so no exchange was attempted. |
| status | string | Overall verdict of a credential validation probe. |
| type | string | |
| validated_at | string | A timestamp in RFC 3339 format |
| vault_id | string | Identifier of the vault containing the credential. |
此示例针对前面创建的 static 凭据,因此实测返回 400 invalid_request_error。要获得校验结果,请先通过一键授权完成用户授权,再将 credential_id 换成产生的 OAuth Secret ID。校验 OAuth 凭据返回 HTTP 200,状态为 valid、invalid 或 unknown。
加载中…gemini-2.5-flash),可用模型见列出模型。只有声明了 Google 协议的模型可以在这里调用,其他模型返回 404。generationConfig.responseModalities 里带上 IMAGE,请求会交给平台的图像模型处理。toolConfig 的 ANY 模式)与 Gemini 原生 API 一致,会原样转发给模型:模型接受即执行,不接受时返回 Google 格式的 400 错误。| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| POST | /v1beta/models/{modelsId}:generateContent | 生成内容 | ● 支持 |
| POST | /v1beta/models/{modelsId}:streamGenerateContent | 流式生成内容 | ● 支持 |
| POST | /v1beta/models/{modelsId}:countTokens | 统计 token | ◐ 部分支持 |
| POST | /v1beta/models/{modelsId}:embedContent | 生成向量嵌入 | ● 支持 |
| POST | /v1beta/models/{modelsId}:batchEmbedContents | 批量生成向量嵌入 | ● 支持 |
| GET | /v1beta/models | 列出模型 | ● 支持 |
| GET | /v1beta/models/{modelsId} | 读取模型 | ● 支持 |
参数与字段的权威定义以 Gemini API 官方文档为准。
/google/v1beta/models/{modelsId}:generateContent● 支持modelstring必填path: Required. The name of the `Model` to use for generating the completion. Format: `models/{model}`.
contentsarray必填◐ 部分支持Required. The content of the current conversation with the model. For single-turn queries, this is a single instance. For multi-turn queries like [chat](https://ai.google.dev/gemini-api/docs/text-generation#chat), this is a repeated field that contains the conversation history and the latest request.
多轮、文本、图片和工具往返生效,图片支持 URL-safe base64;audio/wav、text/plain 内联媒体及 fileData URL 返回 400。
partsarray可选Ordered `Parts` that constitute a single message. Parts may have different MIME types.
audioTranscriptionobject可选Optional. Audio (input or output) transcription. This is only set when this Part contains audio data.
codeExecutionResultobject可选Result of executing the `ExecutableCode`.
executableCodeobject可选Code generated by the model that is meant to be executed.
fileDataobject可选○ 未支持URI based data.
已测 HTTPS、gs、Files API 和 YouTube URL 均返回 400。
functionCallobject可选A predicted `FunctionCall` returned from the model that contains a string representing the `FunctionDeclaration.name` with the arguments and their values.
functionResponseobject可选The result output of a `FunctionCall` that contains a string representing the `FunctionDeclaration.name` and a structured JSON object containing any output from the function is used as context to the model.
inlineDataobject可选◐ 部分支持Inline media bytes.
image/png 生效(含 URL-safe base64);audio/wav、text/plain 返回 400;PDF 效果不可观测。
mediaProcessingstring可选Optional. How the model processes this part's media for understanding. Only meaningful for video parts (`inline_data` or `file_data` with video mime). Non-video parts ignore this field.
mediaResolutionobject可选Optional. Media resolution for the input media.
partMetadataobject可选Custom metadata associated with the Part. Agents using genai.Part as content representation may need to keep track of the additional information. For example it can be name of a file/source from which the Part originates or a way to multiplex multiple Part streams.
textstring可选Inline text.
thoughtboolean可选Optional. Indicates if the part is thought from the model.
thoughtSignaturestring可选Optional. An opaque signature for the thought so it can be reused in subsequent requests.
toolCallobject可选Server-side tool call. This field is populated when the model predicts a tool invocation that should be executed on the server. The client is expected to echo this message back to the API.
toolResponseobject可选The output from a server-side `ToolCall` execution. This field is populated by the client with the results of executing the corresponding `ToolCall`.
videoMetadataobject可选Optional. Video metadata. The metadata should only be specified while the video data is presented in inline_data or file_data.
rolestring可选Optional. The producer of the content. Must be either 'user' or 'model'. Useful to set for multi-turn conversations, otherwise can be left blank or unset.
systemInstructionobject可选Optional. Developer set [system instruction(s)](https://ai.google.dev/gemini-api/docs/system-instructions). Currently, text only.
已验证生效。
partsarray可选Ordered `Parts` that constitute a single message. Parts may have different MIME types.
rolestring可选Optional. The producer of the content. Must be either 'user' or 'model'. Useful to set for multi-turn conversations, otherwise can be left blank or unset.
generationConfigobject可选Optional. Configuration options for model generation and outputs.
_responseJsonSchemaany可选○ 当前不生效Optional. Output schema of the generated response. This is an alternative to `response_schema` that accepts [JSON Schema](https://json-schema.org/). If set, `response_schema` must be omitted, but `response_mime_type` is required. While the full JSON Schema may be sent, not all features are supported. Specifically, only the following properties are supported: - `$id` - `$defs` - `$ref` - `$anchor` - `type` - `format` - `title` - `description` - `enum` (for strings and numbers) - `items` - `prefixItems` - `minItems` - `maxItems` - `minimum` - `maximum` - `anyOf` - `oneOf` (interpreted the same as `anyOf`) - `properties` - `additionalProperties` - `required` The non-standard `propertyOrdering` property may also be set. Cyclic references are unrolled to a limited degree and, as such, may only be used within non-required properties. (Nullable properties are not sufficient.) If `$ref` is set on a sub-schema, no other properties, except for than those starting as a `$`, may be set. Deprecated. Use `response_format` instead.
接受但当前不生效。请使用 responseJsonSchema。
audioTranscriptionConfigobject可选○ 当前不生效Optional. Config for audio transcription (speech recognition).
接受但当前不生效。已测文本模型不应用此选项。
candidateCountinteger可选◐ 部分支持Optional. Number of generated responses to return. If unset, this will default to 1. Please note that this doesn't work for previous generation models (Gemini 1.0 family)
非流式支持多个候选;流式设置 2 返回 400。
enableAffectiveDialogboolean可选○ 当前不生效Optional. If enabled, the model will detect emotions and adapt its responses accordingly.
接受但当前不生效。已测文本模型不应用此选项。
enableEnhancedCivicAnswersboolean可选○ 未支持Optional. Enables enhanced civic answers. It may not be available for all models.
已测文本模型传入返回 400。
frequencyPenaltynumber可选◐ 部分支持Optional. Frequency penalty applied to the next token's logprobs, multiplied by the number of times each token has been seen in the respponse so far. A positive penalty will discourage the use of tokens that have already been used, proportional to the number of times the token has been used: The more a token is used, the more difficult it is for the model to use that token again increasing the vocabulary of responses. Caution: A _negative_ penalty will encourage the model to reuse tokens proportional to the number of times the token has been used. Small negative values will reduce the vocabulary of a response. Larger negative values will cause the model to start repeating a common token until it hits the max_output_tokens limit.
gemini-2.5-flash 偶发观察到效果;gemini-2.5-flash-lite 接受但当前不生效;2.0 可能返回 400。
imageConfigobject可选○ 未支持Optional. Config for image generation. An error will be returned if this field is set for models that don't support these config options.
已测文本模型传入返回 400。
logprobsinteger可选Optional. Only valid if response_logprobs=True. This sets the number of top logprobs, including the chosen candidate, to return at each decoding step in the Candidate.logprobs_result. The number must be in the range of [0, 20].
已验证生效。
maxOutputTokensinteger可选◐ 部分支持Optional. The maximum number of tokens to include in a response candidate. Note: The default value varies by model, see the `Model.output_token_limit` attribute of the `Model` returned from the `getModel` function.
限制输出预算;思考占用预算,极小预算可能只返回思考或报错,gemini-3.5-flash 可能提前截断。
mediaResolutionstring可选Optional. If specified, the media resolution specified will be used.
gemini-2.5-flash 的 LOW/MEDIUM/HIGH 改变图片 token 消耗。
presencePenaltynumber可选○ 当前不生效Optional. Presence penalty applied to the next token's logprobs if the token has already been seen in the response. This penalty is binary on/off and not dependant on the number of times the token is used (after the first). Use frequency_penalty for a penalty that increases with each use. A positive penalty will discourage the use of tokens that have already been used in the response, increasing the vocabulary. A negative penalty will encourage the use of tokens that have already been used in the response, decreasing the vocabulary.
接受但当前不生效。gemini-2.5-flash 和 gemini-2.5-flash-lite 输出未变化。
responseFormatobject可选○ 当前不生效Optional. Configuration for the response output format. Allows specifying output configuration per modality (text, audio, image) in a flat structure.
接受但当前不生效。已测文本模型不应用此选项。
responseJsonSchemaany可选◐ 部分支持Optional. An internal detail. Use `responseJsonSchema` rather than this field.
2.5 系列生效;3.5 预算不足可能截断。不可与 responseSchema 同传。
responseLogprobsboolean可选Optional. If true, export the logprobs results in response.
已验证生效。
responseMimeTypestring可选◐ 部分支持Optional. MIME type of the generated candidate text. Supported MIME types are: `text/plain`: (default) Text output. `application/json`: JSON response in the response candidates. `text/x.enum`: ENUM as a string response in the response candidates. Refer to the [docs](https://ai.google.dev/gemini-api/docs/prompting_with_media#plain_text_formats) for a list of all supported text MIME types.
application/json 在 2.5 系列生效,3.5 可能返回非 JSON;text/x.enum 在 flash-lite 生效。
responseModalitiesarray可选◐ 部分支持Optional. The requested modalities of the response. Represents the set of modalities that the model can return, and should be expected in the response. This is an exact match to the modalities of the response. A model may have multiple combinations of supported modalities. If the requested modalities do not match any of the supported combinations, an error will be returned. An empty list is equivalent to requesting only text.
已测文本模型支持 TEXT;AUDIO 返回 400,IMAGE 返回错误。
responseSchemaobject可选◐ 部分支持Optional. Output schema of the generated candidate text. Schemas must be a subset of the [OpenAPI schema](https://spec.openapis.org/oas/v3.0.3#schema) and can be objects, primitives or arrays. If set, a compatible `response_mime_type` must also be set. Compatible MIME types: `application/json`: Schema for JSON response. Refer to the [JSON text generation guide](https://ai.google.dev/gemini-api/docs/json-mode) for more details. Deprecated. Use `response_format` instead.
2.5 系列的 JSON 约束生效;3.5 预算不足可能截断;需正确指定 responseMimeType。
seedinteger可选◐ 部分支持Optional. Seed used in decoding. If not set, the request uses a randomly generated seed.
gemini-2.5-flash-lite 可复现;gemini-2.5-flash 接受但当前不生效。
speechConfigobject可选○ 当前不生效Optional. The speech generation config.
接受但当前不生效。已测文本模型不应用此选项。
stopSequencesarray可选Optional. The set of character sequences (up to 5) that will stop output generation. If specified, the API will stop at the first appearance of a `stop_sequence`. The stop sequence will not be included as part of the response.
gemini-2.5-flash、gemini-2.5-flash-lite 生效;最多 5 项。
temperaturenumber可选◐ 部分支持Optional. Controls the randomness of the output. Note: The default value varies by model, see the `Model.temperature` attribute of the `Model` returned from the `getModel` function. Values can range from [0.0, 2.0].
gemini-2.5-flash-lite 观察到效果;gemini-2.5-flash 的采样差异不可观测。
thinkingConfigobject可选Optional. Config for thinking features. An error will be returned if this field is set for models that don't support thinking.
includeThoughtsboolean可选◐ 部分支持Indicates whether to include thoughts in the response. If true, thoughts are returned only when available.
思考开启时 true/false 控制是否返回思考;flash-lite 默认未开启思考时单传此字段返回 400。
thinkingBudgetinteger可选The number of thoughts tokens that the model should generate.
0 关闭思考;正数控制思考预算,-1 为自动。越界值返回 400。
thinkingLevelstring可选◐ 部分支持Optional. Controls the maximum depth of the model's internal reasoning process before it produces a response. The default value is model-dependent. Refer to the [Thinking levels guide](https://ai.google.dev/gemini-api/docs/thinking#thinking-levels) for more details. Recommended for Gemini 3 or later models. Use with earlier models results in an error.
gemini-3.5-flash 支持 MINIMAL/LOW/MEDIUM/HIGH;用于 2.5 系列返回 400。
topKinteger可选○ 当前不生效接受该参数但不生效:采样不使用 topK。
接受但当前不生效。gemini-2.5-flash-lite 在 topK=1 时仍返回不同输出;gemini-2.5-flash 不可观测。
topPnumber可选Optional. The maximum cumulative probability of tokens to consider when sampling. The model uses combined Top-k and Top-p (nucleus) sampling. Tokens are sorted based on their assigned probabilities so that only the most likely tokens are considered. Top-k sampling directly limits the maximum number of tokens to consider, while Nucleus sampling limits the number of tokens based on the cumulative probability. Note: The default value varies by `Model` and is specified by the`Model.top_p` attribute returned from the `getModel` function. An empty `top_k` attribute indicates that the model doesn't apply top-k sampling and doesn't allow setting `top_k` on requests.
gemini-2.5-flash 和 gemini-2.5-flash-lite 已验证生效。
translationConfigobject可选○ 当前不生效Optional. Config for translation.
接受但当前不生效。已测文本模型不应用此选项。
toolsarray可选Optional. A list of `Tools` the `Model` may use to generate the next response. A `Tool` is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the `Model`. Supported `Tool`s are `Function` and `code_execution`. Refer to the [Function calling](https://ai.google.dev/gemini-api/docs/function-calling) and the [Code execution](https://ai.google.dev/gemini-api/docs/code-execution) guides to learn more.
codeExecutionobject可选○ 未支持Optional. Enables the model to execute code as part of generation.
已测请求返回 502,当前不可用。
computerUseobject可选○ 未支持Optional. Tool to support the model interacting directly with the computer. If enabled, it automatically populates computer-use specific Function Declarations.
已测 gemini-2.5-flash 返回 400。
fileSearchobject可选○ 未支持Optional. FileSearch tool type. Tool to retrieve knowledge from Semantic Retrieval corpora.
已测 gemini-2.5-flash 返回 400。
functionDeclarationsarray可选Optional. A list of `FunctionDeclarations` available to the model that can be used for function calling. The model or system does not execute the function. Instead the defined function may be returned as a FunctionCall with arguments to the client side for execution. The model may decide to call a subset of these functions by populating FunctionCall in the response. The next conversation turn may contain a FunctionResponse with the Content.role "function" generation context for the next model turn.
behaviorstring可选○ 当前不生效Optional. Specifies the function Behavior. Currently only supported by the BidiGenerateContent method.
接受但当前不生效。
descriptionstring可选Required. A brief description of the function.
namestring可选Required. The name of the function. Must be a-z, A-Z, 0-9, or contain underscores, colons, dots, and dashes, with a maximum length of 128.
parametersobject可选Optional. Describes the parameters to this function. Reflects the Open API 3.03 Parameter Object string Key: the name of the parameter. Parameter names are case sensitive. Schema Value: the Schema defining the type used for the parameter.
已验证生效。
parametersJsonSchemaany可选Optional. Describes the parameters to the function in JSON Schema format. The schema must describe an object where the properties are the parameters to the function. For example: ``` { "type": "object", "properties": { "name": { "type": "string" }, "age": { "type": "integer" } }, "additionalProperties": false, "required": ["name", "age"], "propertyOrdering": ["name", "age"] } ``` This field is mutually exclusive with `parameters`.
已验证生效。
responseobject可选○ 当前不生效Optional. Describes the output from this function in JSON Schema format. Reflects the Open API 3.03 Response Object. The Schema defines the type used for the response value of the function.
接受但当前不生效。
responseJsonSchemaany可选Optional. Describes the output from this function in JSON Schema format. The value specified by the schema is the response value of the function. This field is mutually exclusive with `response`.
googleMapsobject可选Optional. Tool that allows grounding the model's response with geospatial context related to the user's query.
googleSearchobject可选Optional. GoogleSearch tool type. Tool to support Google Search in Model. Powered by Google.
gemini-2.5-flash 返回 groundingMetadata。
googleSearchRetrievalobject可选○ 未支持Optional. Retrieval tool that is powered by Google search.
已测 gemini-2.5-flash 返回 400。
mcpServersarray可选○ 未支持Optional. MCP Servers to connect to.
已测 gemini-2.5-flash 返回 400。
urlContextobject可选Optional. Tool to support URL context retrieval.
toolConfigobject可选Optional. Tool configuration for any `Tool` specified in the request. Refer to the [Function calling guide](https://ai.google.dev/gemini-api/docs/function-calling#function_calling_mode) for a usage example.
functionCallingConfigobject可选Optional. Function calling config.
allowedFunctionNamesarray可选Optional. A set of function names that, when provided, limits the functions the model will call. This should only be set when the Mode is ANY or VALIDATED. Function names should match [FunctionDeclaration.name]. When set, model will predict a function call from only allowed function names.
已验证生效。
modestring可选◐ 部分支持Optional. Specifies the mode in which function calling should execute. If unspecified, the default value will be set to AUTO.
ANY/AUTO/VALIDATED 生效;NONE 在 flash-lite 偶发仍调用工具,复测生效。
includeServerSideToolInvocationsboolean可选Optional. If true, the API response will include the server-side tool calls and responses within the `Content` message. This allows clients to observe the server's tool interactions.
retrievalConfigobject可选Optional. Retrieval config.
safetySettingsarray可选接受该参数但不生效:安全设置不会拦截或改变任何回复。
categorystring可选Required. The category for this setting.
thresholdstring可选Required. Controls the probability threshold at which harm is blocked.
cachedContentstring可选○ 未支持平台不支持上下文缓存:传入会返回 400(Google 错误格式)。
传入返回 400;当前不支持引用上下文缓存。
labelsobject可选接受该参数但不生效:标签不会被存储,也不参与请求处理。
modelstring可选○ 当前不生效Required. The name of the `Model` to use for generating the completion. Format: `models/{model}`.
接受但当前不生效。以 URL 路径里的模型名为准。
serviceTierstring可选接受该参数但不生效:所有请求都按平台当前的服务档位处理。
storeboolean可选Optional. Configures the logging behavior for a given request. If set, it takes precedence over the project-level logging config.
200
toolConfig 的强制工具(functionCallingConfig mode ANY,含 allowedFunctionNames) 在思考模型上同样忠实转发给上游——与 Gemini 原生 API 一致,是否接受由上游模型 决定:如果上游返回 400,错误保持 Google 格式并携带上游的代码与状态。
错误按 Gemini API 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| candidates | array<object> | Candidate responses from the model. |
| candidates[].avgLogprobs | number | Output only. Average log probability score of the candidate. |
| candidates[].citationMetadata | object | Output only. Citation information for model-generated candidate. This field may be populated with recitation information for any text included in the `content`. These are passages that are "recited" from copyrighted material in the foundational LLM's training data. |
| candidates[].content | object | Output only. Generated content returned from the model. |
| candidates[].finishMessage | string | Optional. Output only. Details the reason why the model stopped generating tokens. This is populated only when `finish_reason` is set. |
| candidates[].finishReason | string | Optional. Output only. The reason why the model stopped generating tokens. If empty, the model has not stopped generating tokens. |
| candidates[].groundingAttributions | array<object> | Output only. Attribution information for sources that contributed to a grounded answer. This field is populated for `GenerateAnswer` calls. |
| candidates[].groundingMetadata | object | Output only. Grounding metadata for the candidate. This field is populated for `GenerateContent` calls. |
| candidates[].index | integer | Output only. Index of the candidate in the list of response candidates. |
| candidates[].logprobsResult | object | Output only. Log-likelihood scores for the response tokens and top tokens |
| candidates[].safetyRatings | array<object> | List of ratings for the safety of a response candidate. There is at most one rating per category. |
| candidates[].tokenCount | integer | Output only. Token count for this candidate. |
| candidates[].urlContextMetadata | object | Output only. Metadata related to url context retrieval tool. |
| modelStatus | object | Output only. The current model status of this model. |
| modelStatus.message | string | A message explaining the model status. |
| modelStatus.modelStage | string | The stage of the underlying model. |
| modelStatus.retirementTime | string | The time at which the model will be retired. |
| modelVersion | string | Output only. The model version used to generate the response. |
| promptFeedback | object | Returns the prompt's feedback related to the content filters. |
| promptFeedback.blockReason | string | Optional. If set, the prompt was blocked and no candidates are returned. Rephrase the prompt. |
| promptFeedback.safetyRatings | array<object> | Ratings for safety of the prompt. There is at most one rating per category. |
| responseId | string | Output only. response_id is used to identify each response. |
| usageMetadata | object | Output only. Metadata on the generation requests' token usage. |
| usageMetadata.cacheTokensDetails | array<object> | Output only. List of modalities of the cached content in the request input. |
| usageMetadata.cachedContentTokenCount | integer | Number of tokens in the cached part of the prompt (the cached content) |
| usageMetadata.candidatesTokenCount | integer | Total number of tokens across all the generated response candidates. |
| usageMetadata.candidatesTokensDetails | array<object> | Output only. List of modalities that were returned in the response. |
| usageMetadata.promptTokenCount | integer | Number of tokens in the prompt. When `cached_content` is set, this is still the total effective prompt size meaning this includes the number of tokens in the cached content. |
| usageMetadata.promptTokensDetails | array<object> | Output only. List of modalities that were processed in the request input. |
| usageMetadata.serviceTier | string | Output only. Service tier of the request. |
| usageMetadata.thoughtsTokenCount | integer | Output only. Number of tokens of thoughts for thinking models. |
| usageMetadata.toolUsePromptTokenCount | integer | Output only. Number of tokens present in tool-use prompt(s). |
| usageMetadata.toolUsePromptTokensDetails | array<object> | Output only. List of modalities that were processed for tool-use request inputs. |
| usageMetadata.totalTokenCount | integer | Total token count for the generation request (prompt + thoughts + response candidates). |
/google/v1beta/models/{modelsId}:streamGenerateContent● 支持modelstring必填path: Required. The name of the `Model` to use for generating the completion. Format: `models/{model}`.
contentsarray必填◐ 部分支持Required. The content of the current conversation with the model. For single-turn queries, this is a single instance. For multi-turn queries like [chat](https://ai.google.dev/gemini-api/docs/text-generation#chat), this is a repeated field that contains the conversation history and the latest request.
多轮、文本、图片和工具往返生效,图片支持 URL-safe base64;audio/wav、text/plain 内联媒体及 fileData URL 返回 400。
partsarray可选Ordered `Parts` that constitute a single message. Parts may have different MIME types.
audioTranscriptionobject可选Optional. Audio (input or output) transcription. This is only set when this Part contains audio data.
codeExecutionResultobject可选Result of executing the `ExecutableCode`.
executableCodeobject可选Code generated by the model that is meant to be executed.
fileDataobject可选○ 未支持URI based data.
已测 HTTPS、gs、Files API 和 YouTube URL 均返回 400。
functionCallobject可选A predicted `FunctionCall` returned from the model that contains a string representing the `FunctionDeclaration.name` with the arguments and their values.
functionResponseobject可选The result output of a `FunctionCall` that contains a string representing the `FunctionDeclaration.name` and a structured JSON object containing any output from the function is used as context to the model.
inlineDataobject可选◐ 部分支持Inline media bytes.
image/png 生效(含 URL-safe base64);audio/wav、text/plain 返回 400;PDF 效果不可观测。
mediaProcessingstring可选Optional. How the model processes this part's media for understanding. Only meaningful for video parts (`inline_data` or `file_data` with video mime). Non-video parts ignore this field.
mediaResolutionobject可选Optional. Media resolution for the input media.
partMetadataobject可选Custom metadata associated with the Part. Agents using genai.Part as content representation may need to keep track of the additional information. For example it can be name of a file/source from which the Part originates or a way to multiplex multiple Part streams.
textstring可选Inline text.
thoughtboolean可选Optional. Indicates if the part is thought from the model.
thoughtSignaturestring可选Optional. An opaque signature for the thought so it can be reused in subsequent requests.
toolCallobject可选Server-side tool call. This field is populated when the model predicts a tool invocation that should be executed on the server. The client is expected to echo this message back to the API.
toolResponseobject可选The output from a server-side `ToolCall` execution. This field is populated by the client with the results of executing the corresponding `ToolCall`.
videoMetadataobject可选Optional. Video metadata. The metadata should only be specified while the video data is presented in inline_data or file_data.
rolestring可选Optional. The producer of the content. Must be either 'user' or 'model'. Useful to set for multi-turn conversations, otherwise can be left blank or unset.
systemInstructionobject可选Optional. Developer set [system instruction(s)](https://ai.google.dev/gemini-api/docs/system-instructions). Currently, text only.
已验证生效。
partsarray可选Ordered `Parts` that constitute a single message. Parts may have different MIME types.
rolestring可选Optional. The producer of the content. Must be either 'user' or 'model'. Useful to set for multi-turn conversations, otherwise can be left blank or unset.
generationConfigobject可选Optional. Configuration options for model generation and outputs.
_responseJsonSchemaany可选○ 当前不生效Optional. Output schema of the generated response. This is an alternative to `response_schema` that accepts [JSON Schema](https://json-schema.org/). If set, `response_schema` must be omitted, but `response_mime_type` is required. While the full JSON Schema may be sent, not all features are supported. Specifically, only the following properties are supported: - `$id` - `$defs` - `$ref` - `$anchor` - `type` - `format` - `title` - `description` - `enum` (for strings and numbers) - `items` - `prefixItems` - `minItems` - `maxItems` - `minimum` - `maximum` - `anyOf` - `oneOf` (interpreted the same as `anyOf`) - `properties` - `additionalProperties` - `required` The non-standard `propertyOrdering` property may also be set. Cyclic references are unrolled to a limited degree and, as such, may only be used within non-required properties. (Nullable properties are not sufficient.) If `$ref` is set on a sub-schema, no other properties, except for than those starting as a `$`, may be set. Deprecated. Use `response_format` instead.
接受但当前不生效。请使用 responseJsonSchema。
audioTranscriptionConfigobject可选○ 当前不生效Optional. Config for audio transcription (speech recognition).
接受但当前不生效。已测文本模型不应用此选项。
candidateCountinteger可选◐ 部分支持Optional. Number of generated responses to return. If unset, this will default to 1. Please note that this doesn't work for previous generation models (Gemini 1.0 family)
非流式支持多个候选;流式设置 2 返回 400。
enableAffectiveDialogboolean可选○ 当前不生效Optional. If enabled, the model will detect emotions and adapt its responses accordingly.
接受但当前不生效。已测文本模型不应用此选项。
enableEnhancedCivicAnswersboolean可选○ 未支持Optional. Enables enhanced civic answers. It may not be available for all models.
已测文本模型传入返回 400。
frequencyPenaltynumber可选◐ 部分支持Optional. Frequency penalty applied to the next token's logprobs, multiplied by the number of times each token has been seen in the respponse so far. A positive penalty will discourage the use of tokens that have already been used, proportional to the number of times the token has been used: The more a token is used, the more difficult it is for the model to use that token again increasing the vocabulary of responses. Caution: A _negative_ penalty will encourage the model to reuse tokens proportional to the number of times the token has been used. Small negative values will reduce the vocabulary of a response. Larger negative values will cause the model to start repeating a common token until it hits the max_output_tokens limit.
gemini-2.5-flash 偶发观察到效果;gemini-2.5-flash-lite 接受但当前不生效;2.0 可能返回 400。
imageConfigobject可选○ 未支持Optional. Config for image generation. An error will be returned if this field is set for models that don't support these config options.
已测文本模型传入返回 400。
logprobsinteger可选Optional. Only valid if response_logprobs=True. This sets the number of top logprobs, including the chosen candidate, to return at each decoding step in the Candidate.logprobs_result. The number must be in the range of [0, 20].
已验证生效。
maxOutputTokensinteger可选◐ 部分支持Optional. The maximum number of tokens to include in a response candidate. Note: The default value varies by model, see the `Model.output_token_limit` attribute of the `Model` returned from the `getModel` function.
限制输出预算;思考占用预算,极小预算可能只返回思考或报错,gemini-3.5-flash 可能提前截断。
mediaResolutionstring可选Optional. If specified, the media resolution specified will be used.
gemini-2.5-flash 的 LOW/MEDIUM/HIGH 改变图片 token 消耗。
presencePenaltynumber可选○ 当前不生效Optional. Presence penalty applied to the next token's logprobs if the token has already been seen in the response. This penalty is binary on/off and not dependant on the number of times the token is used (after the first). Use frequency_penalty for a penalty that increases with each use. A positive penalty will discourage the use of tokens that have already been used in the response, increasing the vocabulary. A negative penalty will encourage the use of tokens that have already been used in the response, decreasing the vocabulary.
接受但当前不生效。gemini-2.5-flash 和 gemini-2.5-flash-lite 输出未变化。
responseFormatobject可选○ 当前不生效Optional. Configuration for the response output format. Allows specifying output configuration per modality (text, audio, image) in a flat structure.
接受但当前不生效。已测文本模型不应用此选项。
responseJsonSchemaany可选◐ 部分支持Optional. An internal detail. Use `responseJsonSchema` rather than this field.
2.5 系列生效;3.5 预算不足可能截断。不可与 responseSchema 同传。
responseLogprobsboolean可选Optional. If true, export the logprobs results in response.
已验证生效。
responseMimeTypestring可选◐ 部分支持Optional. MIME type of the generated candidate text. Supported MIME types are: `text/plain`: (default) Text output. `application/json`: JSON response in the response candidates. `text/x.enum`: ENUM as a string response in the response candidates. Refer to the [docs](https://ai.google.dev/gemini-api/docs/prompting_with_media#plain_text_formats) for a list of all supported text MIME types.
application/json 在 2.5 系列生效,3.5 可能返回非 JSON;text/x.enum 在 flash-lite 生效。
responseModalitiesarray可选◐ 部分支持Optional. The requested modalities of the response. Represents the set of modalities that the model can return, and should be expected in the response. This is an exact match to the modalities of the response. A model may have multiple combinations of supported modalities. If the requested modalities do not match any of the supported combinations, an error will be returned. An empty list is equivalent to requesting only text.
已测文本模型支持 TEXT;AUDIO 返回 400,IMAGE 返回错误。
responseSchemaobject可选◐ 部分支持Optional. Output schema of the generated candidate text. Schemas must be a subset of the [OpenAPI schema](https://spec.openapis.org/oas/v3.0.3#schema) and can be objects, primitives or arrays. If set, a compatible `response_mime_type` must also be set. Compatible MIME types: `application/json`: Schema for JSON response. Refer to the [JSON text generation guide](https://ai.google.dev/gemini-api/docs/json-mode) for more details. Deprecated. Use `response_format` instead.
2.5 系列的 JSON 约束生效;3.5 预算不足可能截断;需正确指定 responseMimeType。
seedinteger可选◐ 部分支持Optional. Seed used in decoding. If not set, the request uses a randomly generated seed.
gemini-2.5-flash-lite 可复现;gemini-2.5-flash 接受但当前不生效。
speechConfigobject可选○ 当前不生效Optional. The speech generation config.
接受但当前不生效。已测文本模型不应用此选项。
stopSequencesarray可选Optional. The set of character sequences (up to 5) that will stop output generation. If specified, the API will stop at the first appearance of a `stop_sequence`. The stop sequence will not be included as part of the response.
gemini-2.5-flash、gemini-2.5-flash-lite 生效;最多 5 项。
temperaturenumber可选◐ 部分支持Optional. Controls the randomness of the output. Note: The default value varies by model, see the `Model.temperature` attribute of the `Model` returned from the `getModel` function. Values can range from [0.0, 2.0].
gemini-2.5-flash-lite 观察到效果;gemini-2.5-flash 的采样差异不可观测。
thinkingConfigobject可选Optional. Config for thinking features. An error will be returned if this field is set for models that don't support thinking.
includeThoughtsboolean可选◐ 部分支持Indicates whether to include thoughts in the response. If true, thoughts are returned only when available.
思考开启时 true/false 控制是否返回思考;flash-lite 默认未开启思考时单传此字段返回 400。
thinkingBudgetinteger可选The number of thoughts tokens that the model should generate.
0 关闭思考;正数控制思考预算,-1 为自动。越界值返回 400。
thinkingLevelstring可选◐ 部分支持Optional. Controls the maximum depth of the model's internal reasoning process before it produces a response. The default value is model-dependent. Refer to the [Thinking levels guide](https://ai.google.dev/gemini-api/docs/thinking#thinking-levels) for more details. Recommended for Gemini 3 or later models. Use with earlier models results in an error.
gemini-3.5-flash 支持 MINIMAL/LOW/MEDIUM/HIGH;用于 2.5 系列返回 400。
topKinteger可选○ 当前不生效接受该参数但不生效:采样不使用 topK。
接受但当前不生效。gemini-2.5-flash-lite 在 topK=1 时仍返回不同输出;gemini-2.5-flash 不可观测。
topPnumber可选Optional. The maximum cumulative probability of tokens to consider when sampling. The model uses combined Top-k and Top-p (nucleus) sampling. Tokens are sorted based on their assigned probabilities so that only the most likely tokens are considered. Top-k sampling directly limits the maximum number of tokens to consider, while Nucleus sampling limits the number of tokens based on the cumulative probability. Note: The default value varies by `Model` and is specified by the`Model.top_p` attribute returned from the `getModel` function. An empty `top_k` attribute indicates that the model doesn't apply top-k sampling and doesn't allow setting `top_k` on requests.
gemini-2.5-flash 和 gemini-2.5-flash-lite 已验证生效。
translationConfigobject可选○ 当前不生效Optional. Config for translation.
接受但当前不生效。已测文本模型不应用此选项。
toolsarray可选Optional. A list of `Tools` the `Model` may use to generate the next response. A `Tool` is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the `Model`. Supported `Tool`s are `Function` and `code_execution`. Refer to the [Function calling](https://ai.google.dev/gemini-api/docs/function-calling) and the [Code execution](https://ai.google.dev/gemini-api/docs/code-execution) guides to learn more.
codeExecutionobject可选○ 未支持Optional. Enables the model to execute code as part of generation.
已测请求返回 502,当前不可用。
computerUseobject可选○ 未支持Optional. Tool to support the model interacting directly with the computer. If enabled, it automatically populates computer-use specific Function Declarations.
已测 gemini-2.5-flash 返回 400。
fileSearchobject可选○ 未支持Optional. FileSearch tool type. Tool to retrieve knowledge from Semantic Retrieval corpora.
已测 gemini-2.5-flash 返回 400。
functionDeclarationsarray可选Optional. A list of `FunctionDeclarations` available to the model that can be used for function calling. The model or system does not execute the function. Instead the defined function may be returned as a FunctionCall with arguments to the client side for execution. The model may decide to call a subset of these functions by populating FunctionCall in the response. The next conversation turn may contain a FunctionResponse with the Content.role "function" generation context for the next model turn.
behaviorstring可选○ 当前不生效Optional. Specifies the function Behavior. Currently only supported by the BidiGenerateContent method.
接受但当前不生效。
descriptionstring可选Required. A brief description of the function.
namestring可选Required. The name of the function. Must be a-z, A-Z, 0-9, or contain underscores, colons, dots, and dashes, with a maximum length of 128.
parametersobject可选Optional. Describes the parameters to this function. Reflects the Open API 3.03 Parameter Object string Key: the name of the parameter. Parameter names are case sensitive. Schema Value: the Schema defining the type used for the parameter.
已验证生效。
parametersJsonSchemaany可选Optional. Describes the parameters to the function in JSON Schema format. The schema must describe an object where the properties are the parameters to the function. For example: ``` { "type": "object", "properties": { "name": { "type": "string" }, "age": { "type": "integer" } }, "additionalProperties": false, "required": ["name", "age"], "propertyOrdering": ["name", "age"] } ``` This field is mutually exclusive with `parameters`.
已验证生效。
responseobject可选○ 当前不生效Optional. Describes the output from this function in JSON Schema format. Reflects the Open API 3.03 Response Object. The Schema defines the type used for the response value of the function.
接受但当前不生效。
responseJsonSchemaany可选Optional. Describes the output from this function in JSON Schema format. The value specified by the schema is the response value of the function. This field is mutually exclusive with `response`.
googleMapsobject可选Optional. Tool that allows grounding the model's response with geospatial context related to the user's query.
googleSearchobject可选Optional. GoogleSearch tool type. Tool to support Google Search in Model. Powered by Google.
gemini-2.5-flash 返回 groundingMetadata。
googleSearchRetrievalobject可选○ 未支持Optional. Retrieval tool that is powered by Google search.
已测 gemini-2.5-flash 返回 400。
mcpServersarray可选○ 未支持Optional. MCP Servers to connect to.
已测 gemini-2.5-flash 返回 400。
urlContextobject可选Optional. Tool to support URL context retrieval.
toolConfigobject可选Optional. Tool configuration for any `Tool` specified in the request. Refer to the [Function calling guide](https://ai.google.dev/gemini-api/docs/function-calling#function_calling_mode) for a usage example.
functionCallingConfigobject可选Optional. Function calling config.
allowedFunctionNamesarray可选Optional. A set of function names that, when provided, limits the functions the model will call. This should only be set when the Mode is ANY or VALIDATED. Function names should match [FunctionDeclaration.name]. When set, model will predict a function call from only allowed function names.
已验证生效。
modestring可选◐ 部分支持Optional. Specifies the mode in which function calling should execute. If unspecified, the default value will be set to AUTO.
ANY/AUTO/VALIDATED 生效;NONE 在 flash-lite 偶发仍调用工具,复测生效。
includeServerSideToolInvocationsboolean可选Optional. If true, the API response will include the server-side tool calls and responses within the `Content` message. This allows clients to observe the server's tool interactions.
retrievalConfigobject可选Optional. Retrieval config.
safetySettingsarray可选接受该参数但不生效:安全设置不会拦截或改变任何回复。
categorystring可选Required. The category for this setting.
thresholdstring可选Required. Controls the probability threshold at which harm is blocked.
cachedContentstring可选○ 未支持平台不支持上下文缓存:传入会返回 400(Google 错误格式)。
传入返回 400;当前不支持引用上下文缓存。
labelsobject可选接受该参数但不生效:标签不会被存储,也不参与请求处理。
modelstring可选○ 当前不生效Required. The name of the `Model` to use for generating the completion. Format: `models/{model}`.
接受但当前不生效。以 URL 路径里的模型名为准。
serviceTierstring可选接受该参数但不生效:所有请求都按平台当前的服务档位处理。
storeboolean可选Optional. Configures the logging behavior for a given request. If set, it takes precedence over the project-level logging config.
200
错误按 Gemini API 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| candidates | array<object> | Candidate responses from the model. |
| candidates[].avgLogprobs | number | Output only. Average log probability score of the candidate. |
| candidates[].citationMetadata | object | Output only. Citation information for model-generated candidate. This field may be populated with recitation information for any text included in the `content`. These are passages that are "recited" from copyrighted material in the foundational LLM's training data. |
| candidates[].content | object | Output only. Generated content returned from the model. |
| candidates[].finishMessage | string | Optional. Output only. Details the reason why the model stopped generating tokens. This is populated only when `finish_reason` is set. |
| candidates[].finishReason | string | Optional. Output only. The reason why the model stopped generating tokens. If empty, the model has not stopped generating tokens. |
| candidates[].groundingAttributions | array<object> | Output only. Attribution information for sources that contributed to a grounded answer. This field is populated for `GenerateAnswer` calls. |
| candidates[].groundingMetadata | object | Output only. Grounding metadata for the candidate. This field is populated for `GenerateContent` calls. |
| candidates[].index | integer | Output only. Index of the candidate in the list of response candidates. |
| candidates[].logprobsResult | object | Output only. Log-likelihood scores for the response tokens and top tokens |
| candidates[].safetyRatings | array<object> | List of ratings for the safety of a response candidate. There is at most one rating per category. |
| candidates[].tokenCount | integer | Output only. Token count for this candidate. |
| candidates[].urlContextMetadata | object | Output only. Metadata related to url context retrieval tool. |
| modelStatus | object | Output only. The current model status of this model. |
| modelStatus.message | string | A message explaining the model status. |
| modelStatus.modelStage | string | The stage of the underlying model. |
| modelStatus.retirementTime | string | The time at which the model will be retired. |
| modelVersion | string | Output only. The model version used to generate the response. |
| promptFeedback | object | Returns the prompt's feedback related to the content filters. |
| promptFeedback.blockReason | string | Optional. If set, the prompt was blocked and no candidates are returned. Rephrase the prompt. |
| promptFeedback.safetyRatings | array<object> | Ratings for safety of the prompt. There is at most one rating per category. |
| responseId | string | Output only. response_id is used to identify each response. |
| usageMetadata | object | Output only. Metadata on the generation requests' token usage. |
| usageMetadata.cacheTokensDetails | array<object> | Output only. List of modalities of the cached content in the request input. |
| usageMetadata.cachedContentTokenCount | integer | Number of tokens in the cached part of the prompt (the cached content) |
| usageMetadata.candidatesTokenCount | integer | Total number of tokens across all the generated response candidates. |
| usageMetadata.candidatesTokensDetails | array<object> | Output only. List of modalities that were returned in the response. |
| usageMetadata.promptTokenCount | integer | Number of tokens in the prompt. When `cached_content` is set, this is still the total effective prompt size meaning this includes the number of tokens in the cached content. |
| usageMetadata.promptTokensDetails | array<object> | Output only. List of modalities that were processed in the request input. |
| usageMetadata.serviceTier | string | Output only. Service tier of the request. |
| usageMetadata.thoughtsTokenCount | integer | Output only. Number of tokens of thoughts for thinking models. |
| usageMetadata.toolUsePromptTokenCount | integer | Output only. Number of tokens present in tool-use prompt(s). |
| usageMetadata.toolUsePromptTokensDetails | array<object> | Output only. List of modalities that were processed for tool-use request inputs. |
| usageMetadata.totalTokenCount | integer | Total token count for the generation request (prompt + thoughts + response candidates). |
/google/v1beta/models/{modelsId}:countTokens◐ 部分支持modelstring必填path: Required. The model's resource name. This serves as an ID for the Model to use. This name should match a model name returned by the `ListModels` method. Format: `models/{model}`
contentsarray可选◐ 部分支持Optional. The input given to the model as a prompt. This field is ignored when `generate_content_request` is set.
原生透传;本地估算。与 generateContentRequest 同传返回 400。
partsarray可选Ordered `Parts` that constitute a single message. Parts may have different MIME types.
audioTranscriptionobject可选Optional. Audio (input or output) transcription. This is only set when this Part contains audio data.
codeExecutionResultobject可选Result of executing the `ExecutableCode`.
executableCodeobject可选Code generated by the model that is meant to be executed.
fileDataobject可选URI based data.
functionCallobject可选A predicted `FunctionCall` returned from the model that contains a string representing the `FunctionDeclaration.name` with the arguments and their values.
functionResponseobject可选The result output of a `FunctionCall` that contains a string representing the `FunctionDeclaration.name` and a structured JSON object containing any output from the function is used as context to the model.
inlineDataobject可选◐ 部分支持Inline media bytes.
原生透传;本地读取 PNG/JPEG/GIF 头估算图片 token,不把 base64 当文本;其他媒体使用近似额度。
mediaProcessingstring可选Optional. How the model processes this part's media for understanding. Only meaningful for video parts (`inline_data` or `file_data` with video mime). Non-video parts ignore this field.
mediaResolutionobject可选Optional. Media resolution for the input media.
partMetadataobject可选Custom metadata associated with the Part. Agents using genai.Part as content representation may need to keep track of the additional information. For example it can be name of a file/source from which the Part originates or a way to multiplex multiple Part streams.
textstring可选Inline text.
thoughtboolean可选Optional. Indicates if the part is thought from the model.
thoughtSignaturestring可选Optional. An opaque signature for the thought so it can be reused in subsequent requests.
toolCallobject可选Server-side tool call. This field is populated when the model predicts a tool invocation that should be executed on the server. The client is expected to echo this message back to the API.
toolResponseobject可选The output from a server-side `ToolCall` execution. This field is populated by the client with the results of executing the corresponding `ToolCall`.
videoMetadataobject可选Optional. Video metadata. The metadata should only be specified while the video data is presented in inline_data or file_data.
rolestring可选Optional. The producer of the content. Must be either 'user' or 'model'. Useful to set for multi-turn conversations, otherwise can be left blank or unset.
generateContentRequestobject可选◐ 部分支持Optional. The overall input given to the `Model`. This includes the prompt as well as other model steering information like [system instructions](https://ai.google.dev/gemini-api/docs/system-instructions), and/or function declarations for [function calling](https://ai.google.dev/gemini-api/docs/function-calling). `Model`s/`Content`s and `generate_content_request`s are mutually exclusive. You can either send `Model` + `Content`s or a `generate_content_request`, but never both.
原生路径保留 systemInstruction 和 tools 并映射模型;本地计入估算。
cachedContentstring可选○ 未支持Optional. The name of the content [cached](https://ai.google.dev/gemini-api/docs/caching) to use as context to serve the prediction. Format: `cachedContents/{cachedContent}`
contentsarray可选Required. The content of the current conversation with the model. For single-turn queries, this is a single instance. For multi-turn queries like [chat](https://ai.google.dev/gemini-api/docs/text-generation#chat), this is a repeated field that contains the conversation history and the latest request.
generationConfigobject可选Optional. Configuration options for model generation and outputs.
labelsobject可选Optional. Labels with user-defined metadata for the request. Optional. Labels must follow standard unified Cloud label requirements: - Label keys must start with a letter. - Label keys and values can be no longer than 63 characters (Unicode codepoints) and can only contain lowercase letters, numeric characters, underscores, and dashes. - International characters are allowed. Usage: - Safety identifiers from aggregators: Use the key `safety_identifier` (e.g. `{"safety_identifier": "user_session_123"}`)
modelstring可选Required. The name of the `Model` to use for generating the completion. Format: `models/{model}`.
safetySettingsarray可选Optional. A list of unique `SafetySetting` instances for blocking unsafe content. This will be enforced on the `GenerateContentRequest.contents` and `GenerateContentResponse.candidates`. There should not be more than one setting for each `SafetyCategory` type. The API will block any contents and responses that fail to meet the thresholds set by these settings. This list overrides the default settings for each `SafetyCategory` specified in the safety_settings. If there is no `SafetySetting` for a given `SafetyCategory` provided in the list, the API will use the default safety setting for that category. Harm categories HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT, HARM_CATEGORY_HARASSMENT, HARM_CATEGORY_CIVIC_INTEGRITY, HARM_CATEGORY_JAILBREAK are supported. Refer to the [guide](https://ai.google.dev/gemini-api/docs/safety-settings) for detailed information on available safety settings. Also refer to the [Safety guidance](https://ai.google.dev/gemini-api/docs/safety-guidance) to learn how to incorporate safety considerations in your AI applications.
serviceTierstring可选Optional. The service tier of the request.
storeboolean可选Optional. Configures the logging behavior for a given request. If set, it takes precedence over the project-level logging config.
systemInstructionobject可选Optional. Developer set [system instruction(s)](https://ai.google.dev/gemini-api/docs/system-instructions). Currently, text only.
toolConfigobject可选Optional. Tool configuration for any `Tool` specified in the request. Refer to the [Function calling guide](https://ai.google.dev/gemini-api/docs/function-calling#function_calling_mode) for a usage example.
toolsarray可选Optional. A list of `Tools` the `Model` may use to generate the next response. A `Tool` is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the `Model`. Supported `Tool`s are `Function` and `code_execution`. Refer to the [Function calling](https://ai.google.dev/gemini-api/docs/function-calling) and the [Code execution](https://ai.google.dev/gemini-api/docs/code-execution) guides to learn more.
200
按模型族校准的估算值(包括中文和工具定义),响应头为 x-praxis-token-count: estimated;不能用作精确用量或计费依据。
错误按 Gemini API 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| cacheTokensDetails | array<object> | Output only. List of modalities that were processed in the cached content. |
| cacheTokensDetails[].modality | string | The modality associated with this token count. |
| cacheTokensDetails[].tokenCount | integer | Number of tokens. |
| cachedContentTokenCount | integer | Number of tokens in the cached part of the prompt (the cached content). |
| promptTokensDetails | array<object> | Output only. List of modalities that were processed in the request input. |
| promptTokensDetails[].modality | string | The modality associated with this token count. |
| promptTokensDetails[].tokenCount | integer | Number of tokens. |
| totalTokens | integer | The number of tokens that the `Model` tokenizes the `prompt` into. Always non-negative. |
/google/v1beta/models/{modelsId}:embedContent● 支持modelstring必填path: Required. The model's resource name. This serves as an ID for the Model to use. This name should match a model name returned by the `ListModels` method. Format: `models/{model}`
contentobject必填◐ 部分支持Required. The content to embed. Only the `parts.text` fields will be counted.
仅文本部件生效;图片(含多模态嵌入模型)返回 400。
partsarray可选Ordered `Parts` that constitute a single message. Parts may have different MIME types.
rolestring可选Optional. The producer of the content. Must be either 'user' or 'model'. Useful to set for multi-turn conversations, otherwise can be left blank or unset.
embedContentConfigobject可选◐ 部分支持Optional. Configuration for the EmbedContent request.
仅 outputDimensionality 可用(受模型限制);autoTruncate、documentOcr、audioTrackExtraction 等其余配置返回 400。
audioTrackExtractionboolean可选○ 未支持Optional. Whether to extract audio from video content.
传入返回 400;此嵌入配置当前不支持。
autoTruncateboolean可选○ 未支持Optional. Whether to silently truncate the input content if it's longer than the maximum sequence length.
传入返回 400;此嵌入配置当前不支持。
documentOcrboolean可选○ 未支持Optional. Whether to enable OCR for document content.
传入返回 400;此嵌入配置当前不支持。
outputDimensionalityinteger可选◐ 部分支持Optional. Reduced dimension for the output embedding. If set, excessive values in the output embedding are truncated from the end.
text-embedding-3-small、qwen3-vl-embedding 支持已测维度;doubao-embedding-vision 需至少 1024;bge-m3、qwen3-embedding-0.6b 报错。
taskTypestring可选○ 未支持Optional. The task type of the embedding.
传入返回 400;此嵌入配置当前不支持。
titlestring可选○ 未支持Optional. The title for the text.
传入返回 400;此嵌入配置当前不支持。
modelstring可选Required. The model's resource name. This serves as an ID for the Model to use. This name should match a model name returned by the `ListModels` method. Format: `models/{model}`
必须与 URL 路径中的模型一致,否则返回 400。
outputDimensionalityinteger可选◐ 部分支持Optional. Deprecated: Please use EmbedContentConfig.output_dimensionality instead. Optional reduced dimension for the output embedding. If set, excessive values in the output embedding are truncated from the end. Supported by newer models since 2024 only. You cannot set this value if using the earlier model (`models/embedding-001`).
text-embedding-3-small、qwen3-vl-embedding 支持已测维度;doubao-embedding-vision 需至少 1024;bge-m3、qwen3-embedding-0.6b 报错。
taskTypestring可选○ 未支持Optional. Deprecated: Please use EmbedContentConfig.task_type instead. Optional task type for which the embeddings will be used. Not supported on earlier models (`models/embedding-001`).
传入返回 400。
titlestring可选○ 未支持Optional. Deprecated: Please use EmbedContentConfig.title instead. An optional title for the text. Only applicable when TaskType is `RETRIEVAL_DOCUMENT`. Note: Specifying a `title` for `RETRIEVAL_DOCUMENT` provides better quality embeddings for retrieval.
传入返回 400。
200
只接受文本部件;图像等多模态部件会被拒绝。taskType、title 以及 autoTruncate / documentOcr / audioTrackExtraction 等检索配置在平台上没有等价语义, 请求携带时会收到 400(INVALID_ARGUMENT),不会静默忽略——因为不同 taskType 生成的向量行为不同,静默丢弃会悄悄改变检索质量。outputDimensionality 映射为 返回向量的维度。
错误按 Gemini API 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| embedding | object | Output only. The embedding generated from the input content. |
| embedding.shape | array<integer> | This field stores the soft tokens tensor frame shape (e.g. [1, 1, 256, 2048]). |
| embedding.values | array<number> | The embedding values. This is for 3P users only and will not be populated for 1P calls. |
| usageMetadata | object | Output only. The usage metadata for the request. |
| usageMetadata.promptTokenCount | integer | Output only. Number of tokens in the prompt. |
| usageMetadata.promptTokenDetails | array<object> | Output only. List of modalities that were processed in the request input. |
/google/v1beta/models/{modelsId}:batchEmbedContents● 支持modelstring必填path: Required. The model's resource name. This serves as an ID for the Model to use. This name should match a model name returned by the `ListModels` method. Format: `models/{model}`
requestsarray必填Required. Embed requests for the batch. The model in each of these requests must match the model specified `BatchEmbedContentsRequest.model`.
支持 1–100 项,返回顺序与输入一致;维度必须一致。
contentobject可选◐ 部分支持Required. The content to embed. Only the `parts.text` fields will be counted.
仅文本部件生效;图片(含多模态嵌入模型)返回 400。
embedContentConfigobject可选◐ 部分支持Optional. Configuration for the EmbedContent request.
仅 outputDimensionality 可用(受模型限制);autoTruncate、documentOcr、audioTrackExtraction 等其余配置返回 400。
audioTrackExtractionboolean可选○ 未支持Optional. Whether to extract audio from video content.
传入返回 400;此嵌入配置当前不支持。
autoTruncateboolean可选○ 未支持Optional. Whether to silently truncate the input content if it's longer than the maximum sequence length.
传入返回 400;此嵌入配置当前不支持。
documentOcrboolean可选○ 未支持Optional. Whether to enable OCR for document content.
传入返回 400;此嵌入配置当前不支持。
outputDimensionalityinteger可选◐ 部分支持Optional. Reduced dimension for the output embedding. If set, excessive values in the output embedding are truncated from the end.
text-embedding-3-small、qwen3-vl-embedding 支持已测维度;doubao-embedding-vision 需至少 1024;bge-m3、qwen3-embedding-0.6b 报错。
taskTypestring可选○ 未支持Optional. The task type of the embedding.
传入返回 400;此嵌入配置当前不支持。
titlestring可选○ 未支持Optional. The title for the text.
传入返回 400;此嵌入配置当前不支持。
modelstring可选Required. The model's resource name. This serves as an ID for the Model to use. This name should match a model name returned by the `ListModels` method. Format: `models/{model}`
必须与 URL 路径中的模型一致,否则返回 400。
outputDimensionalityinteger可选◐ 部分支持Optional. Deprecated: Please use EmbedContentConfig.output_dimensionality instead. Optional reduced dimension for the output embedding. If set, excessive values in the output embedding are truncated from the end. Supported by newer models since 2024 only. You cannot set this value if using the earlier model (`models/embedding-001`).
text-embedding-3-small、qwen3-vl-embedding 支持已测维度;doubao-embedding-vision 需至少 1024;bge-m3、qwen3-embedding-0.6b 报错。
taskTypestring可选○ 未支持Optional. Deprecated: Please use EmbedContentConfig.task_type instead. Optional task type for which the embeddings will be used. Not supported on earlier models (`models/embedding-001`).
传入返回 400。
titlestring可选○ 未支持Optional. Deprecated: Please use EmbedContentConfig.title instead. An optional title for the text. Only applicable when TaskType is `RETRIEVAL_DOCUMENT`. Note: Specifying a `title` for `RETRIEVAL_DOCUMENT` provides better quality embeddings for retrieval.
传入返回 400。
200
requests 中每一项的约束与 embedContent 相同(文本部件、同上拒绝规则);批量内 所有条目的 outputDimensionality 必须一致。当前官方 JS 与 Python SDK 的 embedContent 调用实际走的就是这个批量端点。
错误按 Gemini API 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| embeddings | array<object> | Output only. The embeddings for each request, in the same order as provided in the batch request. |
| embeddings[].shape | array<integer> | This field stores the soft tokens tensor frame shape (e.g. [1, 1, 256, 2048]). |
| embeddings[].values | array<number> | The embedding values. This is for 3P users only and will not be populated for 1P calls. |
| usageMetadata | object | Output only. The usage metadata for the request. |
| usageMetadata.promptTokenCount | integer | Output only. Number of tokens in the prompt. |
| usageMetadata.promptTokenDetails | array<object> | Output only. List of modalities that were processed in the request input. |
/google/v1beta/models● 支持pageSizeinteger可选query: The maximum number of `Models` to return (per page). If unspecified, 50 models will be returned per page. This method returns at most 1000 models per page, even if you pass a larger page_size.
支持分页;0、负数和非数字返回 400,超过上限会截断。
pageTokenstring可选query: A page token, received from a previous `ListModels` call. Provide the `page_token` returned by one request as an argument to the next request to retrieve the next page. When paginating, all other parameters provided to `ListModels` must match the call that provided the page token.
已验证生效。
200
向量嵌入模型会以 embedContent 作为其唯一受支持的方法列出。当模型目录 暂时不可用时,generateContent 的行为保持不变:显式要求图像输出 (responseModalities 含 IMAGE)的请求仍走图像通道;未显式声明的旧式图像请求 在该窗口内会按文本对话处理——降级期间每个响应都带 X-Praxis-Route-Degraded: model-catalog-unavailable 头以示区别。
错误按 Gemini API 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| models | array<object> | The returned Models. |
| models[].baseModelId | string | Required. The name of the base model, pass this to the generation request. Examples: * `gemini-1.5-flash` |
| models[].description | string | A short description of the model. |
| models[].displayName | string | The human-readable name of the model. E.g. "Gemini 1.5 Flash". The name can be up to 128 characters long and can consist of any UTF-8 characters. |
| models[].inputTokenLimit | integer | Maximum number of input tokens allowed for this model. |
| models[].maxTemperature | number | The maximum temperature this model can use. |
| models[].name | string | Required. The resource name of the `Model`. Refer to Model variants for all allowed values. Format: `models/{model}` with a `{model}` naming convention of: * "{base_model_id}-{version}" Examples: * `models/gemini-1.5-flash-001` |
| models[].outputTokenLimit | integer | Maximum number of output tokens available for this model. |
| models[].supportedGenerationMethods | array<string> | The model's supported generation methods. The corresponding API method names are defined as Pascal case strings, such as `generateMessage` and `generateContent`. |
| models[].temperature | number | Controls the randomness of the output. Values can range over `[0.0,max_temperature]`, inclusive. A higher value will produce responses that are more varied, while a value closer to `0.0` will typically result in less surprising responses from the model. This value specifies default to be used by the backend while making the call to the model. |
| models[].thinking | boolean | Whether the model supports thinking. |
| models[].topK | integer | For Top-k sampling. Top-k sampling considers the set of `top_k` most probable tokens. This value specifies default to be used by the backend while making the call to the model. If empty, indicates the model doesn't use top-k sampling, and `top_k` isn't allowed as a generation parameter. |
| models[].topP | number | For Nucleus sampling. Nucleus sampling considers the smallest set of tokens whose probability sum is at least `top_p`. This value specifies default to be used by the backend while making the call to the model. |
| models[].version | string | Required. The version number of the model. This represents the major version (`1.0` or `1.5`) |
| nextPageToken | string | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no more pages. |
/google/v1beta/models/{modelsId}● 支持namestring必填path: Required. The resource name of the model. This name should match a model name returned by the `ListModels` method. Format: `models/{model}`
200
错误按 Gemini API 格式返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| baseModelId | string | Required. The name of the base model, pass this to the generation request. Examples: * `gemini-1.5-flash` |
| description | string | A short description of the model. |
| displayName | string | The human-readable name of the model. E.g. "Gemini 1.5 Flash". The name can be up to 128 characters long and can consist of any UTF-8 characters. |
| inputTokenLimit | integer | Maximum number of input tokens allowed for this model. |
| maxTemperature | number | The maximum temperature this model can use. |
| name | string | Required. The resource name of the `Model`. Refer to Model variants for all allowed values. Format: `models/{model}` with a `{model}` naming convention of: * "{base_model_id}-{version}" Examples: * `models/gemini-1.5-flash-001` |
| outputTokenLimit | integer | Maximum number of output tokens available for this model. |
| supportedGenerationMethods | array<string> | The model's supported generation methods. The corresponding API method names are defined as Pascal case strings, such as `generateMessage` and `generateContent`. |
| temperature | number | Controls the randomness of the output. Values can range over `[0.0,max_temperature]`, inclusive. A higher value will produce responses that are more varied, while a value closer to `0.0` will typically result in less surprising responses from the model. This value specifies default to be used by the backend while making the call to the model. |
| thinking | boolean | Whether the model supports thinking. |
| topK | integer | For Top-k sampling. Top-k sampling considers the set of `top_k` most probable tokens. This value specifies default to be used by the backend while making the call to the model. If empty, indicates the model doesn't use top-k sampling, and `top_k` isn't allowed as a generation parameter. |
| topP | number | For Nucleus sampling. Nucleus sampling considers the smallest set of tokens whose probability sum is at least `top_p`. This value specifies default to be used by the backend while making the call to the model. |
| version | string | Required. The version number of the model. This represents the major version (`1.0` or `1.5`) |
加载中…X-API-Key 头,官方 SDK 自动带上)。<端口>-<沙箱 ID>.praxisusercontent.com,用创建沙箱时返回的访问凭证认证。所以 SDK 除了 api_url 还要把 domain 设为 praxisusercontent.com。也可以不改代码,只设环境变量:
加载中…| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| POST | /sandboxes | 创建沙箱 | ● 支持 |
| GET | /sandboxes | 列出沙箱 | ● 支持 |
| GET | /sandboxes/{sandboxID} | 读取沙箱 | ● 支持 |
| GET | /sandboxes/{sandboxID}/metrics | 沙箱指标 | ● 支持 |
| POST | /sandboxes/{sandboxID}/timeout | 设置超时 | ● 支持 |
| POST | /sandboxes/{sandboxID}/pause | 暂停沙箱 | ● 支持 |
| POST | /sandboxes/{sandboxID}/connect | 连接沙箱 | ● 支持 |
| DELETE | /sandboxes/{sandboxID} | 终止沙箱 | ● 支持 |
| POST | /v2/sandboxes | 创建沙箱(v2) | ● 支持 |
| GET | /v2/sandboxes | 列出沙箱(v2) | ● 支持 |
| POST | /v2/sandboxes/{sandboxID}/connect | 连接沙箱(v2) | ● 支持 |
| GET | /templates | 列出模板 | ● 支持 |
| GET | /v2/templates | 列出模板(v2) | ● 支持 |
| POST | /volumes | 创建卷 | ● 支持 |
| GET | /volumes | 列出卷 | ● 支持 |
| GET | /volumes/{volumeID} | 读取卷 | ● 支持 |
| DELETE | /volumes/{volumeID} | 删除卷 | ● 支持 |
| POST | /sandboxes/{sandboxID}/fork | 复制沙箱 | ● 支持 |
| POST | /sandboxes/{sandboxID}/snapshots | 创建快照 | ● 支持 |
| GET | /snapshots | 列出快照 | ● 支持 |
| DELETE | /templates/{templateID} | 删除快照 | ● 支持 |
| PUT | /sandboxes/{sandboxID}/network | 更新网络策略 | ● 支持 |
| GET | /v2/sandboxes/{sandboxID}/logs | 读取沙箱日志 | ● 支持 |
参数与字段的权威定义以 E2B 官方文档为准。
/e2b/sandboxes● 支持templateIDstring必填Identifier of the required template
timeoutinteger可选Time to live for the sandbox in seconds.
autoPauseboolean可选Automatically pauses the sandbox after the timeout
metadataany可选envVarsany可选secureboolean可选Secure all system communication with sandbox
allow_internet_accessboolean可选Allow sandbox to access the internet. When set to false, it behaves the same as specifying denyOut to 0.0.0.0/0 in the network config.
autoPauseMemoryboolean可选Controls the snapshot kind taken when the sandbox auto-pauses on timeout (only relevant when autoPause is true). When false, the auto-pause drops the in-memory state and persists only the filesystem (a filesystem-only snapshot); resuming it cold-boots (reboots) the sandbox from disk. Such a snapshot cannot be auto-resumed by traffic and must be resumed explicitly, so it cannot be combined with autoResume. Defaults to true (full memory snapshot).
autoResumeobject可选Auto-resume configuration for paused sandboxes.
enabledboolean必填Auto-resume enabled flag for paused sandboxes. Default false.
networkobject可选allowPublicTrafficboolean可选Specify if the sandbox URLs should be accessible only with authentication.
allowOutarray可选List of allowed destinations for egress traffic. Each entry can be a CIDR block (e.g. "8.8.8.8/32"), a bare IP address (e.g. "8.8.8.8"), or a domain name (e.g. "example.com", "*.example.com"). Allowed entries always take precedence over denied entries.
denyOutarray可选List of denied CIDR blocks or IP addresses for egress traffic. Domain names are not supported for deny rules.
egressProxyobject可选SOCKS5 proxy for sandbox egress. Outbound TCP is tunneled through the proxy after allow/deny filtering; the sandbox is unaware. Domain-matched flows use remote DNS (ATYP=domain).
maskRequestHoststring可选Specify host mask which will be used for all sandbox requests
httpsPortsarray可选Sandbox ports that serve HTTPS rather than plaintext HTTP. Affects how the proxy reaches the service inside the sandbox; the public URL is HTTPS either way. Certificates are not verified, so self-signed ones work. The envd port (49983) cannot be listed.
rulesobject可选Per-domain transform rules applied to matching outbound HTTPS requests. Keys may be exact DNS names (for example, "api.example.com") or a leading wildcard (for example, "*.example.com"), and are normalized to lowercase on write. Wildcards match subdomains at any depth but not the apex domain; a bare "*" is invalid. Exact rules take precedence, followed by the longest matching wildcard suffix, and matching rule sets are not merged. Broad wildcards such as "*.com" are allowed and may expose transformed credentials to every matching destination the sandbox contacts. Rules do not grant network access; configure allowOut separately to permit the destination.
mcpobject可选MCP configuration for the sandbox
iamobject可选Sandbox workload identity configuration. A non-empty, valid tokens map enables workload identity for the sandbox.
tokensobject可选Named workload-token definitions, keyed by a caller-chosen token name.
volumeMountsarray可选namestring必填Name of the volume
pathstring必填Path of the volume
201
已弃用:最新官方 SDK 走 v2。平台暂未提供 E2B 默认的 base 模板:不带模板参数的 Sandbox.create() 会返回 404,请显式指定模板(可用模板见「列出模板」)。
错误按 E2B 格式返回,参见 错误码
The sandbox was created successfully
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| templateID | string | Identifier of the template from which is the sandbox created |
| sandboxID | string | Identifier of the sandbox |
| alias | string | Alias of the template |
| clientID | string | Identifier of the client |
| envdVersion | string | Version of the envd running in the sandbox |
| envdAccessToken | string | Access token used for envd communication |
| trafficAccessToken | string | Token required for accessing sandbox via proxy. |
| domain | string | Base domain where the sandbox traffic is accessible |
/e2b/sandboxes● 支持metadatastring可选query: Metadata query used to filter the sandboxes (e.g. "user=abc&app=prod"). Each key and values must be URL encoded.
200
已弃用:最新官方 SDK 走 v2。
错误按 E2B 格式返回,参见 错误码
Successfully returned all running sandboxes
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].templateID | string | Identifier of the template from which is the sandbox created |
| [].alias | string | Alias of the template |
| [].sandboxID | string | Identifier of the sandbox |
| [].clientID | string | Identifier of the client |
| [].startedAt | string | Time when the sandbox was started |
| [].endAt | string | Time when the sandbox will expire |
| [].cpuCount | integer | CPU cores for the sandbox |
| [].memoryMB | integer | Memory for the sandbox in MiB |
| [].diskSizeMB | integer | Disk size for the sandbox in MiB |
| [].metadata | any | |
| [].state | string | State of the sandbox |
| [].envdVersion | string | Version of the envd running in the sandbox |
| [].volumeMounts | array<object> | |
| [].volumeMounts[].name | string | Name of the volume |
| [].volumeMounts[].path | string | Path of the volume |
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
Successfully returned the sandbox
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| templateID | string | Identifier of the template from which is the sandbox created |
| alias | string | Alias of the template |
| sandboxID | string | Identifier of the sandbox |
| clientID | string | Identifier of the client |
| startedAt | string | Time when the sandbox was started |
| endAt | string | Time when the sandbox will expire |
| envdVersion | string | Version of the envd running in the sandbox |
| envdAccessToken | string | Access token used for envd communication |
| allowInternetAccess | boolean | Whether internet access was explicitly enabled or disabled for the sandbox. Null means it was not explicitly set. |
| domain | string | Base domain where the sandbox traffic is accessible |
| cpuCount | integer | CPU cores for the sandbox |
| memoryMB | integer | Memory for the sandbox in MiB |
| diskSizeMB | integer | Disk size for the sandbox in MiB |
| metadata | any | |
| state | string | State of the sandbox |
| network | object | |
| network.allowPublicTraffic | boolean | Specify if the sandbox URLs should be accessible only with authentication. |
| network.allowOut | array<string> | List of allowed destinations for egress traffic. Each entry can be a CIDR block (e.g. "8.8.8.8/32"), a bare IP address (e.g. "8.8.8.8"), or a domain name (e.g. "example.com", "*.example.com"). Allowed entries always take precedence over denied entries. |
| network.denyOut | array<string> | List of denied CIDR blocks or IP addresses for egress traffic. Domain names are not supported for deny rules. |
| network.egressProxy | object | SOCKS5 proxy for sandbox egress. Outbound TCP is tunneled through the proxy after allow/deny filtering; the sandbox is unaware. Domain-matched flows use remote DNS (ATYP=domain). |
| network.maskRequestHost | string | Specify host mask which will be used for all sandbox requests |
| network.httpsPorts | array<integer> | Sandbox ports that serve HTTPS rather than plaintext HTTP. Affects how the proxy reaches the service inside the sandbox; the public URL is HTTPS either way. Certificates are not verified, so self-signed ones work. The envd port (49983) cannot be listed. |
| network.rules | object | Per-domain transform rules applied to matching outbound HTTPS requests. Keys may be exact DNS names (for example, "api.example.com") or a leading wildcard (for example, ".example.com"), and are normalized to lowercase on write. Wildcards match subdomains at any depth but not the apex domain; a bare "" is invalid. Exact rules take precedence, followed by the longest matching wildcard suffix, and matching rule sets are not merged. Broad wildcards such as "*.com" are allowed and may expose transformed credentials to every matching destination the sandbox contacts. Rules do not grant network access; configure allowOut separately to permit the destination. |
| lifecycle | object | Sandbox lifecycle policy returned by sandbox info. |
| lifecycle.autoResume | boolean | Whether the sandbox can auto-resume. |
| lifecycle.onTimeout | string | Action taken when the sandbox times out. |
| volumeMounts | array<object> | |
| volumeMounts[].name | string | Name of the volume |
| volumeMounts[].path | string | Path of the volume |
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/e2b/sandboxes/{sandboxID}/metrics● 支持sandboxIDstring必填path:
startinteger可选query: Unix timestamp for the start of the interval, in seconds, for which the metrics
endinteger可选query: Unix timestamp for the end of the interval, in seconds, for which the metrics
200
错误按 E2B 格式返回,参见 错误码
Successfully returned the sandbox metrics
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].timestamp | string | Timestamp of the metric entry |
| [].timestampUnix | integer | Timestamp of the metric entry in Unix time (seconds since epoch) |
| [].cpuCount | integer | Number of CPU cores |
| [].cpuUsedPct | number | CPU usage percentage |
| [].memUsed | integer | Memory used in bytes |
| [].memTotal | integer | Total memory in bytes |
| [].memCache | integer | Cached memory (page cache) in bytes |
| [].diskUsed | integer | Disk used in bytes |
| [].diskTotal | integer | Total disk space in bytes |
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/e2b/sandboxes/{sandboxID}/pause● 支持sandboxIDstring必填path:
memoryboolean可选Whether to capture a full memory snapshot. When false, only the filesystem is persisted and resuming the sandbox cold-boots (reboots) it from disk, losing in-memory state, running processes, and open connections. Resume it with an explicit request (connect or resume); auto-resume, which can be triggered by arbitrary traffic, refuses such a sandbox. Defaults to true.
204
错误按 E2B 格式返回,参见 错误码
The sandbox was paused successfully and can be resumed
未声明响应体。
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/e2b/sandboxes/{sandboxID}/connect● 支持sandboxIDstring必填path:
timeoutinteger必填Timeout in seconds from the current time after which the sandbox should expire
memoryboolean可选Defaults to true. When false and the sandbox is paused, resume from disk state only: the sandbox cold-boots fresh and any memory in the snapshot is ignored, never modified or deleted. Disk state has crash-recovery semantics — writes not flushed before the pause may be lost. A no-op for snapshots that contain no memory. Rejected with an error in environments where this capability is not enabled, never silently downgraded to a memory restore.
201
已弃用:最新官方 SDK 走 v2。
错误按 E2B 格式返回,参见 错误码
The sandbox was already running
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| templateID | string | Identifier of the template from which is the sandbox created |
| sandboxID | string | Identifier of the sandbox |
| alias | string | Alias of the template |
| clientID | string | Identifier of the client |
| envdVersion | string | Version of the envd running in the sandbox |
| envdAccessToken | string | Access token used for envd communication |
| trafficAccessToken | string | Token required for accessing sandbox via proxy. |
| domain | string | Base domain where the sandbox traffic is accessible |
The sandbox was resumed successfully
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| templateID | string | Identifier of the template from which is the sandbox created |
| sandboxID | string | Identifier of the sandbox |
| alias | string | Alias of the template |
| clientID | string | Identifier of the client |
| envdVersion | string | Version of the envd running in the sandbox |
| envdAccessToken | string | Access token used for envd communication |
| trafficAccessToken | string | Token required for accessing sandbox via proxy. |
| domain | string | Base domain where the sandbox traffic is accessible |
/e2b/v2/sandboxes● 支持templateIDstring必填Identifier of the required template
timeoutinteger可选Time to live for the sandbox in seconds.
autoPauseboolean可选Automatically pauses the sandbox after the timeout
metadataany可选envVarsany可选allow_internet_accessboolean可选Allow sandbox to access the internet. When set to false, it behaves the same as specifying denyOut to 0.0.0.0/0 in the network config.
autoPauseMemoryboolean可选Controls the snapshot kind taken when the sandbox auto-pauses on timeout (only relevant when autoPause is true). When false, the auto-pause drops the in-memory state and persists only the filesystem (a filesystem-only snapshot); resuming it cold-boots (reboots) the sandbox from disk. Such a snapshot cannot be auto-resumed by traffic and must be resumed explicitly, so it cannot be combined with autoResume. Defaults to true (full memory snapshot).
autoResumeobject可选Auto-resume configuration for paused sandboxes.
enabledboolean必填Auto-resume enabled flag for paused sandboxes. Default false.
networkobject可选allowPublicTrafficboolean可选Specify if the sandbox URLs should be accessible only with authentication.
allowOutarray可选List of allowed destinations for egress traffic. Each entry can be a CIDR block (e.g. "8.8.8.8/32"), a bare IP address (e.g. "8.8.8.8"), or a domain name (e.g. "example.com", "*.example.com"). Allowed entries always take precedence over denied entries.
denyOutarray可选List of denied CIDR blocks or IP addresses for egress traffic. Domain names are not supported for deny rules.
egressProxyobject可选SOCKS5 proxy for sandbox egress. Outbound TCP is tunneled through the proxy after allow/deny filtering; the sandbox is unaware. Domain-matched flows use remote DNS (ATYP=domain).
maskRequestHoststring可选Specify host mask which will be used for all sandbox requests
httpsPortsarray可选Sandbox ports that serve HTTPS rather than plaintext HTTP. Affects how the proxy reaches the service inside the sandbox; the public URL is HTTPS either way. Certificates are not verified, so self-signed ones work. The envd port (49983) cannot be listed.
rulesobject可选Per-domain transform rules applied to matching outbound HTTPS requests. Keys may be exact DNS names (for example, "api.example.com") or a leading wildcard (for example, "*.example.com"), and are normalized to lowercase on write. Wildcards match subdomains at any depth but not the apex domain; a bare "*" is invalid. Exact rules take precedence, followed by the longest matching wildcard suffix, and matching rule sets are not merged. Broad wildcards such as "*.com" are allowed and may expose transformed credentials to every matching destination the sandbox contacts. Rules do not grant network access; configure allowOut separately to permit the destination.
mcpobject可选MCP configuration for the sandbox
iamobject可选Sandbox workload identity configuration. A non-empty, valid tokens map enables workload identity for the sandbox.
tokensobject可选Named workload-token definitions, keyed by a caller-chosen token name.
volumeMountsarray可选namestring必填Name of the volume
pathstring必填Path of the volume
201
错误按 E2B 格式返回,参见 错误码
The sandbox was created successfully
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| templateID | string | Identifier of the template from which is the sandbox created |
| sandboxID | string | Identifier of the sandbox |
| alias | string | Alias of the template |
| clientID | string | Identifier of the client |
| envdVersion | string | Version of the envd running in the sandbox |
| envdAccessToken | string | Access token used for envd communication |
| trafficAccessToken | string | Token required for accessing sandbox via proxy. |
| domain | string | Base domain where the sandbox traffic is accessible |
/e2b/v2/sandboxes● 支持metadatastring可选query: Metadata query used to filter the sandboxes (e.g. "user=abc&app=prod"). Each key and values must be URL encoded.
statearray可选query: Filter sandboxes by one or more states
orderstring可选query: Sort direction by sandbox start time. Defaults to desc (newest first).
startedAfterstring可选query: Return sandboxes started at or after this timestamp.
templatestring可选query: Filter sandboxes by a template ID or alias.
nextTokenstring可选query: Cursor to start the list from
limitinteger可选query: Maximum number of items to return per page
200
错误按 E2B 格式返回,参见 错误码
Successfully returned all running sandboxes
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].templateID | string | Identifier of the template from which is the sandbox created |
| [].alias | string | Alias of the template |
| [].sandboxID | string | Identifier of the sandbox |
| [].clientID | string | Identifier of the client |
| [].startedAt | string | Time when the sandbox was started |
| [].endAt | string | Time when the sandbox will expire |
| [].cpuCount | integer | CPU cores for the sandbox |
| [].memoryMB | integer | Memory for the sandbox in MiB |
| [].diskSizeMB | integer | Disk size for the sandbox in MiB |
| [].metadata | any | |
| [].state | string | State of the sandbox |
| [].envdVersion | string | Version of the envd running in the sandbox |
| [].volumeMounts | array<object> | |
| [].volumeMounts[].name | string | Name of the volume |
| [].volumeMounts[].path | string | Path of the volume |
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/e2b/v2/sandboxes/{sandboxID}/connect● 支持sandboxIDstring必填path:
timeoutinteger可选Timeout in seconds from the current time after which the sandbox should expire
memoryboolean可选Defaults to true. When false and the sandbox is paused, resume from disk state only: the sandbox cold-boots fresh and any memory in the snapshot is ignored, never modified or deleted. Disk state has crash-recovery semantics — writes not flushed before the pause may be lost. A no-op for snapshots that contain no memory. Rejected with an error in environments where this capability is not enabled, never silently downgraded to a memory restore.
200
错误按 E2B 格式返回,参见 错误码
The sandbox was already running
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| templateID | string | Identifier of the template from which is the sandbox created |
| sandboxID | string | Identifier of the sandbox |
| alias | string | Alias of the template |
| clientID | string | Identifier of the client |
| envdVersion | string | Version of the envd running in the sandbox |
| envdAccessToken | string | Access token used for envd communication |
| trafficAccessToken | string | Token required for accessing sandbox via proxy. |
| domain | string | Base domain where the sandbox traffic is accessible |
The sandbox was resumed successfully
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| templateID | string | Identifier of the template from which is the sandbox created |
| sandboxID | string | Identifier of the sandbox |
| alias | string | Alias of the template |
| clientID | string | Identifier of the client |
| envdVersion | string | Version of the envd running in the sandbox |
| envdAccessToken | string | Access token used for envd communication |
| trafficAccessToken | string | Token required for accessing sandbox via proxy. |
| domain | string | Base domain where the sandbox traffic is accessible |
/e2b/templates● 支持teamIDstring可选query: Identifier of the team
200
已弃用:最新官方 SDK 走 v2。
错误按 E2B 格式返回,参见 错误码
Successfully returned all templates
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].templateID | string | Identifier of the template |
| [].buildID | string | Identifier of the last successful build for given template |
| [].cpuCount | integer | CPU cores for the sandbox |
| [].memoryMB | integer | Memory for the sandbox in MiB |
| [].diskSizeMB | integer | Disk size for the sandbox in MiB |
| [].public | boolean | Whether the template is public or only accessible by the team |
| [].aliases | array<string> | Aliases of the template |
| [].names | array<string> | Names of the template (namespace/alias format when namespaced) |
| [].createdAt | string | Time when the template was created |
| [].updatedAt | string | Time when the template was last updated |
| [].createdBy | object | |
| [].createdBy.id | string | Identifier of the user |
| [].createdBy.email | string | Email of the user |
| [].lastSpawnedAt | string | Time when the template was last used |
| [].spawnCount | integer | Number of times the template was used |
| [].buildCount | integer | Number of times the template was built |
| [].envdVersion | string | Version of the envd running in the sandbox |
| [].buildStatus | string | Status of the template build |
/e2b/v2/templates● 支持teamIDstring可选query: Identifier of the team
nextTokenstring可选query: Cursor to start the list from
limitinteger可选query: Maximum number of items to return per page
200
错误按 E2B 格式返回,参见 错误码
Successfully returned all templates
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].templateID | string | Identifier of the template |
| [].buildID | string | Identifier of the last successful build for given template |
| [].cpuCount | integer | CPU cores for the sandbox |
| [].memoryMB | integer | Memory for the sandbox in MiB |
| [].diskSizeMB | integer | Disk size for the sandbox in MiB |
| [].public | boolean | Whether the template is public or only accessible by the team |
| [].aliases | array<string> | Aliases of the template |
| [].names | array<string> | Names of the template (namespace/alias format when namespaced) |
| [].createdAt | string | Time when the template was created |
| [].updatedAt | string | Time when the template was last updated |
| [].createdBy | object | |
| [].createdBy.id | string | Identifier of the user |
| [].createdBy.email | string | Email of the user |
| [].lastSpawnedAt | string | Time when the template was last used |
| [].spawnCount | integer | Number of times the template was used |
| [].buildCount | integer | Number of times the template was built |
| [].envdVersion | string | Version of the envd running in the sandbox |
| [].buildStatus | string | Status of the template build |
Successfully created a new team volume
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| volumeID | string | ID of the volume |
| name | string | Name of the volume |
| token | string | Auth token to use for interacting with volume content |
| domain | string | Domain to use as the destination for volume content requests, replacing the default `api.<E2B_DOMAIN>`. Only returned when the team is connected to a custom (BYOC) cluster; absent otherwise, in which case the default domain is used. |
Successfully retrieved a team volume
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| volumeID | string | ID of the volume |
| name | string | Name of the volume |
| token | string | Auth token to use for interacting with volume content |
| domain | string | Domain to use as the destination for volume content requests, replacing the default `api.<E2B_DOMAIN>`. Only returned when the team is connected to a custom (BYOC) cluster; absent otherwise, in which case the default domain is used. |
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/e2b/sandboxes/{sandboxID}/fork● 支持sandboxIDstring必填path:
timeoutinteger可选新副本的存活时间,单位为秒。
countinteger可选要创建的独立副本数。所有副本来自同一次快照,每个副本分别返回成功结果或错误。
201
错误按 E2B 格式返回,参见 错误码
The sandbox was snapshotted and the forks were attempted; each entry reports one fork's outcome
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].sandbox | object | |
| [].sandbox.templateID | string | Identifier of the template from which is the sandbox created |
| [].sandbox.sandboxID | string | Identifier of the sandbox |
| [].sandbox.alias | string | Alias of the template |
| [].sandbox.clientID | string | Identifier of the client |
| [].sandbox.envdVersion | string | Version of the envd running in the sandbox |
| [].sandbox.envdAccessToken | string | Access token used for envd communication |
| [].sandbox.trafficAccessToken | string | Token required for accessing sandbox via proxy. |
| [].sandbox.domain | string | Base domain where the sandbox traffic is accessible |
| [].error | object | |
| [].error.code | integer | Error code |
| [].error.error_code | string | Machine-readable semantic error code. Not a closed set; initial values: sandbox_capacity_unavailable, sandbox_placement_timeout, sandbox_no_compatible_node, sandbox_create_failed, internal_server_error. |
| [].error.message | string | Error |
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/e2b/sandboxes/{sandboxID}/snapshots● 支持sandboxIDstring必填path:
namestring可选可选别名。同一主体重复使用该别名会更新既有快照,保留本平台快照 ID。
201
错误按 E2B 格式返回,参见 错误码
Snapshot created successfully
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| snapshotID | string | Identifier of the snapshot template including the tag. Uses namespace/alias when a name was provided (e.g. team-slug/my-snapshot:default), otherwise falls back to the raw template ID (e.g. abc123:default). |
| names | array<string> | Full names of the snapshot template including team namespace and tag (e.g. team-slug/my-snapshot:v2) |
/e2b/snapshots● 支持sandboxIDstring可选query: 按来源沙箱 ID 筛选。
namestring可选query: 按原始别名或本平台 snap_ 快照 ID 筛选。
limitinteger可选query: 每页返回的快照数量上限。
nextTokenstring可选query: 上一页响应头 X-Next-Token 返回的游标。
200
错误按 E2B 格式返回,参见 错误码
Successfully returned snapshots
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].snapshotID | string | Identifier of the snapshot template including the tag. Uses namespace/alias when a name was provided (e.g. team-slug/my-snapshot:default), otherwise falls back to the raw template ID (e.g. abc123:default). |
| [].names | array<string> | Full names of the snapshot template including team namespace and tag (e.g. team-slug/my-snapshot:v2) |
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/e2b/sandboxes/{sandboxID}/network● 支持sandboxIDstring必填path:
allow_internet_accessboolean可选是否允许访问外网。false 等效于 denyOut 包含 0.0.0.0/0。
allowOutarray可选出站目标白名单,可用 CIDR、IP 或域名;白名单优先于拒绝规则。
denyOutarray可选出站目标黑名单,支持 CIDR 或 IP,不支持域名。
egressProxyobject可选上游代理配置字段,当前平台尚未应用。
addressstring必填SOCKS5 proxy address in host:port format (e.g. "proxy.example.com:1080").
usernamestring可选Optional SOCKS5 username (RFC 1929), max 255 bytes.
passwordstring可选Optional SOCKS5 password (RFC 1929), max 255 bytes.
rulesobject可选上游按域名转换规则字段,当前平台尚未应用。
204
错误按 E2B 格式返回,参见 错误码
Successfully updated the sandbox network configuration
未声明响应体。
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/e2b/v2/sandboxes/{sandboxID}/logs● 支持sandboxIDstring必填path:
cursorinteger可选query: 起始时间戳,单位为 Unix 毫秒。
limitinteger可选query: 最多返回的日志条数。
directionstring可选query: forward 按时间向后读取;backward 按时间向前读取。
levelstring可选query: 最低日志级别,低于该级别的日志会被过滤。
searchstring可选query: 按日志正文的子串筛选,区分大小写。
200
错误按 E2B 格式返回,参见 错误码
Successfully returned the sandbox logs
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| logs | array<object> | Sandbox logs structured |
| logs[].timestamp | string | Timestamp of the log entry |
| logs[].message | string | Log message content |
| logs[].level | string | State of the sandbox |
| logs[].fields | object |
加载中…| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| POST | /search | 搜索 | ● 支持 |
| POST | /extract | 提取网页内容 | ● 支持 |
| POST | /crawl | 站内爬取 | ● 支持 |
| POST | /map | 站点地图 | ● 支持 |
| POST | /feedback | 提交反馈 | ● 支持 |
参数与字段的权威定义以 Tavily 官方文档为准。
/tavily/search● 支持querystring必填The search query to execute with Tavily.
search_depthstring可选Controls the latency vs. relevance tradeoff and how `results[].content` is generated: - `advanced`: Highest relevance with increased latency. Best for detailed, high-precision queries. Returns multiple semantically relevant snippets per URL (configurable via `chunks_per_source`). - `basic`: A balanced option for relevance and latency. Ideal for general-purpose searches. Returns multiple semantically relevant snippets per URL (configurable via `chunks_per_source`). - `fast`: Prioritizes lower latency while maintaining good relevance. Returns multiple semantically relevant snippets per URL (configurable via `chunks_per_source`). - `ultra-fast`: Minimizes latency above all else. Best for time-critical use cases. Returns one NLP summary per URL. **Cost**: - `basic`, `fast`, `ultra-fast`: 1 API Credit - `advanced`: 2 API Credits See [Search Best Practices](/documentation/best-practices/best-practices-search#search-depth) for guidance on choosing the right search depth.
chunks_per_sourceinteger可选Chunks are short content snippets (maximum 500 characters each) pulled directly from the source. Use `chunks_per_source` to define the maximum number of relevant chunks returned per source and to control the `content` length. Chunks will appear in the `content` field as: `<chunk 1> [...] <chunk 2> [...] <chunk 3>`. Available when `search_depth` is `advanced`, `basic` or `fast`.
max_resultsinteger可选The maximum number of search results to return.
topicstring可选The category of the search.`news` is useful for retrieving real-time updates, particularly about politics, sports, and major current events covered by mainstream media sources. `general` is for broader, more general-purpose searches that may include a wide range of sources.
time_rangestring可选The time range back from the current date to filter results based on publish date or last updated date. Useful when looking for sources that have published or updated data. By default, results with no detectable published date are not removed; set `filter_by_published_date` to `true` to remove them.
start_datestring可选Will return all results after the specified start date based on publish date or last updated date. Required to be written in the format YYYY-MM-DD. By default, results with no detectable published date are not removed; set `filter_by_published_date` to `true` to remove them.
end_datestring可选Will return all results before the specified end date based on publish date or last updated date. Required to be written in the format YYYY-MM-DD. By default, results with no detectable published date are not removed; set `filter_by_published_date` to `true` to remove them.
include_published_dateboolean可选Include a `published_date` field in each result. The date is Tavily's best estimate of when the source was published or last updated, so it can be later than the original publish date. Results with no detectable date return `null`. Automatically enabled when `topic` is `news`. **Note**: this feature is currently in beta.
filter_by_published_dateboolean可选Remove results whose published date falls outside the `time_range`, `start_date`, or `end_date` window. Results with no detectable published date are also removed. Setting this to `true` also enables `include_published_date`. If you want date-window filtering but don't want to lose sources without a detectable date, leave this `false` and set `include_published_date: true` together with a date range instead.
include_answerboolean | string可选Include an LLM-generated answer to the provided query. `basic` or `true` returns a quick answer. `advanced` returns a more detailed answer.
include_raw_contentboolean | string可选Include the cleaned and parsed HTML content of each search result. `markdown` or `true` returns search result content in markdown format. `text` returns the plain text from the results and may increase latency.
include_imagesboolean可选Include images in the response. Returns both a top-level `images` list of query-related images and an `images` array inside each result object with images extracted from that specific source.
include_image_descriptionsboolean可选When `include_images` is `true`, also add a descriptive text for each image.
include_faviconboolean可选Whether to include the favicon URL for each result.
include_domainsarray可选A list of domains to specifically include in the search results. Maximum 300 domains.
exclude_domainsarray可选A list of domains to specifically exclude from the search results. Maximum 150 domains.
include_domains_modestring可选Controls how `include_domains` is applied. `restrict` limits results to only the listed domains. `prefer` also searches the rest of the web, so results outside `include_domains` can still surface, rather than excluding them. Requires `include_domains` to be set; returns a 400 error otherwise.
countrystring可选Boost search results from a specific country. This will prioritize content from the selected country in the search results. Available only if topic is `general`.
languagestring可选Boost search results in a specific language. Accepts an ISO 639-1 code (e.g. `en`, `fr`, `zh-cn`) or an English language name (e.g. `english`, `french`). By default this only boosts matching-language results in ranking; pass `filter_by_language: true` to strictly filter out non-matching results instead. For best results, write your `query` in the same language you set here.
filter_by_languageboolean可选Strictly filter out search results that don't match the `language` parameter, instead of only boosting them in ranking. Requires `language` to be set; returns a 400 error otherwise.
auto_parametersboolean可选When `auto_parameters` is enabled, Tavily automatically configures search parameters based on your query's content and intent. You can still set other parameters manually, and your explicit values will override the automatic ones. The parameters `include_answer`, `include_raw_content`, and `max_results` must always be set manually, as they directly affect response size. Note: `search_depth` may be automatically set to advanced when it's likely to improve results. This uses 2 API credits per request. To avoid the extra cost, you can explicitly set `search_depth` to `basic`.
exact_matchboolean可选Ensure that only search results containing the exact quoted phrase(s) in the query are returned, bypassing synonyms or semantic variations. Wrap target phrases in quotes within your query (e.g. `"John Smith" CEO Acme Corp`). Punctuation is typically ignored inside quotes.
include_usageboolean可选Whether to include credit usage information in the response.
safe_searchboolean可选Whether to filter out adult or unsafe content from results. Not supported for `fast` or `ultra-fast` search depths.
200
错误按 Tavily 格式返回,参见 错误码
Search results returned successfully
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| query | string | The search query that was executed. |
| answer | string | A short answer to the user's query, generated by an LLM. Included in the response only if `include_answer` is requested (i.e., set to `true`, `basic`, or `advanced`) |
| images | array<object> | A list of query-related images from image search. If `include_image_descriptions` is true, each item will have `url` and `description`. Note: per-result images are also returned inside each result object's `images` field. |
| images[].url | string | |
| images[].description | string | |
| results | array<object> | A list of sorted search results, ranked by relevancy. |
| results[].title | string | The title of the search result. |
| results[].url | string | The URL of the search result. |
| results[].content | string | A short description of the search result. |
| results[].score | number | The relevance score of the search result. |
| results[].raw_content | string | The cleaned and parsed HTML content of the search result. Only if `include_raw_content` is true. |
| results[].published_date | string | Tavily's best estimate of when the source was published or last updated. Can be later than the original publish date. `null` if no date could be detected. Only returned when `include_published_date` is `true` (automatically enabled when `topic` is `news`). |
| results[].favicon | string | The favicon URL for the result. |
| results[].images | array<object> | A list of images extracted from this search result. Only included when `include_images` is `true`. If `include_image_descriptions` is `true`, each item will have `url` and `description`. |
| results[].id | string | Unique identifier for this result |
| auto_parameters | object | A dictionary of the selected auto_parameters, only shown when `auto_parameters` is true. |
| response_time | number | Time in seconds it took to complete the request. |
| usage | object | Credit usage details for the request. |
| request_id | string | A unique request identifier you can share with customer support to help resolve issues with specific requests. |
/tavily/extract● 支持querystring可选User intent for reranking extracted content chunks. When provided, chunks are reranked based on relevance to this query.
urlsstring | array必填chunks_per_sourceinteger可选Chunks are short content snippets (maximum 500 characters each) pulled directly from the source. Use `chunks_per_source` to define the maximum number of relevant chunks returned per source and to control the `raw_content` length. Chunks will appear in the `raw_content` field as: `<chunk 1> [...] <chunk 2> [...] <chunk 3>`. Available only when `query` is provided. Must be between 1 and 5.
extract_depthstring可选The depth of the extraction process. `advanced` extraction retrieves more data, including tables and embedded content, with higher success but may increase latency.`basic` extraction costs 1 credit per 5 successful URL extractions, while `advanced` extraction costs 2 credits per 5 successful URL extractions.
include_imagesboolean可选Include a list of images extracted from the URLs in the response. Default is false.
include_faviconboolean可选Whether to include the favicon URL for each result.
formatstring可选The format of the extracted web page content. `markdown` returns content in markdown format. `text` returns plain text and may increase latency.
timeoutnumber可选Maximum time in seconds to wait for the URL extraction before timing out. Must be between 1.0 and 60.0 seconds. If not specified, default timeouts are applied based on extract_depth: 10 seconds for basic extraction and 30 seconds for advanced extraction.
include_usageboolean可选Whether to include credit usage information in the response. `NOTE:`The value may be 0 if the total successful URL extractions has not yet reached 5 calls. See our [Credits & Pricing documentation](https://docs.tavily.com/documentation/api-credits) for details.
200
错误按 Tavily 格式返回,参见 错误码
Extraction completed. Check results and failed_results for each URL. HTTP 200 can have an empty results array when all valid URLs fail during extraction; output order is not guaranteed.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| results | array<object> | A list of extracted content from the provided URLs. |
| results[].url | string | The URL from which the content was extracted. |
| results[].raw_content | string | The full content extracted from the page. When `query` is provided, contains the top-ranked chunks joined by `[...]` separator. |
| results[].images | array<string> | This is only available if `include_images` is set to `true`. A list of image URLs extracted from the page. |
| results[].favicon | string | The favicon URL for the result. |
| failed_results | array<object> | A list of URLs that could not be processed. |
| failed_results[].url | string | The URL that failed to be processed. |
| failed_results[].error | string | An error message describing why the URL couldn't be processed. |
| response_time | number | Time in seconds it took to complete the request. |
| usage | object | Credit usage details for the request. |
| request_id | string | A unique request identifier you can share with customer support to help resolve issues with specific requests. |
/tavily/crawl● 支持urlstring必填The root URL to begin the crawl.
limitinteger可选Total number of links the crawler will process before stopping.
instructionsstring可选Natural language instructions for the crawler. When specified, the mapping cost increases to 2 API credits per 10 successful pages instead of 1 API credit per 10 pages.
chunks_per_sourceinteger可选Chunks are short content snippets (maximum 500 characters each) pulled directly from the source. Use `chunks_per_source` to define the maximum number of relevant chunks returned per source and to control the `raw_content` length. Chunks will appear in the `raw_content` field as: `<chunk 1> [...] <chunk 2> [...] <chunk 3>`. Available only when `instructions` are provided. Must be between 1 and 5.
max_depthinteger可选Max depth of the crawl. Defines how far from the base URL the crawler can explore.
max_breadthinteger可选Max number of links to follow per level of the tree (i.e., per page).
select_pathsarray可选Regex patterns to select only URLs with specific path patterns (e.g., `/docs/.*`, `/api/v1.*`).
select_domainsarray可选Regex patterns to select crawling to specific domains or subdomains (e.g., `^docs\.example\.com$`).
exclude_pathsarray可选Regex patterns to exclude URLs with specific path patterns (e.g., `/private/.*`, `/admin/.*`).
exclude_domainsarray可选Regex patterns to exclude specific domains or subdomains from crawling (e.g., `^private\.example\.com$`).
allow_externalboolean可选Whether to include external domain links in the final results list.
include_imagesboolean可选Whether to include images in the crawl results.
extract_depthstring可选Advanced extraction retrieves more data, including tables and embedded content, with higher success but may increase latency. `basic` extraction costs 1 credit per 5 successful extractions, while `advanced` extraction costs 2 credits per 5 successful extractions.
formatstring可选The format of the extracted web page content. `markdown` returns content in markdown format. `text` returns plain text and may increase latency.
include_faviconboolean可选Whether to include the favicon URL for each result.
timeoutnumber可选Maximum time in seconds to wait for the crawl operation before timing out. Must be between 10 and 150 seconds.
include_usageboolean可选Whether to include credit usage information in the response. `NOTE:`The value may be 0 if the total use of /extract and /map have not yet reached minimum requirements. See our [Credits & Pricing documentation](https://docs.tavily.com/documentation/api-credits) for details.
200
调用前要求账户余额大于 0;按 Tavily 返回的 usage.credits 计费,每 credit $0.01;Tavily 未返回用量时,按本次请求可能消耗的上限计费。
错误按 Tavily 格式返回,参见 错误码
Crawl results returned successfully
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| base_url | string | The base URL that was crawled. |
| results | array<object> | A list of extracted content from the crawled URLs. |
| results[].url | string | The URL that was crawled. |
| results[].raw_content | string | The full content extracted from the page. When `query` is provided, contains the top-ranked chunks joined by `[...]` separator. |
| results[].favicon | string | The favicon URL for the result. |
| response_time | number | Time in seconds it took to complete the request. |
| usage | object | Credit usage details for the request. |
| request_id | string | A unique request identifier you can share with customer support to help resolve issues with specific requests. |
/tavily/map● 支持urlstring必填The root URL to begin the mapping.
limitinteger可选Total number of links the crawler will process before stopping.
instructionsstring可选Natural language instructions for the crawler. When specified, the cost increases to 2 API credits per 10 successful pages instead of 1 API credit per 10 pages.
max_depthinteger可选Max depth of the mapping. Defines how far from the base URL the crawler can explore.
max_breadthinteger可选Max number of links to follow per level of the tree (i.e., per page).
select_pathsarray可选Regex patterns to select only URLs with specific path patterns (e.g., `/docs/.*`, `/api/v1.*`).
select_domainsarray可选Regex patterns to select crawling to specific domains or subdomains (e.g., `^docs\.example\.com$`).
exclude_pathsarray可选Regex patterns to exclude URLs with specific path patterns (e.g., `/private/.*`, `/admin/.*`).
exclude_domainsarray可选Regex patterns to exclude specific domains or subdomains from crawling (e.g., `^private\.example\.com$`).
allow_externalboolean可选Whether to include external domain links in the final results list.
timeoutnumber可选Maximum time in seconds to wait for the map operation before timing out. Must be between 10 and 150 seconds.
include_usageboolean可选Whether to include credit usage information in the response.`NOTE:`The value may be 0 if the total successful pages mapped has not yet reached 10 calls. See our [Credits & Pricing documentation](https://docs.tavily.com/documentation/api-credits) for details.
200
调用前要求账户余额大于 0;按 Tavily 返回的 usage.credits 计费,每 credit $0.01;Tavily 未返回用量时,按本次请求可能消耗的上限计费。
错误按 Tavily 格式返回,参见 错误码
Map results returned successfully
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| base_url | string | The base URL that was mapped. |
| results | array<string> | A list of URLs that were discovered during the mapping. |
| response_time | number | Time in seconds it took to complete the request. |
| usage | object | Credit usage details for the request. |
| request_id | string | A unique request identifier you can share with customer support to help resolve issues with specific requests. |
/tavily/feedback● 支持request_idstring可选The search request to give feedback on, as returned in the `request_id` field of the search response. When provided, the feedback applies to this request.
session_idstring可选The session to give feedback on — the value you sent in the `X-Session-Id` header. When `request_id` is omitted, the feedback applies to the whole session. Optional if `request_id` is provided.
agent_scorenumber | string可选Overall score for how relevant and useful the results were for your task.
human_scorenumber | string可选Feedback from your end user, if you collect it.
extra_scoresarray可选Additional labeled scores for the dimensions you care about.
labelstring必填Name of the dimension being scored.
valuenumber | string必填A numeric score, or a short string label (max 64 characters).
commentstring可选Free-text explanation of the feedback.
response_deliveredstring可选The final answer you produced using the results.
used_idsarray可选IDs of the results you actually used in your answer. Alternative to `used_urls`.
used_urlsarray可选URLs of the results you actually used in your answer. Alternative to `used_ids`.
used_citationsarray可选The specific content snippets you quoted from the results.
urls_scoresarray可选Per-result feedback. Identify each result by `id` or `url`.
idstring可选The `id` of the result, as returned in the search response.
urlstring可选The URL of the result. Use instead of `id` when you don't have the result ID.
agent_scorenumber | string可选Score for this specific result.
scoresarray可选Additional labeled scores for this result.
commentstring可选Free-text explanation of the feedback on this result.
200
原样转发给 Tavily,不计费(Tavily 官方定价未对反馈单独计费)。
错误按 Tavily 格式返回,参见 错误码
Feedback accepted
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| success | boolean | Whether the feedback was accepted. |
| feedback_id | string | Unique identifier of this feedback submission. |
| response_time | number | Response time of this feedback request in seconds. |
使用官方 supabase-js 读写一个库中的表。
https://api.deepraxis.ai/supabase/{database_id}/
| 部分 | 含义 |
|---|---|
| {database_id} | 建库返回的 ID;每个库使用自己的地址。 |
| / | 保留末尾斜杠,supabase-js 才会保留库 ID 并追加 rest/v1。 |
API Key 用作 Authorization: Bearer 凭据;supabase-js 的第二个参数传同一 Key。以下示例在服务端运行。
import { createClient } from "@supabase/supabase-js";
const supabase = createClient(
`https://api.deepraxis.ai/supabase/${process.env.DATABASE_ID}/`,
process.env.PRAXIS_API_KEY,
{ auth: { persistSession: false, autoRefreshToken: false } },
);GET / HEAD / POST / PATCH / DELETE
/supabase/{database_id}/rest/v1/{table}
仅提供下列 PostgREST 子集。不支持的语法返回 HTTP 400,code 为 PGRST127;无效或未知参数可能返回 PGRST100。
| 值 | 支持情况 |
|---|---|
eq | 支持 |
neq | 支持 |
gt | 支持 |
gte | 支持 |
lt | 支持 |
lte | 支持 |
like | 支持 |
ilike | 支持 |
in | 支持 |
is | 支持 |
cs | 支持 |
cd | 支持 |
ov | 支持 |
fts | 不支持 |
plfts | 不支持 |
phfts | 不支持 |
wfts | 不支持 |
match | 不支持 |
imatch | 不支持 |
isdistinct | 不支持 |
sl | 不支持 |
sr | 不支持 |
nxl | 不支持 |
nxr | 不支持 |
adj | 不支持 |
| 值 | 支持情况 |
|---|---|
return=minimal | 支持 |
return=headers-only | 支持 |
return=representation | 支持 |
count=exact | 支持 |
count=planned | 部分支持 |
count=estimated | 部分支持 |
resolution=merge-duplicates | 支持 |
resolution=ignore-duplicates | 支持 |
missing=default | 部分支持 |
handling=strict | 支持 |
handling=lenient | 支持 |
| 值 | 支持情况 |
|---|---|
application/json | 支持 |
*/* | 支持 |
application/vnd.pgrst.object+json | 支持 |
text/csv | 不支持 |
application/geo+json | 不支持 |
application/vnd.pgrst.plan* | 不支持 |
| 值 | 支持情况 |
|---|---|
not | 支持 |
and/or/not.and/not.or | 支持 |
JSON paths (->, ->>) | 支持 |
aliases | 支持 |
link embedding | 支持 |
!field hint | 支持 |
embedded filters/order/pagination | 不支持 |
casts (::) | 不支持 |
aggregates | 不支持 |
spread (...) | 不支持 |
!inner/!left | 不支持 |
operator(any)/operator(all) | 不支持 |
planned/estimated 当前返回精确计数;字段可以配置 default:批量插入中有的行提供、有的行缺失的列,带 missing=default 时缺失处取字段 default,否则按 PostgREST 写 null;所有行都未提供的列始终取 default(没有 default 时为 null)。cs/cd/ov 接收数组({a,b} 或 ["a"]);json 字段上的 cs/cd 还接受 JSON 对象,按 jsonb 包含判断,例如 meta=cs.{"color":"red"}(键值逐层包含);cs 还接受 JSON 标量,数组顶层含该元素即匹配,例如 meta=cs."a"。cs.{}/cd.{} 在 json 字段上是空对象,在数组字段上是空数组。一次 DELETE 删除的行之间互相引用不阻断删除,只要有引用者不在本次删除中就返回 409 23503。like/ilike 只适用于 string 字段与 ->> 文本路径,用在其他类型返回 400 42883。字符串按二进制序(区分大小写,大写在小写前)比较与排序,不支持按 lower() 排序;需要不区分大小写排序时,另存一个小写字段并按它排序。GET/HEAD 带 If-None-Match 且与当前 ETag 匹配时返回 304、无正文。不支持的 Accept 返回 406 PGRST107。upsert 仅接受 id 或单个 unique 字段。
Prefer 中的未知值默认忽略;handling=strict 时返回 400 PGRST122。单对象 Accept 恰好匹配一行时返回对象,否则返回 406 PGRST116。 其他不支持的 Accept 返回 406 PGRST107。
| 路径 | HTTP | code |
|---|---|---|
| /supabase/{database_id}/auth/v1/{+path} | 501 | not_implemented |
| /supabase/{database_id}/storage/v1/{+path} | 501 | not_implemented |
| /supabase/{database_id}/realtime/v1/{+path} | 501 | not_implemented |
| /supabase/{database_id}/functions/v1/{+path} | 501 | not_implemented |
| /supabase/{database_id}/graphql/v1/{+path} | 501 | not_implemented |
这些服务返回 x-should-retry: false。它们的错误体与表端点不同,只有 code 和 message。
/supabase/{database_id}/rest/v1/{table}
与同一库的其它入口读写相同的行;错误使用 PostgREST code。
| 名称 | 位置 | 说明 |
|---|---|---|
| database_id | path | 库 ID。 |
| table | path | 表 ID 或名称。 |
| select | query | 列名列表;支持 *、别名、JSON 路径及 link 关联展开。不支持类型转换、聚合、展开运算和连接修饰。 |
| {column} | query | 把 {column} 换为字段名或 JSON 路径,例如 title=eq.summary;不同列的条件同时生效。 |
| and | query | 括号内的条件全部成立,例如 (done.eq.false,title.neq.draft)。 |
| or | query | 括号内任一条件成立。 |
| not.and | query | 否定全部条件成立。 |
| not.or | query | 否定任一条件成立。 |
| order | query | 逗号分隔的字段,可带 asc/desc、nullsfirst/nullslast;支持 JSON 路径。 |
| limit | query | 最多返回的条数。 |
| offset | query | 跳过的行数。 |
| on_conflict | query | upsert 的冲突键:id 或单个 unique 字段;配合 Prefer 的 resolution。 |
| columns | query | 写入列的逗号分隔列表;列表之外的输入键被忽略。 |
| Range | header | GET/HEAD 的闭区间,例如 0-9;与 limit/offset 取交集。 |
| Range-Unit | header | items;其它单位使 Range 被忽略。 |
| Prefer | header | 逗号分隔的偏好。未知值默认被忽略;handling=strict 时返回 400 PGRST122。 |
| Accept | header | application/json、/ 或 application/vnd.pgrst.object+json;单对象模式必须恰好匹配一行,否则返回 406 PGRST116。其他媒体类型返回 406 PGRST107;text/csv、application/geo+json 与 application/vnd.pgrst.plan 返回 400 PGRST127。 |
| If-None-Match | header | 上次 GET/HEAD 返回的 ETag(弱比较);与当前 ETag 匹配时返回 304,无正文。 |
POST 接受单个对象或对象数组;PATCH 接受对象。系统列由服务管理。写入默认不返回正文,使用 Prefer: return=representation(SDK 的 .select())返回行。PATCH 和 DELETE 只影响匹配过滤器的行;省略过滤器会影响全部匹配行。
| 响应头 | 说明 |
|---|---|
| Content-Range | 本次行范围/总数;未请求计数时总数为 *。 |
| Preference-Applied | 已应用的偏好。 |
| ETag | GET/HEAD 返回的版本标记;请求带 If-None-Match 且与之匹配时返回 304、无正文。 |
| Location | POST 使用 return=headers-only 时的新行地址。 |
读取通常为 200;请求计数且只返回部分行时为 206。POST 为 201。PATCH/DELETE 使用 representation 时为 200,否则为 204。HEAD 没有正文。If-None-Match 与当前 ETag 匹配时返回 304。datetime 值统一按 UTC、3 位毫秒保存和读出(如 2026-10-11T00:30:00.000Z),精度为毫秒,超过 3 位的小数秒四舍五入。
GET /supabase/{database_id}/rest/v1/{table}
const { data, error } = await supabase.from("tasks").select("*").order("title").limit(10);
if (error) throw error;
console.log(data);Success; write bodies require Prefer: return=representation
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].id | string | |
| [].version | integer | |
| [].created_at | string | |
| [].updated_at | string |
application/vnd.pgrst.object+json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| version | integer | |
| created_at | string | |
| updated_at | string |
Partial range with requested count
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].id | string | |
| [].version | integer | |
| [].created_at | string | |
| [].updated_at | string |
application/vnd.pgrst.object+json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| version | integer | |
| created_at | string | |
| updated_at | string |
响应示例 — HTTP 200
| 响应头 | 值 |
|---|---|
| content-range | 0-0/* |
| etag | W/"5.1" |
| range-unit | items |
[
{
"id": "rec_e88fcbd357aa49c9",
"version": 1,
"created_at": "2026-10-11T17:42:00.094Z",
"updated_at": "2026-10-11T17:42:00.094Z",
"title": "Write a summary",
"done": false
}
]HEAD /supabase/{database_id}/rest/v1/{table}
const { data, error, count } = await supabase.from("tasks").select("*", { head: true, count: "exact" });
if (error) throw error;
console.log(count);Success; write bodies require Prefer: return=representation
未声明响应体。
Partial range with requested count
未声明响应体。
响应示例 — HTTP 200
| 响应头 | 值 |
|---|---|
| content-range | 0-0/1 |
| preference-applied | count=exact |
| etag | W/"5.1" |
| range-unit | items |
无响应正文。
POST /supabase/{database_id}/rest/v1/{table}
const { data, error } = await supabase.from("tasks").insert({"title":"Write a summary","done":false}).select();
if (error) throw error;
console.log(data);Success; write bodies require Prefer: return=representation
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].id | string | |
| [].version | integer | |
| [].created_at | string | |
| [].updated_at | string |
application/vnd.pgrst.object+json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| version | integer | |
| created_at | string | |
| updated_at | string |
响应示例 — HTTP 201
| 响应头 | 值 |
|---|---|
| content-range | 0-0/* |
| preference-applied | return=representation |
| range-unit | items |
[
{
"id": "rec_e88fcbd357aa49c9",
"version": 1,
"created_at": "2026-10-11T17:42:00.094Z",
"updated_at": "2026-10-11T17:42:00.094Z",
"title": "Write a summary",
"done": false
}
]PATCH /supabase/{database_id}/rest/v1/{table}
const { data, error } = await supabase.from("tasks").update({ done: true }).eq("title", "Write a summary").select();
if (error) throw error;
console.log(data);Success; write bodies require Prefer: return=representation
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].id | string | |
| [].version | integer | |
| [].created_at | string | |
| [].updated_at | string |
application/vnd.pgrst.object+json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| version | integer | |
| created_at | string | |
| updated_at | string |
Success without a body
未声明响应体。
响应示例 — HTTP 200
| 响应头 | 值 |
|---|---|
| content-range | 0-0/* |
| preference-applied | return=representation |
| range-unit | items |
[
{
"id": "rec_e88fcbd357aa49c9",
"version": 2,
"created_at": "2026-10-11T17:42:00.094Z",
"updated_at": "2026-10-11T17:42:01.047Z",
"title": "Write a summary",
"done": true
}
]POST /supabase/{database_id}/rest/v1/{table}
const { data, error } = await supabase.from("tasks").upsert({"title":"Write a summary","done":true}, { onConflict: "title" }).select();
if (error) throw error;
console.log(data);Success; write bodies require Prefer: return=representation
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].id | string | |
| [].version | integer | |
| [].created_at | string | |
| [].updated_at | string |
application/vnd.pgrst.object+json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| version | integer | |
| created_at | string | |
| updated_at | string |
响应示例 — HTTP 201
| 响应头 | 值 |
|---|---|
| content-range | 0-0/* |
| preference-applied | resolution=merge-duplicates, return=representation |
| range-unit | items |
[
{
"id": "rec_e88fcbd357aa49c9",
"version": 3,
"created_at": "2026-10-11T17:42:00.094Z",
"updated_at": "2026-10-11T17:42:01.735Z",
"title": "Write a summary",
"done": true
}
]DELETE /supabase/{database_id}/rest/v1/{table}
const { data, error } = await supabase.from("tasks").delete().eq("title", "Write a summary").select();
if (error) throw error;
console.log(data);Success; write bodies require Prefer: return=representation
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].id | string | |
| [].version | integer | |
| [].created_at | string | |
| [].updated_at | string |
application/vnd.pgrst.object+json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| version | integer | |
| created_at | string | |
| updated_at | string |
Success without a body
未声明响应体。
响应示例 — HTTP 200
| 响应头 | 值 |
|---|---|
| content-range | 0-0/* |
| preference-applied | return=representation |
| range-unit | items |
[
{
"id": "rec_e88fcbd357aa49c9",
"version": 3,
"created_at": "2026-10-11T17:42:00.094Z",
"updated_at": "2026-10-11T17:42:01.735Z",
"title": "Write a summary",
"done": true
}
]用官方 Cloudinary SDK 管理一个素材库。只需以下三项配置;API Key 作为 Bearer 凭据发送。
https://api.deepraxis.ai/cloudinary/v1_1/{library_id}
| 配置 | 值 |
|---|---|
| cloud_name | library_id |
| oauth_token | API Key |
| upload_prefix | https://api.deepraxis.ai/cloudinary |
npm install cloudinary@2import { v2 as cloudinary } from "cloudinary";
cloudinary.config({
cloud_name: process.env.LIBRARY_ID,
oauth_token: process.env.PRAXIS_API_KEY,
upload_prefix: "https://api.deepraxis.ai/cloudinary",
});python -m pip install cloudinaryimport os
import cloudinary
import cloudinary.uploader
import cloudinary.api
cloudinary.config(
cloud_name=os.environ["LIBRARY_ID"],
oauth_token=os.environ["PRAXIS_API_KEY"],
upload_prefix="https://api.deepraxis.ai/cloudinary",
)| 操作 | 支持 |
|---|---|
| GET /v1_1/{library_id}/resources/visual_search | 支持 |
| POST /v1_1/{library_id}/resources/visual_search | 支持 |
| POST /v1_1/{library_id}/{resource_type}/upload | 支持 |
| POST /v1_1/{library_id}/{resource_type}/destroy | 支持 |
| POST /v1_1/{library_id}/{resource_type}/rename | 支持 |
| POST /v1_1/{library_id}/{resource_type}/tags | 支持 |
| POST /v1_1/{library_id}/{resource_type}/context | 支持 |
| POST /v1_1/{library_id}/{resource_type}/explicit | 支持 |
| GET /v1_1/{library_id}/resources/search | 支持 |
| POST /v1_1/{library_id}/resources/search | 支持 |
| GET /v1_1/{library_id}/resources | 支持 |
| GET /v1_1/{library_id}/resources/{resource_type} | 支持 |
| GET /v1_1/{library_id}/resources/{resource_type}/upload | 支持 |
| GET /v1_1/{library_id}/resources/{asset_id} | 支持 |
| GET /v1_1/{library_id}/resources/by_asset_ids | 支持 |
| GET /v1_1/{library_id}/resources/by_asset_folder | 支持 |
| GET /v1_1/{library_id}/resources/{resource_type}/tags/{tag} | 支持 |
| GET /v1_1/{library_id}/resources/{resource_type}/context | 支持 |
| GET /v1_1/{library_id}/resources/{resource_type}/upload/{public_id} | 支持 |
| POST /v1_1/{library_id}/resources/by_asset_ids | 支持 |
| POST /v1_1/{library_id}/resources/{resource_type}/upload/{public_id} | 支持 |
| PUT /v1_1/{library_id}/resources/{resource_type}/upload/{public_id} | 支持 |
| DELETE /v1_1/{library_id}/resources/{resource_type}/upload | 支持 |
| DELETE /v1_1/{library_id}/resources/{resource_type}/tags/{tag} | 支持 |
| GET /v1_1/{library_id}/tags/{resource_type} | 支持 |
| GET /v1_1/{library_id}/folders | 支持 |
| GET /v1_1/{library_id}/folders/{folder} | 支持 |
| POST /v1_1/{library_id}/folders/{folder} | 支持 |
| PUT /v1_1/{library_id}/folders/{folder} | 支持 |
| DELETE /v1_1/{library_id}/folders/{folder} | 支持 |
| GET /v1_1/{library_id}/ping | 支持 |
| GET /v1_1/{library_id}/usage | 部分支持 |
| GET /v1_1/{library_id}/usage/{date} | 部分支持 |
usage 只返回当前存储字节数与素材数,日期不选择历史统计。
| 端点 | HTTP |
|---|---|
| upload_presets | 400 |
| metadata_fields | 400 |
| transformations | 400 |
| streaming_profiles | 400 |
| upload_mappings | 400 |
| triggers | 400 |
| derived_resources | 400 |
| relations | 400 |
| restore | 400 |
| backups | 400 |
| text | 400 |
| sprite | 400 |
| multi | 400 |
| explode | 400 |
| generate_archive | 400 |
| create_slideshow | 400 |
| download_backup_asset | 400 |
| folders/search | 400 |
上述端点错误消息含 is not supported;private 与 authenticated 交付类型也返回 400。
| 参数 | 支持 |
|---|---|
| file | 支持 |
| public_id | 支持 |
| public_id_prefix | 支持 |
| display_name | 支持 |
| asset_folder | 支持 |
| use_filename | 支持 |
| unique_filename | 支持 |
| use_filename_as_display_name | 支持 |
| filename_override | 支持 |
| overwrite | 支持 |
| tags | 支持 |
| context | 支持 |
| auto_tagging | 部分支持 |
| resource_type | 支持 |
| eager | 不支持 |
| eager_async | 不支持 |
| eager_notification_url | 不支持 |
| async | 不支持 |
| notification_url | 不支持 |
| upload_preset | 不支持 |
| moderation | 不支持 |
| detection | 不支持 |
| ocr | 不支持 |
| raw_convert | 不支持 |
| background_removal | 不支持 |
| categorization | 不支持 |
| transformation | 不支持 |
| responsive_breakpoints | 不支持 |
| proxy | 不支持 |
| backup | 不支持 |
| return_delete_token | 不支持 |
| access_control | 不支持 |
| access_mode | 不支持 |
| metadata | 不支持 |
| face_coordinates | 不支持 |
| custom_coordinates | 不支持 |
| regions | 不支持 |
| quality_analysis | 不支持 |
| accessibility_analysis | 不支持 |
| cinemagraph_analysis | 不支持 |
| media_metadata | 不支持 |
| phash | 不支持 |
| colors | 不支持 |
| faces | 不支持 |
| image_metadata | 不支持 |
| exif | 不支持 |
| invalidate | 不支持 |
| type | 不支持 |
不支持的上传参数返回 400,消息为 Unsupported upload parameter: 参数名。
官方 SDK 的 upload("file_…") 会把字符串当作本地路径。从文件导入请使用自有接口 POST /media/v1/libraries/{library_id}/assets/import,见导入文件。
上传接受文件字节、HTTPS URL 或 data URI。音频使用 video,自动识别使用 auto。SDK 的 upload_large 将分片发送到同一 upload 端点。
tags 可写成逗号分隔字符串、数组或多个 tags 字段(-F tags=a -F tags=b),三者等价;逗号分隔时每项去首尾空白并丢弃空项。0 字节文件返回 FILE_EMPTY;读不出宽高的图片返回 Invalid image file;其他任意文件作为 raw 接受。
await new Promise((resolve, reject) => {
cloudinary.uploader.upload_large("./video.mp4", {
resource_type: "video",
chunk_size: 20 * 1024 * 1024,
}, (error, result) => error ? reject(error) : resolve(result));
});每片共享 X-Unique-Upload-Id。Content-Range 为 bytes 起点-终点/总字节数;未知总数用 -1,末片给最终大小。非末片至少 5 MiB 且等长。会话有效期 24 小时。中间片返回 done=false 与 upload_id;末片返回素材和 done=true。
POST /cloudinary/v1_1/{library_id}/{resource_type}/upload
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| resource_type | path | image / video / raw / auto | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
| X-Unique-Upload-Id | header | string | — |
| Content-Range | header | string | — |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| file | string / string | 是 | 文件字节、HTTPS URL、data URI 或同账户 file_… |
| public_id | string | 否 | 交付地址中的素材名称,可带路径 |
| public_id_prefix | string | 否 | public_id 的路径前缀;末尾的 / 可有可无,前缀与 ID 之间只保留一个 / |
| display_name | string | 否 | 显示名称 |
| asset_folder | string | 否 | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| use_filename | boolean | 否 | 用文件名生成 public_id |
| unique_filename | boolean | 否 | 自动附加唯一后缀 |
| use_filename_as_display_name | boolean | 否 | 用文件名作为显示名称 |
| filename_override | string | 否 | 覆盖原文件名称 |
| overwrite | boolean | 否 | 是否覆盖同名素材 |
| tags | string / string[] | 否 | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| context | string / object | 否 | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
| auto_tagging | number | 否 | 理解后将达到阈值的标签合并;0–1 |
| resource_type | ResourceType / "auto" | 否 | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
返回: CloudinaryResource.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| asset_id | string | |
| public_id | string | |
| display_name | string | |
| asset_folder | string | |
| resource_type | string | |
| type | string | |
| format | string | |
| version | number | |
| version_id | string | |
| bytes | number | |
| etag | string | |
| width | number | |
| height | number | |
| duration | number | |
| pages | number | |
| is_audio | boolean | |
| original_filename | string | |
| tags | array<string> | |
| context | object | |
| context.custom | object | |
| created_at | string | |
| url | string | |
| secure_url | string | |
| placeholder | boolean | |
| existing | boolean | |
| processing | object | |
| processing.state | string | |
| processing.kinds | object | |
| processing.updated_at | string | |
| done | boolean | |
| upload_id | string |
curl -X POST "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/image/upload" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"file":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==","public_id":"walk-lib-r1-MDP-1791733789929-plain","tags":["docs"]}'HTTP 200
{
"asset_id": "85b7ef616a8b4719a41777a036ebc1d2",
"public_id": "walk-lib-r1-MDP-1791733789929-plain",
"display_name": "walk-lib-r1-MDP-1791733789929-plain",
"asset_folder": "",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791733810,
"version_id": "fdf3c8cd40c2424d86e8397425a69857",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"tags": [
"docs"
],
"created_at": "2026-10-11T15:50:10.842Z",
"url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733810/walk-lib-r1-MDP-1791733789929-plain.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733810/walk-lib-r1-MDP-1791733789929-plain.png",
"placeholder": false
}POST /cloudinary/v1_1/{library_id}/{resource_type}/destroy
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| resource_type | path | image / video / raw / auto | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| public_id | string | 是 | 交付地址中的素材名称,可带路径 |
返回: DestroyResult.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| result | string |
curl -X POST "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/image/destroy" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"public_id":"docs/renamed"}'HTTP 200
{
"result": "ok"
}POST /cloudinary/v1_1/{library_id}/{resource_type}/rename
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| resource_type | path | image / video / raw / auto | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| from_public_id | string | 是 | 原 public_id |
| to_public_id | string | 是 | 新 public_id |
| overwrite | boolean | 否 | 是否覆盖同名素材 |
返回: CloudinaryResource.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| asset_id | string | |
| public_id | string | |
| display_name | string | |
| asset_folder | string | |
| resource_type | string | |
| type | string | |
| format | string | |
| version | number | |
| version_id | string | |
| bytes | number | |
| etag | string | |
| width | number | |
| height | number | |
| duration | number | |
| pages | number | |
| is_audio | boolean | |
| original_filename | string | |
| tags | array<string> | |
| context | object | |
| context.custom | object | |
| created_at | string | |
| url | string | |
| secure_url | string | |
| placeholder | boolean | |
| existing | boolean | |
| processing | object | |
| processing.state | string | |
| processing.kinds | object | |
| processing.updated_at | string |
curl -X POST "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/image/rename" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"from_public_id":"docs/pixel","to_public_id":"docs/renamed"}'HTTP 200
{
"asset_id": "9339cdae93804c0c8c65d5189ef1f646",
"public_id": "docs/renamed",
"display_name": "Sample image",
"asset_folder": "examples",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791538418,
"version_id": "35848c1529994e338e7aa634a1c13d9c",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"tags": [
"docs"
],
"context": {
"custom": {
"alt": "Sample"
}
},
"created_at": "2026-10-09T09:33:38.899Z",
"url": "https://media-develop.praxisusercontent.com/lib_77374d4ee73b4ae79c4aa430f3ba3885/image/upload/v1791538418/docs/renamed.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_77374d4ee73b4ae79c4aa430f3ba3885/image/upload/v1791538418/docs/renamed.png",
"placeholder": false
}POST /cloudinary/v1_1/{library_id}/{resource_type}/tags
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| resource_type | path | image / video / raw / auto | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| public_ids | string[] | 是 | 素材 public_id 列表 |
| tag | string | 否 | 标签名称 |
| command | add / remove / replace / remove_all | 是 | 标签或上下文操作 |
返回: PublicIds.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| public_ids | array<string> |
curl -X POST "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/image/tags" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"public_ids":["docs/pixel"],"tag":"sample","command":"add"}'HTTP 200
{
"public_ids": [
"docs/pixel"
]
}POST /cloudinary/v1_1/{library_id}/{resource_type}/context
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| resource_type | path | image / video / raw / auto | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| public_ids | string[] | 是 | 素材 public_id 列表 |
| context | string / object | 否 | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
| command | add / remove_all | 是 | 标签或上下文操作 |
返回: PublicIds.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| public_ids | array<string> |
curl -X POST "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/image/context" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"public_ids":["docs/pixel"],"context":"alt=Sample","command":"add"}'HTTP 200
{
"public_ids": [
"docs/pixel"
]
}POST /cloudinary/v1_1/{library_id}/{resource_type}/explicit
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| resource_type | path | image / video / raw / auto | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| public_id | string | 是 | 交付地址中的素材名称,可带路径 |
| tags | string / string[] | 否 | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| context | string / object | 否 | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
返回: CloudinaryResource.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| asset_id | string | |
| public_id | string | |
| display_name | string | |
| asset_folder | string | |
| resource_type | string | |
| type | string | |
| format | string | |
| version | number | |
| version_id | string | |
| bytes | number | |
| etag | string | |
| width | number | |
| height | number | |
| duration | number | |
| pages | number | |
| is_audio | boolean | |
| original_filename | string | |
| tags | array<string> | |
| context | object | |
| context.custom | object | |
| created_at | string | |
| url | string | |
| secure_url | string | |
| placeholder | boolean | |
| existing | boolean | |
| processing | object | |
| processing.state | string | |
| processing.kinds | object | |
| processing.updated_at | string |
curl -X POST "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/image/explicit" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"public_id":"docs/pixel","tags":["docs"]}'HTTP 200
{
"asset_id": "9339cdae93804c0c8c65d5189ef1f646",
"public_id": "docs/pixel",
"display_name": "Sample image",
"asset_folder": "examples",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791538418,
"version_id": "35848c1529994e338e7aa634a1c13d9c",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"tags": [
"docs"
],
"context": {
"custom": {
"alt": "Sample"
}
},
"created_at": "2026-10-09T09:33:38.899Z",
"url": "https://media-develop.praxisusercontent.com/lib_77374d4ee73b4ae79c4aa430f3ba3885/image/upload/v1791538418/docs/pixel.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_77374d4ee73b4ae79c4aa430f3ba3885/image/upload/v1791538418/docs/pixel.png",
"placeholder": false
}| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| asset_id | AssetId | 是 | 素材 ID |
| public_id | string | 是 | 交付地址中的素材名称,可带路径 |
| display_name | string | 是 | 显示名称 |
| asset_folder | string | 是 | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| resource_type | ResourceType | 是 | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
| type | DeliveryType | 是 | 资源或事件类型 |
| format | string | 是 | 文件格式 |
| version | number | 是 | 交付版本号 |
| version_id | string | 是 | 版本标识 |
| bytes | number | 是 | 文件字节数 |
| etag | string | 是 | 文件校验标识 |
| width | number | 否 | 宽度像素 |
| height | number | 否 | 高度像素 |
| duration | number | 否 | 时长秒数 |
| pages | number | 否 | 文档页数 |
| is_audio | boolean | 否 | 是否为音频 |
| original_filename | string | 否 | 原文件名称 |
| tags | string[] | 是 | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| context | object | 否 | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
| created_at | IsoTimestamp | 是 | 创建时间 |
| url | string | 是 | 原文件地址 |
| secure_url | string | 是 | HTTPS 交付地址 |
| placeholder | false | 是 | 固定为 false |
| existing | boolean | 否 | 未覆盖时是否返回已有素材 |
| processing | Processing | 否 | 整体与各项理解状态 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| result | ok / not found | 是 | 操作结果 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| public_ids | string[] | 是 | 素材 public_id 列表 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| done | false | 是 | 已完成数量;分片响应中表示是否完成 |
| upload_id | string | 是 | 分片会话标识 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| asset_id | AssetId | 是 | 素材 ID |
| public_id | string | 是 | 交付地址中的素材名称,可带路径 |
| display_name | string | 是 | 显示名称 |
| asset_folder | string | 是 | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| resource_type | ResourceType | 是 | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
| type | DeliveryType | 是 | 资源或事件类型 |
| format | string | 是 | 文件格式 |
| version | number | 是 | 交付版本号 |
| version_id | string | 是 | 版本标识 |
| bytes | number | 是 | 文件字节数 |
| etag | string | 是 | 文件校验标识 |
| width | number | 否 | 宽度像素 |
| height | number | 否 | 高度像素 |
| duration | number | 否 | 时长秒数 |
| pages | number | 否 | 文档页数 |
| is_audio | boolean | 否 | 是否为音频 |
| original_filename | string | 否 | 原文件名称 |
| tags | string[] | 是 | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| context | object | 否 | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
| created_at | IsoTimestamp | 是 | 创建时间 |
| url | string | 是 | 原文件地址 |
| secure_url | string | 是 | HTTPS 交付地址 |
| placeholder | false | 是 | 固定为 false |
| existing | boolean | 否 | 未覆盖时是否返回已有素材 |
| processing | Processing | 否 | 整体与各项理解状态 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| done | true | 是 | 已完成数量;分片响应中表示是否完成 |
Admin 管理当前库的素材。usage 只返回当前存储量和素材数。
GET /cloudinary/v1_1/{library_id}/resources
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| prefix | query | string | — |
| public_ids | query | string[] | 素材 public_id 列表 |
| asset_ids | query | string[] | — |
| asset_folder | query | string | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| key | query | string | — |
| value | query | string | — |
| tags | query | string | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| context | query | string | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
| direction | query | string | — |
| max_results | query | integer | 最多 500;检索默认 100,Admin 默认 10 |
| next_cursor | query | string | 下一页游标;没有时为 null 或省略 |
返回: ResourcePage.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| resources | array<object> | |
| resources[].asset_id | string | |
| resources[].public_id | string | |
| resources[].display_name | string | |
| resources[].asset_folder | string | |
| resources[].resource_type | string | |
| resources[].type | string | |
| resources[].format | string | |
| resources[].version | number | |
| resources[].version_id | string | |
| resources[].bytes | number | |
| resources[].etag | string | |
| resources[].width | number | |
| resources[].height | number | |
| resources[].duration | number | |
| resources[].pages | number | |
| resources[].is_audio | boolean | |
| resources[].original_filename | string | |
| resources[].tags | array<string> | |
| resources[].context | object | |
| resources[].created_at | string | |
| resources[].url | string | |
| resources[].secure_url | string | |
| resources[].placeholder | boolean | |
| resources[].existing | boolean | |
| resources[].processing | object | |
| next_cursor | string |
curl -X GET "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/resources" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"resources": [
{
"asset_id": "9dfa312ef9bc4b00816339b598b1152c",
"public_id": "walk-lib-r1-MDP-1791733789929-tagged",
"display_name": "walk-lib-r1-MDP-1791733789929-tagged",
"asset_folder": "",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791733815,
"version_id": "26cb8171caa5431b8373ad417fd71e32",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"processing": {
"state": "processing",
"kinds": {
"embedding": "running",
"visual": "failed",
"tagging": "failed"
},
"updated_at": "2026-10-11T15:50:21.512Z"
},
"created_at": "2026-10-11T15:50:15.996Z",
"url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733815/walk-lib-r1-MDP-1791733789929-tagged.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733815/walk-lib-r1-MDP-1791733789929-tagged.png",
"placeholder": false
},
{
"asset_id": "85b7ef616a8b4719a41777a036ebc1d2",
"public_id": "walk-lib-r1-MDP-1791733789929-plain",
"display_name": "walk-lib-r1-MDP-1791733789929-plain",
"asset_folder": "",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791733810,
"version_id": "fdf3c8cd40c2424d86e8397425a69857",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"created_at": "2026-10-11T15:50:10.842Z",
"url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733810/walk-lib-r1-MDP-1791733789929-plain.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733810/walk-lib-r1-MDP-1791733789929-plain.png",
"placeholder": false
}
]
}GET /cloudinary/v1_1/{library_id}/resources/{resource_type}
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| resource_type | path | image / video / raw | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
| prefix | query | string | — |
| public_ids | query | string[] | 素材 public_id 列表 |
| asset_ids | query | string[] | — |
| asset_folder | query | string | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| key | query | string | — |
| value | query | string | — |
| tags | query | string | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| context | query | string | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
| direction | query | string | — |
| max_results | query | integer | 最多 500;检索默认 100,Admin 默认 10 |
| next_cursor | query | string | 下一页游标;没有时为 null 或省略 |
返回: ResourcePage.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| resources | array<object> | |
| resources[].asset_id | string | |
| resources[].public_id | string | |
| resources[].display_name | string | |
| resources[].asset_folder | string | |
| resources[].resource_type | string | |
| resources[].type | string | |
| resources[].format | string | |
| resources[].version | number | |
| resources[].version_id | string | |
| resources[].bytes | number | |
| resources[].etag | string | |
| resources[].width | number | |
| resources[].height | number | |
| resources[].duration | number | |
| resources[].pages | number | |
| resources[].is_audio | boolean | |
| resources[].original_filename | string | |
| resources[].tags | array<string> | |
| resources[].context | object | |
| resources[].created_at | string | |
| resources[].url | string | |
| resources[].secure_url | string | |
| resources[].placeholder | boolean | |
| resources[].existing | boolean | |
| resources[].processing | object | |
| next_cursor | string |
curl -X GET "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/resources/image" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"resources": [
{
"asset_id": "e5f3de0d8609482d8b351894b133c8cb",
"public_id": "examples/pixel",
"display_name": "pixel",
"asset_folder": "examples",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791538435,
"version_id": "001fb6336c9b4a4c9e4597b69fdec3cd",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"created_at": "2026-10-09T09:33:55.536Z",
"url": "https://media-develop.praxisusercontent.com/lib_b762c40631bd42278a204cd0370fed36/image/upload/v1791538435/examples/pixel.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_b762c40631bd42278a204cd0370fed36/image/upload/v1791538435/examples/pixel.png",
"placeholder": false
}
]
}GET /cloudinary/v1_1/{library_id}/resources/{resource_type}/upload
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| resource_type | path | image / video / raw | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
| prefix | query | string | — |
| public_ids | query | string[] | 素材 public_id 列表 |
| asset_ids | query | string[] | — |
| asset_folder | query | string | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| key | query | string | — |
| value | query | string | — |
| tags | query | string | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| context | query | string | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
| direction | query | string | — |
| max_results | query | integer | 最多 500;检索默认 100,Admin 默认 10 |
| next_cursor | query | string | 下一页游标;没有时为 null 或省略 |
返回: ResourcePage.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| resources | array<object> | |
| resources[].asset_id | string | |
| resources[].public_id | string | |
| resources[].display_name | string | |
| resources[].asset_folder | string | |
| resources[].resource_type | string | |
| resources[].type | string | |
| resources[].format | string | |
| resources[].version | number | |
| resources[].version_id | string | |
| resources[].bytes | number | |
| resources[].etag | string | |
| resources[].width | number | |
| resources[].height | number | |
| resources[].duration | number | |
| resources[].pages | number | |
| resources[].is_audio | boolean | |
| resources[].original_filename | string | |
| resources[].tags | array<string> | |
| resources[].context | object | |
| resources[].created_at | string | |
| resources[].url | string | |
| resources[].secure_url | string | |
| resources[].placeholder | boolean | |
| resources[].existing | boolean | |
| resources[].processing | object | |
| next_cursor | string |
curl -X GET "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/resources/image/upload" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"resources": [
{
"asset_id": "e5f3de0d8609482d8b351894b133c8cb",
"public_id": "examples/pixel",
"display_name": "pixel",
"asset_folder": "examples",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791538435,
"version_id": "001fb6336c9b4a4c9e4597b69fdec3cd",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"created_at": "2026-10-09T09:33:55.536Z",
"url": "https://media-develop.praxisusercontent.com/lib_b762c40631bd42278a204cd0370fed36/image/upload/v1791538435/examples/pixel.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_b762c40631bd42278a204cd0370fed36/image/upload/v1791538435/examples/pixel.png",
"placeholder": false
}
]
}GET /cloudinary/v1_1/{library_id}/resources/{asset_id}
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| asset_id | path | string | 素材 ID |
| prefix | query | string | — |
| public_ids | query | string[] | 素材 public_id 列表 |
| asset_ids | query | string[] | — |
| asset_folder | query | string | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| key | query | string | — |
| value | query | string | — |
| tags | query | string | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| context | query | string | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
| direction | query | string | — |
| max_results | query | integer | 最多 500;检索默认 100,Admin 默认 10 |
| next_cursor | query | string | 下一页游标;没有时为 null 或省略 |
返回: CloudinaryResource.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| asset_id | string | |
| public_id | string | |
| display_name | string | |
| asset_folder | string | |
| resource_type | string | |
| type | string | |
| format | string | |
| version | number | |
| version_id | string | |
| bytes | number | |
| etag | string | |
| width | number | |
| height | number | |
| duration | number | |
| pages | number | |
| is_audio | boolean | |
| original_filename | string | |
| tags | array<string> | |
| context | object | |
| context.custom | object | |
| created_at | string | |
| url | string | |
| secure_url | string | |
| placeholder | boolean | |
| existing | boolean | |
| processing | object | |
| processing.state | string | |
| processing.kinds | object | |
| processing.updated_at | string |
curl -X GET "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/resources/9dfa312ef9bc4b00816339b598b1152c" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"asset_id": "9dfa312ef9bc4b00816339b598b1152c",
"public_id": "walk-lib-r1-MDP-1791733789929-tagged",
"display_name": "walk-lib-r1-MDP-1791733789929-tagged",
"asset_folder": "",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791733815,
"version_id": "26cb8171caa5431b8373ad417fd71e32",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"tags": [
"docs"
],
"processing": {
"state": "processing",
"kinds": {
"embedding": "running",
"visual": "failed",
"tagging": "failed"
},
"updated_at": "2026-10-11T15:50:21.512Z"
},
"created_at": "2026-10-11T15:50:15.996Z",
"url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733815/walk-lib-r1-MDP-1791733789929-tagged.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733815/walk-lib-r1-MDP-1791733789929-tagged.png",
"placeholder": false
}GET /cloudinary/v1_1/{library_id}/resources/by_asset_ids
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| prefix | query | string | — |
| public_ids | query | string[] | 素材 public_id 列表 |
| asset_ids | query | string[] | — |
| asset_folder | query | string | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| key | query | string | — |
| value | query | string | — |
| tags | query | string | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| context | query | string | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
| direction | query | string | — |
| max_results | query | integer | 最多 500;检索默认 100,Admin 默认 10 |
| next_cursor | query | string | 下一页游标;没有时为 null 或省略 |
返回: ResourcePage.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| resources | array<object> | |
| resources[].asset_id | string | |
| resources[].public_id | string | |
| resources[].display_name | string | |
| resources[].asset_folder | string | |
| resources[].resource_type | string | |
| resources[].type | string | |
| resources[].format | string | |
| resources[].version | number | |
| resources[].version_id | string | |
| resources[].bytes | number | |
| resources[].etag | string | |
| resources[].width | number | |
| resources[].height | number | |
| resources[].duration | number | |
| resources[].pages | number | |
| resources[].is_audio | boolean | |
| resources[].original_filename | string | |
| resources[].tags | array<string> | |
| resources[].context | object | |
| resources[].created_at | string | |
| resources[].url | string | |
| resources[].secure_url | string | |
| resources[].placeholder | boolean | |
| resources[].existing | boolean | |
| resources[].processing | object | |
| next_cursor | string |
curl -X GET "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/resources/by_asset_ids?asset_ids[]=e5f3de0d8609482d8b351894b133c8cb" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"resources": [
{
"asset_id": "e5f3de0d8609482d8b351894b133c8cb",
"public_id": "examples/pixel",
"display_name": "pixel",
"asset_folder": "examples",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791538435,
"version_id": "001fb6336c9b4a4c9e4597b69fdec3cd",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"created_at": "2026-10-09T09:33:55.536Z",
"url": "https://media-develop.praxisusercontent.com/lib_b762c40631bd42278a204cd0370fed36/image/upload/v1791538435/examples/pixel.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_b762c40631bd42278a204cd0370fed36/image/upload/v1791538435/examples/pixel.png",
"placeholder": false
}
]
}GET /cloudinary/v1_1/{library_id}/resources/by_asset_folder
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| prefix | query | string | — |
| public_ids | query | string[] | 素材 public_id 列表 |
| asset_ids | query | string[] | — |
| asset_folder | query | string | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| key | query | string | — |
| value | query | string | — |
| tags | query | string | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| context | query | string | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
| direction | query | string | — |
| max_results | query | integer | 最多 500;检索默认 100,Admin 默认 10 |
| next_cursor | query | string | 下一页游标;没有时为 null 或省略 |
返回: ResourcePage.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| resources | array<object> | |
| resources[].asset_id | string | |
| resources[].public_id | string | |
| resources[].display_name | string | |
| resources[].asset_folder | string | |
| resources[].resource_type | string | |
| resources[].type | string | |
| resources[].format | string | |
| resources[].version | number | |
| resources[].version_id | string | |
| resources[].bytes | number | |
| resources[].etag | string | |
| resources[].width | number | |
| resources[].height | number | |
| resources[].duration | number | |
| resources[].pages | number | |
| resources[].is_audio | boolean | |
| resources[].original_filename | string | |
| resources[].tags | array<string> | |
| resources[].context | object | |
| resources[].created_at | string | |
| resources[].url | string | |
| resources[].secure_url | string | |
| resources[].placeholder | boolean | |
| resources[].existing | boolean | |
| resources[].processing | object | |
| next_cursor | string |
curl -X GET "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/resources/by_asset_folder?asset_folder=examples" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"resources": [
{
"asset_id": "e5f3de0d8609482d8b351894b133c8cb",
"public_id": "examples/pixel",
"display_name": "pixel",
"asset_folder": "examples",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791538435,
"version_id": "001fb6336c9b4a4c9e4597b69fdec3cd",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"created_at": "2026-10-09T09:33:55.536Z",
"url": "https://media-develop.praxisusercontent.com/lib_b762c40631bd42278a204cd0370fed36/image/upload/v1791538435/examples/pixel.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_b762c40631bd42278a204cd0370fed36/image/upload/v1791538435/examples/pixel.png",
"placeholder": false
}
]
}GET /cloudinary/v1_1/{library_id}/resources/{resource_type}/tags/{tag}
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| resource_type | path | image / video / raw | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
| tag | path | string | 标签名称 |
| prefix | query | string | — |
| public_ids | query | string[] | 素材 public_id 列表 |
| asset_ids | query | string[] | — |
| asset_folder | query | string | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| key | query | string | — |
| value | query | string | — |
| tags | query | string | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| context | query | string | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
| direction | query | string | — |
| max_results | query | integer | 最多 500;检索默认 100,Admin 默认 10 |
| next_cursor | query | string | 下一页游标;没有时为 null 或省略 |
返回: ResourcePage.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| resources | array<object> | |
| resources[].asset_id | string | |
| resources[].public_id | string | |
| resources[].display_name | string | |
| resources[].asset_folder | string | |
| resources[].resource_type | string | |
| resources[].type | string | |
| resources[].format | string | |
| resources[].version | number | |
| resources[].version_id | string | |
| resources[].bytes | number | |
| resources[].etag | string | |
| resources[].width | number | |
| resources[].height | number | |
| resources[].duration | number | |
| resources[].pages | number | |
| resources[].is_audio | boolean | |
| resources[].original_filename | string | |
| resources[].tags | array<string> | |
| resources[].context | object | |
| resources[].created_at | string | |
| resources[].url | string | |
| resources[].secure_url | string | |
| resources[].placeholder | boolean | |
| resources[].existing | boolean | |
| resources[].processing | object | |
| next_cursor | string |
curl -X GET "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/resources/image/tags/docs" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"resources": [
{
"asset_id": "e5f3de0d8609482d8b351894b133c8cb",
"public_id": "examples/pixel",
"display_name": "pixel",
"asset_folder": "examples",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791538435,
"version_id": "001fb6336c9b4a4c9e4597b69fdec3cd",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"created_at": "2026-10-09T09:33:55.536Z",
"url": "https://media-develop.praxisusercontent.com/lib_b762c40631bd42278a204cd0370fed36/image/upload/v1791538435/examples/pixel.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_b762c40631bd42278a204cd0370fed36/image/upload/v1791538435/examples/pixel.png",
"placeholder": false
}
]
}GET /cloudinary/v1_1/{library_id}/resources/{resource_type}/context
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| resource_type | path | image / video / raw | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
| prefix | query | string | — |
| public_ids | query | string[] | 素材 public_id 列表 |
| asset_ids | query | string[] | — |
| asset_folder | query | string | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| key | query | string | — |
| value | query | string | — |
| tags | query | string | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| context | query | string | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
| direction | query | string | — |
| max_results | query | integer | 最多 500;检索默认 100,Admin 默认 10 |
| next_cursor | query | string | 下一页游标;没有时为 null 或省略 |
返回: ResourcePage.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| resources | array<object> | |
| resources[].asset_id | string | |
| resources[].public_id | string | |
| resources[].display_name | string | |
| resources[].asset_folder | string | |
| resources[].resource_type | string | |
| resources[].type | string | |
| resources[].format | string | |
| resources[].version | number | |
| resources[].version_id | string | |
| resources[].bytes | number | |
| resources[].etag | string | |
| resources[].width | number | |
| resources[].height | number | |
| resources[].duration | number | |
| resources[].pages | number | |
| resources[].is_audio | boolean | |
| resources[].original_filename | string | |
| resources[].tags | array<string> | |
| resources[].context | object | |
| resources[].created_at | string | |
| resources[].url | string | |
| resources[].secure_url | string | |
| resources[].placeholder | boolean | |
| resources[].existing | boolean | |
| resources[].processing | object | |
| next_cursor | string |
curl -X GET "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/resources/image/context?key=alt&value=sample" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"resources": [
{
"asset_id": "e5f3de0d8609482d8b351894b133c8cb",
"public_id": "examples/pixel",
"display_name": "pixel",
"asset_folder": "examples",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791538435,
"version_id": "001fb6336c9b4a4c9e4597b69fdec3cd",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"created_at": "2026-10-09T09:33:55.536Z",
"url": "https://media-develop.praxisusercontent.com/lib_b762c40631bd42278a204cd0370fed36/image/upload/v1791538435/examples/pixel.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_b762c40631bd42278a204cd0370fed36/image/upload/v1791538435/examples/pixel.png",
"placeholder": false
}
]
}GET /cloudinary/v1_1/{library_id}/resources/{resource_type}/upload/{public_id}
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| resource_type | path | image / video / raw | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
| public_id | path | string | 交付地址中的素材名称,可带路径 |
| prefix | query | string | — |
| public_ids | query | string[] | 素材 public_id 列表 |
| asset_ids | query | string[] | — |
| asset_folder | query | string | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| key | query | string | — |
| value | query | string | — |
| tags | query | string | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| context | query | string | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
| direction | query | string | — |
| max_results | query | integer | 最多 500;检索默认 100,Admin 默认 10 |
| next_cursor | query | string | 下一页游标;没有时为 null 或省略 |
返回: CloudinaryResource.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| asset_id | string | |
| public_id | string | |
| display_name | string | |
| asset_folder | string | |
| resource_type | string | |
| type | string | |
| format | string | |
| version | number | |
| version_id | string | |
| bytes | number | |
| etag | string | |
| width | number | |
| height | number | |
| duration | number | |
| pages | number | |
| is_audio | boolean | |
| original_filename | string | |
| tags | array<string> | |
| context | object | |
| context.custom | object | |
| created_at | string | |
| url | string | |
| secure_url | string | |
| placeholder | boolean | |
| existing | boolean | |
| processing | object | |
| processing.state | string | |
| processing.kinds | object | |
| processing.updated_at | string |
curl -X GET "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/resources/image/upload/examples/pixel" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"asset_id": "e5f3de0d8609482d8b351894b133c8cb",
"public_id": "examples/pixel",
"display_name": "pixel",
"asset_folder": "examples",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791538435,
"version_id": "001fb6336c9b4a4c9e4597b69fdec3cd",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"tags": [
"docs"
],
"context": {
"custom": {
"alt": "sample"
}
},
"created_at": "2026-10-09T09:33:55.536Z",
"url": "https://media-develop.praxisusercontent.com/lib_b762c40631bd42278a204cd0370fed36/image/upload/v1791538435/examples/pixel.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_b762c40631bd42278a204cd0370fed36/image/upload/v1791538435/examples/pixel.png",
"placeholder": false
}POST /cloudinary/v1_1/{library_id}/resources/by_asset_ids
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| asset_ids | string[] | 是 | — |
| max_results | integer | 否 | 最多 500;检索默认 100,Admin 默认 10 |
| next_cursor | string | 否 | 下一页游标;没有时为 null 或省略 |
返回: ResourcePage.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| resources | array<object> | |
| resources[].asset_id | string | |
| resources[].public_id | string | |
| resources[].display_name | string | |
| resources[].asset_folder | string | |
| resources[].resource_type | string | |
| resources[].type | string | |
| resources[].format | string | |
| resources[].version | number | |
| resources[].version_id | string | |
| resources[].bytes | number | |
| resources[].etag | string | |
| resources[].width | number | |
| resources[].height | number | |
| resources[].duration | number | |
| resources[].pages | number | |
| resources[].is_audio | boolean | |
| resources[].original_filename | string | |
| resources[].tags | array<string> | |
| resources[].context | object | |
| resources[].created_at | string | |
| resources[].url | string | |
| resources[].secure_url | string | |
| resources[].placeholder | boolean | |
| resources[].existing | boolean | |
| resources[].processing | object | |
| next_cursor | string |
curl -X POST "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/resources/by_asset_ids" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"asset_ids":["e5f3de0d8609482d8b351894b133c8cb"]}'HTTP 200
{
"resources": [
{
"asset_id": "e5f3de0d8609482d8b351894b133c8cb",
"public_id": "examples/pixel",
"display_name": "pixel",
"asset_folder": "examples",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791538435,
"version_id": "001fb6336c9b4a4c9e4597b69fdec3cd",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"created_at": "2026-10-09T09:33:55.536Z",
"url": "https://media-develop.praxisusercontent.com/lib_b762c40631bd42278a204cd0370fed36/image/upload/v1791538435/examples/pixel.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_b762c40631bd42278a204cd0370fed36/image/upload/v1791538435/examples/pixel.png",
"placeholder": false
}
]
}POST /cloudinary/v1_1/{library_id}/resources/{resource_type}/upload/{public_id}
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| resource_type | path | image / video / raw | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
| public_id | path | string | 交付地址中的素材名称,可带路径 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| display_name | string | 否 | 显示名称 |
| asset_folder | string | 否 | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| tags | string[] | 否 | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| context | object | 否 | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
返回: CloudinaryResource.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| asset_id | string | |
| public_id | string | |
| display_name | string | |
| asset_folder | string | |
| resource_type | string | |
| type | string | |
| format | string | |
| version | number | |
| version_id | string | |
| bytes | number | |
| etag | string | |
| width | number | |
| height | number | |
| duration | number | |
| pages | number | |
| is_audio | boolean | |
| original_filename | string | |
| tags | array<string> | |
| context | object | |
| context.custom | object | |
| created_at | string | |
| url | string | |
| secure_url | string | |
| placeholder | boolean | |
| existing | boolean | |
| processing | object | |
| processing.state | string | |
| processing.kinds | object | |
| processing.updated_at | string |
curl -X POST "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/resources/image/upload/examples/pixel" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"display_name":"Sample image"}'HTTP 200
{
"asset_id": "e5f3de0d8609482d8b351894b133c8cb",
"public_id": "examples/pixel",
"display_name": "Sample image",
"asset_folder": "examples",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791538435,
"version_id": "001fb6336c9b4a4c9e4597b69fdec3cd",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"tags": [
"docs"
],
"context": {
"custom": {
"alt": "sample"
}
},
"created_at": "2026-10-09T09:33:55.536Z",
"url": "https://media-develop.praxisusercontent.com/lib_b762c40631bd42278a204cd0370fed36/image/upload/v1791538435/examples/pixel.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_b762c40631bd42278a204cd0370fed36/image/upload/v1791538435/examples/pixel.png",
"placeholder": false
}PUT /cloudinary/v1_1/{library_id}/resources/{resource_type}/upload/{public_id}
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| resource_type | path | image / video / raw | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
| public_id | path | string | 交付地址中的素材名称,可带路径 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| display_name | string | 否 | 显示名称 |
| asset_folder | string | 否 | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| tags | string[] | 否 | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| context | object | 否 | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
返回: CloudinaryResource.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| asset_id | string | |
| public_id | string | |
| display_name | string | |
| asset_folder | string | |
| resource_type | string | |
| type | string | |
| format | string | |
| version | number | |
| version_id | string | |
| bytes | number | |
| etag | string | |
| width | number | |
| height | number | |
| duration | number | |
| pages | number | |
| is_audio | boolean | |
| original_filename | string | |
| tags | array<string> | |
| context | object | |
| context.custom | object | |
| created_at | string | |
| url | string | |
| secure_url | string | |
| placeholder | boolean | |
| existing | boolean | |
| processing | object | |
| processing.state | string | |
| processing.kinds | object | |
| processing.updated_at | string |
curl -X PUT "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/resources/image/upload/examples/pixel" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"tags":["docs"]}'HTTP 200
{
"asset_id": "e5f3de0d8609482d8b351894b133c8cb",
"public_id": "examples/pixel",
"display_name": "Sample image",
"asset_folder": "examples",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791538435,
"version_id": "001fb6336c9b4a4c9e4597b69fdec3cd",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"tags": [
"docs"
],
"context": {
"custom": {
"alt": "sample"
}
},
"created_at": "2026-10-09T09:33:55.536Z",
"url": "https://media-develop.praxisusercontent.com/lib_b762c40631bd42278a204cd0370fed36/image/upload/v1791538435/examples/pixel.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_b762c40631bd42278a204cd0370fed36/image/upload/v1791538435/examples/pixel.png",
"placeholder": false
}DELETE /cloudinary/v1_1/{library_id}/resources/{resource_type}/upload
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| resource_type | path | image / video / raw | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
| public_ids | query | string[] | 素材 public_id 列表 |
| prefix | query | string | — |
| all | query | boolean | — |
| next_cursor | query | string | 下一页游标;没有时为 null 或省略 |
返回: DeletedResources.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| deleted | object | |
| partial | boolean | |
| next_cursor | string |
curl -X DELETE "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/resources/image/upload" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"prefix":"imported/"}'HTTP 200
{
"deleted": {},
"partial": false
}DELETE /cloudinary/v1_1/{library_id}/resources/{resource_type}/tags/{tag}
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| resource_type | path | image / video / raw | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
| tag | path | string | 标签名称 |
| public_ids | query | string[] | 素材 public_id 列表 |
| prefix | query | string | — |
| all | query | boolean | — |
| next_cursor | query | string | 下一页游标;没有时为 null 或省略 |
返回: DeletedResources.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| deleted | object | |
| partial | boolean | |
| next_cursor | string |
curl -X DELETE "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/resources/image/tags/remove-me" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{}'HTTP 200
{
"deleted": {
"tagged/pixel": "deleted"
},
"partial": false
}GET /cloudinary/v1_1/{library_id}/tags/{resource_type}
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| resource_type | path | image / video / raw | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
| prefix | query | string | — |
| max_results | query | integer | 最多 500;检索默认 100,Admin 默认 10 |
| next_cursor | query | string | 下一页游标;没有时为 null 或省略 |
返回: Tags.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| tags | array<string> | |
| next_cursor | string |
curl -X GET "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/tags/image" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"tags": [
"docs"
]
}GET /cloudinary/v1_1/{library_id}/folders
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| max_results | query | integer | 最多 500;检索默认 100,Admin 默认 10 |
| next_cursor | query | string | 下一页游标;没有时为 null 或省略 |
返回: CompatFolders.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| folders | array<object> | |
| folders[].name | string | |
| folders[].path | string | |
| total_count | number | |
| next_cursor | string |
curl -X GET "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/folders" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"folders": [
{
"name": "examples",
"path": "examples"
}
],
"total_count": 1
}GET /cloudinary/v1_1/{library_id}/folders/{folder}
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| folder | path | string | — |
| max_results | query | integer | 最多 500;检索默认 100,Admin 默认 10 |
| next_cursor | query | string | 下一页游标;没有时为 null 或省略 |
返回: CompatFolders.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| folders | array<object> | |
| folders[].name | string | |
| folders[].path | string | |
| total_count | number | |
| next_cursor | string |
curl -X GET "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/folders/examples" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"folders": [],
"total_count": 0
}POST /cloudinary/v1_1/{library_id}/folders/{folder}
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| folder | path | string | — |
返回: FolderResult.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | object |
curl -X POST "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/folders/sample" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{}'HTTP 200
{
"success": true,
"path": "sample"
}PUT /cloudinary/v1_1/{library_id}/folders/{folder}
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| folder | path | string | — |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| to_folder | string | 是 | 目标文件夹路径 |
返回: FolderResult.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | object |
DELETE /cloudinary/v1_1/{library_id}/folders/{folder}
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| folder | path | string | — |
返回: FolderResult.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | object |
curl -X DELETE "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/folders/sample" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{}'HTTP 200
{
"success": true,
"path": "sample"
}GET /cloudinary/v1_1/{library_id}/ping
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
返回: Ping.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| status | string |
curl -X GET "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/ping" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"status": "ok"
}GET /cloudinary/v1_1/{library_id}/usage
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
返回: Usage.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| storage | object | |
| storage.usage | number | |
| objects | object | |
| objects.usage | number |
curl -X GET "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/usage" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"storage": {
"usage": 70
},
"objects": {
"usage": 1
}
}GET /cloudinary/v1_1/{library_id}/usage/{date}
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| date | path | string | — |
返回: Usage.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| storage | object | |
| storage.usage | number | |
| objects | object | |
| objects.usage | number |
curl -X GET "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/usage/2026-10-09" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"storage": {
"usage": 70
},
"objects": {
"usage": 1
}
}| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| resources | SearchResource[] | 是 | 本页素材 |
| next_cursor | string | 否 | 下一页游标;没有时为 null 或省略 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| asset_id | AssetId | 是 | 素材 ID |
| public_id | string | 是 | 交付地址中的素材名称,可带路径 |
| display_name | string | 是 | 显示名称 |
| asset_folder | string | 是 | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| resource_type | ResourceType | 是 | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
| type | DeliveryType | 是 | 资源或事件类型 |
| format | string | 是 | 文件格式 |
| version | number | 是 | 交付版本号 |
| version_id | string | 是 | 版本标识 |
| bytes | number | 是 | 文件字节数 |
| etag | string | 是 | 文件校验标识 |
| width | number | 否 | 宽度像素 |
| height | number | 否 | 高度像素 |
| duration | number | 否 | 时长秒数 |
| pages | number | 否 | 文档页数 |
| is_audio | boolean | 否 | 是否为音频 |
| original_filename | string | 否 | 原文件名称 |
| tags | string[] | 是 | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| context | object | 否 | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
| created_at | IsoTimestamp | 是 | 创建时间 |
| url | string | 是 | 原文件地址 |
| secure_url | string | 是 | HTTPS 交付地址 |
| placeholder | false | 是 | 固定为 false |
| existing | boolean | 否 | 未覆盖时是否返回已有素材 |
| processing | Processing | 否 | 整体与各项理解状态 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| deleted | object | 是 | 删除结果 |
| partial | boolean | 是 | 是否还有未处理的后续页 |
| next_cursor | string | 否 | 下一页游标;没有时为 null 或省略 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| tags | string[] | 是 | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| next_cursor | string | 否 | 下一页游标;没有时为 null 或省略 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| folders | object[] | 是 | 文件夹列表 |
| total_count | number | 是 | 匹配总数 |
| next_cursor | string | 否 | 下一页游标;没有时为 null 或省略 |
| 字段 | 类型 | 必填 | 说明 |
|---|
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| status | "ok" | 是 | 资源状态 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| storage | object | 是 | 存储字节用量 |
| objects | object | 是 | 素材数量 |
表达式检索仅支持以下子集。不支持的语法或字段返回 HTTP 400 INVALID_EXPRESSION;兼容错误体只包含消息。默认省略 tags 与 context;需要时用 with_field 请求。
| 语法 | 含义 |
|---|---|
| AND / OR / NOT / - / ( ) | 布尔组合;相邻条件默认 AND |
| field:value / field=value | 字段匹配 |
| bytes > 1000 / width >= 160 | 数值比较;也支持 height、duration |
| created_at >= 2026-01-01 / uploaded_at > 7d | 日期或相对时间,支持 d/w/m/y |
| tags:docs / context.alt:"sample image" | 标签和自定义文字 |
| public_id:docs* | 仅末尾通配符 |
| "sample image" | 短语 |
| sunset | 裸词:在 public_id、display_name、tags、context 以及理解得到的描述、图片文字、转写中做全文匹配,不区分大小写 |
| ~ / ^ / [a TO z] / prefix / ab | 不支持,返回 400 |
字段名不区分大小写(RESOURCE_TYPE:image 等同 resource_type:image);resource_type、type、format 的值不区分大小写;tags、context 等其他字段的值区分大小写。空表达式返回全部素材;无法解析的表达式返回 400 INVALID_EXPRESSION。
查询字段: asset_id, resource_type, type, format, public_id, asset_folder, display_name, tags, bytes, width, height, duration, created_at, uploaded_at, context.<key>.
排序字段: created_at, public_id, display_name, bytes, uploaded_at.
统计字段: resource_type, format, asset_folder, processing_state.
指南 →
GET /cloudinary/v1_1/{library_id}/resources/visual_search
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| image_asset_id | query | string | 本库素材 ID |
| image_url | query | string | 仅接受本库交付 URL,不支持抓取外部 URL |
| text | query | string | 自然语言查询,使用语义检索 |
| max_results | query | integer | 最多 500;检索默认 100,Admin 默认 10 |
| filter | query | string | 表达式筛选条件 |
返回: VisualResources.
库的 search.image 为 true 时可用;不支持的库返回 LIBRARY_INVALID_STATE。图片仅接受 JPEG、PNG、WebP、GIF,解码后最大 10 MiB。每个素材返回最高分命中,视频定位到最佳帧。qwen3-vl-embedding 的图片相似度门槛为 0.35。标定来自 2026-10-10 的测试:同图变体 0.82–0.96,同类场景 0.38–0.66,无关图片最高 0.34。
image_asset_id、image_file(multipart)、image_url、text 必须且只能传一个。text 使用纯语义检索;返回 { "resources": [...] }。image_url 只接受本库交付 URL,不抓取外部 URL;外部 URL 返回 400「不支持抓取外部 URL」。
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| resources | array<object> | |
| resources[].asset_id | string | |
| resources[].public_id | string | |
| resources[].display_name | string | |
| resources[].asset_folder | string | |
| resources[].resource_type | string | |
| resources[].type | string | |
| resources[].format | string | |
| resources[].version | number | |
| resources[].version_id | string | |
| resources[].bytes | number | |
| resources[].etag | string | |
| resources[].width | number | |
| resources[].height | number | |
| resources[].duration | number | |
| resources[].pages | number | |
| resources[].is_audio | boolean | |
| resources[].original_filename | string | |
| resources[].tags | array<string> | |
| resources[].context | object | |
| resources[].created_at | string | |
| resources[].url | string | |
| resources[].secure_url | string | |
| resources[].placeholder | boolean | |
| resources[].existing | boolean | |
| resources[].processing | object |
POST /cloudinary/v1_1/{library_id}/resources/visual_search
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| image_asset_id | string | 否 | 本库素材 ID |
| image_url | string | 否 | 仅接受本库交付 URL,不支持抓取外部 URL |
| image_file | string | 否 | JPEG、PNG、WebP 或 GIF 文件,最大 10 MiB |
| text | string | 否 | 自然语言查询,使用语义检索 |
| max_results | integer | 否 | 最多 500;检索默认 100,Admin 默认 10 |
| filter | string | 否 | 表达式筛选条件 |
返回: VisualResources.
库的 search.image 为 true 时可用;不支持的库返回 LIBRARY_INVALID_STATE。图片仅接受 JPEG、PNG、WebP、GIF,解码后最大 10 MiB。每个素材返回最高分命中,视频定位到最佳帧。qwen3-vl-embedding 的图片相似度门槛为 0.35。标定来自 2026-10-10 的测试:同图变体 0.82–0.96,同类场景 0.38–0.66,无关图片最高 0.34。
image_asset_id、image_file(multipart)、image_url、text 必须且只能传一个。text 使用纯语义检索;返回 { "resources": [...] }。image_url 只接受本库交付 URL,不抓取外部 URL;外部 URL 返回 400「不支持抓取外部 URL」。
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| resources | array<object> | |
| resources[].asset_id | string | |
| resources[].public_id | string | |
| resources[].display_name | string | |
| resources[].asset_folder | string | |
| resources[].resource_type | string | |
| resources[].type | string | |
| resources[].format | string | |
| resources[].version | number | |
| resources[].version_id | string | |
| resources[].bytes | number | |
| resources[].etag | string | |
| resources[].width | number | |
| resources[].height | number | |
| resources[].duration | number | |
| resources[].pages | number | |
| resources[].is_audio | boolean | |
| resources[].original_filename | string | |
| resources[].tags | array<string> | |
| resources[].context | object | |
| resources[].created_at | string | |
| resources[].url | string | |
| resources[].secure_url | string | |
| resources[].placeholder | boolean | |
| resources[].existing | boolean | |
| resources[].processing | object |
GET /cloudinary/v1_1/{library_id}/resources/search
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| expression | query | string | 结构化查询表达式;空表达式返回全部素材 |
| sort_by | query | string | 排序字段与方向 |
| max_results | query | integer | 最多 500;检索默认 100,Admin 默认 10 |
| next_cursor | query | string | 下一页游标;没有时为 null 或省略 |
| with_field | query | string[] | 额外返回 tags 或 context |
| aggregate | query | string[] | 统计字段 |
返回: CompatExpressionSearchResult.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| total_count | number | |
| time | number | |
| next_cursor | string | |
| resources | array<object> | |
| resources[].asset_id | string | |
| resources[].public_id | string | |
| resources[].display_name | string | |
| resources[].asset_folder | string | |
| resources[].resource_type | string | |
| resources[].type | string | |
| resources[].format | string | |
| resources[].version | number | |
| resources[].version_id | string | |
| resources[].bytes | number | |
| resources[].etag | string | |
| resources[].width | number | |
| resources[].height | number | |
| resources[].duration | number | |
| resources[].pages | number | |
| resources[].is_audio | boolean | |
| resources[].original_filename | string | |
| resources[].tags | array<string> | |
| resources[].context | object | |
| resources[].created_at | string | |
| resources[].url | string | |
| resources[].secure_url | string | |
| resources[].placeholder | boolean | |
| resources[].existing | boolean | |
| resources[].processing | object | |
| aggregations | object |
curl -X GET "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/resources/search?expression=tags%3Adocs" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"total_count": 1,
"time": 0,
"resources": [
{
"asset_id": "9339cdae93804c0c8c65d5189ef1f646",
"public_id": "docs/pixel",
"display_name": "Sample image",
"asset_folder": "examples",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791538418,
"version_id": "35848c1529994e338e7aa634a1c13d9c",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"created_at": "2026-10-09T09:33:38.899Z",
"url": "https://media-develop.praxisusercontent.com/lib_77374d4ee73b4ae79c4aa430f3ba3885/image/upload/v1791538418/docs/pixel.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_77374d4ee73b4ae79c4aa430f3ba3885/image/upload/v1791538418/docs/pixel.png",
"placeholder": false
}
]
}POST /cloudinary/v1_1/{library_id}/resources/search
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| expression | string | 否 | 结构化查询表达式;空表达式返回全部素材 |
| sort_by | object[] | 否 | 排序字段与方向 |
| max_results | integer | 否 | 最多 500;检索默认 100,Admin 默认 10 |
| next_cursor | string | 否 | 下一页游标;没有时为 null 或省略 |
| with_field | "tags" / "context"[] | 否 | 额外返回 tags 或 context |
| aggregate | AggregateField[] | 否 | 统计字段 |
返回: CompatExpressionSearchResult.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| total_count | number | |
| time | number | |
| next_cursor | string | |
| resources | array<object> | |
| resources[].asset_id | string | |
| resources[].public_id | string | |
| resources[].display_name | string | |
| resources[].asset_folder | string | |
| resources[].resource_type | string | |
| resources[].type | string | |
| resources[].format | string | |
| resources[].version | number | |
| resources[].version_id | string | |
| resources[].bytes | number | |
| resources[].etag | string | |
| resources[].width | number | |
| resources[].height | number | |
| resources[].duration | number | |
| resources[].pages | number | |
| resources[].is_audio | boolean | |
| resources[].original_filename | string | |
| resources[].tags | array<string> | |
| resources[].context | object | |
| resources[].created_at | string | |
| resources[].url | string | |
| resources[].secure_url | string | |
| resources[].placeholder | boolean | |
| resources[].existing | boolean | |
| resources[].processing | object | |
| aggregations | object |
curl -X POST "https://api.deepraxis.ai/cloudinary/v1_1/${LIBRARY_ID}/resources/search" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"expression":"tags:docs"}'HTTP 200
{
"total_count": 2,
"time": 0,
"resources": [
{
"asset_id": "9dfa312ef9bc4b00816339b598b1152c",
"public_id": "walk-lib-r1-MDP-1791733789929-tagged",
"display_name": "walk-lib-r1-MDP-1791733789929-tagged",
"asset_folder": "",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791733815,
"version_id": "26cb8171caa5431b8373ad417fd71e32",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"processing": {
"state": "processing",
"kinds": {
"embedding": "running",
"visual": "failed",
"tagging": "failed"
},
"updated_at": "2026-10-11T15:50:21.512Z"
},
"created_at": "2026-10-11T15:50:15.996Z",
"url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733815/walk-lib-r1-MDP-1791733789929-tagged.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733815/walk-lib-r1-MDP-1791733789929-tagged.png",
"placeholder": false
},
{
"asset_id": "85b7ef616a8b4719a41777a036ebc1d2",
"public_id": "walk-lib-r1-MDP-1791733789929-plain",
"display_name": "walk-lib-r1-MDP-1791733789929-plain",
"asset_folder": "",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791733810,
"version_id": "fdf3c8cd40c2424d86e8397425a69857",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"created_at": "2026-10-11T15:50:10.842Z",
"url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733810/walk-lib-r1-MDP-1791733789929-plain.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733810/walk-lib-r1-MDP-1791733789929-plain.png",
"placeholder": false
}
]
}| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| resources | CloudinaryResource[] | 是 | 本页素材 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| total_count | number | 是 | 匹配总数 |
| time | number | 是 | 检索耗时,整数毫秒,由服务端测得 |
| next_cursor | string | 否 | 下一页游标;没有时为 null 或省略 |
| resources | SearchResource[] | 是 | 本页素材 |
| aggregations | object | 否 | 按请求字段统计 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| asset_id | AssetId | 是 | 素材 ID |
| public_id | string | 是 | 交付地址中的素材名称,可带路径 |
| display_name | string | 是 | 显示名称 |
| asset_folder | string | 是 | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| resource_type | ResourceType | 是 | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
| type | DeliveryType | 是 | 资源或事件类型 |
| format | string | 是 | 文件格式 |
| version | number | 是 | 交付版本号 |
| version_id | string | 是 | 版本标识 |
| bytes | number | 是 | 文件字节数 |
| etag | string | 是 | 文件校验标识 |
| width | number | 否 | 宽度像素 |
| height | number | 否 | 高度像素 |
| duration | number | 否 | 时长秒数 |
| pages | number | 否 | 文档页数 |
| is_audio | boolean | 否 | 是否为音频 |
| original_filename | string | 否 | 原文件名称 |
| tags | string[] | 否 | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| context | object | 否 | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
| created_at | IsoTimestamp | 是 | 创建时间 |
| url | string | 是 | 原文件地址 |
| secure_url | string | 是 | HTTPS 交付地址 |
| placeholder | false | 是 | 固定为 false |
| existing | boolean | 否 | 未覆盖时是否返回已有素材 |
| processing | Processing | 否 | 整体与各项理解状态 |
用上传响应的 secure_url 读取原文件,在 upload 与版本之间插入变换。
https://media-develop.praxisusercontent.com/{library_id}/{resource_type}/upload/{transformation}/v{version}/{public_id}.{format}
原文件省略 transformation 及其后斜杠。仅接受以下白名单;其它变换返回错误。
| 参数 | 允许值 |
|---|---|
| w_ | 160, 320, 640, 1280 |
| c_ | fill, fit, limit, scale, pad |
| g_ | auto, center |
| f_ | auto, jpg, png, webp, avif |
| q_ | auto, auto:good, auto:eco |
| dpr_ | 1, 2 |
| so_ | 视频秒数,扩展名 .jpg;源文件不超过 100 MiB |
w_160,c_fit
w_320,c_fill,g_center,f_webp,q_auto,dpr_2交付使用独立的可注册域 praxisusercontent.com,与 API 和登录域隔离:Develop 为 media-develop.praxisusercontent.com,生产为 media.praxisusercontent.com。URL 路径形状不变,交付不携带任何 cookie。
X-Content-Type-Options: nosniff。Content-Security-Policy: sandbox 和 Content-Disposition: attachment。基础地址: https://api-develop.deepraxis.ai/browserbase
请求头: X-BB-API-Key: $PRAXIS_API_KEY
请求 ID 响应头: X-Request-Id
官方 SDK 设置 baseURL 后使用以下接口。代理、反检测、扩展和 Selenium 不可用;region 与 solveCaptchas 接受但忽略。删除登录态返回 200 和 deleted=true;会话响应还可能包含 currentUrl、clients、handoff。
| 操作 | 方法与路径 |
|---|---|
| 创建浏览器会话 | POST /browserbase/v1/sessions |
| 列出浏览器会话 | GET /browserbase/v1/sessions |
| 读取浏览器会话 | GET /browserbase/v1/sessions/{id} |
| 关闭浏览器会话 | POST /browserbase/v1/sessions/{id} |
| 读取调试地址 | GET /browserbase/v1/sessions/{id}/debug |
| 读取会话日志 | GET /browserbase/v1/sessions/{id}/logs |
| 读取会话录像 | GET /browserbase/v1/sessions/{id}/recording |
| 创建登录态 | POST /browserbase/v1/contexts |
| 读取登录态 | GET /browserbase/v1/contexts/{id} |
| 删除登录态 | DELETE /browserbase/v1/contexts/{id} |
/browserbase/v1/sessions● 支持projectIdstring可选The Project ID. Can be found in [Settings](https://www.browserbase.com/settings). Optional - if not provided, the project will be inferred from the API key.
extensionIdstring可选○ 未支持不支持此配置。
browserSettingsobject可选contextobject可选idstring必填The Context ID.
persistboolean可选Whether or not to persist the context after browsing. Defaults to `false`.
extensionIdstring可选○ 未支持不支持此配置。
viewportobject可选widthinteger可选The width of the browser.
heightinteger可选The height of the browser.
blockAdsboolean可选◐ 部分支持接受但忽略;不会启用此能力。
solveCaptchasboolean可选◐ 部分支持接受但忽略;不会启用此能力。
recordSessionboolean可选◐ 部分支持接受但忽略;不会启用此能力。
logSessionboolean可选◐ 部分支持接受但忽略;不会启用此能力。
advancedStealthboolean可选○ 未支持不支持此配置。
verifiedboolean可选○ 未支持不支持此配置。
captchaImageSelectorstring可选Custom selector for captcha image. See [Custom Captcha Solving](/features/stealth-mode#custom-captcha-solving)
captchaInputSelectorstring可选Custom selector for captcha input. See [Custom Captcha Solving](/features/stealth-mode#custom-captcha-solving)
osstring可选○ 未支持不支持此配置。
allowedDomainsarray可选○ 未支持不支持此配置。
ignoreCertificateErrorsboolean可选○ 未支持不支持此配置。
timeoutinteger可选Duration in seconds after which the session will automatically end. Defaults to the Project's `defaultTimeout`. Minimum 60 seconds, maximum 21600 seconds (6 hours).
keepAliveboolean可选Set to true to keep the session alive even after disconnections. Available on the Hobby Plan and above.
proxiesunion可选◐ 部分支持仅省略、false 或 [{type: 'none'}] 可用,其它代理配置返回 501。
proxySettingsobject可选Supplementary proxy settings. Optional.
caCertificatesarray可选The TLS certificate IDs to trust. Optional.
regionstring可选◐ 部分支持接受但忽略;不会启用此能力。
userMetadataobject可选Arbitrary user metadata to attach to the session. To learn more about user metadata, see [User Metadata](/features/sessions#user-metadata).
201
仅支持服务指南列出的能力;部分官方请求参数不可用。
错误含 statusCode、error、message;自有面另含 code。请求 ID 见 X-Request-Id。 错误
代理、反检测、扩展和 Selenium 不可用。region 和 solveCaptchas 接受但忽略;不提供区域选择或验证码代解。
The request has succeeded and a new resource has been created as a result.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| createdAt | string | |
| updatedAt | string | |
| projectId | string | The Project ID linked to the Session. |
| startedAt | string | |
| endedAt | string | |
| expiresAt | string | |
| status | string | |
| proxyBytes | integer | Bytes used via the Proxy |
| keepAlive | boolean | Indicates if the Session was created to be kept alive upon disconnections |
| contextId | string | Optional. The Context linked to the Session. |
| region | string | The region where the Session is running. |
| userMetadata | object | Arbitrary user metadata to attach to the session. To learn more about user metadata, see User Metadata. |
| connectUrl | string | WebSocket URL to connect to the Session. |
| seleniumRemoteUrl | string | HTTP URL to connect to the Session. |
| signingKey | string | Signing key to use when connecting to the Session via HTTP. |
/browserbase/v1/sessions● 支持statusstring可选qstring可选Query sessions by user metadata. See [Querying Sessions by User Metadata](/features/sessions#querying-sessions-by-user-metadata) for the schema of this query.
200
仅支持服务指南列出的能力;部分官方请求参数不可用。
错误含 statusCode、error、message;自有面另含 code。请求 ID 见 X-Request-Id。 错误
代理、反检测、扩展和 Selenium 不可用。region 和 solveCaptchas 接受但忽略;不提供区域选择或验证码代解。
The request has succeeded.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].id | string | |
| [].createdAt | string | |
| [].updatedAt | string | |
| [].projectId | string | The Project ID linked to the Session. |
| [].startedAt | string | |
| [].endedAt | string | |
| [].expiresAt | string | |
| [].status | string | |
| [].proxyBytes | integer | Bytes used via the Proxy |
| [].keepAlive | boolean | Indicates if the Session was created to be kept alive upon disconnections |
| [].contextId | string | Optional. The Context linked to the Session. |
| [].region | string | The region where the Session is running. |
| [].userMetadata | object | Arbitrary user metadata to attach to the session. To learn more about user metadata, see User Metadata. |
/browserbase/v1/sessions/{id}● 支持idstring必填200
仅支持服务指南列出的能力;部分官方请求参数不可用。
错误含 statusCode、error、message;自有面另含 code。请求 ID 见 X-Request-Id。 错误
代理、反检测、扩展和 Selenium 不可用。region 和 solveCaptchas 接受但忽略;不提供区域选择或验证码代解。
The request has succeeded.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| createdAt | string | |
| updatedAt | string | |
| projectId | string | The Project ID linked to the Session. |
| startedAt | string | |
| endedAt | string | |
| expiresAt | string | |
| status | string | |
| proxyBytes | integer | Bytes used via the Proxy |
| keepAlive | boolean | Indicates if the Session was created to be kept alive upon disconnections |
| contextId | string | Optional. The Context linked to the Session. |
| region | string | The region where the Session is running. |
| userMetadata | object | Arbitrary user metadata to attach to the session. To learn more about user metadata, see User Metadata. |
| connectUrl | string | WebSocket URL to connect to the Session. |
| seleniumRemoteUrl | string | HTTP URL to connect to the Session. |
| signingKey | string | Signing key to use when connecting to the Session via HTTP. |
/browserbase/v1/sessions/{id}● 支持idstring必填statusstring必填Set to `REQUEST_RELEASE` to request that the session complete. Use before session's timeout to avoid additional charges.
200
仅支持服务指南列出的能力;部分官方请求参数不可用。
错误含 statusCode、error、message;自有面另含 code。请求 ID 见 X-Request-Id。 错误
代理、反检测、扩展和 Selenium 不可用。region 和 solveCaptchas 接受但忽略;不提供区域选择或验证码代解。
The request has succeeded.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| createdAt | string | |
| updatedAt | string | |
| projectId | string | The Project ID linked to the Session. |
| startedAt | string | |
| endedAt | string | |
| expiresAt | string | |
| status | string | |
| proxyBytes | integer | Bytes used via the Proxy |
| keepAlive | boolean | Indicates if the Session was created to be kept alive upon disconnections |
| contextId | string | Optional. The Context linked to the Session. |
| region | string | The region where the Session is running. |
| userMetadata | object | Arbitrary user metadata to attach to the session. To learn more about user metadata, see User Metadata. |
/browserbase/v1/sessions/{id}/debug● 支持expiresIninteger可选Time-to-live of the generated live view URLs, in seconds. If omitted, the URLs expire with the session, up to a maximum of 21600 seconds (6 hours).
idstring必填200
仅支持服务指南列出的能力;部分官方请求参数不可用。
错误含 statusCode、error、message;自有面另含 code。请求 ID 见 X-Request-Id。 错误
代理、反检测、扩展和 Selenium 不可用。region 和 solveCaptchas 接受但忽略;不提供区域选择或验证码代解。
The request has succeeded.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| debuggerFullscreenUrl | string | |
| debuggerUrl | string | |
| pages | array<object> | |
| pages[].id | string | |
| pages[].url | string | |
| pages[].faviconUrl | string | |
| pages[].title | string | |
| pages[].debuggerUrl | string | |
| pages[].debuggerFullscreenUrl | string | |
| wsUrl | string |
/browserbase/v1/sessions/{id}/logs● 支持idstring必填200
仅支持服务指南列出的能力;部分官方请求参数不可用。
错误含 statusCode、error、message;自有面另含 code。请求 ID 见 X-Request-Id。 错误
代理、反检测、扩展和 Selenium 不可用。region 和 solveCaptchas 接受但忽略;不提供区域选择或验证码代解。
The request has succeeded.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].method | string | |
| [].pageId | integer | |
| [].sessionId | string | |
| [].request | object | |
| [].request.timestamp | integer | milliseconds that have elapsed since the UNIX epoch |
| [].request.params | object | |
| [].request.rawBody | string | |
| [].response | object | |
| [].response.timestamp | integer | milliseconds that have elapsed since the UNIX epoch |
| [].response.result | object | |
| [].response.rawBody | string | |
| [].timestamp | integer | milliseconds that have elapsed since the UNIX epoch |
| [].frameId | string | |
| [].loaderId | string |
/browserbase/v1/sessions/{id}/recording● 支持idstring必填200
仅支持服务指南列出的能力;部分官方请求参数不可用。
错误含 statusCode、error、message;自有面另含 code。请求 ID 见 X-Request-Id。 错误
代理、反检测、扩展和 Selenium 不可用。region 和 solveCaptchas 接受但忽略;不提供区域选择或验证码代解。
The request has succeeded.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].id | string | |
| [].data | object | See rrweb documentation. |
| [].sessionId | string | |
| [].timestamp | integer | milliseconds that have elapsed since the UNIX epoch |
| [].type | integer |
/browserbase/v1/contexts● 支持projectIdstring可选The Project ID. Can be found in [Settings](https://www.browserbase.com/settings). Optional - if not provided, the project will be inferred from the API key.
namestring可选Optional user-defined name for the Context. Leading and trailing whitespace is trimmed before storage. Names are unique within the project among active Contexts, compared case-insensitively.
201
仅支持服务指南列出的能力;部分官方请求参数不可用。
错误含 statusCode、error、message;自有面另含 code。请求 ID 见 X-Request-Id。 错误
代理、反检测、扩展和 Selenium 不可用。region 和 solveCaptchas 接受但忽略;不提供区域选择或验证码代解。
The request has succeeded and a new resource has been created as a result.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| publicKey | string | The public key to encrypt the user-data-directory. |
| cipherAlgorithm | string | The cipher algorithm used to encrypt the user-data-directory. AES-256-CBC is currently the only supported algorithm. |
| initializationVectorSize | integer | The initialization vector size used to encrypt the user-data-directory. Read more about how to use it. |
/browserbase/v1/contexts/{id}● 支持idstring必填200
仅支持服务指南列出的能力;部分官方请求参数不可用。
错误含 statusCode、error、message;自有面另含 code。请求 ID 见 X-Request-Id。 错误
代理、反检测、扩展和 Selenium 不可用。region 和 solveCaptchas 接受但忽略;不提供区域选择或验证码代解。
The request has succeeded.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| createdAt | string | |
| updatedAt | string | |
| projectId | string | The Project ID linked to the uploaded Context. |
| name | string | Optional user-defined name for the Context. Leading and trailing whitespace is trimmed before storage. Names are unique within the project among active Contexts, compared case-insensitively. |
/browserbase/v1/contexts/{id}● 支持idstring必填200
仅支持服务指南列出的能力;部分官方请求参数不可用。
错误含 statusCode、error、message;自有面另含 code。请求 ID 见 X-Request-Id。 错误
代理、反检测、扩展和 Selenium 不可用。region 和 solveCaptchas 接受但忽略;不提供区域选择或验证码代解。
此接口返回 200 和 JSON 确认;Browserbase 官方为 204。
Context deleted. Praxis returns JSON instead of Browserbase's 204.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| deleted | boolean |
加载中…| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| POST | /v1/computers | 创建电脑 | ● 支持 |
| GET | /v1/computers | 列出电脑 | ● 支持 |
| GET | /v1/computers/{computer_id} | 读取电脑 | ● 支持 |
| POST | /v1/computers/{computer_id} | 更新电脑 | ● 支持 |
| POST | /v1/computers/{computer_id}/archive | 归档电脑 | ● 支持 |
| DELETE | /v1/computers/{computer_id} | 删除已归档电脑 | ● 支持 |
| GET | /v1/computers/{computer_id}/files | 浏览电脑文件 | ● 支持 |
| GET | /v1/computers/{computer_id}/files/content | 读取电脑文件内容 | ● 支持 |
| POST | /v1/computers/{computer_id}/connect | 连接电脑 | ● 支持 |
| POST | /v1/computers/{computer_id}/attachments | 上传电脑附件 | ● 支持 |
| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| POST | /v1/sessions/{session_id}/resources | 添加会话资源 | ◐ 部分支持 |
| GET | /v1/sessions/{session_id}/resources | 列出会话资源 | ◐ 部分支持 |
| GET | /v1/sessions/{session_id}/resources/{resource_id} | 读取会话资源 | ◐ 部分支持 |
| DELETE | /v1/sessions/{session_id}/resources/{resource_id} | 删除会话资源 | ◐ 部分支持 |
| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| GET | /v1/agents | 列出智能体 | ● 支持 |
| POST | /v1/agents | 创建智能体 | ◐ 部分支持 |
| GET | /v1/agents/{agent_id} | 读取智能体 | ● 支持 |
| POST | /v1/agents/{agent_id} | 更新智能体 | ◐ 部分支持 |
| GET | /v1/agents/{agent_id}/versions | 列出版本 | ● 支持 |
| POST | /v1/agents/{agent_id}/archive | 归档智能体 | ● 支持 |
| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| GET | /v1/sessions | 列出会话 | ◐ 部分支持 |
| POST | /v1/sessions | 创建会话 | ◐ 部分支持 |
| GET | /v1/sessions/{session_id} | 读取会话 | ● 支持 |
| POST | /v1/sessions/{session_id}/fork | 分支会话(扩展) | ● 支持 |
| GET | /v1/sessions/{session_id}/context | 读取会话上下文(扩展) | ● 支持 |
| GET | /v1/sessions/{session_id}/background_tasks | 列出后台任务(扩展) | ● 支持 |
| GET | /v1/sessions/{session_id}/background_tasks/{task_id}/output | 读取后台任务输出(扩展) | ● 支持 |
| POST | /v1/sessions/{session_id}/background_tasks/{task_id}/stop | 停止后台任务(扩展) | ● 支持 |
| POST | /v1/sessions/{session_id}/compact | 压缩会话(扩展) | ● 支持 |
| GET | /v1/sessions/{session_id}/compact/{operation_id} | 读取压缩操作(扩展) | ● 支持 |
| GET | /v1/sessions/{session_id}/compactions | 列出压缩历史(扩展) | ● 支持 |
| GET | /v1/sessions/{session_id}/events | 列出事件 | ● 支持 |
| POST | /v1/sessions/{session_id}/events | 发送事件 | ◐ 部分支持 |
| GET | /v1/sessions/{session_id}/events/stream | 订阅事件 | ◐ 部分支持 |
| POST | /v1/sessions/{session_id} | 更新会话 | ◐ 部分支持 |
| POST | /v1/sessions/{session_id}/archive | 归档会话 | ● 支持 |
| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| GET | /v1/sessions/{session_id}/threads | 列出线程 | ◐ 部分支持 |
| GET | /v1/sessions/{session_id}/threads/{thread_id} | 读取线程 | ◐ 部分支持 |
| GET | /v1/sessions/{session_id}/threads/{thread_id}/events | 列出线程事件 | ◐ 部分支持 |
| GET | /v1/sessions/{session_id}/threads/{thread_id}/stream | 订阅线程事件 | ◐ 部分支持 |
| POST | /v1/sessions/{session_id}/threads/{thread_id}/archive | 归档线程 | ◐ 部分支持 |
| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| POST | /v1/environments | 创建环境 | ◐ 部分支持 |
| POST | /v1/environments/{environment_id} | 更新环境 | ◐ 部分支持 |
| POST | /v1/environments/{environment_id}/archive | 归档环境 | ◐ 部分支持 |
| GET | /v1/environments | 列出环境 | ◐ 部分支持 |
| GET | /v1/environments/{environment_id} | 读取环境 | ◐ 部分支持 |
| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| GET | /v1/toolsets | 列出工具集 | ● 支持 |
原生工具与参数以本站各端点说明及 /meta/v1/openapi.yaml 为准;Claude Managed Agents 官方文档描述兼容 API 的官方字段。
错误按 Anthropic 错误格式返回(type / message / request_id),参见错误;额度与响应头参见限流。
/agent/v1/environments◐ 部分支持namestring必填Human-readable name for the environment
metadataobject可选User-provided metadata key-value pairs
configobject可选Environment configuration
typestring必填Environment type
networkingobject可选Network configuration policy. Omit on update to preserve the existing value.
packagesobject可选Specify packages (and optionally their versions) available in this environment. When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. Under `limited` networking, requires `networking.allow_package_managers` to be `true`.
descriptionstring可选Optional description of the environment
scopestring可选The visibility scope for this environment. 'organization' makes the environment visible to all accounts. 'account' restricts visibility to the owning account only. API organizations support only 'organization'; 'account' is rejected. If not specified, defaults based on organization type.
200
支持租户自建 cloud 环境、配置更新与软归档;内置环境只读。列表支持 limit、page 和 include_archived。limited 网络在沙箱创建时生效;安装失败会终止会话,错误码为 ENVIRONMENT_PACKAGE_INSTALL_FAILED。self_hosted、scope 和跨会话包缓存尚不支持。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Environment identifier (e.g., 'env_...') |
| archived_at | null | string | RFC 3339 timestamp when environment was archived, or null if not archived |
| config | object | Environment configuration (either Anthropic Cloud or self-hosted) |
| config.networking | object | Network configuration policy. |
| config.packages | object | Package manager configuration. |
| config.type | string | Environment type |
| created_at | string | RFC 3339 timestamp when environment was created |
| description | null | string | User-provided description for the environment; null when unset |
| metadata | object | User-provided metadata key-value pairs |
| name | string | Human-readable name for the environment |
| type | string | The type of object (always 'environment') |
| updated_at | string | RFC 3339 timestamp when environment was last updated |
| scope | string | The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account. |
先调用「创建环境」,用返回的环境 ID 替换 env_123。
/agent/v1/environments/{environment_id}◐ 部分支持environment_idstring必填path: Environment id, as returned by environments.create or environments.list. Built-in environments can be read but not changed.
namestring可选Updated name for the environment
metadataobject可选User-provided metadata key-value pairs. Set a value to null or empty string to delete the key.
configobject可选Updated environment configuration
typestring必填Environment type
networkingobject可选Network configuration policy. Omit on update to preserve the existing value.
packagesobject可选Specify packages (and optionally their versions) available in this environment. When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. Under `limited` networking, requires `networking.allow_package_managers` to be `true`.
descriptionstring可选Updated description of the environment. Omit to preserve; null clears to null; an empty string is stored as an empty string.
scopestring可选The visibility scope for this environment. 'organization' makes the environment visible to all accounts. 'account' restricts visibility to the owning account only.
200
支持租户自建 cloud 环境、配置更新与软归档;内置环境只读。列表支持 limit、page 和 include_archived。limited 网络在沙箱创建时生效;安装失败会终止会话,错误码为 ENVIRONMENT_PACKAGE_INSTALL_FAILED。self_hosted、scope 和跨会话包缓存尚不支持。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Environment identifier (e.g., 'env_...') |
| archived_at | null | string | RFC 3339 timestamp when environment was archived, or null if not archived |
| config | object | Environment configuration (either Anthropic Cloud or self-hosted) |
| config.networking | object | Network configuration policy. |
| config.packages | object | Package manager configuration. |
| config.type | string | Environment type |
| created_at | string | RFC 3339 timestamp when environment was created |
| description | null | string | User-provided description for the environment; null when unset |
| metadata | object | User-provided metadata key-value pairs |
| name | string | Human-readable name for the environment |
| type | string | The type of object (always 'environment') |
| updated_at | string | RFC 3339 timestamp when environment was last updated |
| scope | string | The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account. |
先调用「创建环境」,用返回的环境 ID 替换 env_123。
/agent/v1/environments/{environment_id}/archive◐ 部分支持environment_idstring必填path: Environment id, as returned by environments.create or environments.list. Built-in environments can be read but not changed.
200
支持租户自建 cloud 环境、配置更新与软归档;内置环境只读。列表支持 limit、page 和 include_archived。limited 网络在沙箱创建时生效;安装失败会终止会话,错误码为 ENVIRONMENT_PACKAGE_INSTALL_FAILED。self_hosted、scope 和跨会话包缓存尚不支持。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Environment identifier (e.g., 'env_...') |
| archived_at | null | string | RFC 3339 timestamp when environment was archived, or null if not archived |
| config | object | Environment configuration (either Anthropic Cloud or self-hosted) |
| config.networking | object | Network configuration policy. |
| config.packages | object | Package manager configuration. |
| config.type | string | Environment type |
| created_at | string | RFC 3339 timestamp when environment was created |
| description | null | string | User-provided description for the environment; null when unset |
| metadata | object | User-provided metadata key-value pairs |
| name | string | Human-readable name for the environment |
| type | string | The type of object (always 'environment') |
| updated_at | string | RFC 3339 timestamp when environment was last updated |
| scope | string | The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account. |
/agent/v1/computers● 支持namestring必填Name of the entry or object.
environment_idstring可选Environment recipe id; null or omitted when none was selected.
201
Praxis 超集:MA 只有会话级临时容器与 memory_stores,没有可长期存续、可浏览的整台电脑。归档后文件仍可读,但不能用于新会话。environment_id 是可空配方引用;电脑默认使用 light sandbox,sandbox_id 为 SDK 可用的公开 ID。分页包含归档电脑。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Computer result
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| type | string | Always `computer`. A computer. |
| id | string | Computer id (cmp_...), the computer_id of computer calls. |
| name | string | Display name of the computer, 1 to 255 characters. |
| sandbox_id | string | null | Public id of the sandbox that backs the computer, usable with the sandbox API; null while none has been created. |
| environment_id | string | null | Environment recipe the computer was created with; null when none. |
| status | string | active computers can be used by new sessions; archived ones keep their files readable but cannot start new sessions. |
| created_at | string | RFC 3339 time at which the computer was created. |
| updated_at | string | RFC 3339 time at which the computer was last modified. |
| archived_at | string | null | RFC 3339 time at which the computer was archived; null while active. |
/agent/v1/computers● 支持limitinteger可选query: Maximum number of items to return in this page: a positive integer, at most 100 (default 20; for session resources default and maximum are 1000). A larger value returns 400.
pagestring可选query: Opaque pagination cursor: pass the next_page value of the previous response unchanged. Omit it for the first page. A cursor from a different query or a malformed one returns 400.
200
Praxis 超集:MA 只有会话级临时容器与 memory_stores,没有可长期存续、可浏览的整台电脑。归档后文件仍可读,但不能用于新会话。environment_id 是可空配方引用;电脑默认使用 light sandbox,sandbox_id 为 SDK 可用的公开 ID。分页包含归档电脑。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Computer result
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | Items of this page, in the order requested by the call. |
| data[].type | string | Always `computer`. A computer. |
| data[].id | string | Computer id (cmp_...), the computer_id of computer calls. |
| data[].name | string | Display name of the computer, 1 to 255 characters. |
| data[].sandbox_id | string | null | Public id of the sandbox that backs the computer, usable with the sandbox API; null while none has been created. |
| data[].environment_id | string | null | Environment recipe the computer was created with; null when none. |
| data[].status | string | active computers can be used by new sessions; archived ones keep their files readable but cannot start new sessions. |
| data[].created_at | string | RFC 3339 time at which the computer was created. |
| data[].updated_at | string | RFC 3339 time at which the computer was last modified. |
| data[].archived_at | string | null | RFC 3339 time at which the computer was archived; null while active. |
| has_more | boolean | Whether more items exist beyond this page. |
| next_page | string | null | Opaque cursor for the next page: pass it unchanged as page to continue. Null when this is the last page. |
先调用「创建计算机」,用返回的计算机 ID 替换 cmp_123。
/agent/v1/computers/{computer_id}● 支持computer_idstring必填path: Computer id (cmp_...), as returned by computers.create or computers.list.
200
Praxis 超集:MA 只有会话级临时容器与 memory_stores,没有可长期存续、可浏览的整台电脑。归档后文件仍可读,但不能用于新会话。environment_id 是可空配方引用;电脑默认使用 light sandbox,sandbox_id 为 SDK 可用的公开 ID。分页包含归档电脑。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Computer result
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| type | string | Always `computer`. A computer. |
| id | string | Computer id (cmp_...), the computer_id of computer calls. |
| name | string | Display name of the computer, 1 to 255 characters. |
| sandbox_id | string | null | Public id of the sandbox that backs the computer, usable with the sandbox API; null while none has been created. |
| environment_id | string | null | Environment recipe the computer was created with; null when none. |
| status | string | active computers can be used by new sessions; archived ones keep their files readable but cannot start new sessions. |
| created_at | string | RFC 3339 time at which the computer was created. |
| updated_at | string | RFC 3339 time at which the computer was last modified. |
| archived_at | string | null | RFC 3339 time at which the computer was archived; null while active. |
| implementation | string | How the computer is backed: a virtual file store or a real sandbox. |
| storage_bytes | integer | Bytes stored on the computer. |
| file_count | integer | Number of files stored on the computer. |
先调用「创建计算机」,用返回的计算机 ID 替换 cmp_123。
/agent/v1/computers/{computer_id}● 支持computer_idstring必填path: Computer id (cmp_...), as returned by computers.create or computers.list.
namestring必填Name of the entry or object.
200
Praxis 超集:MA 只有会话级临时容器与 memory_stores,没有可长期存续、可浏览的整台电脑。归档后文件仍可读,但不能用于新会话。environment_id 是可空配方引用;电脑默认使用 light sandbox,sandbox_id 为 SDK 可用的公开 ID。分页包含归档电脑。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Computer result
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| type | string | Always `computer`. A computer. |
| id | string | Computer id (cmp_...), the computer_id of computer calls. |
| name | string | Display name of the computer, 1 to 255 characters. |
| sandbox_id | string | null | Public id of the sandbox that backs the computer, usable with the sandbox API; null while none has been created. |
| environment_id | string | null | Environment recipe the computer was created with; null when none. |
| status | string | active computers can be used by new sessions; archived ones keep their files readable but cannot start new sessions. |
| created_at | string | RFC 3339 time at which the computer was created. |
| updated_at | string | RFC 3339 time at which the computer was last modified. |
| archived_at | string | null | RFC 3339 time at which the computer was archived; null while active. |
先调用「创建计算机」,用返回的计算机 ID 替换 cmp_123。
/agent/v1/computers/{computer_id}/archive● 支持computer_idstring必填path: Computer id (cmp_...), as returned by computers.create or computers.list.
200
Praxis 超集:MA 只有会话级临时容器与 memory_stores,没有可长期存续、可浏览的整台电脑。归档后文件仍可读,但不能用于新会话。environment_id 是可空配方引用;电脑默认使用 light sandbox,sandbox_id 为 SDK 可用的公开 ID。分页包含归档电脑。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Computer result
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| type | string | Always `computer`. A computer. |
| id | string | Computer id (cmp_...), the computer_id of computer calls. |
| name | string | Display name of the computer, 1 to 255 characters. |
| sandbox_id | string | null | Public id of the sandbox that backs the computer, usable with the sandbox API; null while none has been created. |
| environment_id | string | null | Environment recipe the computer was created with; null when none. |
| status | string | active computers can be used by new sessions; archived ones keep their files readable but cannot start new sessions. |
| created_at | string | RFC 3339 time at which the computer was created. |
| updated_at | string | RFC 3339 time at which the computer was last modified. |
| archived_at | string | null | RFC 3339 time at which the computer was archived; null while active. |
先调用「创建计算机」,用返回的计算机 ID 替换 cmp_123。
/agent/v1/computers/{computer_id}● 支持computer_idstring必填path: Computer id (cmp_...), as returned by computers.create or computers.list.
200
Praxis 扩展:Managed Agents 没有持久 Computer 的删除生命周期。仅允许已归档的电脑;active 返回 400 COMPUTER_ACTIVE(先归档),先销毁电脑数据再删除登记,成功返回 id 和 type=computer_deleted;不存在或跨租户返回 404。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Computer result
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Id of the deleted computer. |
| type | string | Always `computer_deleted`. Confirms that a computer was deleted. |
先调用「创建计算机」,用返回的计算机 ID 替换 cmp_123。
/agent/v1/computers/{computer_id}/files● 支持computer_idstring必填path: Computer id (cmp_...), as returned by computers.create or computers.list.
pathstring可选query: Directory on the computer to list; absolute path as returned in the path field of an earlier listing. Omit it to list from the computer's root.
200
Praxis 超集:MA 只有会话级临时容器与 memory_stores,没有可长期存续、可浏览的整台电脑。归档后文件仍可读,但不能用于新会话。environment_id 是可空配方引用;电脑默认使用 light sandbox,sandbox_id 为 SDK 可用的公开 ID。分页包含归档电脑。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Computer result
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | Items of this page, in the order requested by the call. |
| data[].path | string | Absolute path of the entry on the computer. |
| data[].name | string | Name of the entry or object. |
| data[].type | string | Kind of entry: a file, a directory or a symbolic link. |
| data[].size | integer | Size in bytes. |
| data[].mime_type | string | MIME type of the file. |
| data[].read_only | boolean | True when the entry cannot be modified through the API. |
| data[].digest | string | null | Content digest of the file; null when not computed. |
| data[].updated_at | string | null | RFC 3339 time at which the object was last modified. |
| has_more | boolean | Whether more items exist beyond this page. |
先调用「创建计算机」,用返回的计算机 ID 替换 cmp_123。
/agent/v1/computers/{computer_id}/files/content● 支持computer_idstring必填path: Computer id (cmp_...), as returned by computers.create or computers.list.
pathstring必填query: Absolute path of the file whose content to download, as returned in the path field of computers.files.list.
200
Praxis 超集:MA 只有会话级临时容器与 memory_stores,没有可长期存续、可浏览的整台电脑。归档后文件仍可读,但不能用于新会话。environment_id 是可空配方引用;电脑默认使用 light sandbox,sandbox_id 为 SDK 可用的公开 ID。分页包含归档电脑。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Raw file bytes (at most 16 MiB); Content-Type is inferred from the extension. ETag is present only when a digest is available. Larger files require the sandbox connection issued by connect.
application/octet-stream
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | string (binary) |
Single byte range
application/octet-stream
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | string (binary) |
先调用「创建计算机」,用返回的计算机 ID 替换 cmp_123。
/agent/v1/computers/{computer_id}/connect● 支持computer_idstring必填path: Computer id (cmp_...), as returned by computers.create or computers.list.
200
Praxis 自有扩展:Managed Agents 没有持久 Computer 连接。返回 SDK 可用的公开 sandbox_id、envd_access_token 和 template_id。归档电脑仍可连接;跨租户或不存在返回 404。连接凭证不可缓存。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Computer result
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| sandbox_id | string | Public id of the sandbox that backs the computer, usable with the sandbox API; null while none has been created. |
| envd_access_token | string | Access token for the sandbox's environment daemon, returned by the connect call; treat it as a secret. |
| template_id | string | Sandbox template the computer's sandbox was created from. |
先调用「创建计算机」,用返回的计算机 ID 替换 cmp_123。
/agent/v1/computers/{computer_id}/attachments● 支持computer_idstring必填path: Computer id (cmp_...), as returned by computers.create or computers.list.
namestring必填query: Single filename, at most 255 UTF-8 bytes, excluding slash, dot segments and control characters.
201
Praxis 扩展:Managed Agents 没有持久 Computer 附件目录。用户上传可以覆盖同名附件,智能体始终只读;运行令牌调用上传返回 403 READ_ONLY。name 是单个文件名、最多 255 UTF-8 字节,MIME 始终按扩展名推断,上传的 Content-Type 不持久保存,digest 可省略。上限 16 MiB,超限 413、非法名字 400;归档电脑也可上传,跨租户 404。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Computer result
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| path | string | Absolute path of the entry on the computer. |
| name | string | Name of the entry or object. |
| type | string | Kind of entry: a file, a directory or a symbolic link. |
| size | integer | Size in bytes. |
| mime_type | string | MIME type of the file. |
| read_only | boolean | True when the entry cannot be modified through the API. |
| digest | string | null | Content digest of the file; null when not computed. |
| updated_at | string | null | RFC 3339 time at which the object was last modified. |
先调用「上传文件」,用返回的文件 ID 替换示例文件 ID。 先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/agent/v1/sessions/{session_id}/resources◐ 部分支持session_idstring必填path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
typestring必填query: Resource type selector for the body; only file resources are supported. Normally you send type inside the JSON body and omit this parameter.
file_idstring必填ID of a previously uploaded file.
mount_pathstring可选Mount path in the container. Defaults to `/mnt/session/uploads/<file_id>`.
200
支持 file 类型资源的持久化、查询和解除关联,单会话最多 500 条。文件须属于当前租户且有效。默认路径为 /mnt/session/uploads/<file_id>,自定义路径归一到该目录,拒绝父目录遍历。不修改文件内容;本批尚不将资源同步到沙箱。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Resource id, the resource_id of sessions.resources calls. |
| created_at | string | A timestamp in RFC 3339 format |
| file_id | string | Id of the uploaded file; it must exist and belong to your tenant. |
| mount_path | string | Path inside the machine where the file is mounted; defaults to /mnt/session/uploads/<file_id>, and custom paths are rooted there. |
| type | string | Always `file`. A file resource: an uploaded file mounted into the session's machine. |
| updated_at | string | A timestamp in RFC 3339 format |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/agent/v1/sessions/{session_id}/resources◐ 部分支持session_idstring必填path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
limitnumber可选query: Number of items per page.
pagestring可选query: Opaque pagination cursor: pass the next_page value of the previous response unchanged. Omit it for the first page. A cursor from a different query or a malformed one returns 400.
200
支持 file 类型资源的持久化、查询和解除关联,单会话最多 500 条。文件须属于当前租户且有效。默认路径为 /mnt/session/uploads/<file_id>,自定义路径归一到该目录,拒绝父目录遍历。不修改文件内容;本批尚不将资源同步到沙箱。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | Items of this page, in the order requested by the call. |
| data[].id | string | Resource id, the resource_id of sessions.resources calls. |
| data[].created_at | string | A timestamp in RFC 3339 format |
| data[].mount_path | string | null | string | Path inside the machine where the file is mounted; defaults to /mnt/session/uploads/<file_id>, and custom paths are rooted there. / Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only. |
| data[].type | string | Always `github_repository`. A GitHub repository resource; not supported on this platform. / Always `file`. A file resource: an uploaded file mounted into the session's machine. / Always `memory_store`. A memory store resource; not supported on this platform. |
| data[].updated_at | string | A timestamp in RFC 3339 format |
| data[].url | string | Repository URL. |
| data[].checkout | null | object | Branch or commit to check out. |
| data[].file_id | string | Id of the uploaded file; it must exist and belong to your tenant. |
| data[].memory_store_id | string | The memory store ID (memstore_...). Must belong to the caller's organization and workspace. |
| data[].access | null | string | Access mode for an attached memory store. |
| data[].description | string | Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description. |
| data[].instructions | null | string | Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars. |
| data[].name | null | string | Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource. |
| next_page | string | null | Opaque cursor for the next page: pass it unchanged as page to continue. Null when this is the last page. |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。 先调用「添加会话资源」,用返回的资源 ID 替换 sesrsc_123。
/agent/v1/sessions/{session_id}/resources/{resource_id}◐ 部分支持session_idstring必填path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
resource_idstring必填path: Id of a resource attached to the session, as returned by sessions.resources.add or sessions.resources.list.
session_idstring必填query: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
200
支持 file 类型资源的持久化、查询和解除关联,单会话最多 500 条。文件须属于当前租户且有效。默认路径为 /mnt/session/uploads/<file_id>,自定义路径归一到该目录,拒绝父目录遍历。不修改文件内容;本批尚不将资源同步到沙箱。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Resource id, the resource_id of sessions.resources calls. |
| created_at | string | A timestamp in RFC 3339 format |
| mount_path | string | null | string | Path inside the machine where the file is mounted; defaults to /mnt/session/uploads/<file_id>, and custom paths are rooted there. / Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only. |
| type | string | Always `github_repository`. A GitHub repository resource; not supported on this platform. / Always `file`. A file resource: an uploaded file mounted into the session's machine. / Always `memory_store`. A memory store resource; not supported on this platform. |
| updated_at | string | A timestamp in RFC 3339 format |
| url | string | Repository URL. |
| checkout | null | object | Branch or commit to check out. |
| checkout.name | string | Branch name to check out. |
| checkout.type | string | Always `branch`. Check out the named branch. / Always `commit`. Check out the commit with the given SHA. |
| checkout.sha | string | Full commit SHA to check out. |
| file_id | string | Id of the uploaded file; it must exist and belong to your tenant. |
| memory_store_id | string | The memory store ID (memstore_...). Must belong to the caller's organization and workspace. |
| access | null | string | Access mode for an attached memory store. |
| description | string | Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description. |
| instructions | null | string | Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars. |
| name | null | string | Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource. |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。 先调用「添加会话资源」,用返回的资源 ID 替换 sesrsc_123。
/agent/v1/sessions/{session_id}/resources/{resource_id}◐ 部分支持session_idstring必填path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
resource_idstring必填path: Id of a resource attached to the session, as returned by sessions.resources.add or sessions.resources.list.
session_idstring必填query: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
200
支持 file 类型资源的持久化、查询和解除关联,单会话最多 500 条。文件须属于当前租户且有效。默认路径为 /mnt/session/uploads/<file_id>,自定义路径归一到该目录,拒绝父目录遍历。不修改文件内容;本批尚不将资源同步到沙箱。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Identifier of the object, as returned by the API; pass it in the path of follow-up calls on the same resource. |
| type | string | Always `session_resource_deleted`. Confirms that a resource was detached from the session. |
/agent/v1/agents● 支持created_at[gte]string可选query: Return agents created at or after this time (inclusive).
created_at[lte]string可选query: Return agents created at or before this time (inclusive).
include_archivedboolean可选query: Include archived agents in results. Defaults to false.
limitnumber可选query: Number of items per page.
pagestring可选query: Opaque pagination cursor: pass the next_page value of the previous response unchanged. Omit it for the first page. A cursor from a different query or a malformed one returns 400.
200
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | Items of this page, in the order requested by the call. |
| data[].id | string | Agent id (agent_...). Pass it as agent when creating a session and as agent_id in agent calls. |
| data[].archived_at | null | string | A timestamp in RFC 3339 format |
| data[].created_at | string | A timestamp in RFC 3339 format |
| data[].description | null | string | Free-text description of what the agent is for; null when none was set. |
| data[].mcp_servers | array<object> | URL MCP servers the agent can call, paired one-to-one with mcp_toolset entries in tools and saved with the agent version. No credentials are stored here. |
| data[].metadata | object | Free-form string key/value pairs stored with the agent for your own bookkeeping. |
| data[].model | object | Model identifier and configuration. |
| data[].multiagent | null | object | Resolved coordinator topology with a concrete agent roster. |
| data[].name | string | Display name of the agent, as set on create or update. It is a label, not a unique key. |
| data[].skills | array<object> | Skills attached to the agent. Setting skills is not supported on this platform and returns 400, so do not send this field on create or update. |
| data[].system | null | string | System prompt given to the model at the start of every session of this agent; null when none was set. |
| data[].tools | array<object> | Tools of the agent: one agent_toolset_20260401 entry for the native tools (all resolved settings are returned, ready to send back on update), plus mcp_toolset entries and custom tool definitions. |
| data[].type | string | Always `agent`. An agent definition. |
| data[].updated_at | string | A timestamp in RFC 3339 format |
| data[].version | number | The agent's current version. Starts at 1 and increments when the agent is modified. |
| data[].computer_id | string | Praxis extension: MA only has session-scoped temporary containers and memory_stores, not durable browsable computers. computer_id selects a tenant-owned active computer. Session selection overrides the agent default; a sandbox environment_id and computer_id cannot be combined. Omitted when no computer is selected. |
| data[].subagent_model | string | null | Praxis extension: default subagent model ID, pinned in the agent revision. Call model overrides this; otherwise it overrides the roster member model or the parent model for built-ins. Null clears the default. /agent/v1 only. |
| data[].models | object | 扩展 / Praxis extension: switchable model ids on /agent/v1 only. The default model must be included. When omitted, only the default model is selectable. |
| next_page | string | null | Opaque cursor for the next page: pass it unchanged as page to continue. Null when this is the last page. |
/agent/v1/agents◐ 部分支持namestring必填智能体名称,1–255 个字符,工作区内可读。
modelstring | object必填智能体使用的模型:直接写模型名字符串(如 claude-opus-5),或传对象做附加配置(见子字段)。
idstring必填模型名字符串,如 claude-opus-5。
effortstring | object可选每次推理的思考力度:可传级别字符串(如 high)或 {type: high} 对象。创建时省略取该模型的默认值;更新时省略保持不变。
inference_geostring可选模型推理的地理区域;不传沿用工作区默认。model 是整体替换字段,更新时省略子字段即清除该项。
speedstring可选推理速度模式:fast 出字显著更快但按溢价计费;并非所有模型都支持,不支持的组合在创建时被拒。
settingsobject可选Platform model settings. Only reasoning is supported; other model controls return 400.
systemstring可选智能体的系统提示词。
metadataobject可选自定义元数据键值对,最多 16 个键、每个值最长 512 字符。
descriptionstring可选智能体的用途说明。
mcp_serversarray可选智能体连接的 MCP 服务器列表,最多 20 个,名称必须唯一;每个服务器都要被 tools 里的 mcp_toolset 引用,否则整笔请求被拒。
typestring必填服务器类型,目前只支持 url。
namestring必填MCP 服务器在本列表内的唯一名称,1–255 个字符,供 mcp_toolset 配置引用。
urlstring必填MCP 服务器的端点地址。
multiagentobject可选◐ 部分支持多智能体协作拓扑:会话主线程作为协调者,从 agents 名单派生会话线程执行工作。
agentsarray必填协调者可以派生为会话线程的智能体名单,1–20 项;支持 ID 字符串、{type: agent, id, version?} 和最多一个 {type: self}。创建/更新时固定版本。成员须唯一、存在且未归档,不能自身带 multiagent。每个 coordinator 最多一个 advisor,模型须可用且不同于智能体模型;仅主会话可咨询,每次咨询为独立 advisor 线程,建议以 agent.thread_message_received 返回。
typestring必填拓扑类型,目前只有 coordinator。
skillsarray可选智能体可用的 Skill 列表。
toolsarray可选智能体可用的工具配置,所有工具合计最多 128 个。
computer_idstring可选Praxis extension: MA only has session-scoped temporary containers and memory_stores, not durable browsable computers. computer_id selects a tenant-owned active computer. Session selection overrides the agent default; a sandbox environment_id and computer_id cannot be combined.
subagent_modelstring可选/agent/v1 扩展:智能体级子智能体默认模型 ID,随修订固定。省略保持,null 清除。调用 model 优先,其次本字段,再其次名册成员模型或内置类型的父会话模型。/anthropic 不接受或返回此字段。
modelsobject可选扩展:可切换模型列表,仅 /agent/v1 支持。
allowedarray必填必须包含默认模型;创建时省略表示只能使用默认模型。更新时省略保持不变。会话使用其钉住版本的列表。
200
agent_toolset_20260401 是原生工具集,包含 bash、edit、glob、grep、read、write、web_search、web_fetch,以及 TaskOutput、TaskStop、Monitor、Agent、SendMessage。新建智能体默认全部启用;configs 可逐个设置 name、enabled、permission_policy,未列出的工具遵循 default_config(默认启用)。后台任务、Monitor 和子智能体依赖 bash;启用任一后台工具时,bash 提供 run_in_background。兼容 API /anthropic 只接受和返回官方 8 个工具,经该入口创建的会话也只注册这 8 个工具。 支持文本提示词、模型、元数据与内置工具。model.settings.reasoning 可选 low、medium、high、xhigh、none,为会话提供默认思考档位;会话显式 thinking 优先,不支持的默认值回退到模型 default_effort。示例 model: {id: "deepseek-v4-flash", settings: {reasoning: "high"}}。Skills 及其它额外模型控制尚不支持,传入会返回 400。可在工具集 permissions 中设置 allow、ask、deny 规则,最多共 100 条,用于以后的对话。 multiagent 接受 null 或 coordinator 名册,1–20 项:智能体 ID、{type:"agent",id,version?} 或最多一个 {type:"self"}。创建/更新时固定版本;成员去重且须存在、未归档、不能自身带 multiagent。名册可启用 Agent,仍需启用 bash;SendMessage 遵循工具配置。每个 coordinator 最多一个 advisor,模型须可用且不同于智能体模型;仅主会话可咨询,每次咨询为独立 advisor 线程,建议以 agent.thread_message_received 返回。 /agent/v1 顶层 subagent_model 是可空模型 ID,随智能体版本保存;省略保留、null 清除。模型须存在。优先级为调用 model > subagent_model > 成员模型(内置类型用父会话模型)。/anthropic 不接受或返回此字段。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Agent id (agent_...). Pass it as agent when creating a session and as agent_id in agent calls. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| description | null | string | Free-text description of what the agent is for; null when none was set. |
| mcp_servers | array<object> | URL MCP servers the agent can call, paired one-to-one with mcp_toolset entries in tools and saved with the agent version. No credentials are stored here. |
| mcp_servers[].type | string | Always `url`. An MCP server reached over a URL. |
| mcp_servers[].name | string | Name of the MCP server; the mcp_toolset entry that refers to it uses the same name in mcp_server_name. |
| mcp_servers[].url | string | http(s) endpoint of the MCP server, at most 2048 characters. |
| metadata | object | Free-form string key/value pairs stored with the agent for your own bookkeeping. |
| model | object | Model identifier and configuration. |
| model.id | string | The model that will power your agent. See models for additional details and options. |
| model.effort | object | How hard Claude works on each turn. Sets `output_config.effort` on every Messages call the session makes. |
| model.inference_geo | string | Geographic region for model inference. When unset, requests fall through to the workspace's default_inference_geo. |
| model.speed | string | Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. |
| model.settings | object | Platform model settings. Only reasoning is supported; other model controls return 400. |
| multiagent | null | object | Resolved coordinator topology with a concrete agent roster. |
| multiagent.agents | array<object> | Agents the coordinator may spawn as session threads, each resolved to a specific version. |
| multiagent.type | string | Always `coordinator`. The agent coordinates the roster in agents and can delegate to its members. |
| name | string | Display name of the agent, as set on create or update. It is a label, not a unique key. |
| skills | array<object> | Skills attached to the agent. Setting skills is not supported on this platform and returns 400, so do not send this field on create or update. |
| skills[].skill_id | string | Id of the skill to attach. |
| skills[].type | string | Always `anthropic`. A skill provided by Anthropic, identified by skill_id. / Always `custom`. A skill created by you, identified by skill_id. |
| skills[].version | string | Version of the skill; a string. |
| system | null | string | System prompt given to the model at the start of every session of this agent; null when none was set. |
| tools | array<object> | Tools of the agent: one agent_toolset_20260401 entry for the native tools (all resolved settings are returned, ready to send back on update), plus mcp_toolset entries and custom tool definitions. |
| tools[].configs | array<object> | array | null | Per-tool settings that override default_config. Tools that are not listed follow default_config. |
| tools[].default_config | object | object | null | Resolved default configuration for agent tools. / Settings applied to every tool of this toolset that configs does not name. When omitted, tools are enabled with the always_allow policy. |
| tools[].type | string | Always `agent_toolset_20260401`. The native toolset entry (bash, edit, glob, grep, read, write, web_search, web_fetch, TaskOutput, TaskStop, Monitor, Agent, SendMessage). / Always `mcp_toolset`. An entry that exposes the tools of one MCP server from mcp_servers. / Always `custom`. A custom tool defined by name, description and input_schema; its calls are answered by the client with user.custom_tool_result. |
| tools[].mcp_server_name | string | Name of the MCP server in mcp_servers whose tools this entry exposes. |
| tools[].description | string | What the custom tool does and when the model should call it. |
| tools[].input_schema | object | JSON Schema for custom tool input parameters. |
| tools[].name | string | Name of the custom tool, as the model sees and calls it. |
| type | string | Always `agent`. An agent definition. |
| updated_at | string | A timestamp in RFC 3339 format |
| version | number | The agent's current version. Starts at 1 and increments when the agent is modified. |
| computer_id | string | Praxis extension: MA only has session-scoped temporary containers and memory_stores, not durable browsable computers. computer_id selects a tenant-owned active computer. Session selection overrides the agent default; a sandbox environment_id and computer_id cannot be combined. Omitted when no computer is selected. |
| subagent_model | string | null | Praxis extension: default subagent model ID, pinned in the agent revision. Call model overrides this; otherwise it overrides the roster member model or the parent model for built-ins. Null clears the default. /agent/v1 only. |
| models | object | 扩展 / Praxis extension: switchable model ids on /agent/v1 only. The default model must be included. When omitted, only the default model is selectable. |
| models.allowed | array<string> | Model ids a session may select with its model field; it must be non-empty and must contain the agent's default model. |
先调用「创建智能体」,用返回的智能体 ID 替换示例 ID。
/agent/v1/agents/{agent_id}● 支持agent_idstring必填path: Agent id, as returned by agents.create or agents.list (for a session filter, the agent the session was created with). Not the agent name.
versionnumber可选query: Agent version to read; omit for the latest. Integer of at least 1; versions are listed by agents.versions.list.
200
tools 在一个 agent_toolset_20260401 条目中返回全部原生工具的有效配置,可原样用于更新。将示例中的资源 ID 替换成你创建的资源 ID。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Agent id (agent_...). Pass it as agent when creating a session and as agent_id in agent calls. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| description | null | string | Free-text description of what the agent is for; null when none was set. |
| mcp_servers | array<object> | URL MCP servers the agent can call, paired one-to-one with mcp_toolset entries in tools and saved with the agent version. No credentials are stored here. |
| mcp_servers[].type | string | Always `url`. An MCP server reached over a URL. |
| mcp_servers[].name | string | Name of the MCP server; the mcp_toolset entry that refers to it uses the same name in mcp_server_name. |
| mcp_servers[].url | string | http(s) endpoint of the MCP server, at most 2048 characters. |
| metadata | object | Free-form string key/value pairs stored with the agent for your own bookkeeping. |
| model | object | Model identifier and configuration. |
| model.id | string | The model that will power your agent. See models for additional details and options. |
| model.effort | object | How hard Claude works on each turn. Sets `output_config.effort` on every Messages call the session makes. |
| model.inference_geo | string | Geographic region for model inference. When unset, requests fall through to the workspace's default_inference_geo. |
| model.speed | string | Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. |
| model.settings | object | Platform model settings. Only reasoning is supported; other model controls return 400. |
| multiagent | null | object | Resolved coordinator topology with a concrete agent roster. |
| multiagent.agents | array<object> | Agents the coordinator may spawn as session threads, each resolved to a specific version. |
| multiagent.type | string | Always `coordinator`. The agent coordinates the roster in agents and can delegate to its members. |
| name | string | Display name of the agent, as set on create or update. It is a label, not a unique key. |
| skills | array<object> | Skills attached to the agent. Setting skills is not supported on this platform and returns 400, so do not send this field on create or update. |
| skills[].skill_id | string | Id of the skill to attach. |
| skills[].type | string | Always `anthropic`. A skill provided by Anthropic, identified by skill_id. / Always `custom`. A skill created by you, identified by skill_id. |
| skills[].version | string | Version of the skill; a string. |
| system | null | string | System prompt given to the model at the start of every session of this agent; null when none was set. |
| tools | array<object> | Tools of the agent: one agent_toolset_20260401 entry for the native tools (all resolved settings are returned, ready to send back on update), plus mcp_toolset entries and custom tool definitions. |
| tools[].configs | array<object> | array | null | Per-tool settings that override default_config. Tools that are not listed follow default_config. |
| tools[].default_config | object | object | null | Resolved default configuration for agent tools. / Settings applied to every tool of this toolset that configs does not name. When omitted, tools are enabled with the always_allow policy. |
| tools[].type | string | Always `agent_toolset_20260401`. The native toolset entry (bash, edit, glob, grep, read, write, web_search, web_fetch, TaskOutput, TaskStop, Monitor, Agent, SendMessage). / Always `mcp_toolset`. An entry that exposes the tools of one MCP server from mcp_servers. / Always `custom`. A custom tool defined by name, description and input_schema; its calls are answered by the client with user.custom_tool_result. |
| tools[].mcp_server_name | string | Name of the MCP server in mcp_servers whose tools this entry exposes. |
| tools[].description | string | What the custom tool does and when the model should call it. |
| tools[].input_schema | object | JSON Schema for custom tool input parameters. |
| tools[].name | string | Name of the custom tool, as the model sees and calls it. |
| type | string | Always `agent`. An agent definition. |
| updated_at | string | A timestamp in RFC 3339 format |
| version | number | The agent's current version. Starts at 1 and increments when the agent is modified. |
| computer_id | string | Praxis extension: MA only has session-scoped temporary containers and memory_stores, not durable browsable computers. computer_id selects a tenant-owned active computer. Session selection overrides the agent default; a sandbox environment_id and computer_id cannot be combined. Omitted when no computer is selected. |
| subagent_model | string | null | Praxis extension: default subagent model ID, pinned in the agent revision. Call model overrides this; otherwise it overrides the roster member model or the parent model for built-ins. Null clears the default. /agent/v1 only. |
| models | object | 扩展 / Praxis extension: switchable model ids on /agent/v1 only. The default model must be included. When omitted, only the default model is selectable. |
| models.allowed | array<string> | Model ids a session may select with its model field; it must be non-empty and must contain the agent's default model. |
先调用「创建智能体」,用返回的智能体 ID 替换示例 ID。
/agent/v1/agents/{agent_id}◐ 部分支持agent_idstring必填path: Agent id, as returned by agents.create or agents.list (for a session filter, the agent the session was created with). Not the agent name.
namestring可选智能体名称;省略保持不变,不能传空串清除。
modelstring | object可选智能体使用的模型:直接写模型名字符串(如 claude-opus-5),或传对象做附加配置(见子字段)。
idstring必填模型名字符串,如 claude-opus-5。
effortstring | object可选每次推理的思考力度:可传级别字符串(如 high)或 {type: high} 对象。创建时省略取该模型的默认值;更新时省略保持不变。
inference_geostring可选模型推理的地理区域;不传沿用工作区默认。model 是整体替换字段,更新时省略子字段即清除该项。
speedstring可选推理速度模式:fast 出字显著更快但按溢价计费;并非所有模型都支持,不支持的组合在创建时被拒。
settingsobject可选Platform model settings. Only reasoning is supported; other model controls return 400.
systemstring可选系统提示词;省略保持不变,传空串或 null 清除。
versionnumber可选智能体当前版本号,用于并发保护:必须与最近一次创建/读取返回的版本一致,否则返回冲突。
metadataobject可选元数据补丁:键设为字符串即写入,设为 null 即删除;省略该字段保持不变。存储上限 16 个键、每个值 512 字符。
descriptionstring可选用途说明;省略保持不变,传空串或 null 清除。
mcp_serversarray可选整体替换的 MCP 服务器列表;省略保持不变,传空数组或 null 清除。
multiagentobject可选◐ 部分支持多智能体协作拓扑:会话主线程作为协调者,从 agents 名单派生会话线程执行工作。
agentsarray必填协调者可以派生为会话线程的智能体名单,1–20 项;支持 ID 字符串、{type: agent, id, version?} 和最多一个 {type: self}。创建/更新时固定版本。成员须唯一、存在且未归档,不能自身带 multiagent。每个 coordinator 最多一个 advisor,模型须可用且不同于智能体模型;仅主会话可咨询,每次咨询为独立 advisor 线程,建议以 agent.thread_message_received 返回。
typestring必填拓扑类型,目前只有 coordinator。
skillsarray可选整体替换的 Skill 列表;省略保持不变,传空数组或 null 清除。
toolsarray可选整体替换的工具配置;省略保持不变,传空数组或 null 清除。
computer_idstring可选Praxis extension: MA only has session-scoped temporary containers and memory_stores, not durable browsable computers. computer_id selects a tenant-owned active computer. Session selection overrides the agent default; a sandbox environment_id and computer_id cannot be combined.
subagent_modelstring可选/agent/v1 扩展:智能体级子智能体默认模型 ID,随修订固定。省略保持,null 清除。调用 model 优先,其次本字段,再其次名册成员模型或内置类型的父会话模型。/anthropic 不接受或返回此字段。
modelsobject可选扩展:可切换模型列表,仅 /agent/v1 支持。
allowedarray必填必须包含默认模型;创建时省略表示只能使用默认模型。更新时省略保持不变。会话使用其钉住版本的列表。
200
通过 agent_toolset_20260401.configs 逐个开关原生工具并设置权限。未列出的工具遵循 default_config;后台任务、Monitor 和子智能体依赖 bash。version 可用于乐观并发控制,版本冲突返回 409;无变化的更新不增加版本。Skills 尚不支持。更新工具集 permissions 可把允许的同类操作保存到智能体的新版本,供以后的对话使用。 multiagent 接受 null 或 coordinator 名册,1–20 项:智能体 ID、{type:"agent",id,version?} 或最多一个 {type:"self"}。创建/更新时固定版本;成员去重且须存在、未归档、不能自身带 multiagent。名册可启用 Agent,仍需启用 bash;SendMessage 遵循工具配置。每个 coordinator 最多一个 advisor,模型须可用且不同于智能体模型;仅主会话可咨询,每次咨询为独立 advisor 线程,建议以 agent.thread_message_received 返回。 /agent/v1 顶层 subagent_model 是可空模型 ID,随智能体版本保存;省略保留、null 清除。模型须存在。优先级为调用 model > subagent_model > 成员模型(内置类型用父会话模型)。/anthropic 不接受或返回此字段。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Agent id (agent_...). Pass it as agent when creating a session and as agent_id in agent calls. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| description | null | string | Free-text description of what the agent is for; null when none was set. |
| mcp_servers | array<object> | URL MCP servers the agent can call, paired one-to-one with mcp_toolset entries in tools and saved with the agent version. No credentials are stored here. |
| mcp_servers[].type | string | Always `url`. An MCP server reached over a URL. |
| mcp_servers[].name | string | Name of the MCP server; the mcp_toolset entry that refers to it uses the same name in mcp_server_name. |
| mcp_servers[].url | string | http(s) endpoint of the MCP server, at most 2048 characters. |
| metadata | object | Free-form string key/value pairs stored with the agent for your own bookkeeping. |
| model | object | Model identifier and configuration. |
| model.id | string | The model that will power your agent. See models for additional details and options. |
| model.effort | object | How hard Claude works on each turn. Sets `output_config.effort` on every Messages call the session makes. |
| model.inference_geo | string | Geographic region for model inference. When unset, requests fall through to the workspace's default_inference_geo. |
| model.speed | string | Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. |
| model.settings | object | Platform model settings. Only reasoning is supported; other model controls return 400. |
| multiagent | null | object | Resolved coordinator topology with a concrete agent roster. |
| multiagent.agents | array<object> | Agents the coordinator may spawn as session threads, each resolved to a specific version. |
| multiagent.type | string | Always `coordinator`. The agent coordinates the roster in agents and can delegate to its members. |
| name | string | Display name of the agent, as set on create or update. It is a label, not a unique key. |
| skills | array<object> | Skills attached to the agent. Setting skills is not supported on this platform and returns 400, so do not send this field on create or update. |
| skills[].skill_id | string | Id of the skill to attach. |
| skills[].type | string | Always `anthropic`. A skill provided by Anthropic, identified by skill_id. / Always `custom`. A skill created by you, identified by skill_id. |
| skills[].version | string | Version of the skill; a string. |
| system | null | string | System prompt given to the model at the start of every session of this agent; null when none was set. |
| tools | array<object> | Tools of the agent: one agent_toolset_20260401 entry for the native tools (all resolved settings are returned, ready to send back on update), plus mcp_toolset entries and custom tool definitions. |
| tools[].configs | array<object> | array | null | Per-tool settings that override default_config. Tools that are not listed follow default_config. |
| tools[].default_config | object | object | null | Resolved default configuration for agent tools. / Settings applied to every tool of this toolset that configs does not name. When omitted, tools are enabled with the always_allow policy. |
| tools[].type | string | Always `agent_toolset_20260401`. The native toolset entry (bash, edit, glob, grep, read, write, web_search, web_fetch, TaskOutput, TaskStop, Monitor, Agent, SendMessage). / Always `mcp_toolset`. An entry that exposes the tools of one MCP server from mcp_servers. / Always `custom`. A custom tool defined by name, description and input_schema; its calls are answered by the client with user.custom_tool_result. |
| tools[].mcp_server_name | string | Name of the MCP server in mcp_servers whose tools this entry exposes. |
| tools[].description | string | What the custom tool does and when the model should call it. |
| tools[].input_schema | object | JSON Schema for custom tool input parameters. |
| tools[].name | string | Name of the custom tool, as the model sees and calls it. |
| type | string | Always `agent`. An agent definition. |
| updated_at | string | A timestamp in RFC 3339 format |
| version | number | The agent's current version. Starts at 1 and increments when the agent is modified. |
| computer_id | string | Praxis extension: MA only has session-scoped temporary containers and memory_stores, not durable browsable computers. computer_id selects a tenant-owned active computer. Session selection overrides the agent default; a sandbox environment_id and computer_id cannot be combined. Omitted when no computer is selected. |
| subagent_model | string | null | Praxis extension: default subagent model ID, pinned in the agent revision. Call model overrides this; otherwise it overrides the roster member model or the parent model for built-ins. Null clears the default. /agent/v1 only. |
| models | object | 扩展 / Praxis extension: switchable model ids on /agent/v1 only. The default model must be included. When omitted, only the default model is selectable. |
| models.allowed | array<string> | Model ids a session may select with its model field; it must be non-empty and must contain the agent's default model. |
先调用「创建智能体」,用返回的智能体 ID 替换示例 ID。
/agent/v1/agents/{agent_id}/versions● 支持agent_idstring必填path: Agent id, as returned by agents.create or agents.list (for a session filter, the agent the session was created with). Not the agent name.
limitnumber可选query: Number of items per page.
pagestring可选query: Opaque pagination cursor: pass the next_page value of the previous response unchanged. Omit it for the first page. A cursor from a different query or a malformed one returns 400.
200
将示例中的资源 ID 替换成你创建的资源 ID。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | Items of this page, in the order requested by the call. |
| data[].id | string | Agent id (agent_...). Pass it as agent when creating a session and as agent_id in agent calls. |
| data[].archived_at | null | string | A timestamp in RFC 3339 format |
| data[].created_at | string | A timestamp in RFC 3339 format |
| data[].description | null | string | Free-text description of what the agent is for; null when none was set. |
| data[].mcp_servers | array<object> | URL MCP servers the agent can call, paired one-to-one with mcp_toolset entries in tools and saved with the agent version. No credentials are stored here. |
| data[].metadata | object | Free-form string key/value pairs stored with the agent for your own bookkeeping. |
| data[].model | object | Model identifier and configuration. |
| data[].multiagent | null | object | Resolved coordinator topology with a concrete agent roster. |
| data[].name | string | Display name of the agent, as set on create or update. It is a label, not a unique key. |
| data[].skills | array<object> | Skills attached to the agent. Setting skills is not supported on this platform and returns 400, so do not send this field on create or update. |
| data[].system | null | string | System prompt given to the model at the start of every session of this agent; null when none was set. |
| data[].tools | array<object> | Tools of the agent: one agent_toolset_20260401 entry for the native tools (all resolved settings are returned, ready to send back on update), plus mcp_toolset entries and custom tool definitions. |
| data[].type | string | Always `agent`. An agent definition. |
| data[].updated_at | string | A timestamp in RFC 3339 format |
| data[].version | number | The agent's current version. Starts at 1 and increments when the agent is modified. |
| data[].computer_id | string | Praxis extension: MA only has session-scoped temporary containers and memory_stores, not durable browsable computers. computer_id selects a tenant-owned active computer. Session selection overrides the agent default; a sandbox environment_id and computer_id cannot be combined. Omitted when no computer is selected. |
| data[].subagent_model | string | null | Praxis extension: default subagent model ID, pinned in the agent revision. Call model overrides this; otherwise it overrides the roster member model or the parent model for built-ins. Null clears the default. /agent/v1 only. |
| data[].models | object | 扩展 / Praxis extension: switchable model ids on /agent/v1 only. The default model must be included. When omitted, only the default model is selectable. |
| next_page | string | null | Opaque cursor for the next page: pass it unchanged as page to continue. Null when this is the last page. |
先调用「创建智能体」,用返回的智能体 ID 替换示例 ID。
/agent/v1/agents/{agent_id}/archive● 支持agent_idstring必填path: Agent id, as returned by agents.create or agents.list (for a session filter, the agent the session was created with). Not the agent name.
200
归档后保留查询与历史版本,不能继续更新。请只归档自己的测试智能体。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Agent id (agent_...). Pass it as agent when creating a session and as agent_id in agent calls. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| description | null | string | Free-text description of what the agent is for; null when none was set. |
| mcp_servers | array<object> | URL MCP servers the agent can call, paired one-to-one with mcp_toolset entries in tools and saved with the agent version. No credentials are stored here. |
| mcp_servers[].type | string | Always `url`. An MCP server reached over a URL. |
| mcp_servers[].name | string | Name of the MCP server; the mcp_toolset entry that refers to it uses the same name in mcp_server_name. |
| mcp_servers[].url | string | http(s) endpoint of the MCP server, at most 2048 characters. |
| metadata | object | Free-form string key/value pairs stored with the agent for your own bookkeeping. |
| model | object | Model identifier and configuration. |
| model.id | string | The model that will power your agent. See models for additional details and options. |
| model.effort | object | How hard Claude works on each turn. Sets `output_config.effort` on every Messages call the session makes. |
| model.inference_geo | string | Geographic region for model inference. When unset, requests fall through to the workspace's default_inference_geo. |
| model.speed | string | Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time. |
| model.settings | object | Platform model settings. Only reasoning is supported; other model controls return 400. |
| multiagent | null | object | Resolved coordinator topology with a concrete agent roster. |
| multiagent.agents | array<object> | Agents the coordinator may spawn as session threads, each resolved to a specific version. |
| multiagent.type | string | Always `coordinator`. The agent coordinates the roster in agents and can delegate to its members. |
| name | string | Display name of the agent, as set on create or update. It is a label, not a unique key. |
| skills | array<object> | Skills attached to the agent. Setting skills is not supported on this platform and returns 400, so do not send this field on create or update. |
| skills[].skill_id | string | Id of the skill to attach. |
| skills[].type | string | Always `anthropic`. A skill provided by Anthropic, identified by skill_id. / Always `custom`. A skill created by you, identified by skill_id. |
| skills[].version | string | Version of the skill; a string. |
| system | null | string | System prompt given to the model at the start of every session of this agent; null when none was set. |
| tools | array<object> | Tools of the agent: one agent_toolset_20260401 entry for the native tools (all resolved settings are returned, ready to send back on update), plus mcp_toolset entries and custom tool definitions. |
| tools[].configs | array<object> | array | null | Per-tool settings that override default_config. Tools that are not listed follow default_config. |
| tools[].default_config | object | object | null | Resolved default configuration for agent tools. / Settings applied to every tool of this toolset that configs does not name. When omitted, tools are enabled with the always_allow policy. |
| tools[].type | string | Always `agent_toolset_20260401`. The native toolset entry (bash, edit, glob, grep, read, write, web_search, web_fetch, TaskOutput, TaskStop, Monitor, Agent, SendMessage). / Always `mcp_toolset`. An entry that exposes the tools of one MCP server from mcp_servers. / Always `custom`. A custom tool defined by name, description and input_schema; its calls are answered by the client with user.custom_tool_result. |
| tools[].mcp_server_name | string | Name of the MCP server in mcp_servers whose tools this entry exposes. |
| tools[].description | string | What the custom tool does and when the model should call it. |
| tools[].input_schema | object | JSON Schema for custom tool input parameters. |
| tools[].name | string | Name of the custom tool, as the model sees and calls it. |
| type | string | Always `agent`. An agent definition. |
| updated_at | string | A timestamp in RFC 3339 format |
| version | number | The agent's current version. Starts at 1 and increments when the agent is modified. |
| computer_id | string | Praxis extension: MA only has session-scoped temporary containers and memory_stores, not durable browsable computers. computer_id selects a tenant-owned active computer. Session selection overrides the agent default; a sandbox environment_id and computer_id cannot be combined. Omitted when no computer is selected. |
| subagent_model | string | null | Praxis extension: default subagent model ID, pinned in the agent revision. Call model overrides this; otherwise it overrides the roster member model or the parent model for built-ins. Null clears the default. /agent/v1 only. |
| models | object | 扩展 / Praxis extension: switchable model ids on /agent/v1 only. The default model must be included. When omitted, only the default model is selectable. |
| models.allowed | array<string> | Model ids a session may select with its model field; it must be non-empty and must contain the agent's default model. |
/agent/v1/sessions◐ 部分支持agent_idstring可选query: Return only sessions created with this agent id (from agents.list or agents.create). This is one of the three filters sessions.list supports.
agent_versionnumber可选query: 按智能体版本过滤;仅在同时设置 agent_id 时生效。
created_at[gt]string可选query: Exclusive created-at lower bound for sessions. Declared by the Managed Agents shape but not supported here; sending it returns 400.
created_at[gte]string可选query: Created-at lower bound for sessions. Declared by the Managed Agents shape but not supported here: sessions.list honors only limit, page and agent_id, and other filters return 400.
created_at[lt]string可选query: Exclusive created-at upper bound for sessions. Declared by the Managed Agents shape but not supported here; sending it returns 400.
created_at[lte]string可选query: Created-at upper bound for sessions. Declared by the Managed Agents shape but not supported here: sessions.list honors only limit, page and agent_id, and other filters return 400.
deployment_idstring可选query: Declared by the Managed Agents shape but not supported by sessions.list; sending it returns 400.
include_archivedboolean可选query: Declared by the Managed Agents shape but not supported by sessions.list; sending it returns 400. Archived sessions are retrievable by id.
memory_store_idstring可选query: Declared by the Managed Agents shape but not supported by sessions.list; sending it returns 400.
orderstring可选query: 按创建时间排序:asc 从旧到新,desc 从新到旧(默认)。
statusesarray可选query: 按会话状态过滤,可重复该参数匹配多种状态。
limitnumber可选query: Number of items per page.
pagestring可选query: Opaque pagination cursor: pass the next_page value of the previous response unchanged. Omit it for the first page. A cursor from a different query or a malformed one returns 400.
200
支持 limit、page 与 agent_id;agent_version、时间范围、deployment_id、memory_store_id、include_archived、order、statuses 尚不支持,传入返回 400。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | Items of this page, in the order requested by the call. |
| data[].id | string | Session id (sesn_...). Pass it as session_id in every session call. |
| data[].agent | object | Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. |
| data[].archived_at | null | string | A timestamp in RFC 3339 format |
| data[].budget | null | object | A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`. |
| data[].created_at | string | A timestamp in RFC 3339 format |
| data[].environment_id | string | Id of the environment recipe the session's sandbox was created from. Omitted when no recipe was selected, that is, for a light machine or the Computer chosen by computer_id. |
| data[].metadata | object | Free-form string key/value pairs stored with the session, changed through sessions.update patch semantics. |
| data[].outcome_evaluations | array<object> | Per-outcome evaluation state. One entry per `define_outcome` event sent to the session. |
| data[].resources | array<object> | Resources attached to the session, at most 500; each is a file reference mounted into the session's machine. |
| data[].stats | object | Timing statistics for a session. |
| data[].status | string | SessionStatus enum - `rescheduling` - Transient error occurred, retrying automatically. - `running` - Agent is actively executing. - `idle` - Agent is waiting for input, including user messages or tool confirmations. Sessions start in idle. - `terminated` - Session has ended, either due to an error or completion. |
| data[].title | null | string | Title of the session, set on create or through sessions.update; null when none was set. |
| data[].type | string | Always `session`. A session, one conversation of an agent on a machine. |
| data[].updated_at | string | A timestamp in RFC 3339 format |
| data[].usage | object | Cumulative token usage for a session across all turns. |
| data[].vault_ids | array<string> | Vault IDs attached to the session at creation. Empty when no vaults were supplied. |
| data[].deployment_id | null | string | Deployment ID when the session was created from a deployment reference. Null otherwise. |
| data[].cwd | string | Normalized session working directory; defaults to /home/user/workspace. Forks inherit this directory. |
| data[].computer_id | string | Praxis extension: MA only has session-scoped temporary containers and memory_stores, not durable browsable computers. computer_id selects a tenant-owned active computer. Session selection overrides the agent default; a sandbox environment_id and computer_id cannot be combined. Omitted when no computer is selected. |
| data[].model | object | 扩展 / Praxis extension: the currently selected session model. |
| data[].thinking | object | null | Praxis extension: explicit session thinking effort; null inherits the pinned agent default, then the model default. none disables thinking only when model.thinking.can_disable is true. Unsupported efforts return 400 invalid_request_error. |
| data[].forked_from | object | null | Praxis extension: source of a forked session; null for other sessions. Available only on /agent/v1. |
| next_page | string | null | Opaque cursor for the next page: pass it unchanged as page to continue. Null when this is the last page. |
先调用「创建智能体」,用返回的智能体 ID 替换示例 ID。
/agent/v1/sessions◐ 部分支持modelstring可选智能体使用的模型:直接写模型名字符串(如 claude-opus-5),或传对象做附加配置(见子字段)。
agentstring | object必填会话要运行的智能体:直接写智能体 ID 字符串(固定用最新版本),或传对象指定 id 与 version(见子字段)。
idstring必填会话要运行的智能体 ID。
typestring必填引用类型,目前只有 agent。
versionnumber可选固定使用的智能体版本;省略用最新版本。
mcp_serversarray可选替换本会话的 MCP 服务器列表:传入的数组整体生效;传空数组清除,省略沿用智能体的配置。
modelstring | object可选替换本会话的模型:模型名字符串(如 claude-opus-5)或配置对象;省略沿用智能体自身的模型。
skillsarray可选替换本会话的 Skill 列表;传空数组清除,省略沿用智能体的配置。
systemstring可选替换本会话的系统提示词,最长 100,000 字符;传 null 清除,省略沿用智能体的。
toolsarray可选替换本会话的工具配置;传空数组清除,省略沿用智能体的配置。
environment_idstring可选会话运行所在的环境 ID,决定容器的基础环境。
titlestring可选会话标题,便于在控制台辨认。
metadataobject可选会话的自定义元数据键值对。
budgetobject可选会话的预算上限设置。
max_list_costobject必填预算内列表类调用的花费上限。
typestring必填预算类型,目前只有 max_list_cost。
initial_eventsarray可选创建时按顺序发给会话的初始事件,支持 user.message 与 user.define_outcome,一次最多 50 条。
resourcesarray可选要挂载进会话容器的资源(如代码仓库、文件)。
vault_idsarray可选保险库 ID 列表:会话里智能体可以使用这些已存凭据。
cwdstring可选Session working directory on any machine. Must be an absolute path within /home/user with no . or .. segments. Repeated and trailing slashes are normalized. Invalid values return 400 invalid_request_error with Invalid cwd.
computer_idstring可选Praxis extension: MA only has session-scoped temporary containers and memory_stores, not durable browsable computers. computer_id selects a tenant-owned active computer. Session selection overrides the agent default; a sandbox environment_id and computer_id cannot be combined.
time_zonestring可选Praxis extension: the session's IANA time zone name (e.g. Asia/Shanghai) — the clock the runtime environment block renders for every turn. Absent means UTC. Only IANA names are accepted; fixed offsets ("+08:00") and unknown names return 400. Never stored in `metadata`.
thinkingobject可选Praxis extension: explicit session thinking effort; null inherits the pinned agent default, then the model default. none disables thinking only when model.thinking.can_disable is true. Unsupported efforts return 400 invalid_request_error.
effortstring必填Thinking level for this session. The model must support the chosen effort; none requires can_disable. Null on thinking restores inheritance from the agent and model.
200
可在创建时传 model(models.allowed 内的 ID 字符串;无 allowed 时只允许默认模型)与 thinking({effort: "low|medium|high|xhigh|none"} 或 null),在首条 initial_events 执行前保存。省略或 null 继承智能体默认,再使用模型默认。档位必须在 model.thinking.efforts 内;none 要求 can_disable 为 true,否则返回 400 invalid_request_error。响应包含 thinking 与 model.thinking: {efforts, can_disable, default_effort};未知能力为 null,默认档位也可为 null。示例:{"agent":"agent_123","model":"deepseek-v4-flash","thinking":{"effort":"xhigh"}}。这些选择字段只在 /agent/v1 提供。先创建智能体,将示例 agent_123 换成返回的 id。省略 environment_id 得到轻量机器(light),有默认或显式 computer_id 时使用该 Computer;指定 node22 或租户自建 cloud 环境则使用沙箱配方。无配方时响应省略 environment_id。不支持内联智能体覆盖、预算与凭据库。支持 file 类型资源的持久化、查询和解除关联,单会话最多 500 条。文件须属于当前租户且有效。默认路径为 /mnt/session/uploads/<file_id>,自定义路径归一到该目录,拒绝父目录遍历。不修改文件内容;本批尚不将资源同步到沙箱。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Session id (sesn_...). Pass it as session_id in every session call. |
| agent | object | Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. |
| agent.id | string | Agent id (agent_...). Pass it as agent when creating a session and as agent_id in agent calls. |
| agent.description | null | string | Free-text description of what the agent is for; null when none was set. |
| agent.mcp_servers | array<object> | URL MCP servers the agent can call, paired one-to-one with mcp_toolset entries in tools and saved with the agent version. No credentials are stored here. |
| agent.model | object | Model identifier and configuration. |
| agent.multiagent | null | object | Resolved coordinator topology with full agent definitions for each roster member. |
| agent.name | string | Display name of the agent, as set on create or update. It is a label, not a unique key. |
| agent.skills | array<object> | Skills attached to the agent. Setting skills is not supported on this platform and returns 400, so do not send this field on create or update. |
| agent.system | null | string | System prompt given to the model at the start of every session of this agent; null when none was set. |
| agent.tools | array<object> | Tools of the agent: one agent_toolset_20260401 entry for the native tools (all resolved settings are returned, ready to send back on update), plus mcp_toolset entries and custom tool definitions. |
| agent.type | string | Always `agent`. An agent definition. |
| agent.version | number | The agent's current version. Starts at 1 and increments each time the agent is modified. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| budget | null | object | A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`. |
| budget.max_list_cost | object | A monetary amount in a specific currency. |
| budget.type | string | Always `limit`. A spending limit. |
| created_at | string | A timestamp in RFC 3339 format |
| environment_id | string | Id of the environment recipe the session's sandbox was created from. Omitted when no recipe was selected, that is, for a light machine or the Computer chosen by computer_id. |
| metadata | object | Free-form string key/value pairs stored with the session, changed through sessions.update patch semantics. |
| outcome_evaluations | array<object> | Per-outcome evaluation state. One entry per `define_outcome` event sent to the session. |
| outcome_evaluations[].completed_at | null | string | A timestamp in RFC 3339 format |
| outcome_evaluations[].description | string | What the agent should produce. |
| outcome_evaluations[].explanation | null | string | Grader's verdict text from the most recent evaluation. For `satisfied`, explains why criteria are met; for `needs_revision` (intermediate), what's missing; for `failed`, why unrecoverable. |
| outcome_evaluations[].iteration | number | 0-indexed revision cycle the outcome is currently on. |
| outcome_evaluations[].outcome_id | string | Server-generated outc_ ID for this outcome. |
| outcome_evaluations[].result | string | Current evaluation state. `pending` before the agent begins work; `running` while producing or revising; `evaluating` while the grader scores; `satisfied`/`max_iterations_reached`/`failed`/`interrupted` are terminal. |
| outcome_evaluations[].type | string | Always `outcome_evaluation`. Record of one outcome evaluation. |
| resources | array<object> | Resources attached to the session, at most 500; each is a file reference mounted into the session's machine. |
| resources[].id | string | Resource id, the resource_id of sessions.resources calls. |
| resources[].created_at | string | A timestamp in RFC 3339 format |
| resources[].mount_path | string | null | string | Path inside the machine where the file is mounted; defaults to /mnt/session/uploads/<file_id>, and custom paths are rooted there. / Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only. |
| resources[].type | string | Always `github_repository`. A GitHub repository resource; not supported on this platform. / Always `file`. A file resource: an uploaded file mounted into the session's machine. / Always `memory_store`. A memory store resource; not supported on this platform. |
| resources[].updated_at | string | A timestamp in RFC 3339 format |
| resources[].url | string | Repository URL. |
| resources[].checkout | null | object | Branch or commit to check out. |
| resources[].file_id | string | Id of the uploaded file; it must exist and belong to your tenant. |
| resources[].memory_store_id | string | The memory store ID (memstore_...). Must belong to the caller's organization and workspace. |
| resources[].access | null | string | Access mode for an attached memory store. |
| resources[].description | string | Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description. |
| resources[].instructions | null | string | Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars. |
| resources[].name | null | string | Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource. |
| stats | object | Timing statistics for a session. |
| stats.active_seconds | number | Cumulative time in seconds the session spent in `running` status. Excludes idle time. |
| stats.duration_seconds | number | Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. |
| status | string | SessionStatus enum - `rescheduling` - Transient error occurred, retrying automatically. - `running` - Agent is actively executing. - `idle` - Agent is waiting for input, including user messages or tool confirmations. Sessions start in idle. - `terminated` - Session has ended, either due to an error or completion. |
| title | null | string | Title of the session, set on create or through sessions.update; null when none was set. |
| type | string | Always `session`. A session, one conversation of an agent on a machine. |
| updated_at | string | A timestamp in RFC 3339 format |
| usage | object | Cumulative token usage for a session across all turns. |
| usage.active_seconds | number | Cumulative time in seconds during which the session had at least one thread in running status. Overlapping activity from concurrent threads is counted once, unlike `stats.active_seconds`, which sums each thread's own active time. This is the duration the session's runtime cost is priced on. |
| usage.cache_creation | object | Prompt-cache creation token usage broken down by cache lifetime. |
| usage.cache_read_input_tokens | number | Total tokens read from prompt cache. |
| usage.input_tokens | number | Total input tokens consumed across all turns. |
| usage.list_cost | null | object | A monetary amount in a specific currency. |
| usage.output_tokens | number | Total output tokens generated across all turns. |
| usage.server_tool_use | null | object | Cumulative count of server-executed tool invocations, broken down by tool. |
| vault_ids | array<string> | Vault IDs attached to the session at creation. Empty when no vaults were supplied. |
| deployment_id | null | string | Deployment ID when the session was created from a deployment reference. Null otherwise. |
| cwd | string | Normalized session working directory; defaults to /home/user/workspace. Forks inherit this directory. |
| computer_id | string | Praxis extension: MA only has session-scoped temporary containers and memory_stores, not durable browsable computers. computer_id selects a tenant-owned active computer. Session selection overrides the agent default; a sandbox environment_id and computer_id cannot be combined. Omitted when no computer is selected. |
| model | object | 扩展 / Praxis extension: the currently selected session model. |
| model.id | string | Identifier of the object, as returned by the API; pass it in the path of follow-up calls on the same resource. |
| model.thinking | object | null | Supported thinking controls, or null when capability is unknown or unavailable. efforts lists selectable strengths; can_disable permits none; default_effort is nullable. |
| thinking | object | null | Praxis extension: explicit session thinking effort; null inherits the pinned agent default, then the model default. none disables thinking only when model.thinking.can_disable is true. Unsupported efforts return 400 invalid_request_error. |
| thinking.effort | string | Thinking level saved for this session: low, medium, high, xhigh, or none to turn thinking off. Null or absent means the session inherits the agent default and then the model default. |
| forked_from | object | null | Praxis extension: source of a forked session; null for other sessions. Available only on /agent/v1. |
| forked_from.session_id | string | Id of the parent session this session was forked from; it is left unchanged by the fork. |
| forked_from.message_id | string | message_id of the agent message in the parent session up to which the conversation was copied. |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/agent/v1/sessions/{session_id}● 支持session_idstring必填path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
200
将示例中的资源 ID 替换成你创建的资源 ID。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Session id (sesn_...). Pass it as session_id in every session call. |
| agent | object | Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. |
| agent.id | string | Agent id (agent_...). Pass it as agent when creating a session and as agent_id in agent calls. |
| agent.description | null | string | Free-text description of what the agent is for; null when none was set. |
| agent.mcp_servers | array<object> | URL MCP servers the agent can call, paired one-to-one with mcp_toolset entries in tools and saved with the agent version. No credentials are stored here. |
| agent.model | object | Model identifier and configuration. |
| agent.multiagent | null | object | Resolved coordinator topology with full agent definitions for each roster member. |
| agent.name | string | Display name of the agent, as set on create or update. It is a label, not a unique key. |
| agent.skills | array<object> | Skills attached to the agent. Setting skills is not supported on this platform and returns 400, so do not send this field on create or update. |
| agent.system | null | string | System prompt given to the model at the start of every session of this agent; null when none was set. |
| agent.tools | array<object> | Tools of the agent: one agent_toolset_20260401 entry for the native tools (all resolved settings are returned, ready to send back on update), plus mcp_toolset entries and custom tool definitions. |
| agent.type | string | Always `agent`. An agent definition. |
| agent.version | number | The agent's current version. Starts at 1 and increments each time the agent is modified. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| budget | null | object | A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`. |
| budget.max_list_cost | object | A monetary amount in a specific currency. |
| budget.type | string | Always `limit`. A spending limit. |
| created_at | string | A timestamp in RFC 3339 format |
| environment_id | string | Id of the environment recipe the session's sandbox was created from. Omitted when no recipe was selected, that is, for a light machine or the Computer chosen by computer_id. |
| metadata | object | Free-form string key/value pairs stored with the session, changed through sessions.update patch semantics. |
| outcome_evaluations | array<object> | Per-outcome evaluation state. One entry per `define_outcome` event sent to the session. |
| outcome_evaluations[].completed_at | null | string | A timestamp in RFC 3339 format |
| outcome_evaluations[].description | string | What the agent should produce. |
| outcome_evaluations[].explanation | null | string | Grader's verdict text from the most recent evaluation. For `satisfied`, explains why criteria are met; for `needs_revision` (intermediate), what's missing; for `failed`, why unrecoverable. |
| outcome_evaluations[].iteration | number | 0-indexed revision cycle the outcome is currently on. |
| outcome_evaluations[].outcome_id | string | Server-generated outc_ ID for this outcome. |
| outcome_evaluations[].result | string | Current evaluation state. `pending` before the agent begins work; `running` while producing or revising; `evaluating` while the grader scores; `satisfied`/`max_iterations_reached`/`failed`/`interrupted` are terminal. |
| outcome_evaluations[].type | string | Always `outcome_evaluation`. Record of one outcome evaluation. |
| resources | array<object> | Resources attached to the session, at most 500; each is a file reference mounted into the session's machine. |
| resources[].id | string | Resource id, the resource_id of sessions.resources calls. |
| resources[].created_at | string | A timestamp in RFC 3339 format |
| resources[].mount_path | string | null | string | Path inside the machine where the file is mounted; defaults to /mnt/session/uploads/<file_id>, and custom paths are rooted there. / Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only. |
| resources[].type | string | Always `github_repository`. A GitHub repository resource; not supported on this platform. / Always `file`. A file resource: an uploaded file mounted into the session's machine. / Always `memory_store`. A memory store resource; not supported on this platform. |
| resources[].updated_at | string | A timestamp in RFC 3339 format |
| resources[].url | string | Repository URL. |
| resources[].checkout | null | object | Branch or commit to check out. |
| resources[].file_id | string | Id of the uploaded file; it must exist and belong to your tenant. |
| resources[].memory_store_id | string | The memory store ID (memstore_...). Must belong to the caller's organization and workspace. |
| resources[].access | null | string | Access mode for an attached memory store. |
| resources[].description | string | Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description. |
| resources[].instructions | null | string | Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars. |
| resources[].name | null | string | Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource. |
| stats | object | Timing statistics for a session. |
| stats.active_seconds | number | Cumulative time in seconds the session spent in `running` status. Excludes idle time. |
| stats.duration_seconds | number | Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. |
| status | string | SessionStatus enum - `rescheduling` - Transient error occurred, retrying automatically. - `running` - Agent is actively executing. - `idle` - Agent is waiting for input, including user messages or tool confirmations. Sessions start in idle. - `terminated` - Session has ended, either due to an error or completion. |
| title | null | string | Title of the session, set on create or through sessions.update; null when none was set. |
| type | string | Always `session`. A session, one conversation of an agent on a machine. |
| updated_at | string | A timestamp in RFC 3339 format |
| usage | object | Cumulative token usage for a session across all turns. |
| usage.active_seconds | number | Cumulative time in seconds during which the session had at least one thread in running status. Overlapping activity from concurrent threads is counted once, unlike `stats.active_seconds`, which sums each thread's own active time. This is the duration the session's runtime cost is priced on. |
| usage.cache_creation | object | Prompt-cache creation token usage broken down by cache lifetime. |
| usage.cache_read_input_tokens | number | Total tokens read from prompt cache. |
| usage.input_tokens | number | Total input tokens consumed across all turns. |
| usage.list_cost | null | object | A monetary amount in a specific currency. |
| usage.output_tokens | number | Total output tokens generated across all turns. |
| usage.server_tool_use | null | object | Cumulative count of server-executed tool invocations, broken down by tool. |
| vault_ids | array<string> | Vault IDs attached to the session at creation. Empty when no vaults were supplied. |
| deployment_id | null | string | Deployment ID when the session was created from a deployment reference. Null otherwise. |
| cwd | string | Normalized session working directory; defaults to /home/user/workspace. Forks inherit this directory. |
| computer_id | string | Praxis extension: MA only has session-scoped temporary containers and memory_stores, not durable browsable computers. computer_id selects a tenant-owned active computer. Session selection overrides the agent default; a sandbox environment_id and computer_id cannot be combined. Omitted when no computer is selected. |
| model | object | 扩展 / Praxis extension: the currently selected session model. |
| model.id | string | Identifier of the object, as returned by the API; pass it in the path of follow-up calls on the same resource. |
| model.thinking | object | null | Supported thinking controls, or null when capability is unknown or unavailable. efforts lists selectable strengths; can_disable permits none; default_effort is nullable. |
| thinking | object | null | Praxis extension: explicit session thinking effort; null inherits the pinned agent default, then the model default. none disables thinking only when model.thinking.can_disable is true. Unsupported efforts return 400 invalid_request_error. |
| thinking.effort | string | Thinking level saved for this session: low, medium, high, xhigh, or none to turn thinking off. Null or absent means the session inherits the agent default and then the model default. |
| forked_from | object | null | Praxis extension: source of a forked session; null for other sessions. Available only on /agent/v1. |
| forked_from.session_id | string | Id of the parent session this session was forked from; it is left unchanged by the fork. |
| forked_from.message_id | string | message_id of the agent message in the parent session up to which the conversation was copied. |
/agent/v1/sessions/{session_id}/fork● 支持session_idstring必填path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
message_idstring必填分支点的 UI 消息 ID,取自自有面事件的 message_id 字段;须为成功完成轮次的最后一条助手消息。
201
仅在 /agent/v1 提供。message_id 来自 /agent/v1 事件的同名字段,不是事件 id。复制截至并包含该消息的全部对话与工具调用结果;父会话不变,其他轮次正在运行不影响已有完成轮次的分支。新会话沿用智能体及版本、当前模型与思考设置和 cwd 工作目录,标题为父标题加「 的分支」,作为普通根会话出现在列表中。父会话有沙箱时复制沙箱及内存快照,新会话独立拥有该沙箱;继承的运行中后台任务被终止,门铃目标只保留新会话,新后台任务表为空。父会话没有沙箱时保留懒创建。返回 201,响应与读取会话相同,forked_from 为 {session_id, message_id},普通会话为 null。新会话历史末尾有 session.forked 事件,包含 forked_from_session_id 与 forked_from_message_id。上述字段和事件仅在 /agent/v1 可见。非法请求返回 400;不满足分支条件返回 409 FORK_TARGET_INVALID;会话不存在或不属于调用者返回 404。初始化失败时不公开新会话,并回收已分出的沙箱。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Forked session (same shape as session retrieval)
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Session id (sesn_...). Pass it as session_id in every session call. |
| agent | object | Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. |
| agent.id | string | Agent id (agent_...). Pass it as agent when creating a session and as agent_id in agent calls. |
| agent.description | null | string | Free-text description of what the agent is for; null when none was set. |
| agent.mcp_servers | array<object> | URL MCP servers the agent can call, paired one-to-one with mcp_toolset entries in tools and saved with the agent version. No credentials are stored here. |
| agent.model | object | Model identifier and configuration. |
| agent.multiagent | null | object | Resolved coordinator topology with full agent definitions for each roster member. |
| agent.name | string | Display name of the agent, as set on create or update. It is a label, not a unique key. |
| agent.skills | array<object> | Skills attached to the agent. Setting skills is not supported on this platform and returns 400, so do not send this field on create or update. |
| agent.system | null | string | System prompt given to the model at the start of every session of this agent; null when none was set. |
| agent.tools | array<object> | Tools of the agent: one agent_toolset_20260401 entry for the native tools (all resolved settings are returned, ready to send back on update), plus mcp_toolset entries and custom tool definitions. |
| agent.type | string | Always `agent`. An agent definition. |
| agent.version | number | The agent's current version. Starts at 1 and increments each time the agent is modified. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| budget | null | object | A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`. |
| budget.max_list_cost | object | A monetary amount in a specific currency. |
| budget.type | string | Always `limit`. A spending limit. |
| created_at | string | A timestamp in RFC 3339 format |
| environment_id | string | Id of the environment recipe the session's sandbox was created from. Omitted when no recipe was selected, that is, for a light machine or the Computer chosen by computer_id. |
| metadata | object | Free-form string key/value pairs stored with the session, changed through sessions.update patch semantics. |
| outcome_evaluations | array<object> | Per-outcome evaluation state. One entry per `define_outcome` event sent to the session. |
| outcome_evaluations[].completed_at | null | string | A timestamp in RFC 3339 format |
| outcome_evaluations[].description | string | What the agent should produce. |
| outcome_evaluations[].explanation | null | string | Grader's verdict text from the most recent evaluation. For `satisfied`, explains why criteria are met; for `needs_revision` (intermediate), what's missing; for `failed`, why unrecoverable. |
| outcome_evaluations[].iteration | number | 0-indexed revision cycle the outcome is currently on. |
| outcome_evaluations[].outcome_id | string | Server-generated outc_ ID for this outcome. |
| outcome_evaluations[].result | string | Current evaluation state. `pending` before the agent begins work; `running` while producing or revising; `evaluating` while the grader scores; `satisfied`/`max_iterations_reached`/`failed`/`interrupted` are terminal. |
| outcome_evaluations[].type | string | Always `outcome_evaluation`. Record of one outcome evaluation. |
| resources | array<object> | Resources attached to the session, at most 500; each is a file reference mounted into the session's machine. |
| resources[].id | string | Resource id, the resource_id of sessions.resources calls. |
| resources[].created_at | string | A timestamp in RFC 3339 format |
| resources[].mount_path | string | null | string | Path inside the machine where the file is mounted; defaults to /mnt/session/uploads/<file_id>, and custom paths are rooted there. / Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only. |
| resources[].type | string | Always `github_repository`. A GitHub repository resource; not supported on this platform. / Always `file`. A file resource: an uploaded file mounted into the session's machine. / Always `memory_store`. A memory store resource; not supported on this platform. |
| resources[].updated_at | string | A timestamp in RFC 3339 format |
| resources[].url | string | Repository URL. |
| resources[].checkout | null | object | Branch or commit to check out. |
| resources[].file_id | string | Id of the uploaded file; it must exist and belong to your tenant. |
| resources[].memory_store_id | string | The memory store ID (memstore_...). Must belong to the caller's organization and workspace. |
| resources[].access | null | string | Access mode for an attached memory store. |
| resources[].description | string | Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description. |
| resources[].instructions | null | string | Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars. |
| resources[].name | null | string | Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource. |
| stats | object | Timing statistics for a session. |
| stats.active_seconds | number | Cumulative time in seconds the session spent in `running` status. Excludes idle time. |
| stats.duration_seconds | number | Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. |
| status | string | SessionStatus enum - `rescheduling` - Transient error occurred, retrying automatically. - `running` - Agent is actively executing. - `idle` - Agent is waiting for input, including user messages or tool confirmations. Sessions start in idle. - `terminated` - Session has ended, either due to an error or completion. |
| title | null | string | Title of the session, set on create or through sessions.update; null when none was set. |
| type | string | Always `session`. A session, one conversation of an agent on a machine. |
| updated_at | string | A timestamp in RFC 3339 format |
| usage | object | Cumulative token usage for a session across all turns. |
| usage.active_seconds | number | Cumulative time in seconds during which the session had at least one thread in running status. Overlapping activity from concurrent threads is counted once, unlike `stats.active_seconds`, which sums each thread's own active time. This is the duration the session's runtime cost is priced on. |
| usage.cache_creation | object | Prompt-cache creation token usage broken down by cache lifetime. |
| usage.cache_read_input_tokens | number | Total tokens read from prompt cache. |
| usage.input_tokens | number | Total input tokens consumed across all turns. |
| usage.list_cost | null | object | A monetary amount in a specific currency. |
| usage.output_tokens | number | Total output tokens generated across all turns. |
| usage.server_tool_use | null | object | Cumulative count of server-executed tool invocations, broken down by tool. |
| vault_ids | array<string> | Vault IDs attached to the session at creation. Empty when no vaults were supplied. |
| deployment_id | null | string | Deployment ID when the session was created from a deployment reference. Null otherwise. |
| cwd | string | Normalized session working directory; defaults to /home/user/workspace. Forks inherit this directory. |
| computer_id | string | Praxis extension: MA only has session-scoped temporary containers and memory_stores, not durable browsable computers. computer_id selects a tenant-owned active computer. Session selection overrides the agent default; a sandbox environment_id and computer_id cannot be combined. Omitted when no computer is selected. |
| model | object | 扩展 / Praxis extension: the currently selected session model. |
| model.id | string | Identifier of the object, as returned by the API; pass it in the path of follow-up calls on the same resource. |
| model.thinking | object | null | Supported thinking controls, or null when capability is unknown or unavailable. efforts lists selectable strengths; can_disable permits none; default_effort is nullable. |
| thinking | object | null | Praxis extension: explicit session thinking effort; null inherits the pinned agent default, then the model default. none disables thinking only when model.thinking.can_disable is true. Unsupported efforts return 400 invalid_request_error. |
| thinking.effort | string | Thinking level saved for this session: low, medium, high, xhigh, or none to turn thinking off. Null or absent means the session inherits the agent default and then the model default. |
| forked_from | object | null | Praxis extension: source of a forked session; null for other sessions. Available only on /agent/v1. |
| forked_from.session_id | string | Id of the parent session this session was forked from; it is left unchanged by the fork. |
| forked_from.message_id | string | message_id of the agent message in the parent session up to which the conversation was copied. |
/agent/v1/sessions/{session_id}/context● 支持session_idstring必填path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
200
扩展:仅在 /agent/v1 提供,形状参照 Claude Agent SDK getContextUsage(),字段使用 snake_case。detail 固定为 summary:总量优先使用上次模型实测,各来源按本地估算占比摊分,used 分类之和等于 total_tokens。categories 只列非零来源,按 kind(used/free/buffer/deferred)判断用途。key 是稳定来源标识扩展;客户端须容忍未知 key 和新增来源,未知名称回退显示 name。MCP 按服务器归组,插件按 id 归组,摘要单独计量。excluded_items 暂为零。尚无测量时 total_tokens、total_tokens_source、measured_at 为 null,categories 为空,明细为零或空数组。切换模型后 max_tokens、auto_compact_threshold 与 free/buffer 立即按新模型重算,保留最近测量值。窗口未知或自动压缩熔断时 is_auto_compact_enabled 为 false。例如 model.thinking 为 {efforts: [high, xhigh], can_disable: true, default_effort: high}。model.thinking 返回 efforts(支持的档位)、can_disable(是否允许 none)及 default_effort(模型默认档位,可为 null);能力未知时整个 thinking 为 null。会话不存在或调用者不可见时返回 404。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Current model and latest context measurement
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| type | string | Always `session_context`. Snapshot of a session's context window usage. |
| session_id | string | Session whose context this snapshot describes. |
| model | object | Model of the session and its context window facts. |
| model.id | string | Identifier of the object, as returned by the API; pass it in the path of follow-up calls on the same resource. |
| model.display_name | string | Human-readable name of the model. |
| model.thinking | object | null | Thinking capability of the model: supported efforts, whether thinking can be disabled, and the default. Null when the capability is unknown. |
| total_tokens | number | null | Tokens currently occupying the context window; null before the first measurement. |
| total_tokens_source | string | null | Whether total_tokens is the provider-reported input usage (actual) or a local estimate (estimated); null before the first measurement. |
| max_tokens | number | null | Context window of the model in tokens; null when the model does not state one. |
| max_input_tokens | number | null | Maximum input tokens the model accepts per request; null when not stated. |
| percentage | number | Share of the context window in use, as a whole-number percent; 0 when the window or usage is unknown. |
| auto_compact_threshold | number | null | Token count at which automatic compaction starts; null when the window is unknown. |
| is_auto_compact_enabled | boolean | Whether automatic compaction is enabled for this session. |
| clear_tool_results_at | number | Token count at which old tool results are cleared from the context. |
| detail | string | Level of detail of the snapshot. |
| categories | array<object> | Context usage by category; each row has a stable key and a kind. |
| categories[].key | string | Praxis extension: stable source identifier (system, tools, mcp:<server>, plugin:<id>, messages, summary, free, buffer). Clients must tolerate unknown keys and newly added sources; classify rows by kind, not key or name. |
| categories[].name | string | Display name of the category. |
| categories[].tokens | number | Tokens used by the category. |
| categories[].kind | string | How the category counts against the window. |
| mcp_tools | array<object> | Tokens spent on the tool definitions of each MCP server. |
| mcp_tools[].name | string | Name of the MCP tool. |
| mcp_tools[].server_name | string | Name of the MCP server that provides the tool. |
| mcp_tools[].tokens | number | Tokens used by the tool definition. |
| plugin_blocks | array<object> | Tokens spent on context blocks injected by each mod. |
| plugin_blocks[].name | string | Name of the mod that injected the block. |
| plugin_blocks[].tokens | number | Tokens used by the block. |
| message_breakdown | object | Tokens in the conversation messages, split by role and tool traffic. |
| message_breakdown.user_message_tokens | number | Tokens of user messages. |
| message_breakdown.assistant_message_tokens | number | Tokens of assistant text messages. |
| message_breakdown.tool_call_tokens | number | Tokens of tool-call arguments. |
| message_breakdown.tool_result_tokens | number | Tokens of tool results. |
| message_breakdown.reasoning_tokens | number | Tokens of reasoning content. |
| message_breakdown.tool_calls_by_type | array<object> | Tool-call and tool-result tokens grouped by tool name. |
| compaction_summary | object | null | Tokens held by the latest compaction summary; null when the session was never compacted. |
| compaction_summary.tokens | number | Tokens of the compaction summary. |
| excluded_items | object | Items removed from the context for content safety, kept for audit only and not counted as usage. |
| excluded_items.count | number | Number of excluded items. |
| excluded_items.tokens | number | Tokens of the excluded items. |
| measured_at | string | null | RFC 3339 time of the measurement; null before the first measurement. |
/agent/v1/sessions/{session_id}/background_tasks● 支持session_idstring必填path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
200
仅在 /agent/v1 提供。kind 是开放字符串。subagent 行的 thread_id 指向对应子线程,其他 kind 为 null。completed 且 delivery=pending 显示 result_pending。notified_at 是系统通知批次被受理开轮的时间,无则 null。trigger_count 仅监视器返回已受理的事件批次数,无记录则 null。时间为 RFC3339。会话不存在或不可见返回 404。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Session background tasks
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | Items of this page, in the order requested by the call. |
| data[].id | string | Identifier of the object, as returned by the API; pass it in the path of follow-up calls on the same resource. |
| data[].kind | string | Kind of background task: bash for a command started with run_in_background, monitor for a Monitor watch. |
| data[].title | string | Short human-readable title of the task or object. |
| data[].thread_id | string | null | Execution thread the task belongs to; null for the primary thread. |
| data[].status | string | Current lifecycle state. |
| data[].started_at | string | RFC 3339 time at which the task started. |
| data[].ended_at | string | null | RFC 3339 time at which the task ended; null while it is running. |
| data[].cancellable | boolean | Whether the task can still be stopped. |
| data[].notified_at | string | null | RFC 3339 time of the latest run that the task's notification started; null while no notification has been delivered. |
| data[].trigger_count | integer | null | For a monitor task, how many times its matches woke the session; null for other kinds or before the first notification. |
/agent/v1/sessions/{session_id}/background_tasks/{task_id}/output● 支持session_idstring必填path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
task_idstring必填path: Background task id (task_...), as listed by sessions.background_tasks.list.
offsetinteger可选query: Byte offset into the task output to read from; start at 0 and continue with the next_offset of the previous response. Integer of at least 0, default 0.
max_bytesinteger可选query: Maximum number of bytes to return: an integer from 1 to 262144, default 65536.
200
offset 默认 0;max_bytes 默认 65536,上限 262144。返回 text、next_offset、eof。沙箱已暂停或不存在时返回空 text、原 offset、eof=true、unavailable=true。读取不确认模型结果。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Background task output byte page
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| text | string | Text of the block. |
| next_offset | integer | Byte offset to pass as offset to continue reading the output. |
| eof | boolean | True when the output has ended and no more bytes will follow. |
| unavailable | boolean | True when the output could not be read; text is then empty. |
/agent/v1/sessions/{session_id}/background_tasks/{task_id}/stop● 支持session_idstring必填path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
task_idstring必填path: Background task id (task_...), as listed by sessions.background_tasks.list.
200
复用 TaskStop:持久化 stop_requested_at 并终止进程组。返回 BackgroundTask;终止尚未观察到时仍可为 running,但不可取消。已结束或不支持停止的任务返回 409。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Current task after stop request
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Identifier of the object, as returned by the API; pass it in the path of follow-up calls on the same resource. |
| kind | string | Kind of background task: bash for a command started with run_in_background, monitor for a Monitor watch. |
| title | string | Short human-readable title of the task or object. |
| thread_id | string | null | Execution thread the task belongs to; null for the primary thread. |
| status | string | Current lifecycle state. |
| started_at | string | RFC 3339 time at which the task started. |
| ended_at | string | null | RFC 3339 time at which the task ended; null while it is running. |
| cancellable | boolean | Whether the task can still be stopped. |
| notified_at | string | null | RFC 3339 time of the latest run that the task's notification started; null while no notification has been delivered. |
| trigger_count | integer | null | For a monitor task, how many times its matches woke the session; null for other kinds or before the first notification. |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/agent/v1/sessions/{session_id}/compact● 支持session_idstring必填path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
instructionsstring可选Optional focus instructions for the summary, passed to the summarizing model unchanged.
200
仅在 /agent/v1 提供。请求体可省略或为 {},可选 instructions 必须为字符串且原样传递。Idempotency-Key 请求头原样传递;缺失时生成 UUID。响应为 { type: session_compaction, id, status, reason? },id 是操作 ID。queued/running 返回 202;skipped/succeeded/failed 返回 200。非字符串 instructions 返回 400 invalid_request_error。不存在或不可见的托管会话返回 404 not_found_error。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Skipped, succeeded or failed compaction
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| type | string | Always `session_compaction`. Result of a compaction request. |
| id | string | Compaction operation id; pass it as operation_id to sessions.compact.retrieve. |
| status | string | State of the compaction operation: queued and running are in progress, skipped means nothing needed compaction, succeeded and failed are final. |
| reason | string | Why the compaction was skipped or failed; absent otherwise. |
Queued or running compaction
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| type | string | Always `session_compaction`. Result of a compaction request. |
| id | string | Compaction operation id; pass it as operation_id to sessions.compact.retrieve. |
| status | string | State of the compaction operation: queued and running are in progress, skipped means nothing needed compaction, succeeded and failed are final. |
| reason | string | Why the compaction was skipped or failed; absent otherwise. |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/agent/v1/sessions/{session_id}/compact/{operation_id}● 支持session_idstring必填path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
operation_idstring必填path: Compaction operation id returned by sessions.compact in the id field of the session_compaction object.
200
仅在 /agent/v1 提供。响应为 { type: session_compaction, id, status, reason? },所有状态均返回 200。操作不存在或会话不可见时返回 404 not_found_error。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Compaction operation
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| type | string | Always `session_compaction`. Result of a compaction request. |
| id | string | Compaction operation id; pass it as operation_id to sessions.compact.retrieve. |
| status | string | State of the compaction operation: queued and running are in progress, skipped means nothing needed compaction, succeeded and failed are final. |
| reason | string | Why the compaction was skipped or failed; absent otherwise. |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/agent/v1/sessions/{session_id}/compactions● 支持session_idstring必填path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
200
仅在 /agent/v1 提供。返回 { data: [...] }。每项包含 type、id、event_id、trigger、status、model、compacted_message_count、input_tokens_before、input_tokens_after、summary、error、created_at,字段按服务记录原样返回。不存在或不可见的托管会话返回 404 not_found_error。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Compaction history
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | Items of this page, in the order requested by the call. |
| data[].type | string | Always `context_compaction`. Record of one past compaction. |
| data[].id | string | Compaction record id. |
| data[].event_id | string | null | Id of the agent.thread_context_compacted event emitted for this compaction; null when none. |
| data[].trigger | string | What started the compaction. |
| data[].status | string | Final outcome of the compaction. |
| data[].model | string | Model that wrote the summary. |
| data[].compacted_message_count | number | Number of messages replaced by the summary. |
| data[].input_tokens_before | number | Context tokens before the compaction. |
| data[].input_tokens_after | number | null | Context tokens after the compaction; null when not measured. |
| data[].summary | string | null | Summary text that replaced the messages; null when the compaction failed. |
| data[].error | string | null | Failure reason; null when the compaction succeeded. |
| data[].created_at | string | RFC 3339 time at which the compaction was recorded. |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/agent/v1/sessions/{session_id}/events● 支持session_idstring必填path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
created_at[gt]string可选query: Return events created after this time (exclusive). Compared against the event's `processed_at` value.
created_at[gte]string可选query: Return events created at or after this time (inclusive). Compared against the event's `processed_at` value.
created_at[lt]string可选query: Return events created before this time (exclusive). Compared against the event's `processed_at` value.
created_at[lte]string可选query: Return events created at or before this time (inclusive). Compared against the event's `processed_at` value.
orderstring可选query: 按事件处理时间排序:asc 从早到晚(默认),desc 相反。
typesarray可选query: 按事件类型过滤,取值与返回事件的 type 字段一致(如 user.message、agent.tool_use);不传返回全部类型。
limitnumber可选query: Number of items per page.
pagestring可选query: Opaque pagination cursor: pass the next_page value of the previous response unchanged. Omit it for the first page. A cursor from a different query or a malformed one returns 400.
200
先发送消息再读取历史;处理完成前可能只看到已接纳的输入。支持分页、事件类型和时间过滤。会话等待工具授权时停在 session.status_idle,stop_reason 为 requires_action,event_ids 列出待确认的 agent.tool_use;运行失败时先出现 session.error,再出现 session.status_terminated。agent.thinking 带思考内容 content。使用网页搜索或读取网页时,/agent/v1 与 /anthropic 的工具结果均为官方 search_result 块;回答文本块的 citations 是 /agent/v1 的扩展字段,/anthropic 将回答引用显示为正文中的 [n]。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | Items of this page, in the order requested by the call. |
| data[].id | string | Unique identifier for this event. / Event id, unique within the session. Use it to refer to this event, for example in user.tool_confirmation or user.steer. / Event id, unique within the session. / Event id, unique within the session. Use it to refer to this event, for example in user.tool_confirmation or user.steer. / Event id, unique within the session. Use it to refer to this event, for example in user.tool_confirmation or user.steer. / Event id, unique within the session. |
| data[].content | array<object> | Array of content blocks comprising the user message. / The result content returned by the tool. / Array of text blocks comprising the agent response. / The result content returned by the tool. / The result content returned by the tool. / Message content blocks. / Message content blocks. / The result content returned by the tool. / System content blocks. Text-only. |
| data[].type | string | Always `user.message`. A message from the user to the agent, with content blocks. / Always `user.interrupt`. The user interrupted the running turn. / Always `user.tool_confirmation`. The user's decision to allow or deny a tool call that waits for approval. / Always `user.custom_tool_result`. The user's result for a custom tool call. / Always `agent.custom_tool_use`. The agent called a custom tool defined by the client. / Always `agent.message`. A message from the agent, with text content blocks. / Always `agent.thinking`. The agent's thinking text for a step. / Always `agent.mcp_tool_use`. The agent called an MCP tool. / Always `agent.mcp_tool_result`. The result of an MCP tool call. / Always `agent.tool_use`. The agent called a tool. / Always `agent.tool_result`. The result of a tool call. / Always `agent.thread_message_received`. The agent received a message from another thread. / Always `agent.thread_message_sent`. The agent sent a message to another thread. / Always `agent.thread_context_compacted`. The thread's context was compacted into a summary. / Always `session.error`. The session hit an error. / Always `session.status_rescheduled`. The session will retry after a recoverable error. / Always `session.status_running`. The session started running a turn. / Always `session.status_idle`. The session stopped running; stop_reason says why. / Always `session.status_terminated`. The session ended and accepts no more work. / Always `session.thread_created`. A child thread was started. / Always `span.outcome_evaluation_start`. An outcome evaluation started. / Always `span.outcome_evaluation_end`. An outcome evaluation ended. / Always `span.model_request_start`. A model request started. / Always `span.model_request_end`. A model request ended, with its usage. / Always `span.outcome_evaluation_ongoing`. An outcome evaluation is still running. / Always `user.define_outcome`. The user defined the outcome the agent should reach. / Always `session.deleted`. The session was deleted. / Always `session.thread_status_running`. A thread started running. / Always `session.thread_status_idle`. A thread stopped running; stop_reason says why. / Always `session.thread_status_terminated`. A thread ended. / Always `user.tool_result`. The user's result for a client-side tool call. / Always `session.thread_status_rescheduled`. A thread will retry after a recoverable error. / Always `session.updated`. The session's model, title, metadata, agent or budget changed. / Always `system.message`. A message produced by the platform rather than the user or the agent. / Always `session.usage`. Cumulative usage of the session. / Always `session.forked`. The session was created by forking another session. / Always `session.goal_changed`. / Always `session.goal_verification`. / Always `user.steer`. Receipt that a queued user.message was injected into the running turn. / Always `user.tool_confirmation`. |
| data[].processed_at | null | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | null | string | string | string | null | string | string | string | string | string | string | string | A timestamp in RFC 3339 format / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / When the event was recorded, RFC 3339. / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / When the event was recorded, RFC 3339. |
| data[].message_id | string | UI transcript message ID. Use the last assistant message in a successfully completed turn as the fork target. / UI transcript message ID shared with this assistant's message parts. |
| data[].session_thread_id | null | string | string | string | string | string | null | string | string | If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread. / Set by the server to the subagent thread this confirmation was routed to. Omitted when it was routed to the primary thread. / Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread. / When set, this event was cross-posted from a subagent's thread to surface its custom tool use on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.custom_tool_result` by `custom_tool_use_id`, so clients do not send it back. / When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.tool_confirmation` by `tool_use_id`, so clients do not send it back. / When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.tool_confirmation` or `user.tool_result` by `tool_use_id`, so clients do not send it back. / Public `sthr_` ID of the newly created thread. / Public sthr_ ID of the thread that started running. / Public sthr_ ID of the thread that went idle. / Public sthr_ ID of the thread that terminated. / Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread. / Public sthr_ ID of the thread that is retrying. |
| data[].result | string | UserToolConfirmationResult enum / Evaluation verdict. 'satisfied': criteria met, session goes idle. 'needs_revision': criteria not met, another revision cycle follows. 'max_iterations_reached': evaluation budget exhausted with criteria still unmet — one final acknowledgment turn follows before the session goes idle, but no further evaluation runs. 'failed': grader determined the rubric does not apply to the deliverables. 'interrupted': user sent an interrupt while evaluation was in progress. / Always `allow`. |
| data[].tool_use_id | string | The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field. / The id of the `agent.tool_use` event this result corresponds to. / The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field. / The id of the AskUserQuestion `agent.tool_use` event this answers. |
| data[].deny_message | null | string | Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. |
| data[].custom_tool_use_id | string | The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field. |
| data[].is_error | null | boolean | Whether the tool execution resulted in an error. / Whether the model request resulted in an error. / Whether the tool execution resulted in an error. |
| data[].input | object | Input parameters for the tool call. |
| data[].name | string | Name of the custom tool being called. / Name of the MCP tool being used. / Name of the agent tool being used. |
| data[].mcp_server_name | string | Name of the MCP server providing the tool. |
| data[].evaluated_permission | string | AgentEvaluatedPermission enum |
| data[].evaluation | object | Names the resolved permission_policy that produced evaluated_permission, and under auto carries the judgement. Open union: clients must tolerate unknown variants. |
| data[]._meta | object | Praxis extension (MCP Apps, SEP-1865): the `ui` and `openai/ui` keys of the MCP tool definition's `_meta`, verbatim; other `_meta` keys are not exposed. When `ui.resourceUri` is a `ui://` URI, the tool has an interactive view: a client that implements MCP Apps can fetch that resource from the MCP server and render it for this call. Absent when the tool declares neither key. Clients that do not render MCP Apps ignore it. / Praxis extension (MCP Apps, SEP-1865): the MCP CallToolResult `_meta`, verbatim. Views use it for data that should not reach the model; absent when the tool returned none. |
| data[].source | string | Praxis extension (MCP Apps, SEP-1865): `app` when the call was made by an MCP Apps view, `codemode` when a program run by the codemode tool called an MCP tool that declares a view (the event pair exists so a client can render that view; the model already has the result in the codemode tool result); absent for the model's own calls. / What caused the change. |
| data[].parent_tool_use_id | string | Praxis extension (MCP Apps, SEP-1865): present when `source` is `codemode`; the id of the codemode tool use whose program made this call. Absent otherwise. |
| data[].mcp_tool_use_id | string | The id of the `agent.mcp_tool_use` event this result corresponds to. |
| data[].structured_content | any | Praxis extension (MCP Apps, SEP-1865): the MCP CallToolResult `structuredContent`, verbatim JSON. MCP Apps views read it as the data to render; absent when the tool returned none. |
| data[].from_session_thread_id | string | Public `sthr_` ID of the thread that sent the message. |
| data[].from_agent_name | null | string | Name of the callable agent this message came from. Absent when received from the primary agent. |
| data[].to_session_thread_id | string | Public `sthr_` ID of the thread the message was sent to. |
| data[].to_agent_name | null | string | Name of the callable agent this message was sent to. Absent when sent to the primary agent. |
| data[].error | object | Description of the error and what the client should do next. |
| data[].stop_reason | object | Why the session stopped running, with the variant data needed to continue. |
| data[].agent_name | string | Name of the callable agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. |
| data[].iteration | number | 0-indexed revision cycle. 0 is the first evaluation; 1 is the re-evaluation after the first revision; etc. / 0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`. / 0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`. |
| data[].outcome_id | string | The `outc_` ID of the outcome being evaluated. / Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list. |
| data[].explanation | string | Human-readable explanation of the verdict. For `needs_revision`, describes which criteria failed and why. |
| data[].outcome_evaluation_start_id | string | The id of the corresponding `span.outcome_evaluation_start` event. |
| data[].usage | object | Token usage for a single model request. / Point-in-time snapshot of a session's cumulative usage. |
| data[].model_request_start_id | string | The id of the corresponding `span.model_request_start` event. |
| data[].model_usage | object | Token usage for a single model request. |
| data[].description | string | What the agent should produce. Copied from the input event. |
| data[].max_iterations | null | number | Evaluate-then-revise cycles before giving up. Default 3, max 20. |
| data[].rubric | object | Rubric for grading the quality of an outcome. |
| data[].agent | null | object | Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. |
| data[].budget | null | object | A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`. |
| data[].metadata | object | The session's full metadata bag after the update. Present when the update set non-empty metadata; absent when metadata was unchanged or cleared to empty. |
| data[].title | null | string | The session's new title. Present only when the update changed it. |
| data[].model | object | 扩展 / Praxis extension: the changed session model, present only on /agent/v1 session.updated events. Model-only updates are omitted on /anthropic. |
| data[].forked_from_session_id | string | Id of the parent session this session was forked from. |
| data[].forked_from_message_id | string | message_id of the agent message in the parent session up to which the conversation was copied. |
| data[].action | string | What changed in the goal. |
| data[].goal | object | null | The goal as the change left it, or null when the session has no goal. |
| data[].previous_goal | object | null | The goal before the change, or null when there was none. |
| data[].status | string | Where the check stands. Read `verification.passed` on the closing event to know whether the goal counts as done. |
| data[].goal_id | string | The goal this check belongs to. |
| data[].goal_iteration | integer | Which check of this goal, matching `iteration` on the goal. |
| data[].verification_id | string | Identifier shared by every event of one check. |
| data[].anchor_message_id | string | null | The assistant message the check follows, or null. |
| data[].verification | object | The verdict; absent on `started`. |
| data[].event_id | string | Id of the event this event refers to. |
| data[].answers | object | The user's answer to each question, keyed by the question text; empty when the questions were dismissed. |
| data[].annotations | object | Per-question notes, keyed by the question text. |
| next_page | string | null | Opaque cursor for the next page: pass it unchanged as page to continue. Null when this is the last page. |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/agent/v1/sessions/{session_id}/events◐ 部分支持session_idstring必填path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
eventsarray必填要发送给会话的事件列表。
200
将 sesn_123 换成创建会话返回的 id。每条 user.message 只接受一个非空文本块。支持文本 user.message、user.interrupt 和工具确认;可发送 user.withdraw 并用 event_id 指向仍在排队的消息来撤回它,消息已开始处理时返回 409。运行中需要提前补充要求时,发送 user.steer 事件,并用 event_id 指向仍在排队的消息:当前工具继续执行,消息在下一次模型请求前进入当前回合。返回带 processed_at 的 user.steer 回执,重复标记返回同一回执;已开始或已撤回返回 409,事件不存在返回 404。有待授权时继续等待;若当前回合先结束,消息仍按普通队列处理。默认发送消息仍然排队,/anthropic 不接受 user.steer。其它事件变体尚不支持。返回的是已接纳事件;模型回复从事件历史或订阅读取。会话等待工具授权时发送的 user.message 会排队:返回的事件 processed_at 为 null,授权处理完成后按发送顺序执行。允许工具调用时可在 updated_permissions 中原样提交该调用的 permission_suggestions,让本次对话记住同类操作;危险操作不提供可记住的建议。使用网页搜索或读取网页时,/agent/v1 与 /anthropic 的工具结果均为官方 search_result 块;回答文本块的 citations 是 /agent/v1 的扩展字段,/anthropic 将回答引用显示为正文中的 [n]。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | Sent events |
| data[].id | string | Unique identifier for this event. / Event id, unique within the session. Use it to refer to this event, for example in user.tool_confirmation or user.steer. / Event id, unique within the session. |
| data[].content | array<object> | Array of content blocks comprising the user message. / The result content returned by the tool. / The result content returned by the tool. / System content blocks. Text-only. |
| data[].type | string | Always `user.message`. A message from the user to the agent, with content blocks. / Always `user.interrupt`. The user interrupted the running turn. / Always `user.tool_confirmation`. The user's decision to allow or deny a tool call that waits for approval. / Always `user.custom_tool_result`. The user's result for a custom tool call. / Always `user.define_outcome`. The user defined the outcome the agent should reach. / Always `user.tool_result`. The user's result for a client-side tool call. / Always `system.message`. A message produced by the platform rather than the user or the agent. / Always `user.steer`. Receipt that a queued user.message was injected into the running turn. / Always `user.tool_confirmation`. |
| data[].processed_at | null | string | string | null | string | null | string | string | string | A timestamp in RFC 3339 format / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / When the event was recorded, RFC 3339. |
| data[].session_thread_id | null | string | If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread. / Set by the server to the subagent thread this confirmation was routed to. Omitted when it was routed to the primary thread. / Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread. / Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread. |
| data[].result | string | UserToolConfirmationResult enum / Always `allow`. |
| data[].tool_use_id | string | The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field. / The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field. / The id of the AskUserQuestion `agent.tool_use` event this answers. |
| data[].deny_message | null | string | Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. |
| data[].custom_tool_use_id | string | The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field. |
| data[].is_error | null | boolean | Whether the tool execution resulted in an error. |
| data[].description | string | What the agent should produce. Copied from the input event. |
| data[].max_iterations | null | number | Evaluate-then-revise cycles before giving up. Default 3, max 20. |
| data[].outcome_id | string | Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list. |
| data[].rubric | object | Rubric for grading the quality of an outcome. |
| data[].event_id | string | Id of the event this event refers to. |
| data[].answers | object | The user's answer to each question, keyed by the question text; empty when the questions were dismissed. |
| data[].annotations | object | Per-question notes, keyed by the question text. |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/agent/v1/sessions/{session_id}/events/stream◐ 部分支持session_idstring必填path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
event_deltasarray可选query: When set, this connection also receives streaming deltas (`event_start`, `event_delta`) while an event is being produced, before the event itself arrives. Deltas are best-effort; when the final event is produced it carries the complete content. A model request that ends early (an error or interrupt) produces no final event — its terminal `span.model_request_end` closes the preview. Accepts one or more event types to preview and may be repeated: `agent.message` streams `content_delta` fragments; `agent.thinking` is start-only — a signal that the agent has begun extended thinking, concluded by the `agent.thinking` event itself. Only previews of the requested event types are sent.
200
保持 SSE 连接以接收事件;请求不会像普通 JSON 接口一样立刻结束。先创建会话并替换 sesn_123,再从另一请求发送消息;停止按钮只断开订阅,不会停止智能体。SDK 0.124.0 会过滤 session.usage,完整用量请读历史。传 event_deltas[]=agent.message 或 event_deltas[]=agent.thinking 可在最终事件到达前收到逐段预览(event_start 与 event_delta)。传 event_deltas[]=agent.tool_use 可以在参数生成过程中收到 input_json_delta 片段。使用网页搜索或读取网页时,/agent/v1 与 /anthropic 的工具结果均为官方 search_result 块;回答文本块的 citations 是 /agent/v1 的扩展字段,/anthropic 将回答引用显示为正文中的 [n]。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Server-sent events
text/event-stream — chunk / 事件对象
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Identifier of the object, as returned by the API; pass it in the path of follow-up calls on the same resource. |
| event | string | Server-Sent Events event name of this frame. / Always `user.message`. SSE event name of this frame; its data is a user.message payload. A message from the user to the agent, with content blocks. / Always `user.interrupt`. SSE event name of this frame; its data is a user.interrupt payload. The user interrupted the running turn. / Always `agent.message`. SSE event name of this frame; its data is a agent.message payload. A message from the agent, with text content blocks. / Always `agent.thinking`. SSE event name of this frame; its data is a agent.thinking payload. The agent's thinking text for a step. / Always `session.status_running`. SSE event name of this frame; its data is a session.status_running payload. The session started running a turn. / Always `session.status_rescheduled`. SSE event name of this frame; its data is a session.status_rescheduled payload. The session will retry after a recoverable error. / Always `session.status_idle`. SSE event name of this frame; its data is a session.status_idle payload. The session stopped running; stop_reason says why. / Always `session.status_terminated`. SSE event name of this frame; its data is a session.status_terminated payload. The session ended and accepts no more work. / Always `agent.thread_context_compacted`. SSE event name of this frame; its data is a agent.thread_context_compacted payload. The thread's context was compacted into a summary. / Always `agent.thread_context_reset`. SSE event name of this frame; its data is a agent.thread_context_reset payload. Content was removed from the model's context after a content-safety refusal. / Always `session.updated`. SSE event name of this frame; its data is a session.updated payload. The session's model, title, metadata, agent or budget changed. / Always `session.error`. SSE event name of this frame; its data is a session.error payload. The session hit an error. / Always `session.usage`. SSE event name of this frame; its data is a session.usage payload. Cumulative usage of the session. / Always `span.model_request_start`. SSE event name of this frame; its data is a span.model_request_start payload. A model request started. / Always `span.model_request_end`. SSE event name of this frame; its data is a span.model_request_end payload. A model request ended, with its usage. / Always `agent.tool_use`. SSE event name of this frame; its data is a agent.tool_use payload. The agent called a tool. / Always `agent.tool_result`. SSE event name of this frame; its data is a agent.tool_result payload. The result of a tool call. / Always `agent.mcp_tool_use`. SSE event name of this frame; its data is a agent.mcp_tool_use payload. The agent called an MCP tool. / Always `agent.mcp_tool_result`. SSE event name of this frame; its data is a agent.mcp_tool_result payload. The result of an MCP tool call. / Always `user.tool_confirmation`. SSE event name of this frame; its data is a user.tool_confirmation payload. The user's decision to allow or deny a tool call that waits for approval. / Always `session.thread_created`. SSE event name of this frame; its data is a session.thread_created payload. A child thread was started. / Always `session.thread_status_running`. SSE event name of this frame; its data is a session.thread_status_running payload. A thread started running. / Always `session.thread_status_idle`. SSE event name of this frame; its data is a session.thread_status_idle payload. A thread stopped running; stop_reason says why. / Always `session.thread_status_rescheduled`. SSE event name of this frame; its data is a session.thread_status_rescheduled payload. A thread will retry after a recoverable error. / Always `session.thread_status_terminated`. SSE event name of this frame; its data is a session.thread_status_terminated payload. A thread ended. / Always `agent.thread_message_sent`. SSE event name of this frame; its data is a agent.thread_message_sent payload. The agent sent a message to another thread. / Always `agent.thread_message_received`. SSE event name of this frame; its data is a agent.thread_message_received payload. The agent received a message from another thread. / Always `user.withdraw`. SSE event name of this frame; its data is a user.withdraw payload. A queued user.message was withdrawn before it ran. / Always `user.steer`. SSE event name of this frame; its data is a user.steer payload. Receipt that a queued user.message was injected into the running turn. / Always `system.notification`. SSE event name of this frame; its data is a system.notification payload. Background work woke the session with a notification. / Always `session.forked`. SSE event name of this frame; its data is a session.forked payload. The session was created by forking another session. / Always `session.goal_changed`. SSE event name of this frame; its data is a session.goal_changed payload. The session's goal was set, changed status, accounted usage or was cleared. / Always `session.goal_verification`. SSE event name of this frame; its data is a session.goal_verification payload. One completion check of the session's goal started or ended. / Always `event_start`. SSE event name of this frame; its data is a event_start payload. Preview that an event of the requested delta types has started. / Always `event_delta`. SSE event name of this frame; its data is a event_delta payload. Incremental fragment of the event being produced. / Always `ping`. SSE event name of this frame; its data is a ping payload. Keep-alive frame; carries no data. / Always `error`. SSE event name of this frame; its data is a error payload. A stream error. |
| data | object | Decoded JSON payload of this frame; its shape is selected by the event name. / Praxis extension (AskUserQuestion, own face only): the confirmation of an AskUserQuestion call, with the answers it carried. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. / Praxis extension (goal mode, own face only): the session's goal was set, moved to another status, accounted usage or was cleared. `goal` is the goal after the change, `previous_goal` the one before; each is null when there was none. / Praxis extension (goal mode, own face only): one completion check of the goal. A `started` event opens it; `completed`, `failed_closed` or `cancelled` closes it. Events of one check share `verification_id`. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. |
| data.id | string | Unique identifier for this event. / Text of the block. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Event id, unique within the session. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Text of the block. / Event id, unique within the session. Use it to refer to this event, for example in user.tool_confirmation or user.steer. / Text of the block. / Event id, unique within the session. Use it to refer to this event, for example in user.tool_confirmation or user.steer. / Event id, unique within the session. / Event id, unique within the session. Use it to refer to this event, for example in user.tool_confirmation or user.steer. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Text of the block. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Event id, unique within the session. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Text of the block. / Event id, unique within the session. Use it to refer to this event, for example in user.tool_confirmation or user.steer. / Text of the block. / Event id, unique within the session. Use it to refer to this event, for example in user.tool_confirmation or user.steer. / Event id, unique within the session. / Event id, unique within the session. Use it to refer to this event, for example in user.tool_confirmation or user.steer. |
| data.content | array<object> | Array of content blocks comprising the user message. / Array of text blocks comprising the agent response. / Content blocks of the event, in order. / The result content returned by the tool. / The result content returned by the tool. / Message content blocks. / Message content blocks. / Array of content blocks comprising the user message. / Array of text blocks comprising the agent response. / Content blocks of the event, in order. / The result content returned by the tool. / The result content returned by the tool. / Message content blocks. / Message content blocks. |
| data.type | string | Always `user.message`. A message from the user to the agent, with content blocks. / Always `user.interrupt`. The user interrupted the running turn. / Always `agent.message`. A message from the agent, with text content blocks. / Always `agent.thinking`. The agent's thinking text for a step. / Always `session.status_running`. The session started running a turn. / Always `session.status_rescheduled`. The session will retry after a recoverable error. / Always `session.status_idle`. The session stopped running; stop_reason says why. / Always `session.status_terminated`. The session ended and accepts no more work. / Always `agent.thread_context_compacted`. The thread's context was compacted into a summary. / Always `agent.thread_context_reset`. Content was removed from the model's context after a content-safety refusal. / Always `session.updated`. The session's model, title, metadata, agent or budget changed. / Always `session.error`. The session hit an error. / Always `session.usage`. Cumulative usage of the session. / Always `span.model_request_start`. A model request started. / Always `span.model_request_end`. A model request ended, with its usage. / Always `agent.tool_use`. The agent called a tool. / Always `agent.tool_result`. The result of a tool call. / Always `agent.mcp_tool_use`. The agent called an MCP tool. / Always `agent.mcp_tool_result`. The result of an MCP tool call. / Always `user.tool_confirmation`. / Always `session.thread_created`. A child thread was started. / Always `session.thread_status_running`. A thread started running. / Always `session.thread_status_idle`. A thread stopped running; stop_reason says why. / Always `session.thread_status_rescheduled`. A thread will retry after a recoverable error. / Always `session.thread_status_terminated`. A thread ended. / Always `agent.thread_message_sent`. The agent sent a message to another thread. / Always `agent.thread_message_received`. The agent received a message from another thread. / Always `user.withdraw`. A queued user.message was withdrawn before it ran. / Always `user.steer`. Receipt that a queued user.message was injected into the running turn. / Always `system.notification`. Background work woke the session with a notification. / Always `session.forked`. The session was created by forking another session. / Always `session.goal_changed`. / Always `session.goal_verification`. / Always `event_start`. Preview that an event of the requested delta types has started. / Always `event_delta`. Incremental fragment of the event being produced. / Always `ping`. Keep-alive frame; carries no data. / Always `error`. A stream error. / Always `user.message`. A message from the user to the agent, with content blocks. / Always `user.interrupt`. The user interrupted the running turn. / Always `agent.message`. A message from the agent, with text content blocks. / Always `agent.thinking`. The agent's thinking text for a step. / Always `session.status_running`. The session started running a turn. / Always `session.status_rescheduled`. The session will retry after a recoverable error. / Always `session.status_idle`. The session stopped running; stop_reason says why. / Always `session.status_terminated`. The session ended and accepts no more work. / Always `agent.thread_context_compacted`. The thread's context was compacted into a summary. / Always `agent.thread_context_reset`. Content was removed from the model's context after a content-safety refusal. / Always `session.updated`. The session's model, title, metadata, agent or budget changed. / Always `session.error`. The session hit an error. / Always `session.usage`. Cumulative usage of the session. / Always `span.model_request_start`. A model request started. / Always `span.model_request_end`. A model request ended, with its usage. / Always `agent.tool_use`. The agent called a tool. / Always `agent.tool_result`. The result of a tool call. / Always `agent.mcp_tool_use`. The agent called an MCP tool. / Always `agent.mcp_tool_result`. The result of an MCP tool call. / Always `user.tool_confirmation`. / Always `session.thread_created`. A child thread was started. / Always `session.thread_status_running`. A thread started running. / Always `session.thread_status_idle`. A thread stopped running; stop_reason says why. / Always `session.thread_status_rescheduled`. A thread will retry after a recoverable error. / Always `session.thread_status_terminated`. A thread ended. / Always `agent.thread_message_sent`. The agent sent a message to another thread. / Always `agent.thread_message_received`. The agent received a message from another thread. / Always `user.withdraw`. A queued user.message was withdrawn before it ran. / Always `user.steer`. Receipt that a queued user.message was injected into the running turn. / Always `system.notification`. Background work woke the session with a notification. / Always `session.forked`. The session was created by forking another session. / Always `session.goal_changed`. / Always `session.goal_verification`. / Always `event_start`. Preview that an event of the requested delta types has started. / Always `event_delta`. Incremental fragment of the event being produced. / Always `ping`. Keep-alive frame; carries no data. / Always `error`. A stream error. |
| data.processed_at | null | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | null | string | null | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | A timestamp in RFC 3339 format / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / When the event was recorded, RFC 3339. / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / When the event was recorded, RFC 3339. / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / When the event was recorded, RFC 3339. / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / When the event was recorded, RFC 3339. / RFC 3339 time at which the server processed the event; null while a queued input has not started running. |
| data.message_id | string | UI transcript message ID. Use the last assistant message in a successfully completed turn as the fork target. / UI transcript message ID shared with this assistant's message parts. / UI transcript message ID. Use the last assistant message in a successfully completed turn as the fork target. / UI transcript message ID. Use the last assistant message in a successfully completed turn as the fork target. / UI transcript message ID shared with this assistant's message parts. |
| data.session_thread_id | null | string | string | null | string | null | string | string | string | string | string | string | string | string | null | string | string | null | string | null | string | string | string | string | string | string | string | string | If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread. / Text of the block. / When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.tool_confirmation` or `user.tool_result` by `tool_use_id`, so clients do not send it back. / When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.tool_confirmation` by `tool_use_id`, so clients do not send it back. / Public `sthr_` ID of the newly created thread. / Public sthr_ ID of the thread that started running. / Public sthr_ ID of the thread that went idle. / Public sthr_ ID of the thread that is retrying. / Public sthr_ ID of the thread that terminated. / Text of the block. / Text of the block. / If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread. / Text of the block. / When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.tool_confirmation` or `user.tool_result` by `tool_use_id`, so clients do not send it back. / When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.tool_confirmation` by `tool_use_id`, so clients do not send it back. / Public `sthr_` ID of the newly created thread. / Public sthr_ ID of the thread that started running. / Public sthr_ ID of the thread that went idle. / Public sthr_ ID of the thread that is retrying. / Public sthr_ ID of the thread that terminated. / Text of the block. / Text of the block. |
| data.stop_reason | object | Why the session stopped running, with the variant data needed to continue. |
| data.removed | array<object> | Content removed from the model's context by this reset. |
| data.category | string | Text of the block. |
| data.stopped | boolean | True when the run was stopped instead of retried after the reset. |
| data.agent | null | object | Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. |
| data.budget | null | object | A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`. |
| data.metadata | object | The session's full metadata bag after the update. Present when the update set non-empty metadata; absent when metadata was unchanged or cleared to empty. |
| data.title | null | string | The session's new title. Present only when the update changed it. |
| data.model | object | 扩展 / Praxis extension: the changed session model, present only on /agent/v1 session.updated events. Model-only updates are omitted on /anthropic. |
| data.error | object | Description of the error and what the client should do next. / Error detail. / Description of the error and what the client should do next. / Error detail. |
| data.usage | object | Point-in-time snapshot of a session's cumulative usage. |
| data.is_error | null | boolean | Whether the model request resulted in an error. / Whether the tool execution resulted in an error. / Whether the tool execution resulted in an error. / Whether the model request resulted in an error. / Whether the tool execution resulted in an error. / Whether the tool execution resulted in an error. |
| data.model_request_start_id | string | The id of the corresponding `span.model_request_start` event. |
| data.model_usage | object | Token usage for a single model request. |
| data.input | object | Input parameters for the tool call. |
| data.name | string | Name of the agent tool being used. / Name of the MCP tool being used. / Name of the agent tool being used. / Name of the MCP tool being used. |
| data.evaluated_permission | string | AgentEvaluatedPermission enum |
| data.evaluation | object | Names the resolved permission_policy that produced evaluated_permission, and under auto carries the judgement. Open union: clients must tolerate unknown variants. |
| data.tool_use_id | string | The id of the `agent.tool_use` event this result corresponds to. / The id of the AskUserQuestion `agent.tool_use` event this answers. / The id of the `agent.tool_use` event this result corresponds to. / The id of the AskUserQuestion `agent.tool_use` event this answers. |
| data.mcp_server_name | string | Name of the MCP server providing the tool. |
| data._meta | object | Praxis extension (MCP Apps, SEP-1865): the `ui` and `openai/ui` keys of the MCP tool definition's `_meta`, verbatim; other `_meta` keys are not exposed. When `ui.resourceUri` is a `ui://` URI, the tool has an interactive view: a client that implements MCP Apps can fetch that resource from the MCP server and render it for this call. Absent when the tool declares neither key. Clients that do not render MCP Apps ignore it. / Praxis extension (MCP Apps, SEP-1865): the MCP CallToolResult `_meta`, verbatim. Views use it for data that should not reach the model; absent when the tool returned none. / Praxis extension (MCP Apps, SEP-1865): the `ui` and `openai/ui` keys of the MCP tool definition's `_meta`, verbatim; other `_meta` keys are not exposed. When `ui.resourceUri` is a `ui://` URI, the tool has an interactive view: a client that implements MCP Apps can fetch that resource from the MCP server and render it for this call. Absent when the tool declares neither key. Clients that do not render MCP Apps ignore it. / Praxis extension (MCP Apps, SEP-1865): the MCP CallToolResult `_meta`, verbatim. Views use it for data that should not reach the model; absent when the tool returned none. |
| data.source | string | Praxis extension (MCP Apps, SEP-1865): `app` when the call was made by an MCP Apps view, `codemode` when a program run by the codemode tool called an MCP tool that declares a view (the event pair exists so a client can render that view; the model already has the result in the codemode tool result); absent for the model's own calls. / What caused the change. / Praxis extension (MCP Apps, SEP-1865): `app` when the call was made by an MCP Apps view, `codemode` when a program run by the codemode tool called an MCP tool that declares a view (the event pair exists so a client can render that view; the model already has the result in the codemode tool result); absent for the model's own calls. / Praxis extension (MCP Apps, SEP-1865): `app` when the call was made by an MCP Apps view, `codemode` when a program run by the codemode tool called an MCP tool that declares a view (the event pair exists so a client can render that view; the model already has the result in the codemode tool result); absent for the model's own calls. / What caused the change. |
| data.parent_tool_use_id | string | Praxis extension (MCP Apps, SEP-1865): present when `source` is `codemode`; the id of the codemode tool use whose program made this call. Absent otherwise. |
| data.mcp_tool_use_id | string | The id of the `agent.mcp_tool_use` event this result corresponds to. |
| data.structured_content | any | Praxis extension (MCP Apps, SEP-1865): the MCP CallToolResult `structuredContent`, verbatim JSON. MCP Apps views read it as the data to render; absent when the tool returned none. |
| data.result | string | Always `allow`. |
| data.answers | object | The user's answer to each question, keyed by the question text; empty when the questions were dismissed. |
| data.annotations | object | Per-question notes, keyed by the question text. |
| data.agent_name | string | Name of the callable agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. / Name of the callable agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. |
| data.to_session_thread_id | string | Public `sthr_` ID of the thread the message was sent to. |
| data.to_agent_name | null | string | Name of the callable agent this message was sent to. Absent when sent to the primary agent. |
| data.from_session_thread_id | string | Public `sthr_` ID of the thread that sent the message. |
| data.from_agent_name | null | string | Name of the callable agent this message came from. Absent when received from the primary agent. |
| data.event_id | string | Text of the block. / Id of the event this event refers to. / Text of the block. / Text of the block. / Id of the event this event refers to. / Text of the block. |
| data.sources | array<object> | Background work that woke the session with this notification. |
| data.forked_from_session_id | string | Id of the parent session this session was forked from. |
| data.forked_from_message_id | string | message_id of the agent message in the parent session up to which the conversation was copied. |
| data.action | string | What changed in the goal. |
| data.goal | object | null | The goal as the change left it, or null when the session has no goal. |
| data.previous_goal | object | null | The goal before the change, or null when there was none. |
| data.status | string | Where the check stands. Read `verification.passed` on the closing event to know whether the goal counts as done. |
| data.goal_id | string | The goal this check belongs to. |
| data.goal_iteration | integer | Which check of this goal, matching `iteration` on the goal. |
| data.verification_id | string | Identifier shared by every event of one check. |
| data.anchor_message_id | string | null | The assistant message the check follows, or null. |
| data.verification | object | The verdict; absent on `started`. |
| data.event | object | Event name or event payload. |
| data.delta | object | Incremental fragment of the event being produced. |
同一地址也可以用 wss:// 建立只读 WebSocket,每个事件一帧,适合服务端长连接。连接、帧格式、关闭码与限额见用 WebSocket 订阅事件。
会话事件除了用 订阅事件(SSE)拉取,也可以在同一个地址上建立 WebSocket 接收:每个事件一帧,内容与 SSE 的事件数据完全相同。这是本平台在官方 SSE 之外额外提供的接入方式,适合在服务端长期挂着连接、把事件转发给自己系统的场景。
wss://api.deepraxis.ai/agent/v1/sessions/{session_id}/events/stream这条连接是只读的:它只推送事件,不接收任何消息。发消息、打断仍然用 发送事件。
握手请求带与 HTTP 接口相同的认证头:Authorization: Bearer <API Key> 或 x-api-key: <API Key>。
浏览器原生的 WebSocket 不能设置请求头,所以这是服务端用法。浏览器里请用 SSE,或者由你的服务端建立连接后再转给前端。
握手失败时连接不会建立,服务端直接返回 HTTP 错误(错误体格式见错误):
| 情况 | 返回 |
|---|---|
| 没带凭证,或 Key 无效、已禁用 | 401 |
| 会话不存在,或不属于这个 Key 所在的工作区 | 404 |
| 同时进行的请求超过 Key 的并发上限 | 429,见限流 |
一条打开的 WebSocket 和一个进行中的 SSE 一样,会一直占用 Key 的一个并发名额,直到连接关闭。
每一帧都是一个 JSON 文本。连接建立后,第一帧是就绪通知:
{"type":"session.events.ready"}收到它之后,会话里产生的每个事件以一帧送达,event 字段就是 SSE 里的事件数据:
{"type":"session.event","event":{"id":"d4dc3d96-…","type":"agent.message","processed_at":"2026-09-26T13:35:04.906Z","content":[{"type":"text","text":"好"}]}}| 字段 | 说明 |
|---|---|
type | session.events.ready(就绪,只出现一次)或 session.event(一个事件) |
event | 仅 session.event 帧有;结构与事件列表返回的单个事件相同 |
同一个事件可能送达不止一次。例如一条 user.message 会先以 processed_at: null(已接纳、待处理)出现,被处理后再以带时间的形式出现一次。请按 event.id 去重,以最后一次为准。
| 关闭码 | 含义 | 你该做什么 |
|---|---|---|
1000 | 服务端正常结束订阅 | 需要继续接收就重新连接 |
1008 | 客户端向连接发送了消息 | 这条连接只读;不要发送任何帧 |
1011 | 服务端内部中断 | 重新连接,并用事件列表回填 |
1013 | 暂时超出限额(见下) | 重新连接,并用事件列表回填 |
1013 关闭。长会话请准备好重连。1013 关闭。断开期间产生的事件不会补发。重新连接后,用事件列表按时间补齐:
GET /agent/v1/sessions/{session_id}/events?order=asc&created_at[gt]=<你收到的最后一个事件的 processed_at>回填的事件和新连接推送的事件可能重叠,按 event.id 去重即可。
Bun(内置 WebSocket 支持 headers):
const ws = new WebSocket(
`wss://api.deepraxis.ai/agent/v1/sessions/${sessionId}/events/stream`,
{ headers: { Authorization: `Bearer ${process.env.PRAXIS_API_KEY}` } },
);
ws.addEventListener("message", (message) => {
const frame = JSON.parse(String(message.data));
if (frame.type === "session.events.ready") console.log("ready");
if (frame.type === "session.event") console.log(frame.event.type, frame.event);
});
ws.addEventListener("close", (close) => console.log("closed", close.code));Node(ws 包):
import WebSocket from "ws";
const ws = new WebSocket(
`wss://api.deepraxis.ai/agent/v1/sessions/${sessionId}/events/stream`,
{ headers: { Authorization: `Bearer ${process.env.PRAXIS_API_KEY}` } },
);
ws.on("message", (data) => {
const frame = JSON.parse(String(data));
if (frame.type === "session.event") console.log(frame.event.type, frame.event);
});
ws.on("close", (code) => console.log("closed", code));Python(websockets 包):
import asyncio, json, os
import websockets
async def main(session_id: str):
url = f"wss://api.deepraxis.ai/agent/v1/sessions/{session_id}/events/stream"
headers = {"Authorization": f"Bearer {os.environ['PRAXIS_API_KEY']}"}
async with websockets.connect(url, additional_headers=headers) as ws:
async for message in ws:
frame = json.loads(message)
if frame["type"] == "session.event":
print(frame["event"]["type"], frame["event"])
asyncio.run(main("sesn_123"))先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/agent/v1/sessions/{session_id}◐ 部分支持session_idstring必填path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
modelstring可选扩展:模型 ID 字符串,必须属于会话钉住版本的 models.allowed;没有列表时只能选默认模型。下一轮生效,在途一轮不受影响,此处不检查上下文窗口。
agentobject可选会话要运行的智能体:直接写智能体 ID 字符串(固定用最新版本),或传对象指定 id 与 version(见子字段)。
mcp_serversarray可选替换本会话的 MCP 服务器列表:传入的数组整体生效;传空数组清除,省略沿用智能体的配置。
toolsarray可选替换本会话的工具配置;传空数组清除,省略沿用智能体的配置。
titlestring可选Human-readable session title.
metadataobject可选Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve.
budgetobject可选A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.
max_list_costobject必填预算内列表类调用的花费上限。
typestring必填预算类型,目前只有 max_list_cost。
vault_idsarray可选Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use.
thinkingobject可选Praxis extension: explicit session thinking effort; null inherits the pinned agent default, then the model default. none disables thinking only when model.thinking.can_disable is true. Unsupported efforts return 400 invalid_request_error.
effortstring必填Thinking level for this session. The model must support the chosen effort; none requires can_disable. Null on thinking restores inheritance from the agent and model.
200
可选 model 为钉住版本 allowed 内的 ID,thinking 为 {effort: "low|medium|high|xhigh|none"} 或 null。省略保留原值,null 恢复继承;仅换模型会清除不支持的会话档位。两者同时传入按新模型校验,不支持返回 400 且原选择不变。下一轮生效,在途一轮不变。示例:{"model":"deepseek-v4-flash","thinking":{"effort":"xhigh"}}。响应含 thinking 及 model.thinking: {efforts, can_disable, default_effort},能力未知为 null。这些选择字段仅在 /agent/v1 提供。支持 title 与 metadata(官方补丁语义:字符串值写入、null 删除该键、整包 null 清空,未提及的键保留)。官方的 agent 覆盖(tools/mcp_servers)、budget 与 vault_ids 不支持,传入返回 400 并点名字段。归档后的会话更新返回 409。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Session id (sesn_...). Pass it as session_id in every session call. |
| agent | object | Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. |
| agent.id | string | Agent id (agent_...). Pass it as agent when creating a session and as agent_id in agent calls. |
| agent.description | null | string | Free-text description of what the agent is for; null when none was set. |
| agent.mcp_servers | array<object> | URL MCP servers the agent can call, paired one-to-one with mcp_toolset entries in tools and saved with the agent version. No credentials are stored here. |
| agent.model | object | Model identifier and configuration. |
| agent.multiagent | null | object | Resolved coordinator topology with full agent definitions for each roster member. |
| agent.name | string | Display name of the agent, as set on create or update. It is a label, not a unique key. |
| agent.skills | array<object> | Skills attached to the agent. Setting skills is not supported on this platform and returns 400, so do not send this field on create or update. |
| agent.system | null | string | System prompt given to the model at the start of every session of this agent; null when none was set. |
| agent.tools | array<object> | Tools of the agent: one agent_toolset_20260401 entry for the native tools (all resolved settings are returned, ready to send back on update), plus mcp_toolset entries and custom tool definitions. |
| agent.type | string | Always `agent`. An agent definition. |
| agent.version | number | The agent's current version. Starts at 1 and increments each time the agent is modified. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| budget | null | object | A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`. |
| budget.max_list_cost | object | A monetary amount in a specific currency. |
| budget.type | string | Always `limit`. A spending limit. |
| created_at | string | A timestamp in RFC 3339 format |
| environment_id | string | Id of the environment recipe the session's sandbox was created from. Omitted when no recipe was selected, that is, for a light machine or the Computer chosen by computer_id. |
| metadata | object | Free-form string key/value pairs stored with the session, changed through sessions.update patch semantics. |
| outcome_evaluations | array<object> | Per-outcome evaluation state. One entry per `define_outcome` event sent to the session. |
| outcome_evaluations[].completed_at | null | string | A timestamp in RFC 3339 format |
| outcome_evaluations[].description | string | What the agent should produce. |
| outcome_evaluations[].explanation | null | string | Grader's verdict text from the most recent evaluation. For `satisfied`, explains why criteria are met; for `needs_revision` (intermediate), what's missing; for `failed`, why unrecoverable. |
| outcome_evaluations[].iteration | number | 0-indexed revision cycle the outcome is currently on. |
| outcome_evaluations[].outcome_id | string | Server-generated outc_ ID for this outcome. |
| outcome_evaluations[].result | string | Current evaluation state. `pending` before the agent begins work; `running` while producing or revising; `evaluating` while the grader scores; `satisfied`/`max_iterations_reached`/`failed`/`interrupted` are terminal. |
| outcome_evaluations[].type | string | Always `outcome_evaluation`. Record of one outcome evaluation. |
| resources | array<object> | Resources attached to the session, at most 500; each is a file reference mounted into the session's machine. |
| resources[].id | string | Resource id, the resource_id of sessions.resources calls. |
| resources[].created_at | string | A timestamp in RFC 3339 format |
| resources[].mount_path | string | null | string | Path inside the machine where the file is mounted; defaults to /mnt/session/uploads/<file_id>, and custom paths are rooted there. / Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only. |
| resources[].type | string | Always `github_repository`. A GitHub repository resource; not supported on this platform. / Always `file`. A file resource: an uploaded file mounted into the session's machine. / Always `memory_store`. A memory store resource; not supported on this platform. |
| resources[].updated_at | string | A timestamp in RFC 3339 format |
| resources[].url | string | Repository URL. |
| resources[].checkout | null | object | Branch or commit to check out. |
| resources[].file_id | string | Id of the uploaded file; it must exist and belong to your tenant. |
| resources[].memory_store_id | string | The memory store ID (memstore_...). Must belong to the caller's organization and workspace. |
| resources[].access | null | string | Access mode for an attached memory store. |
| resources[].description | string | Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description. |
| resources[].instructions | null | string | Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars. |
| resources[].name | null | string | Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource. |
| stats | object | Timing statistics for a session. |
| stats.active_seconds | number | Cumulative time in seconds the session spent in `running` status. Excludes idle time. |
| stats.duration_seconds | number | Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. |
| status | string | SessionStatus enum - `rescheduling` - Transient error occurred, retrying automatically. - `running` - Agent is actively executing. - `idle` - Agent is waiting for input, including user messages or tool confirmations. Sessions start in idle. - `terminated` - Session has ended, either due to an error or completion. |
| title | null | string | Title of the session, set on create or through sessions.update; null when none was set. |
| type | string | Always `session`. A session, one conversation of an agent on a machine. |
| updated_at | string | A timestamp in RFC 3339 format |
| usage | object | Cumulative token usage for a session across all turns. |
| usage.active_seconds | number | Cumulative time in seconds during which the session had at least one thread in running status. Overlapping activity from concurrent threads is counted once, unlike `stats.active_seconds`, which sums each thread's own active time. This is the duration the session's runtime cost is priced on. |
| usage.cache_creation | object | Prompt-cache creation token usage broken down by cache lifetime. |
| usage.cache_read_input_tokens | number | Total tokens read from prompt cache. |
| usage.input_tokens | number | Total input tokens consumed across all turns. |
| usage.list_cost | null | object | A monetary amount in a specific currency. |
| usage.output_tokens | number | Total output tokens generated across all turns. |
| usage.server_tool_use | null | object | Cumulative count of server-executed tool invocations, broken down by tool. |
| vault_ids | array<string> | Vault IDs attached to the session at creation. Empty when no vaults were supplied. |
| deployment_id | null | string | Deployment ID when the session was created from a deployment reference. Null otherwise. |
| cwd | string | Normalized session working directory; defaults to /home/user/workspace. Forks inherit this directory. |
| computer_id | string | Praxis extension: MA only has session-scoped temporary containers and memory_stores, not durable browsable computers. computer_id selects a tenant-owned active computer. Session selection overrides the agent default; a sandbox environment_id and computer_id cannot be combined. Omitted when no computer is selected. |
| model | object | 扩展 / Praxis extension: the currently selected session model. |
| model.id | string | Identifier of the object, as returned by the API; pass it in the path of follow-up calls on the same resource. |
| model.thinking | object | null | Supported thinking controls, or null when capability is unknown or unavailable. efforts lists selectable strengths; can_disable permits none; default_effort is nullable. |
| thinking | object | null | Praxis extension: explicit session thinking effort; null inherits the pinned agent default, then the model default. none disables thinking only when model.thinking.can_disable is true. Unsupported efforts return 400 invalid_request_error. |
| thinking.effort | string | Thinking level saved for this session: low, medium, high, xhigh, or none to turn thinking off. Null or absent means the session inherits the agent default and then the model default. |
| forked_from | object | null | Praxis extension: source of a forked session; null for other sessions. Available only on /agent/v1. |
| forked_from.session_id | string | Id of the parent session this session was forked from; it is left unchanged by the fork. |
| forked_from.message_id | string | message_id of the agent message in the parent session up to which the conversation was copied. |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/agent/v1/sessions/{session_id}/archive● 支持session_idstring必填path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
200
归档后的会话拒绝新消息(400 invalid_request_error,写明会话已归档),读取与事件历史仍可用;重复归档幂等,archived_at 保持首次归档时间。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Session id (sesn_...). Pass it as session_id in every session call. |
| agent | object | Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. |
| agent.id | string | Agent id (agent_...). Pass it as agent when creating a session and as agent_id in agent calls. |
| agent.description | null | string | Free-text description of what the agent is for; null when none was set. |
| agent.mcp_servers | array<object> | URL MCP servers the agent can call, paired one-to-one with mcp_toolset entries in tools and saved with the agent version. No credentials are stored here. |
| agent.model | object | Model identifier and configuration. |
| agent.multiagent | null | object | Resolved coordinator topology with full agent definitions for each roster member. |
| agent.name | string | Display name of the agent, as set on create or update. It is a label, not a unique key. |
| agent.skills | array<object> | Skills attached to the agent. Setting skills is not supported on this platform and returns 400, so do not send this field on create or update. |
| agent.system | null | string | System prompt given to the model at the start of every session of this agent; null when none was set. |
| agent.tools | array<object> | Tools of the agent: one agent_toolset_20260401 entry for the native tools (all resolved settings are returned, ready to send back on update), plus mcp_toolset entries and custom tool definitions. |
| agent.type | string | Always `agent`. An agent definition. |
| agent.version | number | The agent's current version. Starts at 1 and increments each time the agent is modified. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| budget | null | object | A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`. |
| budget.max_list_cost | object | A monetary amount in a specific currency. |
| budget.type | string | Always `limit`. A spending limit. |
| created_at | string | A timestamp in RFC 3339 format |
| environment_id | string | Id of the environment recipe the session's sandbox was created from. Omitted when no recipe was selected, that is, for a light machine or the Computer chosen by computer_id. |
| metadata | object | Free-form string key/value pairs stored with the session, changed through sessions.update patch semantics. |
| outcome_evaluations | array<object> | Per-outcome evaluation state. One entry per `define_outcome` event sent to the session. |
| outcome_evaluations[].completed_at | null | string | A timestamp in RFC 3339 format |
| outcome_evaluations[].description | string | What the agent should produce. |
| outcome_evaluations[].explanation | null | string | Grader's verdict text from the most recent evaluation. For `satisfied`, explains why criteria are met; for `needs_revision` (intermediate), what's missing; for `failed`, why unrecoverable. |
| outcome_evaluations[].iteration | number | 0-indexed revision cycle the outcome is currently on. |
| outcome_evaluations[].outcome_id | string | Server-generated outc_ ID for this outcome. |
| outcome_evaluations[].result | string | Current evaluation state. `pending` before the agent begins work; `running` while producing or revising; `evaluating` while the grader scores; `satisfied`/`max_iterations_reached`/`failed`/`interrupted` are terminal. |
| outcome_evaluations[].type | string | Always `outcome_evaluation`. Record of one outcome evaluation. |
| resources | array<object> | Resources attached to the session, at most 500; each is a file reference mounted into the session's machine. |
| resources[].id | string | Resource id, the resource_id of sessions.resources calls. |
| resources[].created_at | string | A timestamp in RFC 3339 format |
| resources[].mount_path | string | null | string | Path inside the machine where the file is mounted; defaults to /mnt/session/uploads/<file_id>, and custom paths are rooted there. / Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only. |
| resources[].type | string | Always `github_repository`. A GitHub repository resource; not supported on this platform. / Always `file`. A file resource: an uploaded file mounted into the session's machine. / Always `memory_store`. A memory store resource; not supported on this platform. |
| resources[].updated_at | string | A timestamp in RFC 3339 format |
| resources[].url | string | Repository URL. |
| resources[].checkout | null | object | Branch or commit to check out. |
| resources[].file_id | string | Id of the uploaded file; it must exist and belong to your tenant. |
| resources[].memory_store_id | string | The memory store ID (memstore_...). Must belong to the caller's organization and workspace. |
| resources[].access | null | string | Access mode for an attached memory store. |
| resources[].description | string | Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description. |
| resources[].instructions | null | string | Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars. |
| resources[].name | null | string | Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource. |
| stats | object | Timing statistics for a session. |
| stats.active_seconds | number | Cumulative time in seconds the session spent in `running` status. Excludes idle time. |
| stats.duration_seconds | number | Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update. |
| status | string | SessionStatus enum - `rescheduling` - Transient error occurred, retrying automatically. - `running` - Agent is actively executing. - `idle` - Agent is waiting for input, including user messages or tool confirmations. Sessions start in idle. - `terminated` - Session has ended, either due to an error or completion. |
| title | null | string | Title of the session, set on create or through sessions.update; null when none was set. |
| type | string | Always `session`. A session, one conversation of an agent on a machine. |
| updated_at | string | A timestamp in RFC 3339 format |
| usage | object | Cumulative token usage for a session across all turns. |
| usage.active_seconds | number | Cumulative time in seconds during which the session had at least one thread in running status. Overlapping activity from concurrent threads is counted once, unlike `stats.active_seconds`, which sums each thread's own active time. This is the duration the session's runtime cost is priced on. |
| usage.cache_creation | object | Prompt-cache creation token usage broken down by cache lifetime. |
| usage.cache_read_input_tokens | number | Total tokens read from prompt cache. |
| usage.input_tokens | number | Total input tokens consumed across all turns. |
| usage.list_cost | null | object | A monetary amount in a specific currency. |
| usage.output_tokens | number | Total output tokens generated across all turns. |
| usage.server_tool_use | null | object | Cumulative count of server-executed tool invocations, broken down by tool. |
| vault_ids | array<string> | Vault IDs attached to the session at creation. Empty when no vaults were supplied. |
| deployment_id | null | string | Deployment ID when the session was created from a deployment reference. Null otherwise. |
| cwd | string | Normalized session working directory; defaults to /home/user/workspace. Forks inherit this directory. |
| computer_id | string | Praxis extension: MA only has session-scoped temporary containers and memory_stores, not durable browsable computers. computer_id selects a tenant-owned active computer. Session selection overrides the agent default; a sandbox environment_id and computer_id cannot be combined. Omitted when no computer is selected. |
| model | object | 扩展 / Praxis extension: the currently selected session model. |
| model.id | string | Identifier of the object, as returned by the API; pass it in the path of follow-up calls on the same resource. |
| model.thinking | object | null | Supported thinking controls, or null when capability is unknown or unavailable. efforts lists selectable strengths; can_disable permits none; default_effort is nullable. |
| thinking | object | null | Praxis extension: explicit session thinking effort; null inherits the pinned agent default, then the model default. none disables thinking only when model.thinking.can_disable is true. Unsupported efforts return 400 invalid_request_error. |
| thinking.effort | string | Thinking level saved for this session: low, medium, high, xhigh, or none to turn thinking off. Null or absent means the session inherits the agent default and then the model default. |
| forked_from | object | null | Praxis extension: source of a forked session; null for other sessions. Available only on /agent/v1. |
| forked_from.session_id | string | Id of the parent session this session was forked from; it is left unchanged by the fork. |
| forked_from.message_id | string | message_id of the agent message in the parent session up to which the conversation was copied. |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/agent/v1/sessions/{session_id}/threads◐ 部分支持session_idstring必填path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
limitnumber可选query: Number of items per page.
pagestring可选query: Opaque pagination cursor: pass the next_page value of the previous response unchanged. Omit it for the first page. A cursor from a different query or a malformed one returns 400.
200
按 created_at 升序返回主线程及全部子线程。线程 id 为 sthr_ 加所属会话 id 的后缀;子线程的 parent_thread_id 指向主线程,session_id 始终为父会话。agent 是实际运行的定义,内置类型的 name 为类型名,未注册的 id/version 为 null。归档子线程的 status 为 terminated,archived_at 为归档时间;stats/usage 无线程级追踪时如实为 null。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | Items of this page, in the order requested by the call. |
| data[].id | string | Unique identifier for this thread. |
| data[].agent | object | The resolved agent a `session_thread` runs. |
| data[].archived_at | null | string | A timestamp in RFC 3339 format |
| data[].created_at | string | A timestamp in RFC 3339 format |
| data[].parent_thread_id | null | string | Parent thread that spawned this thread. Null for the primary thread. |
| data[].session_id | string | The session this thread belongs to. |
| data[].stats | null | object | Timing statistics for a session thread. |
| data[].status | string | SessionThreadStatus enum |
| data[].type | string | Always `session_thread`. An execution thread of a session. |
| data[].updated_at | string | A timestamp in RFC 3339 format |
| data[].usage | null | object | Cumulative token usage for a session thread across all turns. |
| next_page | string | null | Opaque cursor for the next page: pass it unchanged as page to continue. Null when this is the last page. |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/agent/v1/sessions/{session_id}/threads/{thread_id}◐ 部分支持session_idstring必填path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
thread_idstring必填path: Execution thread id (sthr_...), as listed by sessions.threads.list; the primary thread id equals the session's own thread. Unknown or foreign ids return 404.
session_idstring必填query: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
200
返回本会话的主线程或子线程,与列表项逐字段一致。其他会话的线程、未知线程或非 sthr_ id 一律返回 404,不泄露其存在性。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for this thread. |
| agent | object | The resolved agent a `session_thread` runs. |
| agent.model | string | object | The advisor model id. / Model identifier and configuration. |
| agent.type | string | Always `advisor`. An advisor whose model is consulted for advice in a separate thread (at most one per coordinator). / Always `agent`. A roster member that refers to an agent by id and pinned version. |
| agent.id | string | Agent id (agent_...). Pass it as agent when creating a session and as agent_id in agent calls. |
| agent.description | null | string | Free-text description of what the agent is for; null when none was set. |
| agent.mcp_servers | array<object> | URL MCP servers the agent can call, paired one-to-one with mcp_toolset entries in tools and saved with the agent version. No credentials are stored here. |
| agent.name | string | Display name of the agent, as set on create or update. It is a label, not a unique key. |
| agent.skills | array<object> | Skills attached to the agent. Setting skills is not supported on this platform and returns 400, so do not send this field on create or update. |
| agent.system | null | string | System prompt given to the model at the start of every session of this agent; null when none was set. |
| agent.tools | array<object> | Tools of the agent: one agent_toolset_20260401 entry for the native tools (all resolved settings are returned, ready to send back on update), plus mcp_toolset entries and custom tool definitions. |
| agent.version | number | The agent's current version. Starts at 1 and increments each time the agent is modified. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| parent_thread_id | null | string | Parent thread that spawned this thread. Null for the primary thread. |
| session_id | string | The session this thread belongs to. |
| stats | null | object | Timing statistics for a session thread. |
| stats.active_seconds | number | Cumulative time in seconds the thread spent actively running. Excludes idle time. |
| stats.duration_seconds | number | Elapsed time since thread creation in seconds. For archived threads, frozen at the final update. |
| stats.startup_seconds | number | Time in seconds for the thread to begin running. Zero for child threads, which start immediately. |
| status | string | SessionThreadStatus enum |
| type | string | Always `session_thread`. An execution thread of a session. |
| updated_at | string | A timestamp in RFC 3339 format |
| usage | null | object | Cumulative token usage for a session thread across all turns. |
| usage.active_seconds | number | Cumulative time in seconds this thread spent in running status. Equal to `stats.active_seconds`; surfaced here so a thread's usage carries every quantity its cost is priced on. |
| usage.cache_creation | object | Prompt-cache creation token usage broken down by cache lifetime. |
| usage.cache_read_input_tokens | number | Total tokens read from prompt cache. |
| usage.input_tokens | number | Total input tokens consumed across all turns. |
| usage.list_cost | null | object | A monetary amount in a specific currency. |
| usage.output_tokens | number | Total output tokens generated across all turns. |
| usage.server_tool_use | null | object | Cumulative count of server-executed tool invocations, broken down by tool. |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/agent/v1/sessions/{session_id}/threads/{thread_id}/events◐ 部分支持session_idstring必填path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
thread_idstring必填path: Execution thread id (sthr_...), as listed by sessions.threads.list; the primary thread id equals the session's own thread. Unknown or foreign ids return 404.
session_idstring必填query: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
limitnumber可选query: Number of items per page.
pagestring可选query: Opaque pagination cursor: pass the next_page value of the previous response unchanged. Omit it for the first page. A cursor from a different query or a malformed one returns 400.
200
读取所选线程自己的事件记录:主线程读主会话,子线程读对应子会话。沿用会话事件接口的查询参数、公开事件类型和 data + next_page 信封。使用网页工具时,两个接口均返回 search_result 块;回答 citations 为 /agent/v1 扩展,/anthropic 将引用显示为正文 [n]。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | Items of this page, in the order requested by the call. |
| data[].id | string | Unique identifier for this event. / Event id, unique within the session. Use it to refer to this event, for example in user.tool_confirmation or user.steer. / Event id, unique within the session. / Event id, unique within the session. Use it to refer to this event, for example in user.tool_confirmation or user.steer. / Event id, unique within the session. Use it to refer to this event, for example in user.tool_confirmation or user.steer. |
| data[].content | array<object> | Array of content blocks comprising the user message. / The result content returned by the tool. / Array of text blocks comprising the agent response. / The result content returned by the tool. / The result content returned by the tool. / Message content blocks. / Message content blocks. / The result content returned by the tool. / System content blocks. Text-only. |
| data[].type | string | Always `user.message`. A message from the user to the agent, with content blocks. / Always `user.interrupt`. The user interrupted the running turn. / Always `user.tool_confirmation`. The user's decision to allow or deny a tool call that waits for approval. / Always `user.custom_tool_result`. The user's result for a custom tool call. / Always `agent.custom_tool_use`. The agent called a custom tool defined by the client. / Always `agent.message`. A message from the agent, with text content blocks. / Always `agent.thinking`. The agent's thinking text for a step. / Always `agent.mcp_tool_use`. The agent called an MCP tool. / Always `agent.mcp_tool_result`. The result of an MCP tool call. / Always `agent.tool_use`. The agent called a tool. / Always `agent.tool_result`. The result of a tool call. / Always `agent.thread_message_received`. The agent received a message from another thread. / Always `agent.thread_message_sent`. The agent sent a message to another thread. / Always `agent.thread_context_compacted`. The thread's context was compacted into a summary. / Always `session.error`. The session hit an error. / Always `session.status_rescheduled`. The session will retry after a recoverable error. / Always `session.status_running`. The session started running a turn. / Always `session.status_idle`. The session stopped running; stop_reason says why. / Always `session.status_terminated`. The session ended and accepts no more work. / Always `session.thread_created`. A child thread was started. / Always `span.outcome_evaluation_start`. An outcome evaluation started. / Always `span.outcome_evaluation_end`. An outcome evaluation ended. / Always `span.model_request_start`. A model request started. / Always `span.model_request_end`. A model request ended, with its usage. / Always `span.outcome_evaluation_ongoing`. An outcome evaluation is still running. / Always `user.define_outcome`. The user defined the outcome the agent should reach. / Always `session.deleted`. The session was deleted. / Always `session.thread_status_running`. A thread started running. / Always `session.thread_status_idle`. A thread stopped running; stop_reason says why. / Always `session.thread_status_terminated`. A thread ended. / Always `user.tool_result`. The user's result for a client-side tool call. / Always `session.thread_status_rescheduled`. A thread will retry after a recoverable error. / Always `session.updated`. The session's model, title, metadata, agent or budget changed. / Always `system.message`. A message produced by the platform rather than the user or the agent. / Always `session.usage`. Cumulative usage of the session. / Always `session.forked`. The session was created by forking another session. / Always `session.goal_changed`. / Always `session.goal_verification`. / Always `user.steer`. Receipt that a queued user.message was injected into the running turn. |
| data[].processed_at | null | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | null | string | string | string | null | string | string | string | string | string | string | A timestamp in RFC 3339 format / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / When the event was recorded, RFC 3339. / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / RFC 3339 time at which the server processed the event; null while a queued input has not started running. |
| data[].message_id | string | UI transcript message ID. Use the last assistant message in a successfully completed turn as the fork target. / UI transcript message ID shared with this assistant's message parts. |
| data[].session_thread_id | null | string | string | string | string | string | null | string | string | If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread. / Set by the server to the subagent thread this confirmation was routed to. Omitted when it was routed to the primary thread. / Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread. / When set, this event was cross-posted from a subagent's thread to surface its custom tool use on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.custom_tool_result` by `custom_tool_use_id`, so clients do not send it back. / When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.tool_confirmation` by `tool_use_id`, so clients do not send it back. / When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.tool_confirmation` or `user.tool_result` by `tool_use_id`, so clients do not send it back. / Public `sthr_` ID of the newly created thread. / Public sthr_ ID of the thread that started running. / Public sthr_ ID of the thread that went idle. / Public sthr_ ID of the thread that terminated. / Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread. / Public sthr_ ID of the thread that is retrying. |
| data[].result | string | UserToolConfirmationResult enum / Evaluation verdict. 'satisfied': criteria met, session goes idle. 'needs_revision': criteria not met, another revision cycle follows. 'max_iterations_reached': evaluation budget exhausted with criteria still unmet — one final acknowledgment turn follows before the session goes idle, but no further evaluation runs. 'failed': grader determined the rubric does not apply to the deliverables. 'interrupted': user sent an interrupt while evaluation was in progress. |
| data[].tool_use_id | string | The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field. / The id of the `agent.tool_use` event this result corresponds to. / The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field. |
| data[].deny_message | null | string | Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'. |
| data[].custom_tool_use_id | string | The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field. |
| data[].is_error | null | boolean | Whether the tool execution resulted in an error. / Whether the model request resulted in an error. / Whether the tool execution resulted in an error. |
| data[].input | object | Input parameters for the tool call. |
| data[].name | string | Name of the custom tool being called. / Name of the MCP tool being used. / Name of the agent tool being used. |
| data[].mcp_server_name | string | Name of the MCP server providing the tool. |
| data[].evaluated_permission | string | AgentEvaluatedPermission enum |
| data[].evaluation | object | Names the resolved permission_policy that produced evaluated_permission, and under auto carries the judgement. Open union: clients must tolerate unknown variants. |
| data[].parent_tool_use_id | string | Praxis extension (MCP Apps, SEP-1865): present when `source` is `codemode`; the id of the codemode tool use whose program made this call. Absent otherwise. |
| data[]._meta | object | Praxis extension (MCP Apps, SEP-1865): the `ui` and `openai/ui` keys of the MCP tool definition's `_meta`, verbatim; other `_meta` keys are not exposed. When `ui.resourceUri` is a `ui://` URI, the tool has an interactive view: a client that implements MCP Apps can fetch that resource from the MCP server and render it for this call. Absent when the tool declares neither key. Clients that do not render MCP Apps ignore it. / Praxis extension (MCP Apps, SEP-1865): the MCP CallToolResult `_meta`, verbatim. Views use it for data that should not reach the model; absent when the tool returned none. |
| data[].source | string | Praxis extension (MCP Apps, SEP-1865): `app` when the call was made by an MCP Apps view, `codemode` when a program run by the codemode tool called an MCP tool that declares a view (the event pair exists so a client can render that view; the model already has the result in the codemode tool result); absent for the model's own calls. / What caused the change. |
| data[].mcp_tool_use_id | string | The id of the `agent.mcp_tool_use` event this result corresponds to. |
| data[].structured_content | any | Praxis extension (MCP Apps, SEP-1865): the MCP CallToolResult `structuredContent`, verbatim JSON. MCP Apps views read it as the data to render; absent when the tool returned none. |
| data[].from_session_thread_id | string | Public `sthr_` ID of the thread that sent the message. |
| data[].from_agent_name | null | string | Name of the callable agent this message came from. Absent when received from the primary agent. |
| data[].to_session_thread_id | string | Public `sthr_` ID of the thread the message was sent to. |
| data[].to_agent_name | null | string | Name of the callable agent this message was sent to. Absent when sent to the primary agent. |
| data[].error | object | Description of the error and what the client should do next. |
| data[].stop_reason | object | Why the session stopped running, with the variant data needed to continue. |
| data[].agent_name | string | Name of the callable agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. |
| data[].iteration | number | 0-indexed revision cycle. 0 is the first evaluation; 1 is the re-evaluation after the first revision; etc. / 0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`. / 0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`. |
| data[].outcome_id | string | The `outc_` ID of the outcome being evaluated. / Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list. |
| data[].explanation | string | Human-readable explanation of the verdict. For `needs_revision`, describes which criteria failed and why. |
| data[].outcome_evaluation_start_id | string | The id of the corresponding `span.outcome_evaluation_start` event. |
| data[].usage | object | Token usage for a single model request. / Point-in-time snapshot of a session's cumulative usage. |
| data[].model_request_start_id | string | The id of the corresponding `span.model_request_start` event. |
| data[].model_usage | object | Token usage for a single model request. |
| data[].description | string | What the agent should produce. Copied from the input event. |
| data[].max_iterations | null | number | Evaluate-then-revise cycles before giving up. Default 3, max 20. |
| data[].rubric | object | Rubric for grading the quality of an outcome. |
| data[].agent | null | object | Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. |
| data[].budget | null | object | A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`. |
| data[].metadata | object | The session's full metadata bag after the update. Present when the update set non-empty metadata; absent when metadata was unchanged or cleared to empty. |
| data[].title | null | string | The session's new title. Present only when the update changed it. |
| data[].model | object | 扩展 / Praxis extension: the changed session model, present only on /agent/v1 session.updated events. Model-only updates are omitted on /anthropic. |
| data[].forked_from_session_id | string | Id of the parent session this session was forked from. |
| data[].forked_from_message_id | string | message_id of the agent message in the parent session up to which the conversation was copied. |
| data[].action | string | What changed in the goal. |
| data[].goal | object | null | The goal as the change left it, or null when the session has no goal. |
| data[].previous_goal | object | null | The goal before the change, or null when there was none. |
| data[].status | string | Where the check stands. Read `verification.passed` on the closing event to know whether the goal counts as done. |
| data[].goal_id | string | The goal this check belongs to. |
| data[].goal_iteration | integer | Which check of this goal, matching `iteration` on the goal. |
| data[].verification_id | string | Identifier shared by every event of one check. |
| data[].anchor_message_id | string | null | The assistant message the check follows, or null. |
| data[].verification | object | The verdict; absent on `started`. |
| data[].event_id | string | Id of the event this event refers to. |
| next_page | string | null | Opaque cursor for the next page: pass it unchanged as page to continue. Null when this is the last page. |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/agent/v1/sessions/{session_id}/threads/{thread_id}/stream◐ 部分支持session_idstring必填path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
thread_idstring必填path: Execution thread id (sthr_...), as listed by sessions.threads.list; the primary thread id equals the session's own thread. Unknown or foreign ids return 404.
session_idstring必填query: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
event_deltasarray可选query: When set, this connection also receives streaming deltas (`event_start`, `event_delta`) while an event is being produced, before the event itself arrives. Deltas are best-effort; when the final event is produced it carries the complete content. A model request that ends early (an error or interrupt) produces no final event — its terminal `span.model_request_end` closes the preview. Accepts one or more event types to preview and may be repeated: `agent.message` streams `content_delta` fragments; `agent.thinking` is start-only — a signal that the agent has begun extended thinking, concluded by the `agent.thinking` event itself. Only previews of the requested event types are sent.
200
订阅所选线程自己的实时事件流。复用会话 SSE 实现;/agent 接口支持同址只读 WebSocket。主会话流同时包含子线程创建、状态和消息事件,子线程审批带 session_thread_id 上浮;确认或中断携带该字段时路由到所属子线程。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Server-sent events
text/event-stream — chunk / 事件对象
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Identifier of the object, as returned by the API; pass it in the path of follow-up calls on the same resource. |
| event | string | Server-Sent Events event name of this frame. / Always `user.message`. SSE event name of this frame; its data is a user.message payload. A message from the user to the agent, with content blocks. / Always `user.interrupt`. SSE event name of this frame; its data is a user.interrupt payload. The user interrupted the running turn. / Always `agent.message`. SSE event name of this frame; its data is a agent.message payload. A message from the agent, with text content blocks. / Always `agent.thinking`. SSE event name of this frame; its data is a agent.thinking payload. The agent's thinking text for a step. / Always `session.status_running`. SSE event name of this frame; its data is a session.status_running payload. The session started running a turn. / Always `session.status_rescheduled`. SSE event name of this frame; its data is a session.status_rescheduled payload. The session will retry after a recoverable error. / Always `session.status_idle`. SSE event name of this frame; its data is a session.status_idle payload. The session stopped running; stop_reason says why. / Always `session.status_terminated`. SSE event name of this frame; its data is a session.status_terminated payload. The session ended and accepts no more work. / Always `agent.thread_context_compacted`. SSE event name of this frame; its data is a agent.thread_context_compacted payload. The thread's context was compacted into a summary. / Always `agent.thread_context_reset`. SSE event name of this frame; its data is a agent.thread_context_reset payload. Content was removed from the model's context after a content-safety refusal. / Always `session.updated`. SSE event name of this frame; its data is a session.updated payload. The session's model, title, metadata, agent or budget changed. / Always `session.error`. SSE event name of this frame; its data is a session.error payload. The session hit an error. / Always `session.usage`. SSE event name of this frame; its data is a session.usage payload. Cumulative usage of the session. / Always `span.model_request_start`. SSE event name of this frame; its data is a span.model_request_start payload. A model request started. / Always `span.model_request_end`. SSE event name of this frame; its data is a span.model_request_end payload. A model request ended, with its usage. / Always `agent.tool_use`. SSE event name of this frame; its data is a agent.tool_use payload. The agent called a tool. / Always `agent.tool_result`. SSE event name of this frame; its data is a agent.tool_result payload. The result of a tool call. / Always `agent.mcp_tool_use`. SSE event name of this frame; its data is a agent.mcp_tool_use payload. The agent called an MCP tool. / Always `agent.mcp_tool_result`. SSE event name of this frame; its data is a agent.mcp_tool_result payload. The result of an MCP tool call. / Always `user.tool_confirmation`. SSE event name of this frame; its data is a user.tool_confirmation payload. The user's decision to allow or deny a tool call that waits for approval. / Always `session.thread_created`. SSE event name of this frame; its data is a session.thread_created payload. A child thread was started. / Always `session.thread_status_running`. SSE event name of this frame; its data is a session.thread_status_running payload. A thread started running. / Always `session.thread_status_idle`. SSE event name of this frame; its data is a session.thread_status_idle payload. A thread stopped running; stop_reason says why. / Always `session.thread_status_rescheduled`. SSE event name of this frame; its data is a session.thread_status_rescheduled payload. A thread will retry after a recoverable error. / Always `session.thread_status_terminated`. SSE event name of this frame; its data is a session.thread_status_terminated payload. A thread ended. / Always `agent.thread_message_sent`. SSE event name of this frame; its data is a agent.thread_message_sent payload. The agent sent a message to another thread. / Always `agent.thread_message_received`. SSE event name of this frame; its data is a agent.thread_message_received payload. The agent received a message from another thread. / Always `user.withdraw`. SSE event name of this frame; its data is a user.withdraw payload. A queued user.message was withdrawn before it ran. / Always `user.steer`. SSE event name of this frame; its data is a user.steer payload. Receipt that a queued user.message was injected into the running turn. / Always `system.notification`. SSE event name of this frame; its data is a system.notification payload. Background work woke the session with a notification. / Always `session.forked`. SSE event name of this frame; its data is a session.forked payload. The session was created by forking another session. / Always `session.goal_changed`. SSE event name of this frame; its data is a session.goal_changed payload. The session's goal was set, changed status, accounted usage or was cleared. / Always `session.goal_verification`. SSE event name of this frame; its data is a session.goal_verification payload. One completion check of the session's goal started or ended. / Always `event_start`. SSE event name of this frame; its data is a event_start payload. Preview that an event of the requested delta types has started. / Always `event_delta`. SSE event name of this frame; its data is a event_delta payload. Incremental fragment of the event being produced. / Always `ping`. SSE event name of this frame; its data is a ping payload. Keep-alive frame; carries no data. / Always `error`. SSE event name of this frame; its data is a error payload. A stream error. |
| data | object | Decoded JSON payload of this frame; its shape is selected by the event name. / Praxis extension (AskUserQuestion, own face only): the confirmation of an AskUserQuestion call, with the answers it carried. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. / Praxis extension (goal mode, own face only): the session's goal was set, moved to another status, accounted usage or was cleared. `goal` is the goal after the change, `previous_goal` the one before; each is null when there was none. / Praxis extension (goal mode, own face only): one completion check of the goal. A `started` event opens it; `completed`, `failed_closed` or `cancelled` closes it. Events of one check share `verification_id`. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. / Decoded JSON payload of this frame; its shape is selected by the event name. |
| data.id | string | Unique identifier for this event. / Text of the block. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Event id, unique within the session. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Text of the block. / Event id, unique within the session. Use it to refer to this event, for example in user.tool_confirmation or user.steer. / Text of the block. / Event id, unique within the session. Use it to refer to this event, for example in user.tool_confirmation or user.steer. / Event id, unique within the session. / Event id, unique within the session. Use it to refer to this event, for example in user.tool_confirmation or user.steer. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Text of the block. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Event id, unique within the session. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Unique identifier for this event. / Text of the block. / Event id, unique within the session. Use it to refer to this event, for example in user.tool_confirmation or user.steer. / Text of the block. / Event id, unique within the session. Use it to refer to this event, for example in user.tool_confirmation or user.steer. / Event id, unique within the session. / Event id, unique within the session. Use it to refer to this event, for example in user.tool_confirmation or user.steer. |
| data.content | array<object> | Array of content blocks comprising the user message. / Array of text blocks comprising the agent response. / Content blocks of the event, in order. / The result content returned by the tool. / The result content returned by the tool. / Message content blocks. / Message content blocks. / Array of content blocks comprising the user message. / Array of text blocks comprising the agent response. / Content blocks of the event, in order. / The result content returned by the tool. / The result content returned by the tool. / Message content blocks. / Message content blocks. |
| data.type | string | Always `user.message`. A message from the user to the agent, with content blocks. / Always `user.interrupt`. The user interrupted the running turn. / Always `agent.message`. A message from the agent, with text content blocks. / Always `agent.thinking`. The agent's thinking text for a step. / Always `session.status_running`. The session started running a turn. / Always `session.status_rescheduled`. The session will retry after a recoverable error. / Always `session.status_idle`. The session stopped running; stop_reason says why. / Always `session.status_terminated`. The session ended and accepts no more work. / Always `agent.thread_context_compacted`. The thread's context was compacted into a summary. / Always `agent.thread_context_reset`. Content was removed from the model's context after a content-safety refusal. / Always `session.updated`. The session's model, title, metadata, agent or budget changed. / Always `session.error`. The session hit an error. / Always `session.usage`. Cumulative usage of the session. / Always `span.model_request_start`. A model request started. / Always `span.model_request_end`. A model request ended, with its usage. / Always `agent.tool_use`. The agent called a tool. / Always `agent.tool_result`. The result of a tool call. / Always `agent.mcp_tool_use`. The agent called an MCP tool. / Always `agent.mcp_tool_result`. The result of an MCP tool call. / Always `user.tool_confirmation`. / Always `session.thread_created`. A child thread was started. / Always `session.thread_status_running`. A thread started running. / Always `session.thread_status_idle`. A thread stopped running; stop_reason says why. / Always `session.thread_status_rescheduled`. A thread will retry after a recoverable error. / Always `session.thread_status_terminated`. A thread ended. / Always `agent.thread_message_sent`. The agent sent a message to another thread. / Always `agent.thread_message_received`. The agent received a message from another thread. / Always `user.withdraw`. A queued user.message was withdrawn before it ran. / Always `user.steer`. Receipt that a queued user.message was injected into the running turn. / Always `system.notification`. Background work woke the session with a notification. / Always `session.forked`. The session was created by forking another session. / Always `session.goal_changed`. / Always `session.goal_verification`. / Always `event_start`. Preview that an event of the requested delta types has started. / Always `event_delta`. Incremental fragment of the event being produced. / Always `ping`. Keep-alive frame; carries no data. / Always `error`. A stream error. / Always `user.message`. A message from the user to the agent, with content blocks. / Always `user.interrupt`. The user interrupted the running turn. / Always `agent.message`. A message from the agent, with text content blocks. / Always `agent.thinking`. The agent's thinking text for a step. / Always `session.status_running`. The session started running a turn. / Always `session.status_rescheduled`. The session will retry after a recoverable error. / Always `session.status_idle`. The session stopped running; stop_reason says why. / Always `session.status_terminated`. The session ended and accepts no more work. / Always `agent.thread_context_compacted`. The thread's context was compacted into a summary. / Always `agent.thread_context_reset`. Content was removed from the model's context after a content-safety refusal. / Always `session.updated`. The session's model, title, metadata, agent or budget changed. / Always `session.error`. The session hit an error. / Always `session.usage`. Cumulative usage of the session. / Always `span.model_request_start`. A model request started. / Always `span.model_request_end`. A model request ended, with its usage. / Always `agent.tool_use`. The agent called a tool. / Always `agent.tool_result`. The result of a tool call. / Always `agent.mcp_tool_use`. The agent called an MCP tool. / Always `agent.mcp_tool_result`. The result of an MCP tool call. / Always `user.tool_confirmation`. / Always `session.thread_created`. A child thread was started. / Always `session.thread_status_running`. A thread started running. / Always `session.thread_status_idle`. A thread stopped running; stop_reason says why. / Always `session.thread_status_rescheduled`. A thread will retry after a recoverable error. / Always `session.thread_status_terminated`. A thread ended. / Always `agent.thread_message_sent`. The agent sent a message to another thread. / Always `agent.thread_message_received`. The agent received a message from another thread. / Always `user.withdraw`. A queued user.message was withdrawn before it ran. / Always `user.steer`. Receipt that a queued user.message was injected into the running turn. / Always `system.notification`. Background work woke the session with a notification. / Always `session.forked`. The session was created by forking another session. / Always `session.goal_changed`. / Always `session.goal_verification`. / Always `event_start`. Preview that an event of the requested delta types has started. / Always `event_delta`. Incremental fragment of the event being produced. / Always `ping`. Keep-alive frame; carries no data. / Always `error`. A stream error. |
| data.processed_at | null | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | null | string | null | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | A timestamp in RFC 3339 format / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / When the event was recorded, RFC 3339. / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / When the event was recorded, RFC 3339. / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / When the event was recorded, RFC 3339. / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / A timestamp in RFC 3339 format / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / RFC 3339 time at which the server processed the event; null while a queued input has not started running. / When the event was recorded, RFC 3339. / RFC 3339 time at which the server processed the event; null while a queued input has not started running. |
| data.message_id | string | UI transcript message ID. Use the last assistant message in a successfully completed turn as the fork target. / UI transcript message ID shared with this assistant's message parts. / UI transcript message ID. Use the last assistant message in a successfully completed turn as the fork target. / UI transcript message ID. Use the last assistant message in a successfully completed turn as the fork target. / UI transcript message ID shared with this assistant's message parts. |
| data.session_thread_id | null | string | string | null | string | null | string | string | string | string | string | string | string | string | null | string | string | null | string | null | string | string | string | string | string | string | string | string | If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread. / Text of the block. / When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.tool_confirmation` or `user.tool_result` by `tool_use_id`, so clients do not send it back. / When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.tool_confirmation` by `tool_use_id`, so clients do not send it back. / Public `sthr_` ID of the newly created thread. / Public sthr_ ID of the thread that started running. / Public sthr_ ID of the thread that went idle. / Public sthr_ ID of the thread that is retrying. / Public sthr_ ID of the thread that terminated. / Text of the block. / Text of the block. / If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread. / Text of the block. / When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.tool_confirmation` or `user.tool_result` by `tool_use_id`, so clients do not send it back. / When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.tool_confirmation` by `tool_use_id`, so clients do not send it back. / Public `sthr_` ID of the newly created thread. / Public sthr_ ID of the thread that started running. / Public sthr_ ID of the thread that went idle. / Public sthr_ ID of the thread that is retrying. / Public sthr_ ID of the thread that terminated. / Text of the block. / Text of the block. |
| data.stop_reason | object | Why the session stopped running, with the variant data needed to continue. |
| data.removed | array<object> | Content removed from the model's context by this reset. |
| data.category | string | Text of the block. |
| data.stopped | boolean | True when the run was stopped instead of retried after the reset. |
| data.agent | null | object | Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time. |
| data.budget | null | object | A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`. |
| data.metadata | object | The session's full metadata bag after the update. Present when the update set non-empty metadata; absent when metadata was unchanged or cleared to empty. |
| data.title | null | string | The session's new title. Present only when the update changed it. |
| data.model | object | 扩展 / Praxis extension: the changed session model, present only on /agent/v1 session.updated events. Model-only updates are omitted on /anthropic. |
| data.error | object | Description of the error and what the client should do next. / Error detail. / Description of the error and what the client should do next. / Error detail. |
| data.usage | object | Point-in-time snapshot of a session's cumulative usage. |
| data.is_error | null | boolean | Whether the model request resulted in an error. / Whether the tool execution resulted in an error. / Whether the tool execution resulted in an error. / Whether the model request resulted in an error. / Whether the tool execution resulted in an error. / Whether the tool execution resulted in an error. |
| data.model_request_start_id | string | The id of the corresponding `span.model_request_start` event. |
| data.model_usage | object | Token usage for a single model request. |
| data.input | object | Input parameters for the tool call. |
| data.name | string | Name of the agent tool being used. / Name of the MCP tool being used. / Name of the agent tool being used. / Name of the MCP tool being used. |
| data.evaluated_permission | string | AgentEvaluatedPermission enum |
| data.evaluation | object | Names the resolved permission_policy that produced evaluated_permission, and under auto carries the judgement. Open union: clients must tolerate unknown variants. |
| data.tool_use_id | string | The id of the `agent.tool_use` event this result corresponds to. / The id of the AskUserQuestion `agent.tool_use` event this answers. / The id of the `agent.tool_use` event this result corresponds to. / The id of the AskUserQuestion `agent.tool_use` event this answers. |
| data.mcp_server_name | string | Name of the MCP server providing the tool. |
| data._meta | object | Praxis extension (MCP Apps, SEP-1865): the `ui` and `openai/ui` keys of the MCP tool definition's `_meta`, verbatim; other `_meta` keys are not exposed. When `ui.resourceUri` is a `ui://` URI, the tool has an interactive view: a client that implements MCP Apps can fetch that resource from the MCP server and render it for this call. Absent when the tool declares neither key. Clients that do not render MCP Apps ignore it. / Praxis extension (MCP Apps, SEP-1865): the MCP CallToolResult `_meta`, verbatim. Views use it for data that should not reach the model; absent when the tool returned none. / Praxis extension (MCP Apps, SEP-1865): the `ui` and `openai/ui` keys of the MCP tool definition's `_meta`, verbatim; other `_meta` keys are not exposed. When `ui.resourceUri` is a `ui://` URI, the tool has an interactive view: a client that implements MCP Apps can fetch that resource from the MCP server and render it for this call. Absent when the tool declares neither key. Clients that do not render MCP Apps ignore it. / Praxis extension (MCP Apps, SEP-1865): the MCP CallToolResult `_meta`, verbatim. Views use it for data that should not reach the model; absent when the tool returned none. |
| data.source | string | Praxis extension (MCP Apps, SEP-1865): `app` when the call was made by an MCP Apps view, `codemode` when a program run by the codemode tool called an MCP tool that declares a view (the event pair exists so a client can render that view; the model already has the result in the codemode tool result); absent for the model's own calls. / What caused the change. / Praxis extension (MCP Apps, SEP-1865): `app` when the call was made by an MCP Apps view, `codemode` when a program run by the codemode tool called an MCP tool that declares a view (the event pair exists so a client can render that view; the model already has the result in the codemode tool result); absent for the model's own calls. / Praxis extension (MCP Apps, SEP-1865): `app` when the call was made by an MCP Apps view, `codemode` when a program run by the codemode tool called an MCP tool that declares a view (the event pair exists so a client can render that view; the model already has the result in the codemode tool result); absent for the model's own calls. / What caused the change. |
| data.parent_tool_use_id | string | Praxis extension (MCP Apps, SEP-1865): present when `source` is `codemode`; the id of the codemode tool use whose program made this call. Absent otherwise. |
| data.mcp_tool_use_id | string | The id of the `agent.mcp_tool_use` event this result corresponds to. |
| data.structured_content | any | Praxis extension (MCP Apps, SEP-1865): the MCP CallToolResult `structuredContent`, verbatim JSON. MCP Apps views read it as the data to render; absent when the tool returned none. |
| data.result | string | Always `allow`. |
| data.answers | object | The user's answer to each question, keyed by the question text; empty when the questions were dismissed. |
| data.annotations | object | Per-question notes, keyed by the question text. |
| data.agent_name | string | Name of the callable agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. / Name of the callable agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. |
| data.to_session_thread_id | string | Public `sthr_` ID of the thread the message was sent to. |
| data.to_agent_name | null | string | Name of the callable agent this message was sent to. Absent when sent to the primary agent. |
| data.from_session_thread_id | string | Public `sthr_` ID of the thread that sent the message. |
| data.from_agent_name | null | string | Name of the callable agent this message came from. Absent when received from the primary agent. |
| data.event_id | string | Text of the block. / Id of the event this event refers to. / Text of the block. / Text of the block. / Id of the event this event refers to. / Text of the block. |
| data.sources | array<object> | Background work that woke the session with this notification. |
| data.forked_from_session_id | string | Id of the parent session this session was forked from. |
| data.forked_from_message_id | string | message_id of the agent message in the parent session up to which the conversation was copied. |
| data.action | string | What changed in the goal. |
| data.goal | object | null | The goal as the change left it, or null when the session has no goal. |
| data.previous_goal | object | null | The goal before the change, or null when there was none. |
| data.status | string | Where the check stands. Read `verification.passed` on the closing event to know whether the goal counts as done. |
| data.goal_id | string | The goal this check belongs to. |
| data.goal_iteration | integer | Which check of this goal, matching `iteration` on the goal. |
| data.verification_id | string | Identifier shared by every event of one check. |
| data.anchor_message_id | string | null | The assistant message the check follows, or null. |
| data.verification | object | The verdict; absent on `started`. |
| data.event | object | Event name or event payload. |
| data.delta | object | Incremental fragment of the event being produced. |
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
/agent/v1/sessions/{session_id}/threads/{thread_id}/archive◐ 部分支持session_idstring必填path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
thread_idstring必填path: Execution thread id (sthr_...), as listed by sessions.threads.list; the primary thread id equals the session's own thread. Unknown or foreign ids return 404.
session_idstring必填query: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
200
主线程沿用会话归档动作;子线程仅归档对应子会话,不归档父会话或其他子线程。子线程归档后 status 为 terminated,带 archived_at;历史事件仍可读。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for this thread. |
| agent | object | The resolved agent a `session_thread` runs. |
| agent.model | string | object | The advisor model id. / Model identifier and configuration. |
| agent.type | string | Always `advisor`. An advisor whose model is consulted for advice in a separate thread (at most one per coordinator). / Always `agent`. A roster member that refers to an agent by id and pinned version. |
| agent.id | string | Agent id (agent_...). Pass it as agent when creating a session and as agent_id in agent calls. |
| agent.description | null | string | Free-text description of what the agent is for; null when none was set. |
| agent.mcp_servers | array<object> | URL MCP servers the agent can call, paired one-to-one with mcp_toolset entries in tools and saved with the agent version. No credentials are stored here. |
| agent.name | string | Display name of the agent, as set on create or update. It is a label, not a unique key. |
| agent.skills | array<object> | Skills attached to the agent. Setting skills is not supported on this platform and returns 400, so do not send this field on create or update. |
| agent.system | null | string | System prompt given to the model at the start of every session of this agent; null when none was set. |
| agent.tools | array<object> | Tools of the agent: one agent_toolset_20260401 entry for the native tools (all resolved settings are returned, ready to send back on update), plus mcp_toolset entries and custom tool definitions. |
| agent.version | number | The agent's current version. Starts at 1 and increments each time the agent is modified. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| parent_thread_id | null | string | Parent thread that spawned this thread. Null for the primary thread. |
| session_id | string | The session this thread belongs to. |
| stats | null | object | Timing statistics for a session thread. |
| stats.active_seconds | number | Cumulative time in seconds the thread spent actively running. Excludes idle time. |
| stats.duration_seconds | number | Elapsed time since thread creation in seconds. For archived threads, frozen at the final update. |
| stats.startup_seconds | number | Time in seconds for the thread to begin running. Zero for child threads, which start immediately. |
| status | string | SessionThreadStatus enum |
| type | string | Always `session_thread`. An execution thread of a session. |
| updated_at | string | A timestamp in RFC 3339 format |
| usage | null | object | Cumulative token usage for a session thread across all turns. |
| usage.active_seconds | number | Cumulative time in seconds this thread spent in running status. Equal to `stats.active_seconds`; surfaced here so a thread's usage carries every quantity its cost is priced on. |
| usage.cache_creation | object | Prompt-cache creation token usage broken down by cache lifetime. |
| usage.cache_read_input_tokens | number | Total tokens read from prompt cache. |
| usage.input_tokens | number | Total input tokens consumed across all turns. |
| usage.list_cost | null | object | A monetary amount in a specific currency. |
| usage.output_tokens | number | Total output tokens generated across all turns. |
| usage.server_tool_use | null | object | Cumulative count of server-executed tool invocations, broken down by tool. |
/agent/v1/environments◐ 部分支持include_archivedboolean可选query: Include archived environments in the response
limitnumber可选query: Number of items per page.
pagestring可选query: Opaque pagination cursor: pass the next_page value of the previous response unchanged. Omit it for the first page. A cursor from a different query or a malformed one returns 400.
200
支持租户自建 cloud 环境、配置更新与软归档;内置环境只读。列表支持 limit、page 和 include_archived。limited 网络在沙箱创建时生效;安装失败会终止会话,错误码为 ENVIRONMENT_PACKAGE_INSTALL_FAILED。self_hosted、scope 和跨会话包缓存尚不支持。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | Items of this page, in the order requested by the call. |
| data[].id | string | Environment identifier (e.g., 'env_...') |
| data[].archived_at | null | string | RFC 3339 timestamp when environment was archived, or null if not archived |
| data[].config | object | Environment configuration (either Anthropic Cloud or self-hosted) |
| data[].created_at | string | RFC 3339 timestamp when environment was created |
| data[].description | null | string | User-provided description for the environment; null when unset |
| data[].metadata | object | User-provided metadata key-value pairs |
| data[].name | string | Human-readable name for the environment |
| data[].type | string | The type of object (always 'environment') |
| data[].updated_at | string | RFC 3339 timestamp when environment was last updated |
| data[].scope | string | The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account. |
| next_page | string | null | Opaque cursor for the next page: pass it unchanged as page to continue. Null when this is the last page. |
/agent/v1/environments/{environment_id}◐ 部分支持environment_idstring必填path: Environment id, as returned by environments.create or environments.list. Built-in environments can be read but not changed.
200
支持租户自建 cloud 环境、配置更新与软归档;内置环境只读。列表支持 limit、page 和 include_archived。limited 网络在沙箱创建时生效;安装失败会终止会话,错误码为 ENVIRONMENT_PACKAGE_INSTALL_FAILED。self_hosted、scope 和跨会话包缓存尚不支持。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Environment identifier (e.g., 'env_...') |
| archived_at | null | string | RFC 3339 timestamp when environment was archived, or null if not archived |
| config | object | Environment configuration (either Anthropic Cloud or self-hosted) |
| config.networking | object | Network configuration policy. |
| config.packages | object | Package manager configuration. |
| config.type | string | Environment type |
| created_at | string | RFC 3339 timestamp when environment was created |
| description | null | string | User-provided description for the environment; null when unset |
| metadata | object | User-provided metadata key-value pairs |
| name | string | Human-readable name for the environment |
| type | string | The type of object (always 'environment') |
| updated_at | string | RFC 3339 timestamp when environment was last updated |
| scope | string | The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account. |
/agent/v1/toolsets● 支持200
返回工具集说明、插件名称与版本,以及每个工具的名称、说明、参数定义、是否只读和默认授权方式。通过 /agent/v1/toolsets 读取此目录;目录不会更改智能体配置。agent_toolset_20260401 包含全部 13 个原生工具;TaskOutput、TaskStop、Monitor、Agent、SendMessage 与其他工具一样可逐个开关及设置权限,它们都依赖 bash。兼容 API 只提供官方 8 个工具。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
Available toolsets
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | Items of this page, in the order requested by the call. |
| data[].type | string | Toolset type id as used in an agent's tools entry, for example agent_toolset_20260401. |
| data[].plugin | object | Unit that registers the toolset, with its name and version. |
| data[].description | string | Free-text description; null when none was set. |
| data[].environment | string | Environment in which the toolset's tools run, for example node22. |
| data[].tools | array<object> | Tools offered to the model. |
| next_page | null | Opaque cursor for the next page: pass it unchanged as page to continue. Null when this is the last page. |
加载中…| SDK | base URL | 认证头 | 能用的端点 |
|---|---|---|---|
| OpenAI SDK | Authorization: Bearer | 对话、生成响应、文本向量、生成图像、模型列表、会话(Conversations) | |
| Anthropic SDK | (SDK 自己补 /v1) | x-api-key 或 Authorization: Bearer | 发送消息、统计 token |
两家用同一把 Key、同一套模型名、同一个账单,换 SDK 不换别的。会话(创建、条目、删除)是跨调用的状态容器,形状与 OpenAI 官方 conversations 一致。
对话的请求体可以带 providerOptions.praxis:
| 字段 | 作用 |
|---|---|
models | 候选模型列表:请求的模型失败时按顺序换下一个 |
byok | 自带上游 Key(按供应商名给出);这把 Key 不可用时自动改用平台的 |
order / only | 指定供应商的顺序或范围,只在带 byok 时可用 |
响应里的 providerMetadata.praxis 给出这次调用的 generationId、cost、credential(platform 或 byok)和实际服务的 model;拿 generationId 可以查询生成记录。其它端点目前不接受 providerOptions.praxis,带上会返回 400。
{type:"file", file_id:"<上传所得 ID>"},直接读取当前租户的 File。file_id 读取上限为 24 MiB(25,165,824 字节,共享 96 MiB 内存预算按四倍预留);超过此上限返回 413,并提示改用 HTTPS document_url(PDF 上限 50 MiB)。PNG/JPEG 仍限 10 MiB,按文件头识别类型;不存在或其他租户的文件统一返回 404。pages 是从 0 开始的页码数组;图片如指定 pages,只能为 [0]。文件读取失败不计费,请求日志仅记录 file_id,不保存文件原文。可选功能依模型而定,不支持的选项返回 400。错误为 problem+json;providerOptions.praxis 不适用于此端点。请求与响应字段的权威定义,见每个端点页链接的 OpenAI、Anthropic 或 Mistral 官方文档。OCR 通过 HTTP 调用,不在 OpenAI 或 Anthropic SDK 的端点中。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见错误;额度与响应头参见限流。
/model/v1/chat/completions● 支持X-OpenRouter-Metadatastring可选○ 当前不生效header: OpenRouter-style request header that asks for routing metadata in the response. It is accepted for compatibility and has no effect: the routing metadata is not returned.
接受但当前不生效;不会返回请求的路由元数据。
modelstring必填Model to use for completion
主模型;提供非空 models 时可省略,使用列表首项。
messagesarray必填◐ 部分支持List of messages for the conversation
文本、角色、历史和工具往返生效;图片受模型尺寸限制;file_id 可引用 user_data 图片、文本和 PDF;模型读取能力与失败处理见[文件引用指南](/docs/cloud/services/model/guides/files)。
元素按 role 区分(assistant / developer / system / tool / user),此处展开其中一种的形状
configuration_updateobject可选OpenRouter extension. Same as the system message `configuration_update`: changes reasoning effort from this point in the conversation onward without invalidating the prompt cache for the preceding turns.
contentstring | array可选Tool response content
namestring可选Optional name for the assistant
rolestring可选Role of the message author; always tool.
audioobject可选Audio output data or reference
imagesarray可选Generated images from image generation models
modelstring必填Model that generated this assistant message
reasoningstring可选Reasoning output
reasoning_detailsarray可选Reasoning details for extended thinking models
refusalstring可选Refusal message if content was refused
tool_callsarray可选Tool calls made by the assistant
tool_call_idstring可选ID of the assistant message tool call this message responds to
max_tokensinteger可选◐ 部分支持Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.
deepseek-v4-flash、glm-5.3-flash 生效;qwen3.8-flash 的小预算可能不生效。与 max_completion_tokens 同传时本字段优先。
streamboolean可选◐ 部分支持Enable streaming response
流式正文和工具增量生效;gemini-2.5-flash 可能缺少结束标记,预算耗尽时 finish_reason 可能不准确。
temperaturenumber可选◐ 部分支持Sampling temperature (0-2)
在 /openai 的 deepseek-v4-flash 观察到效果;其余模型的采样差异无法确认。
top_pnumber可选◐ 部分支持Nucleus sampling parameter (0-1)
仅 /model 的 glm-5.3-flash 观察到效果;其余已测模型或协议面接受但未见效果。
toolsarray可选Available tools for function calling
已验证生效。
tool_choicestring | object可选◐ 部分支持Tool choice configuration
auto 生效;deepseek-v4-flash 忽略 none/required/具名函数;qwen3.8-flash 的 required/具名函数在思考模式报错;glm-5.3-flash 的具名函数结果不稳定。
functionobject必填The function the model must call.
typestring必填OpenRouter server-tool type to force (e.g. `openrouter:web_search`, `web_search`, `web_search_preview`).
response_formatobject可选◐ 部分支持Response format configuration
json_object 生效;json_schema 在 deepseek-v4-flash、qwen3.8-flash 生效,glm-5.3-flash 接受但未遵守。
按 type 区分(grammar / json_object / json_schema / python / text),此处展开其中一种的形状
typestring必填Always `python`. Discriminator that marks this object as a ChatFormatPythonConfig in a `type`-tagged union.
json_schemaobject必填JSON Schema configuration object
grammarstring必填Custom grammar for text generation
promptstring可选○ 当前不生效接受并忽略;Chat 仍须提供 messages,本字段不替代消息。
cache_controlobject可选Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.
ttlstring可选Lifetime of an Anthropic-style cache breakpoint.
typestring必填Always `ephemeral`. Discriminator that marks this object as a AnthropicCacheControlDirective in a `type`-tagged union.
debugobject可选Debug options for inspecting request transformations (streaming only)
echo_upstream_bodyboolean可选○ 当前不生效If true, includes the transformed upstream request body in a debug chunk at the start of the stream. Only works with streaming mode.
接受但当前不生效。流式请求不会回显上游请求体。
frequency_penaltynumber可选◐ 部分支持Frequency penalty (-2.0 to 2.0)
deepseek-v4-flash、glm-5.3-flash 部分请求生效;qwen3.8-flash 在部分取值或协议面返回 400。
image_configobject可选Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details.
logit_biasobject可选Token logit bias adjustments
logprobsboolean可选◐ 部分支持Return log probabilities
qwen3.8-flash 生效;deepseek-v4-flash 仅 /openai 生效,glm-5.3-flash 的两面结果不一致;gemini-2.5-flash 返回 400。
max_completion_tokensinteger可选◐ 部分支持Maximum tokens in completion
deepseek-v4-flash、glm-5.3-flash 生效;qwen3.8-flash 的小预算可能不生效或报超限。
metadataobject可选Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
min_pnumber可选○ 当前不生效Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter.
接受但当前不生效。
modalitiesarray可选Output modalities for the response. Supported values are "text", "image", and "audio".
modelsarray可选Models to use for completion
按顺序回退:主模型不存在、无同协议线路或上游失败均尝试下一项。可只给 models;响应 model 和费用归属最终完成请求的模型。
parallel_tool_callsboolean可选◐ 部分支持Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response.
false 在 qwen3.8-flash 生效;deepseek-v4-flash 接受但不生效;glm-5.3-flash 的两面结果不一致。
pluginsarray可选◐ 部分支持Plugins you want to enable for this request, including their settings.
支持 file-parser(pdf.engine 为 native、mistral-ocr→ocr、ocr、auto)和平台 guardrails。请求覆盖账户默认,锁定设置保留。web 等未实现插件、未知引擎或非法形状返回 400 并点名字段。
元素按 id 区分(auto-beta-router / auto-router / context-compression / file-parser / fusion / moderation / pareto-router / response-healing / web / web-fetch),此处展开其中一种的形状
allowed_modelsarray可选List of model patterns to filter which models the auto-beta-router can route between. Supports wildcards (e.g., "anthropic/*" matches all Anthropic models). Up to 1024 patterns, each at most 1024 characters, with 65536 total characters across all patterns. When not specified, every model ranked for the classified task type is a candidate, falling back to a default model set when rankings are unavailable.
cost_quality_tradeoffinteger可选Deprecated: Use cost_tier instead. Balances routing between cost and quality on a 0-10 scale. The auto-beta-router ranks models for the classified task type by community spend share, then filters candidates by their average cost per generation for that task. Higher values favor cheaper models: 10 keeps only models around the cheapest 10th percentile, while 0 permits models up to the 90th percentile for cost. Defaults to 9 when no cost setting is provided. It remains supported and retains ceiling behavior, but cost_tier takes precedence when both are provided.
cost_tierstring可选Named cost/quality setting. For auto-beta-router, tiers select cost-percentile bands: low = [0, 20), medium = [20, 40), high = [40, 60), xhigh = [60, 80), and max = [80, 100]. Takes precedence over the deprecated numeric cost_quality_tradeoff when both are provided.
enabledboolean可选Set to false to disable Fusion configuration for a run started by the `openrouter/fusion` model slug or `openrouter:fusion` server tool. Defaults to true.
excluded_modelsarray可选List of model patterns to exclude from auto-beta-router selection. Supports wildcards (e.g., "meta-llama/*" excludes all Llama models). Up to 1024 patterns, each at most 1024 characters, with 65536 total characters across all patterns. Applied after allowed_models, so an excluded pattern always wins over an allowed one.
idstring可选Plugin id; always fusion.
pin_modelboolean可选When true, reuses the model from the most recent assistant message's `model` attribute for subsequent turns. Defaults to false.
enginestring可选The compression engine to use. Defaults to "middle-out".
exclude_domainsarray可选A list of domains to exclude from web search results. Supports wildcards (e.g. "*.substack.com") and path filtering (e.g. "openai.com/blog").
include_domainsarray可选A list of domains to restrict web search results to. Supports wildcards (e.g. "*.substack.com") and path filtering (e.g. "openai.com/blog").
max_resultsinteger可选Maximum number of search results to use.
max_usesinteger可选Maximum number of web fetches per request. Once exceeded, the tool returns an error.
modestring可选Engine-native search mode. Exa supports instant, fast, auto (default), deep-lite, deep, and deep-reasoning. Parallel supports turbo, fast, basic (default), and advanced. Modes unsupported by the selected engine are ignored.
search_promptstring可选Prompt that introduces the search results to the model.
user_locationobject可选Approximate user location for location-biased search results.
allowed_domainsarray可选Only fetch from these domains.
blocked_domainsarray可选Never fetch from these domains.
max_content_tokensinteger可选Maximum content length in approximate tokens. Content exceeding this limit is truncated.
pdfobject可选Options for PDF parsing.
max_pricenumber可选Maximum input price in USD per million tokens. When set, quality-tier selection (min_coding_score) is bypassed: the router computes the Pareto frontier over the top coding models and routes to the best-scoring frontier model priced at or below this cap, falling back through cheaper frontier models, then non-frontier models. Enforced against the price source given by price_source. Returns 404 when no candidate satisfies the cap.
min_coding_scorenumber可选Minimum coding quality score between 0 and 1. Maps to internal quality tiers: >= 0.66 → high (top coding models), >= 0.33 → medium (strong modern flagships), < 0.33 → low (capable coders above the median). Omit to default to the highest tier (equivalent to >= 0.66). Not used when max_price is set (price-based selection takes over).
price_sourcestring可选Price source for the Pareto frontier cost axis and for enforcing max_price. "prompt" uses catalog list price (endpoint.pricing.prompt). "weighted_avg" uses traffic-weighted effective input price from ClickHouse, falling back to prompt price for models without traffic data. Defaults to "prompt".
analysis_modelsarray可选For a Fusion run started by the `openrouter/fusion` model slug or `openrouter:fusion` server tool, slugs of models to run in parallel as the "expert panel" the analyst analyzes. Each model receives the same user prompt with web_search + web_fetch enabled. Capped at 8 models to bound cost amplification. When omitted, defaults to the Quality preset from the /labs/fusion UI (~anthropic/claude-opus-latest, ~openai/gpt-sol-latest, ~google/gemini-pro-latest).
max_tool_callsinteger可选For a Fusion run started by the `openrouter/fusion` model slug or `openrouter:fusion` server tool, the maximum number of tool-calling steps each panelist (analysis model) and the analyst model may take during their agentic web-research loop. Models with web_search/web_fetch enabled iterate until they produce a text response or hit this ceiling. Defaults to 4. Capped at 16.
modelstring必填For a Fusion run started by the `openrouter/fusion` model slug or `openrouter:fusion` server tool, the slug of the model that performs both the analyst step (with web_search + web_fetch) and the final synthesis. When omitted, defaults to the first model in the Quality preset.
presetstring可选Configuration for a Fusion run started by the `openrouter/fusion` model slug or `openrouter:fusion` server tool. A curated OpenRouter preset (slugs follow `<task>-<tier>`, e.g. `general-high`). Expands server-side into the preset's analysis_models panel and analyst model, so callers never name individual models. Explicitly provided `analysis_models` / `model` take precedence.
toolsarray可选For a Fusion run started by the `openrouter/fusion` model slug or `openrouter:fusion` server tool, server tools available to panelist and analyst inner calls. Each entry uses the same `{ type, parameters? }` shorthand as the outer Chat Completions request. When omitted, defaults to `[{ type: "openrouter:web_search" }, { type: "openrouter:web_fetch" }]`. Pass an empty array to disable tools entirely (panelists answer from parametric knowledge only).
predictionobject可选Static predicted output content. Supported models can use this to reduce latency when much of the response is known in advance.
contentstring | array必填Predicted output: a string or an array of text parts.
typestring必填Always `content`. Discriminator that marks this object as a Prediction in a `type`-tagged union.
presence_penaltynumber可选◐ 部分支持Presence penalty (-2.0 to 2.0)
deepseek-v4-flash 的 /openai 面观察到效果;qwen3.8-flash 部分请求返回 400,其余不可观测。
prompt_cache_keystring可选Caller-chosen key that groups requests with a long shared prefix so that they can reuse the provider's prompt cache; null for none.
prompt_cache_optionsobject可选Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer.
modestring必填Prompt cache mode; explicit caches only the blocks marked with prompt_cache_breakpoint.
ttlstring可选Lifetime of cache entries, for example 30m; null leaves the provider default.
providerobject可选◐ 部分支持When multiple model providers are available, optionally indicate your routing preference.
只有选择具体供应商(order / only / ignore)仅限 BYOK、返回 400;require_parameters 生效,其余选项接受但不生效。
allow_fallbacksboolean可选○ 当前不生效Whether to allow backup providers to serve requests - true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider. - false: use only the primary/custom provider, and return the upstream error if it's unavailable.
接受但当前不生效(不属于供应商选择,平台凭证下可用)。
data_collectionstring可选○ 当前不生效Data collection setting. If no available model provider meets the requirement, your request will return an error. - allow: (default) allow providers which store user data non-transiently and may train on it - deny: use only providers which do not collect user data.
接受但当前不生效(不属于供应商选择,平台凭证下可用)。
enforce_distillable_textboolean可选Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used.
ignorearray可选○ 未支持List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.
选择具体供应商(order / only / ignore)仅限 BYOK,平台凭证下返回 400 PROVIDER_SELECTION_NOT_ALLOWED。
max_priceobject可选○ 当前不生效The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
接受但当前不生效(不属于供应商选择,平台凭证下可用)。
onlyarray可选○ 未支持List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.
选择具体供应商(order / only / ignore)仅限 BYOK,平台凭证下返回 400 PROVIDER_SELECTION_NOT_ALLOWED。
orderarray可选○ 未支持An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.
选择具体供应商(order / only / ignore)仅限 BYOK,平台凭证下返回 400 PROVIDER_SELECTION_NOT_ALLOWED。
preferred_max_latencynumber | object可选Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
preferred_min_throughputnumber | object可选Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
quantizationsarray可选○ 当前不生效A list of quantization levels to filter the provider by.
接受但当前不生效(不属于供应商选择,平台凭证下可用)。
require_parametersboolean可选Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.
只走能表达全部参数的线路;平台凭证下可用。
sortstring | object可选○ 当前不生效The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
接受但当前不生效(不属于供应商选择,平台凭证下可用)。
zdrboolean可选○ 当前不生效Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.
接受但当前不生效(不属于供应商选择,平台凭证下可用)。
reasoningobject可选Configuration options for reasoning models
effortstring可选◐ 部分支持Constrains effort on reasoning for reasoning models
none 仅在 qwen3.8-flash 可靠关闭思考;deepseek-v4-flash 和 glm-5.3-flash 未遵守。
summarystring可选○ 当前不生效How detailed the reasoning summary should be.
接受但当前不生效。deepseek-v4-flash 未返回请求的摘要。
reasoning_effortstring可选◐ 部分支持Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.
none 在 qwen3.8-flash 关闭思考;deepseek-v4-flash 仍思考,glm-5.3-flash 的档位效果不符合预期。
repetition_penaltynumber可选Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter.
routestring可选**DEPRECATED** Use providers.sort.partition instead. Backwards-compatible alias for providers.sort.partition. Accepts legacy values: "fallback" (maps to "model"), "sort" (maps to "none").
seedinteger可选○ 当前不生效Random seed for deterministic outputs
接受但当前不生效。deepseek-v4-flash、glm-5.3-flash、qwen3.8-flash 同 seed 不能复现输出。
service_tierstring可选The service tier to use for processing this request. `fast` is accepted as an alias for `priority`.
session_idstring可选A unique identifier for grouping related requests (e.g., a conversation or agent workflow). When provided, OpenRouter uses it as the sticky routing key, routing all requests in the session to the same provider to maximize prompt cache hits. Also used for observability grouping. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters.
stopstring | array可选◐ 部分支持Stop sequences (up to 4)
qwen3.8-flash 生效;deepseek-v4-flash、glm-5.3-flash 可能截断思考并返回空正文。
stop_server_tools_whenarray可选Stop conditions for the server-tool agent loop. Any condition firing halts the loop (OR logic). When set, this overrides `max_tool_calls`. When a condition fires while the model is still emitting tool calls, the pending tool calls are executed and one final turn is made with tool calls disabled so the response ends with a natural-language answer instead of an unfinished tool call.
元素按 type 区分(finish_reason_is / has_tool_call / max_cost / max_tokens_used / step_count_is),此处展开其中一种的形状
step_countinteger可选Number of steps after which the loop stops.
typestring可选Always `finish_reason_is`. Discriminator that marks this object as a StopServerToolsWhenFinishReasonIs in a `type`-tagged union.
tool_namestring可选Name of the tool whose call stops the loop.
max_tokensinteger可选Cumulative token count after which the loop stops.
max_cost_in_dollarsnumber可选Cumulative cost in USD after which the loop stops.
reasonstring可选Finish reason that stops the loop.
stream_optionsobject可选Streaming configuration options
include_usageboolean可选○ 当前不生效Deprecated: This field has no effect. Full usage details are always included.
接受但当前不生效。无论 true、false 或省略,流末尾都会返回 usage。
top_anumber可选○ 当前不生效Consider only tokens with "sufficiently high" probabilities based on the probability of the most likely token. Not all providers support this parameter.
接受但当前不生效。
top_kinteger可选◐ 部分支持Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter.
已测模型接受但未见采样效果;/model 的 deepseek-v4-flash 返回错误。
top_logprobsinteger可选◐ 部分支持Number of top log probabilities to return (0-20)
需与 logprobs=true 同传;支持度随 logprobs 和所选模型而异。
traceobject可选Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
generation_namestring可选Name of this generation in the trace.
parent_span_idstring可选Id of the parent span in the trace.
span_namestring可选Name of this request's span in the trace.
trace_idstring可选Id that groups several requests into one trace.
trace_namestring可选Name of the trace.
userstring可选Per-end-user identifier for abuse isolation. Use a stable ID, hash, or pseudonym. When a provider requires a user identity, OpenRouter folds it into the hashed identity sent upstream and never forwards it raw. If omitted, requests use an account-level identity, so provider policy blocks can affect the whole account.
storeboolean可选○ 当前不生效接受但当前不生效。此结论仅适用于 Chat Completions。
max_output_tokensinteger可选○ 当前不生效接受但当前不生效。此结论仅适用于 Chat Completions。
thinkingobject可选○ 当前不生效接受但当前不生效。此结论仅适用于 Chat Completions。
web_search_optionsobject可选○ 当前不生效接受但当前不生效。此结论仅适用于 Chat Completions。
functionsarray可选○ 当前不生效接受但当前不生效。此结论仅适用于 Chat Completions。
audioobject可选○ 当前不生效接受但当前不生效。此结论仅适用于 Chat Completions。
ninteger可选◐ 部分支持glm-5.3-flash 生效;deepseek-v4-flash 接受但当前不生效;qwen3.8-flash 返回错误。
usageobject可选○ 当前不生效接受并忽略;用量默认始终返回,include 不改变行为。
transformsarray可选○ 当前不生效接受并忽略;不执行 middle-out 或其他消息变换,保留原消息。
deferred_toolsobject可选○ 当前不生效接受并忽略;尚未实现 OpenRouter 延迟工具协议。
structured_outputsboolean可选○ 当前不生效接受并忽略此开关;结构化输出使用 response_format,支持度见该字段。
include_reasoningboolean可选○ 当前不生效接受并忽略此旧别名;思考配置使用 reasoning,支持度见该字段。
safe_promptboolean可选○ 当前不生效接受并忽略;未实现 Mistral 的 safe_prompt 开关。
raw_modeboolean可选○ 当前不生效接受并忽略;未实现 Hyperbolic 的 raw_mode 开关。
providerOptionsobject可选◐ 部分支持providerOptions.praxis.models 与顶层 models 使用同一有序回退。order/only 仅允许与已有的请求级 BYOK 凭证同时使用;非 BYOK 返回 400。
praxisobject必填Platform options: ordered model fallback, request-level BYOK credentials and credential-gated provider selection.
200 chat.completion
stream=true 时以 SSE 增量返回(text/event-stream)。
未知顶层字段原样转发给同协议上游,由上游决定是否接受;已声明字段的类型与取值范围仍会校验,不合法时返回 400 并点名字段。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Chat completion (application/json) or streamed chunks (text/event-stream)
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Id of the completion. |
| object | string | Object type; always `chat.completion`. |
| created | number | Unix time in seconds at which the completion was created. |
| model | string | Model that produced the completion; with fallback this is the model that finally answered. |
| choices | array<object> | Completion choices; one entry per generated answer. |
| choices[].index | number | Zero-based index of the choice. |
| choices[].message | object | The message the model generated. |
| choices[].finish_reason | string | null | Why generation stopped, for example `stop`, `length` or `tool_calls`; null while a stream is still generating. |
| choices[].logprobs | any | null | Log probabilities of the output tokens, when requested; null otherwise. |
| usage | object | Token usage of the request. |
| usage.prompt_tokens | number | Number of tokens in the prompt. |
| usage.completion_tokens | number | Number of tokens in the completion. |
| usage.total_tokens | number | Prompt plus completion tokens. |
| usage.prompt_tokens_details | object | Breakdown of the prompt tokens. |
| usage.completion_tokens_details | object | Breakdown of the completion tokens. |
| usage.prompt_cache_hit_tokens | number | Prompt tokens served from the cache, as reported by providers that use this DeepSeek-style counter. |
| usage.prompt_cache_miss_tokens | number | Prompt tokens not served from the cache, as reported by providers that use this DeepSeek-style counter. |
| system_fingerprint | string | null | Backend fingerprint; always null on this face. |
| service_tier | string | null | Service tier the provider used; null when not reported. |
| providerMetadata | object | Platform metadata of the call. |
| providerMetadata.praxis | object | Platform metadata of the call: generation id, cost, credential kind and serving model. |
text/event-stream — chunk / 事件对象
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Optional id of the server-sent event. |
| event | string | Name of the server-sent event. |
| data | object | string | Payload of the server-sent event. |
| data.id | string | Id of the completion; every chunk of one stream carries the same id. |
| data.object | string | Object type; always `chat.completion.chunk`. |
| data.created | number | Unix time in seconds at which the completion was created. |
| data.model | string | Model that produced the completion; with fallback this is the model that finally answered. |
| data.choices | array<object> | Completion choices of the chunk. |
| data.providerMetadata | object | Platform metadata of the call. |
/model/v1/responses● 支持modelstring可选◐ 部分支持Model id, for example one listed by listModels?type=language. Router support (partial): Verified on glm-5.3-flash and deepseek-flash; models without Responses support return 404.
已验证支持 glm-5.3-flash、deepseek-flash;没有 Responses 协议的模型返回 404。
inputstring | array可选◐ 部分支持Input for a response request - can be a string or array of items
字符串、消息数组、input_text、input_image 和函数往返生效;input_file 在 glm-5.3-flash 报错、deepseek-flash 忽略;托管文件引用返回 400。
streamboolean可选◐ 部分支持Whether to stream the response as server-sent events. Router support (partial): Works on deepseek-flash; glm-5.3-flash returns 400.
deepseek-flash 生效;glm-5.3-flash 返回 400。
temperaturenumber可选◐ 部分支持Sampling temperature between 0 and 2; higher values make output more random. Router support (partial): Partly effective on glm-5.3-flash; 2 may produce empty or garbled text. Effects on deepseek-flash are unobservable.
glm-5.3-flash 部分生效,2 可能返回空文本或乱码;deepseek-flash 的效果不可观测。
top_pnumber可选◐ 部分支持Nucleus sampling: only tokens within this cumulative probability are considered. Router support (partial): Sampling changes were observed on glm-5.3-flash; effects on deepseek-flash are unobservable.
glm-5.3-flash 观察到采样变化;deepseek-flash 不可观测。
toolsarray可选◐ 部分支持Tools the model may call: functions, built-in tools and MCP servers. Router support (partial): function works. web_search, code_interpreter, image_generation, mcp and computer_use are accepted but currently have no effect; file_search returns 404.
function 生效;web_search、code_interpreter、image_generation、mcp、computer_use 接受但当前不生效;file_search 返回 404。
tool_choicestring | object可选◐ 部分支持How the model picks tools: a mode string or a specific tool.
auto 生效;deepseek-flash 的 required/具名函数需 reasoning.effort=none;allowed_tools 在 glm-5.3-flash 被忽略,在 deepseek-flash 返回 422。
namestring必填Name of the function or tool the model must call.
typestring必填Kind of tool the model must call.
modestring必填auto lets the model pick among the allowed tools or none; required forces a call to one of them.
toolsarray必填The allowed tools, each as a tool reference such as {type: function, name}.
promptobject可选○ 未支持Reference to a saved prompt template and its variables. We don't have a Prompts resource yet — any id you pass returns 404 object_not_found.
当前没有可引用的提示词模板;传入模板 id 返回 404。
idstring必填Id of the stored prompt template.
variablesobject可选Values for the template variables, keyed by variable name; a value is a string or an input text, image or file part.
backgroundboolean可选◐ 部分支持Whether to run the model response in the background. Available only when the routed model has Router-built background support — Router returns status "queued" immediately, then stream-calls the upstream itself, runs the job to a terminal state, and bills usage exactly once, while the client polls GET /v1/responses/{id} (this does not mean the upstream natively supports OpenAI's background parameter). A provider without this capability still returns HTTP 400 (native_responses_background_unsupported) for background:true. Cancel (POST /v1/responses/{id}/cancel) can only stop our own read of the upstream stream — it cannot guarantee upstream compute already issued stops — and billing reflects only usage actually received, falling back to the platform's general "upstream reported no usage" rule when none was received.
deepseek-flash 生效;glm-5.3-flash 返回 400。background 与 stream 同传时返回 JSON。
includearray可选◐ 部分支持Forwarded to the upstream model as-is; only takes effect for capabilities the model has (e.g., reasoning content, web search results). Fields the model doesn't support are ignored.
deepseek-flash 返回 logprobs;reasoning.encrypted_content 仅为占位串。glm-5.3-flash 接受但当前不生效。
instructionsstring可选System or developer instructions inserted at the start of the context. Router support (supported): Verified to take effect.
已验证生效。
max_output_tokensinteger可选Upper bound on generated tokens, including reasoning tokens. Router support (supported): A positive value controls the output budget; zero returns 400.
正数控制输出预算;0 返回 400。
metadataobject可选◐ 部分支持Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed.
glm-5.3-flash 回显;deepseek-flash 接受但当前不生效,响应及读取均为空对象。
parallel_tool_callsboolean可选◐ 部分支持Whether the model may call several tools in one turn. Router support (partial): true permits multiple calls; false is accepted but currently has no effect and may still return multiple calls.
true 可返回多个调用;false 接受但当前不生效,仍可能返回多个调用。
previous_response_idany可选ID of a previous response. Its owner may continue it; the model field can then be omitted. The platform expands the stored history before calling the upstream.
平台将祖先的输入与输出和本轮 input 合并,发往上游前移除 previous_response_id;没有活副本或不属于当前租户时返回 404 previous_response_not_found。
prompt_cache_keystring可选Caller-chosen key that groups requests with a long shared prefix so that they can reuse the provider's prompt cache.
prompt_cache_optionsobject可选Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer.
modestring必填Prompt cache mode; explicit caches only the blocks marked with prompt_cache_breakpoint.
ttlstring可选Lifetime of cache entries, for example 30m; null leaves the provider default.
reasoningobject可选Configuration for reasoning mode in the response
contextstring可选Controls which reasoning is available to the model. `auto` uses the model default (same as omitting); `all_turns` includes reasoning from earlier turns passed in input; `current_turn` limits to the current turn only. Only supported by OpenAI GPT-5.6 and newer.
effortstring可选◐ 部分支持How much reasoning the model should spend.
deepseek-flash 的 none 可关闭思考,其余档位不保证单调;glm-5.3-flash 接受但当前不生效,none 仍思考。
modestring可选Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer.
summarystring可选◐ 部分支持How detailed the reasoning summary should be.
glm-5.3-flash 的 concise 偶发有摘要,auto/detailed 未见;deepseek-flash 接受但当前不生效。
enabledboolean可选Whether reasoning is on for models that let you switch it.
max_tokensinteger可选Upper bound on reasoning tokens, for models that take a reasoning budget.
safety_identifierstring可选Recommended per-end-user identifier for abuse isolation. Use a stable ID, hash, or pseudonym. When a provider requires a user identity, we fold it into the hashed identity sent upstream and never forward it raw. If omitted, requests use an account-level identity, so provider policy blocks can affect the whole account.
service_tierstring可选Requested service tier; its effect is currently unobservable.
storeboolean可选Whether to store the response server-side so it can be retrieved or continued later via previous_response_id. Defaults to true; pass false to opt out.
true 保存响应供读取;false 不保存,读取返回 404。
textobject可选Text output configuration including format and verbosity
formatobject可选◐ 部分支持Text response format configuration
json_object、json_schema 生效(预算需足够);text 在 glm-5.3-flash 偶发 400,在 deepseek-flash 生效。
verbositystring可选○ 当前不生效How long the answer should be. Router support (ignored): Accepted but currently has no effect. No verbosity effect was observed on glm-5.3-flash or deepseek-flash.
接受但当前不生效。glm-5.3-flash、deepseek-flash 均未观察到长度变化。
top_logprobsinteger可选◐ 部分支持Number of most likely tokens whose log probabilities are returned per position, from 0 to 20. Router support (partial): Works on deepseek-flash with values 0–20; glm-5.3-flash returns empty logprobs.
deepseek-flash 生效,允许 0–20;glm-5.3-flash 返回空 logprobs。
truncationstring可选How to handle input that exceeds the context window.
userstring可选A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 256 characters.
conversationstring可选The conversation this response belongs to (a conversation id string, or a `{id}` object). Before the request reaches the upstream provider, we prepend that conversation's existing items to this request's input; after the response completes, this turn's input and output items are appended back to the conversation. Only the conversation's owner may reference it — otherwise 404 object_not_found; cannot be used together with previous_response_id — sending both returns 400.
会话历史进入本次输入,响应条目追加到会话;不能与 previous_response_id 同传。
context_managementarray可选Context management configuration for this request (e.g. automatic compaction once a token threshold is exceeded).
moderationobject可选Configuration for running moderation on the input and output of this response.
prompt_cache_retentionstring可选The retention policy for the prompt cache. Set to 24h to keep cached prefixes active for up to 24 hours.
stream_optionsobject可选Options for streaming responses. Only set this when stream=true (e.g. whether to include usage statistics at the end of the stream).
access_programsobject可选○ 未支持已识别的官方字段;平台未实现访问计划,传入返回 400 并明确说明不支持。
200 response
stream=true 时以 SSE 增量返回(text/event-stream)。
未知顶层字段原样转发给同协议上游,由上游决定是否接受;已声明字段的类型与取值范围仍会校验,不合法时返回 400 并点名字段。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| background | boolean | null | Whether the response was started in background mode. |
| completed_at | integer | null | Unix time in seconds at which the response finished; null while it has not finished. |
| created_at | integer | Unix time in seconds at which the response was created. |
| error | object | null | Error information returned from the API |
| error.code | string | Machine-readable error code. |
| error.message | string | Human-readable error message. |
| frequency_penalty | number | null | The frequency penalty that applied to the request, if any. |
| id | string | Unique id of the response; use it as response_id to retrieve, cancel or delete it, or as previous_response_id to continue the conversation. |
| incomplete_details | object | null | Why the response stopped before finishing; null for complete responses. |
| incomplete_details.reason | string | Why the response is incomplete. |
| instructions | string | array<object> | null | Input of the request: a string or an array of input items. |
| max_output_tokens | integer | null | Upper bound on generated tokens that applied to the request; null when none was set. |
| max_tool_calls | integer | null | Upper bound on built-in tool calls that applied to the request; null when none was set. |
| metadata | object | null | Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed. |
| model | string | Model that produced the response. |
| object | string | Object type; always `response`. |
| output | array<object> | Items the model produced, in order: messages, reasoning, tool calls and tool results. |
| output[].content | array<object> | array | null | string | Content parts of the message: output text or refusal. / Reasoning text parts, when the provider returns them. / Text content of the fetched page. |
| output[].id | string | Id of the message item. / Id of the reasoning item. / Id of the function call item. / Id of the web search call item. / Id of the file search call item. / Id of the image generation call item. / Id of the code interpreter call item. / Id of the computer call item. / Id of the datetime server tool item. / Id of the web search server tool item. / Id of the code interpreter server tool item. / Id of the file search server tool item. / Id of the image generation server tool item. / Id of the browser use server tool item. / Id of the bash server tool item. / Id of the text editor server tool item. / Id of the apply_patch server tool item. / Id of the apply_patch call item. / Id of the shell call item. / Id of the shell call output item. / Id of the shell server tool item. / Id of the web fetch server tool item. / Id of the tool search server tool item. / Id of the memory server tool item. / Id of the MCP server tool item. / Id of the model search server tool item. / Id of the fusion server tool item. / Id of the advisor server tool item. / Id of the subagent server tool item. / Id of the files server tool item. / Id of the custom tool call item. |
| output[].phase | string | null | The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages. |
| output[].role | string | Role of the author; always assistant. |
| output[].status | string | Status of the message item. / Status of the reasoning item. / Status of the function call item. / Status of a web search call. / Status of a web search call. / Status of an image generation call. / Status of the code interpreter call. / Status of the computer call item. / Status of a tool call. / Status of a tool call. / Status of a tool call. / Status of a tool call. / Status of a tool call. / Status of a tool call. / Status of a tool call that can fail. / Status of a tool call. / Status of a tool call. / Lifecycle state of an `apply_patch_call` output item. / Status of a shell call or its output. / Status of a shell call or its output. / Status of a tool call that can fail. / Status of a tool call. / Status of a tool call. / Status of a tool call. / Status of a tool call. / Status of a tool call. / Status of a tool call. / Status of a tool call that can fail. / Status of a tool call that can fail. / Status of a tool call. / Status of the custom tool call item. |
| output[].type | string | Always `message`. Discriminator that marks this object as a OutputMessage in a `type`-tagged union. / Always `reasoning`. Discriminator that marks this object as a OutputItemReasoning in a `type`-tagged union. / Always `function_call`. Discriminator that marks this object as a OutputItemFunctionCall in a `type`-tagged union. / Always `web_search_call`. Discriminator that marks this object as a OutputItemWebSearchCall in a `type`-tagged union. / Always `file_search_call`. Discriminator that marks this object as a OutputItemFileSearchCall in a `type`-tagged union. / Always `image_generation_call`. Discriminator that marks this object as a OutputItemImageGenerationCall in a `type`-tagged union. / Always `code_interpreter_call`. Discriminator that marks this object as a OutputItemCodeInterpreterCall in a `type`-tagged union. / Always `computer_call`. Discriminator that marks this object as a OutputComputerCallItem in a `type`-tagged union. / Always `openrouter:datetime`. Discriminator that marks this object as a OutputDatetimeItem in a `type`-tagged union. / Always `openrouter:web_search`. Discriminator that marks this object as a OutputWebSearchServerToolItem in a `type`-tagged union. / Always `openrouter:code_interpreter`. Discriminator that marks this object as a OutputCodeInterpreterServerToolItem in a `type`-tagged union. / Always `openrouter:file_search`. Discriminator that marks this object as a OutputFileSearchServerToolItem in a `type`-tagged union. / Always `openrouter:image_generation`. Discriminator that marks this object as a OutputImageGenerationServerToolItem in a `type`-tagged union. / Always `openrouter:browser_use`. Discriminator that marks this object as a OutputBrowserUseServerToolItem in a `type`-tagged union. / Always `openrouter:bash`. Discriminator that marks this object as a OutputBashServerToolItem in a `type`-tagged union. / Always `openrouter:text_editor`. Discriminator that marks this object as a OutputTextEditorServerToolItem in a `type`-tagged union. / Always `openrouter:apply_patch`. Discriminator that marks this object as a OutputApplyPatchServerToolItem in a `type`-tagged union. / Always `apply_patch_call`. Discriminator that marks this object as a OutputApplyPatchCallItem in a `type`-tagged union. / Always `shell_call`. Discriminator that marks this object as a OutputShellCallItem in a `type`-tagged union. / Always `shell_call_output`. Discriminator that marks this object as a OutputShellCallOutputItem in a `type`-tagged union. / Always `openrouter:shell`. Discriminator that marks this object as a OutputShellServerToolItem in a `type`-tagged union. / Always `openrouter:web_fetch`. Discriminator that marks this object as a OutputWebFetchServerToolItem in a `type`-tagged union. / Always `openrouter:tool_search`. Discriminator that marks this object as a OutputToolSearchServerToolItem in a `type`-tagged union. / Always `openrouter:memory`. Discriminator that marks this object as a OutputMemoryServerToolItem in a `type`-tagged union. / Always `openrouter:mcp`. Discriminator that marks this object as a OutputMcpServerToolItem in a `type`-tagged union. / Always `openrouter:experimental__search_models`. Discriminator that marks this object as a OutputSearchModelsServerToolItem in a `type`-tagged union. / Always `openrouter:fusion`. Discriminator that marks this object as a OutputFusionServerToolItem in a `type`-tagged union. / Always `openrouter:advisor`. Discriminator that marks this object as a OutputAdvisorServerToolItem in a `type`-tagged union. / Always `openrouter:subagent`. Discriminator that marks this object as a OutputSubagentServerToolItem in a `type`-tagged union. / Always `openrouter:files`. Discriminator that marks this object as a OutputFilesServerToolItem in a `type`-tagged union. / Always `custom_tool_call`. Discriminator that marks this object as a OutputCustomToolCallItem in a `type`-tagged union. |
| output[].encrypted_content | string | null | Opaque encrypted reasoning; send it back unchanged to let the model continue its reasoning on the next turn. |
| output[].summary | array<object> | Summary parts of the reasoning. |
| output[].format | string | null | Wire format of the reasoning details, which names the provider family that produced them. |
| output[].signature | string | null | A signature for the reasoning content, used for verification |
| output[].arguments | string | string | null | string | null | string | null | string | string | null | JSON-encoded arguments the model produced for the function. / The raw tool-call arguments string as emitted by the model. / The raw tool-call arguments string as emitted by the model. Echo back unchanged when replaying history; used verbatim to preserve provider prompt-cache prefixes. / The raw tool-call arguments string as emitted by the model. / The JSON arguments submitted to the search tool (e.g. {"query":"Claude"}) / The raw tool-call arguments string as emitted by the model. |
| output[].async | boolean | True when the model called a tool declared with `async: true` and may continue its turn before the output is returned. Return the result in a later request as a `function_call_output` with this `call_id`. |
| output[].call_id | string | string | null | string | string | string | string | string | null | string | string | null | string | Id of the call; the function_call_output item that answers it repeats it as call_id. / Id of the call; the computer_call_output item that answers it repeats it as call_id. / The model-generated tool call id from the originating turn. / Id of the apply_patch tool call. / Id of the call; the apply_patch_call_output item that answers it repeats it as call_id. / Id of the call; the shell_call_output item that answers it repeats it as call_id. / Id of the shell call this output answers. / The model-generated tool call id from the originating turn. / EXPERIMENTAL — subject to change without notice. The `call_id` of the tool call that spawned this subagent. This id will also be included as the `subagent_id` on any `function_call` items created by the subagent. This must be returned in the request so the `function_call` can be matched with the correct subagent. A suspended `in_progress` item is announced once and never re-emitted or terminally closed — completion arrives as a new item with the same `call_id`. / The model-generated tool call id from the originating turn. / Id of the call; the custom_tool_call_output item that answers it repeats it as call_id. |
| output[].name | string | Name of the function being called. / Configured name of the subagent that executed the task (the `name` on its tool entry). Present only for named subagents; omitted for an unnamed (default) subagent. / Name of the custom tool being called. |
| output[].namespace | string | Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server) |
| output[].subagent_id | string | EXPERIMENTAL — subject to change without notice. String id that matches the `call_id` of the `openrouter:subagent` server tool call that spawned the subagent. Present on every `function_call` item the subagent projects; absent on ordinary function calls. |
| output[].subagent_items | array<object> | EXPERIMENTAL — subject to change without notice. The subagent's output items produced on this turn. Treat this as an opaque object; you must replay it in the request so that the subagent can continue execution of the tool with the same context. If a subagent created multiple parallel tool calls, only the first tool call will have this field. The other tool calls will only have `subagent_id`. Present only if the tool call originates from a subagent spawned by the `openrouter:subagent` server tool. |
| output[].action | object | any | object | string | object | object | string | The search action the model took: a search, opening a page, or finding a pattern in a page. / The action the model asks the client to perform on the computer. / The search action performed, matching OpenAI web_search_call.action shape. Includes the query the model issued and optional source URLs returned by the search provider. / The browser action that was performed. / The commands the model asks the client to run. / The commands that were run. / Memory action that was performed. |
| output[].queries | array<string> | Queries the model ran against the vector stores. / Queries that ran against the vector stores. |
| output[].result | string | null | string | Base64-encoded generated image; null while generation has not finished. / The generated image as a base64-encoded string or URL, matching OpenAI image_generation_call format / JSON-serialized result of the file operation. |
| output[].prompt | string | The prompt (possibly rewritten) that the image was generated from. / The prompt the executor sent to the advisor. |
| output[].code | string | null | string | The code the interpreter ran; null while it is still being written. / The code that ran. |
| output[].container_id | string | Id of the container the code ran in. / The canonical container id the command ran under — the `{container_id}` for the Container Files API, reusable as a `container_reference` in later requests. Present on every sandbox-executed call, even when no files changed. / The canonical container id the command ran under — the `{container_id}` for the Container Files API, reusable as a `container_reference` in later requests. Present on every sandbox-executed call, even when no files changed. / The canonical container id the command ran under — the `{container_id}` for the Container Files API, reusable as a `container_reference` in later requests. Present on every sandbox-executed call, even when no files changed. |
| output[].outputs | array | null | Outputs of the run: logs and images; null while the run has not finished. |
| output[].pending_safety_checks | array<object> | Safety checks that must be acknowledged before the action is performed. |
| output[].datetime | string | ISO 8601 datetime string |
| output[].timezone | string | IANA timezone name |
| output[].exitCode | integer | Exit code of the run; 0 means success. / Exit code of the command; 0 means success. |
| output[].language | string | Language of the code that ran. |
| output[].stderr | string | Standard error output of the code. / Standard error output of the command. |
| output[].stdout | string | Standard output of the code. / Standard output of the command. |
| output[].imageB64 | string | Base64-encoded generated image. |
| output[].imageUrl | string | URL of the generated image. |
| output[].revisedPrompt | string | Prompt after the image model rewrote it. |
| output[].screenshotB64 | string | Base64-encoded screenshot taken after the action. |
| output[].command | string | The bash command that ran. / Editor command that ran. |
| output[].error | string | The error message when the sandbox call failed before producing a result (for example, the per-user container limit was reached). Set together with `status: 'failed'`; absent on a successful call. A non-zero `exitCode` is a command failure, not a tool failure. / The error message when the sandbox call failed before producing a result (for example, the per-user container limit was reached). Set together with `status: 'incomplete'` and an empty `output`; absent on a successful call. / The error message when the sandbox call failed before producing a result (for example, the per-user container limit was reached). Set together with `status: 'failed'`; absent on a successful call. `output` is omitted when `error` is set. / The error message if the fetch failed. / Error message when the fusion run did not produce an analysis result. / Error message when the advisor call did not produce advice. Set together with `status: 'failed'` on the terminal item. / Error message when the subagent task did not produce an outcome. Set together with `status: 'failed'` on the terminal item. / Error message when the file operation failed. |
| output[].files | array<object> | Citations for the files the sandbox command created or modified, most-recently-touched first (at most 10). Retrieve them via the Container Files API. |
| output[].filePath | string | Path of the file the command worked on. |
| output[].operation | object | string | The patch operation requested by an `apply_patch_call`. `create_file` and `update_file` carry a V4A diff; `delete_file` omits it. / The file operation performed (list, read, write, or edit). |
| output[].max_output_length | integer | null | Maximum number of characters of output that was kept; null for no limit. |
| output[].output | array<object> | Output of each command, in the order the commands ran. |
| output[].httpStatus | integer | The HTTP status code returned by the upstream URL fetch. |
| output[].title | string | Title of the fetched page. |
| output[].url | string | URL that was fetched. |
| output[].query | string | The tool search query. / The model search query. |
| output[].key | string | Key of the memory entry. |
| output[].value | any | Value of the memory entry; absent for reads that found nothing and for deletes. |
| output[].serverLabel | string | Label of the MCP server. |
| output[].toolName | string | Name of the MCP tool that was called. |
| output[].analysis | object | Structured analysis produced by the fusion analyst model. |
| output[].failed_models | array<object> | Models that were requested as part of the analysis panel but did not produce a response. Present when at least one requested analysis model failed. The fusion result is still usable but was produced from a degraded panel. |
| output[].failure_reason | string | Typed failure reason when the fusion run failed. Possible values include: all_panels_failed, insufficient_credits, rate_limited, invalid_model, judge_not_valid_json, judge_schema_mismatch, judge_upstream_error, judge_empty_completion. The four analysis-stage codes keep their pre-rename `judge_` spelling so existing consumers keep matching. The consumer-cancellation code is `cancelled`. |
| output[].responses | array<object> | Analysis models that produced a response in this fusion run, with each model's full panel content. |
| output[].sources | array<object> | Web pages the analysis panels and analyst retrieved via web search during this fusion run, deduplicated by URL across the whole run. Present when at least one model cited a source. |
| output[].advice | string | The advisor model's response (the advice text returned to the executor). |
| output[].instance_name | string | Provider-safe function name of the specific advisor instance that produced this item (e.g. `openrouter_advisor__1`). Present only when more than one advisor tool is configured; omitted for the default single advisor. Echo this field back unchanged so the advisor's cross-request memory stays namespaced to the correct instance. This identity is positional: it is derived from the index of the advisor entry in the request `tools` array, so clients must keep the order of advisor tool entries stable across requests in a conversation. Reordering or inserting advisor entries shifts these names and causes each advisor's cross-request memory to be attributed to the wrong instance. / Provider-safe function name of the specific subagent instance that produced this item (e.g. `openrouter_subagent__1`). Present only on items from non-default instances — the second and later subagent entries in the request `tools` array. The first (default) instance omits it, even when multiple subagents are configured. When a replayed item echoes this field back, the transcript rehydrates the call under that instance's tool. This identity is positional: it is derived from the index of the subagent entry in the request `tools` array, so keep the order of subagent entries stable across requests in a conversation. |
| output[].model | string | Slug of the advisor model that was consulted. / Slug of the worker model that executed the task. |
| output[].outcome | string | The worker model's result (the outcome text returned to the delegating model). |
| output[].task_description | string | The task description the delegating model sent to the worker. |
| output[].task_name | string | The short task identifier the delegating model supplied. |
| output[].file_id | string | The target file id supplied in the tool-call arguments. |
| output[].filename | string | The target filename supplied in the tool-call arguments. |
| output[].input | string | Free-form input the model produced for the custom tool. |
| output_text | string | Convenience concatenation of all output text of the response. |
| parallel_tool_calls | boolean | Whether the model was allowed to call several tools in one turn. |
| presence_penalty | number | null | The presence penalty that applied to the request, if any. |
| previous_response_id | string | null | Id of the response this one continued; null when it started a new conversation. |
| prompt | object | null | Reference to a stored prompt template with its variables. |
| prompt.id | string | Id of the stored prompt template. |
| prompt.variables | object | null | Values for the template variables, keyed by variable name; a value is a string or an input text, image or file part. |
| prompt_cache_key | string | null | Cache key the request supplied to improve prompt cache hits; null when none was set. |
| prompt_cache_options | object | null | Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. |
| prompt_cache_options.mode | string | Prompt cache mode; explicit caches only the blocks marked with prompt_cache_breakpoint. |
| prompt_cache_options.ttl | string | null | Lifetime of cache entries, for example 30m; null leaves the provider default. |
| reasoning | object | null | Reasoning settings that applied: effort, summary verbosity, mode and context. |
| reasoning.context | string | null | Controls which reasoning is available to the model. `auto` uses the model default (same as omitting); `all_turns` includes reasoning from earlier turns passed in input; `current_turn` limits to the current turn only. Only supported by OpenAI GPT-5.6 and newer. |
| reasoning.effort | string | null | How much reasoning the model should spend. |
| reasoning.mode | string | null | Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer. |
| reasoning.summary | string | null | How detailed the reasoning summary should be. |
| safety_identifier | string | null | End-user identifier the request supplied for abuse monitoring; null when none was set. |
| service_tier | string | null | Service tier the provider used for the response; null when not reported. |
| status | string | Lifecycle status of the response. |
| store | boolean | Whether the response is stored so it can be retrieved later. |
| temperature | number | null | Sampling temperature that applied to the request, if any. |
| text | object | Text output configuration including format and verbosity |
| text.format | object | Text response format configuration |
| text.verbosity | string | null | How long the answer should be. |
| tool_choice | string | object | How the model picks tools: a mode string or a specific tool. |
| tool_choice.name | string | Name of the function or tool the model must call. |
| tool_choice.type | string | Kind of tool the model must call. / Always `allowed_tools`. Discriminator that marks this object as a ToolChoiceAllowed in a `type`-tagged union. / Kind of tool the model must call. / Kind of tool the model must call. |
| tool_choice.mode | string | auto lets the model pick among the allowed tools or none; required forces a call to one of them. |
| tool_choice.tools | array<object> | The allowed tools, each as a tool reference such as {type: function, name}. |
| tools | array<object> | Tools that were available to the model for this response. |
| tools[].description | string | null | string | string | What the function does and when to use it; the model reads this to decide whether to call it. / What the custom tool does and when to use it. / What the group of tools is for. |
| tools[].name | string | Name of the function; the model uses it in function_call items. / Name of the custom tool. / Name of the namespace that groups the tools. |
| tools[].parameters | object | null | JSON Schema of the function arguments; null when the function takes none. |
| tools[].strict | boolean | null | Whether to enforce strict argument validation against the schema; null leaves the provider default. |
| tools[].type | string | Always `function`. Discriminator that marks this object as a FunctionTool in a `type`-tagged union. / Always `web_search_preview`. Discriminator that marks this object as a Preview_WebSearchServerTool in a `type`-tagged union. / Always `web_search_preview_2025_03_11`. Discriminator that marks this object as a Preview_20250311_WebSearchServerTool in a `type`-tagged union. / Always `web_search`. Discriminator that marks this object as a Legacy_WebSearchServerTool in a `type`-tagged union. / Always `web_search_2025_08_26`. Discriminator that marks this object as a WebSearchServerTool in a `type`-tagged union. / Comparison operator. / Always `computer_use_preview`. Discriminator that marks this object as a ComputerUseServerTool in a `type`-tagged union. / Always `code_interpreter`. Discriminator that marks this object as a CodeInterpreterServerTool in a `type`-tagged union. / Always `mcp`. Discriminator that marks this object as a McpServerTool in a `type`-tagged union. / Always `image_generation`. Discriminator that marks this object as a ImageGenerationServerTool in a `type`-tagged union. / Always `local_shell`. Discriminator that marks this object as a CodexLocalShellTool in a `type`-tagged union. / Always `shell`. Discriminator that marks this object as a ShellServerTool in a `type`-tagged union. / Always `apply_patch`. Discriminator that marks this object as a ApplyPatchServerTool in a `type`-tagged union. / Always `custom`. Discriminator that marks this object as a CustomTool in a `type`-tagged union. / Always `namespace`. Discriminator that marks this object as a NamespaceTool in a `type`-tagged union. |
| tools[].async | boolean | Lets the model keep working after calling this tool instead of waiting for its output. The tool is still executed by the client; return the result in a later request as a `function_call_output` with the original `call_id`. Only honored by providers whose Responses API supports async tools; ignored elsewhere. |
| tools[].defer_loading | boolean | Withhold this tool from the model until `openrouter:tool_search` finds it. Requires the tool search server tool; at least one tool must remain non-deferred. |
| tools[].engine | string | Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses Firecrawl (requires BYOK). "parallel" uses the Parallel search API. "perplexity" uses the Perplexity Search API (raw ranked results). |
| tools[].filters | object | null | Restricts web search by domain. / Attribute filter applied to the search: a comparison or a compound filter. |
| tools[].max_results | integer | Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped. |
| tools[].max_uses | integer | Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it. |
| tools[].mode | string | Engine-native search mode. Exa supports instant, fast, auto (default), deep-lite, deep, and deep-reasoning. Parallel supports turbo, fast, basic (default), and advanced. Modes unsupported by the selected engine are ignored. |
| tools[].search_context_size | string | Size of the search context for web search tools |
| tools[].user_location | object | null | Approximate location of the user, used to bias web search results. / User location information for web search / User location information for web search |
| tools[].max_num_results | integer | Maximum number of results to return, between 1 and 50. |
| tools[].ranking_options | object | Ranking options for the search. |
| tools[].vector_store_ids | array<string> | Ids of the vector stores to search. |
| tools[].display_height | integer | Height of the computer display in pixels. |
| tools[].display_width | integer | Width of the computer display in pixels. |
| tools[].environment | string | Kind of environment that is controlled. |
| tools[].container | string | object | Container for the code to run in: a container id or an automatic container with files. |
| tools[].allowed_tools | array<string> | object | null | Tools of the server the model may use: a list of names or a filter. |
| tools[].authorization | string | OAuth access token for the MCP server. |
| tools[].connector_id | string | Id of a built-in connector; give this or server_url. |
| tools[].headers | object | null | HTTP headers sent to the MCP server; null for none. |
| tools[].require_approval | object | string | null | Whether tool calls need approval before they run: always, never, or a filter per tool. |
| tools[].server_description | string | What the MCP server is for, which helps the model decide when to use it. |
| tools[].server_label | string | Label that names the MCP server in the conversation. |
| tools[].server_url | string | URL of the MCP server; give this or connector_id. |
| tools[].background | string | Background of the generated image. |
| tools[].input_fidelity | string | null | How closely to preserve details of input images; null uses the default. |
| tools[].input_image_mask | object | Mask that marks the region of the input image to edit. |
| tools[].model | string | Image model to use. |
| tools[].moderation | string | Moderation level applied to the generated image. |
| tools[].output_compression | integer | Compression level from 0 to 100 for jpeg and webp output. |
| tools[].output_format | string | File format of the generated image. |
| tools[].partial_images | integer | Number of partial images to stream while generating, from 0 to 3. |
| tools[].quality | string | Quality of the generated image. |
| tools[].size | string | Size of the generated image; auto lets the model choose. |
| tools[].format | object | Format of the tool input: free text or a grammar. |
| tools[].tools | array<object> | Function tools in the namespace. |
| top_logprobs | integer | Number of most likely tokens whose log probabilities were requested per position. |
| top_p | number | null | Nucleus sampling value that applied to the request, if any. |
| truncation | string | null | How to handle input that exceeds the context window. |
| usage | object | null | Token usage information for the response |
| usage.input_tokens | integer | Number of input tokens, cached tokens included. |
| usage.input_tokens_details | object | Breakdown of the input tokens. |
| usage.output_tokens | integer | Number of output tokens, reasoning tokens included. |
| usage.output_tokens_details | object | Breakdown of the output tokens. |
| usage.total_tokens | integer | Input plus output tokens. |
| usage.cost | number | null | Cost of the completion |
| usage.cost_details | object | Breakdown of the upstream inference cost. |
| usage.is_byok | boolean | Whether a request was made using a Bring Your Own Key configuration |
| usage.server_tool_use_details | object | null | Usage for server-side tool execution (e.g., web search) |
| user | string | null | End-user identifier the request supplied; null when none was set. |
| error_type | string | Canonical OpenRouter error type, stable across all API formats |
| openrouter_metadata | object | Routing report: what was requested, how the router chose, and what was attempted. |
| openrouter_metadata.attempt | integer | Number of the attempt that served the request, starting at 1. |
| openrouter_metadata.attempts | array<object> | Every attempt that was made, in order. |
| openrouter_metadata.endpoints | object | Which endpoints were available and which one was chosen. |
| openrouter_metadata.generation_time | integer | Milliseconds measured for the generation, from dispatching the upstream request until its response body ended. Divide the completion token count by this for throughput. Absent when no upstream request was dispatched. |
| openrouter_metadata.is_byok | boolean | Whether the request used a key supplied by the caller. |
| openrouter_metadata.params | object | Router parameters that applied to the request. |
| openrouter_metadata.pipeline | array<object> | Stages the request went through before and after the model call. |
| openrouter_metadata.region | string | null | Region that served the request; null when unknown. |
| openrouter_metadata.requested | string | The model or alias the request asked for. |
| openrouter_metadata.strategy | string | How the router picked the model or provider for this request. |
| openrouter_metadata.summary | string | One-line summary of the routing decision. |
text/event-stream — chunk / 事件对象
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Optional id of the server-sent event. |
| event | string | Name of the server-sent event. |
| data | object | string | Payload of the server-sent event. |
| data.response | object | Complete non-streaming response from the Responses API |
| data.sequence_number | integer | Position of this event in the stream. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream. |
| data.type | string | Always `response.created`. Discriminator that marks this object as a CreatedEvent in a `type`-tagged union. / Always `response.in_progress`. Discriminator that marks this object as a InProgressEvent in a `type`-tagged union. / Always `response.completed`. Discriminator that marks this object as a CompletedEvent in a `type`-tagged union. / Always `response.incomplete`. Discriminator that marks this object as a IncompleteEvent in a `type`-tagged union. / Always `response.failed`. Discriminator that marks this object as a FailedEvent in a `type`-tagged union. / Always `error`. Discriminator that marks this object as a BaseErrorEvent in a `type`-tagged union. / Always `response.output_item.added`. Discriminator that marks this object as a OutputItemAddedEvent in a `type`-tagged union. / Always `response.output_item.done`. Discriminator that marks this object as a OutputItemDoneEvent in a `type`-tagged union. / Always `response.content_part.added`. Discriminator that marks this object as a BaseContentPartAddedEvent in a `type`-tagged union. / Always `response.content_part.done`. Discriminator that marks this object as a BaseContentPartDoneEvent in a `type`-tagged union. / Always `response.output_text.delta`. Discriminator that marks this object as a BaseTextDeltaEvent in a `type`-tagged union. / Always `response.output_text.done`. Discriminator that marks this object as a BaseTextDoneEvent in a `type`-tagged union. / Always `response.refusal.delta`. Discriminator that marks this object as a BaseRefusalDeltaEvent in a `type`-tagged union. / Always `response.refusal.done`. Discriminator that marks this object as a BaseRefusalDoneEvent in a `type`-tagged union. / Always `response.output_text.annotation.added`. Discriminator that marks this object as a BaseAnnotationAddedEvent in a `type`-tagged union. / Always `response.function_call_arguments.delta`. Discriminator that marks this object as a BaseFunctionCallArgsDeltaEvent in a `type`-tagged union. / Always `response.function_call_arguments.done`. Discriminator that marks this object as a BaseFunctionCallArgsDoneEvent in a `type`-tagged union. / Always `response.reasoning_text.delta`. Discriminator that marks this object as a BaseReasoningDeltaEvent in a `type`-tagged union. / Always `response.reasoning_text.done`. Discriminator that marks this object as a BaseReasoningDoneEvent in a `type`-tagged union. / Always `response.reasoning_summary_part.added`. Discriminator that marks this object as a BaseReasoningSummaryPartAddedEvent in a `type`-tagged union. / Always `response.reasoning_summary_part.done`. Discriminator that marks this object as a BaseReasoningSummaryPartDoneEvent in a `type`-tagged union. / Always `response.reasoning_summary_text.delta`. Discriminator that marks this object as a BaseReasoningSummaryTextDeltaEvent in a `type`-tagged union. / Always `response.reasoning_summary_text.done`. Discriminator that marks this object as a BaseReasoningSummaryTextDoneEvent in a `type`-tagged union. / Always `response.image_generation_call.in_progress`. Discriminator that marks this object as a OpenAIResponsesImageGenCallInProgress in a `type`-tagged union. / Always `response.image_generation_call.generating`. Discriminator that marks this object as a OpenAIResponsesImageGenCallGenerating in a `type`-tagged union. / Always `response.image_generation_call.partial_image`. Discriminator that marks this object as a OpenAIResponsesImageGenCallPartialImage in a `type`-tagged union. / Always `response.image_generation_call.completed`. Discriminator that marks this object as a OpenAIResponsesImageGenCallCompleted in a `type`-tagged union. / Always `response.code_interpreter_call.in_progress`. Discriminator that marks this object as a OpenAIResponsesCodeInterpreterCallInProgress in a `type`-tagged union. / Always `response.code_interpreter_call.interpreting`. Discriminator that marks this object as a OpenAIResponsesCodeInterpreterCallInterpreting in a `type`-tagged union. / Always `response.code_interpreter_call.completed`. Discriminator that marks this object as a OpenAIResponsesCodeInterpreterCallCompleted in a `type`-tagged union. / Always `response.code_interpreter_call_code.delta`. Discriminator that marks this object as a OpenAIResponsesCodeInterpreterCallCodeDelta in a `type`-tagged union. / Always `response.code_interpreter_call_code.done`. Discriminator that marks this object as a OpenAIResponsesCodeInterpreterCallCodeDone in a `type`-tagged union. / Always `response.web_search_call.in_progress`. Discriminator that marks this object as a OpenAIResponsesWebSearchCallInProgress in a `type`-tagged union. / Always `response.web_search_call.searching`. Discriminator that marks this object as a OpenAIResponsesWebSearchCallSearching in a `type`-tagged union. / Always `response.web_search_call.completed`. Discriminator that marks this object as a OpenAIResponsesSearchCompleted in a `type`-tagged union. / Always `response.custom_tool_call_input.delta`. Discriminator that marks this object as a BaseCustomToolCallInputDeltaEvent in a `type`-tagged union. / Always `response.custom_tool_call_input.done`. Discriminator that marks this object as a BaseCustomToolCallInputDoneEvent in a `type`-tagged union. / Always `response.apply_patch_call_operation_diff.delta`. Discriminator that marks this object as a ApplyPatchCallOperationDiffDeltaEvent in a `type`-tagged union. / Always `response.apply_patch_call_operation_diff.done`. Discriminator that marks this object as a ApplyPatchCallOperationDiffDoneEvent in a `type`-tagged union. / Always `response.fusion_call.in_progress`. Discriminator that marks this object as a FusionCallInProgressEvent in a `type`-tagged union. / Always `response.fusion_call.panel.added`. Discriminator that marks this object as a FusionCallPanelAddedEvent in a `type`-tagged union. / Always `response.fusion_call.panel.delta`. Discriminator that marks this object as a FusionCallPanelDeltaEvent in a `type`-tagged union. / Always `response.fusion_call.panel.reasoning.delta`. Discriminator that marks this object as a FusionCallPanelReasoningDeltaEvent in a `type`-tagged union. / Always `response.fusion_call.panel.completed`. Discriminator that marks this object as a FusionCallPanelCompletedEvent in a `type`-tagged union. / Always `response.fusion_call.panel.failed`. Discriminator that marks this object as a FusionCallPanelFailedEvent in a `type`-tagged union. / Always `response.fusion_call.analysis.in_progress`. Discriminator that marks this object as a FusionCallAnalysisInProgressEvent in a `type`-tagged union. / Always `response.fusion_call.analysis.completed`. Discriminator that marks this object as a FusionCallAnalysisCompletedEvent in a `type`-tagged union. / Always `response.fusion_call.completed`. Discriminator that marks this object as a FusionCallCompletedEvent in a `type`-tagged union. / Always `response.debug`. Discriminator that marks this object as a DebugEvent in a `type`-tagged union. |
| data.code | string | null | string | Error code; null when the upstream gave none. / The complete code the interpreter runs. |
| data.message | string | Human-readable error message. |
| data.param | string | null | Name of the request parameter the error is about; null when it is not about a parameter. |
| data.item | object | An output item from the response |
| data.output_index | integer | Index of the item in the response output array that this event belongs to. |
| data.content_index | integer | Index of the content part inside the output item that this event belongs to. |
| data.item_id | string | Id of the output item this event belongs to; it equals the id of that item in the response output. |
| data.part | object | The content part as it starts: output text or refusal. / The content part in its final form: output text or refusal. / A reasoning summary part. / A reasoning summary part. |
| data.delta | string | Text fragment to append to the output text of this content part. / Refusal text fragment to append. / Fragment of the JSON-encoded function arguments to append. / Reasoning text fragment to append. / Reasoning summary text fragment to append. / Fragment of the code the interpreter will run, to append. / Fragment of the custom tool call input to append. / Fragment of the patch diff to append. / Text fragment the panel model produced. / Reasoning text fragment the panel model produced. |
| data.logprobs | array<object> | Log probabilities of the tokens in this fragment, when requested. / Log probabilities of the tokens in the complete text, when requested. |
| data.text | string | The complete output text of this content part. / The complete reasoning text of this content part. / The complete reasoning summary text of this part. |
| data.refusal | string | The complete refusal text. |
| data.annotation | object | Annotation attached to output text: a file citation, URL citation or file path. |
| data.annotation_index | integer | Index of the new annotation inside the content part's annotations array. |
| data.arguments | string | The complete JSON-encoded arguments of the function call. |
| data.name | string | Name of the function being called. |
| data.summary_index | integer | Index of the reasoning summary part inside the reasoning item that this event belongs to. |
| data.partial_image_b64 | string | Base64-encoded partial image produced while generation is still running. |
| data.partial_image_index | integer | Zero-based index of this partial image among the partial images of the call. |
| data.input | string | The complete input of the custom tool call. |
| data.diff | string | The complete patch diff. |
| data.model | string | Slug of the panel model that started. / Slug of the panel model that produced the fragment. / Slug of the panel model that produced the fragment. / Slug of the panel model that finished. / Slug of the panel model that failed. |
| data.content | string | The complete answer of the panel model. |
| data.error | string | Error message that explains why the panel model failed. |
| data.status_code | integer | HTTP status code of the failed upstream call, when one is available. |
| data.analyst_model | string | Slug of the model producing the structured analysis. |
| data.judge_model | string | Deprecated alias of `analyst_model`, kept so existing consumers keep working. Always carries the same value. Use `analyst_model`. |
| data.analysis | object | Structured analysis produced by the fusion analyst model. |
| data.debug | object | Debug information. |
先调用「生成响应」,用返回的 ID 替换 resp_123。
/model/v1/responses/{response_id}● 支持response_idstring必填path: Id of the stored response, the `id` returned by createResponse (it looks like resp_...). An unknown id, a response created with store false, an expired response and another tenant's response all answer 404.
200 response
按 ID 读取一条已保存的响应。如果创建时 store 为 false,我们不会保存这次响应,读取会返回 404 response_not_found;超过保留期(默认 30 天)后读取也会返回同样的 404。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Native Responses API response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | object |
先调用「生成响应」,用返回的 ID 替换 resp_123。
/model/v1/responses/{response_id}● 支持response_idstring必填path: Id of the stored response, the `id` returned by createResponse (it looks like resp_...). An unknown id, a response created with store false, an expired response and another tenant's response all answer 404.
200 response
按 ID 立即删除一条已保存的响应。如果创建时 store 为 false,我们不会保存这次响应,删除会返回 404 response_not_found。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Native Responses API delete response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | object |
先调用「生成响应」,用返回的 ID 替换 resp_123。
/model/v1/responses/{response_id}/cancel◐ 部分支持response_idstring必填path: Id of the stored response, the `id` returned by createResponse (it looks like resp_...). An unknown id, a response created with store false, an expired response and another tenant's response all answer 404.
200 response
仅对以 background:true 创建、且路由到具备后台生成能力的模型的响应可用:取消是 幂等的,重复调用返回同一个终态响应;我方的取消只能停止我方对上游流的继续读取, 不能保证已发往上游的算力停止计算,用量按实际收到的部分结算。对一个非后台 (同步)响应调用 cancel:如果这个响应 id 不存在(未持久化、已过期或 id 有误), 返回 404 object_not_found;如果响应存在但其来源 provider 没有声明支持 cancel 操作(我们目前没有接入任何为同步响应声明该能力的上游),返回 400 native_responses_operation_unsupported。这两种情况都不是尚未实现的 501 gate。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Native Responses API cancel response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | object |
先调用「生成响应」,用返回的 ID 替换 resp_123。
/model/v1/responses/{response_id}/input_items● 支持response_idstring必填path: Id of the stored response, the `id` returned by createResponse (it looks like resp_...). An unknown id, a response created with store false, an expired response and another tenant's response all answer 404.
200 list
列出一条已保存响应的输入项。支持 limit(1–100,默认 20)、order(asc/desc, 默认 desc,与官方一致)与基于条目 id 的 after 游标分页;has_more/first_id/ last_id 均与实际返回页一致,可据此翻页且不重不漏。每个条目都带服务端签发的 id(message 为 msg_ 前缀,function_call/function_call_output/reasoning 各自 对应前缀),本次上线前已保存、尚无服务端 id 的旧数据在读取时按确定性规则补 id,不做破坏性迁移,同一游标反复读取保持稳定。以 previous_response_id 续接 创建的响应,其输入项列出解析后的完整输入:前序响应链已有的输入与输出条目 再加本轮自己提交的输入;若该祖先响应在我方平台未保存(例如创建时 store 为 false)或已过期删除,则只列出本轮自己提交的输入。如果创建时 store 为 false,我们不会保存这次响应,列出会返回 404 response_not_found。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Native Responses API input item list
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | object |
/model/v1/responses/compact○ 未支持501 平台还没有实现这个端点;调用会得到下面这个响应:
把响应的输入压缩成摘要,依赖 OpenAI Responses 官方的服务端存储(store)语义,我们目前还没有实现;调用会返回 501(message 为 “This platform has not implemented … yet.”,响应头 x-should-retry 为 false),不产生副作用,官方 SDK 不会重试。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Native Responses API compact response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | object |
/model/v1/responses/input_tokens○ 未支持501 平台还没有实现这个端点;调用会得到下面这个响应:
只统计请求输入会消耗的 token 数、不生成内容,依赖 OpenAI Responses 官方的服务端存储(store)语义,我们目前还没有实现;调用会返回 501(message 为 “This platform has not implemented … yet.”,响应头 x-should-retry 为 false),不产生副作用,官方 SDK 不会重试。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Native Responses API input token count
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | object |
/model/v1/embeddings● 支持modelstring必填The model to use for embeddings
已验证生效。
inputstring | array必填◐ 部分支持Text, token, or multimodal input(s) to embed
文本及文本数组生效;token 整数数组返回 400。图片仅 qwen3-vl-embedding、doubao-embedding-vision 支持;text-embedding-3-small 的 16 条批量返回 400。
dimensionsinteger可选◐ 部分支持The number of dimensions for the output embeddings
仅 text-embedding-3-small、qwen3-vl-embedding 支持已测的 256 维;text-embedding-3-small 也支持 512,100 返回 400。bge-m3、qwen3-embedding-0.6b、doubao-embedding-vision 的 256 维返回 400。
encoding_formatstring可选The format of the output embeddings
float 与 base64 均支持;base64 为向量的二进制编码。
input_typestring可选◐ 部分支持The type of input (e.g. search_query, search_document)
query/document 在 bge-m3、qwen3-embedding-0.6b 生效;search_query 返回 400;text-embedding-3-small 接受但当前不生效。
providerobject可选◐ 部分支持OpenRouter-style provider preferences, accepted for compatibility. Router support (partial): bge-m3 and qwen3-embedding-0.6b return 400; text-embedding-3-small accepts it, with an unobservable effect.
bge-m3、qwen3-embedding-0.6b 返回 400;text-embedding-3-small 接受,但效果不可观测。
allow_fallbacksboolean可选Whether to allow backup providers to serve requests - true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider. - false: use only the primary/custom provider, and return the upstream error if it's unavailable.
data_collectionstring可选Data collection setting. If no available model provider meets the requirement, your request will return an error. - allow: (default) allow providers which store user data non-transiently and may train on it - deny: use only providers which do not collect user data.
enforce_distillable_textboolean可选Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used.
ignorearray可选List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.
max_priceobject可选The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
onlyarray可选List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.
orderarray可选An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.
preferred_max_latencynumber | object可选Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
preferred_min_throughputnumber | object可选Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
quantizationsarray可选A list of quantization levels to filter the provider by.
require_parametersboolean可选Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.
sortstring | object可选The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
zdrboolean可选Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.
session_idstring可选◐ 部分支持A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters.
bge-m3、qwen3-embedding-0.6b 返回 400;text-embedding-3-small 接受,但效果不可观测。
traceobject可选◐ 部分支持Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
bge-m3、qwen3-embedding-0.6b 返回 400;text-embedding-3-small 接受,但效果不可观测。
generation_namestring可选Name of this generation in the trace.
parent_span_idstring可选Id of the parent span in the trace.
span_namestring可选Name of this request's span in the trace.
trace_idstring可选Id that groups several requests into one trace.
trace_namestring可选Name of the trace.
userstring可选◐ 部分支持A unique identifier for the end-user
bge-m3、qwen3-embedding-0.6b 返回 400;text-embedding-3-small 接受,但效果不可观测。
200 list
未知顶层字段原样转发给同协议上游,由上游决定是否接受;已声明字段的类型与取值范围仍会校验,不合法时返回 400 并点名字段。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Embedding response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | List of embedding objects |
| data[].embedding | array<number> | string | Embedding vector as an array of floats or a base64 string |
| data[].index | integer | Index of the embedding in the input list |
| data[].object | string | Object type of the entry; always `embedding`. |
| id | string | Unique identifier for the embeddings response |
| model | string | The model used for embeddings |
| object | string | Object type; always `list`. |
| usage | object | Token usage statistics |
| usage.cost | number | Cost of the request in credits |
| usage.cost_details | object | null | Breakdown of upstream inference costs |
| usage.is_byok | boolean | Whether a request was made using a Bring Your Own Key configuration |
| usage.prompt_tokens | integer | Number of tokens in the input |
| usage.prompt_tokens_details | object | Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included. |
| usage.total_tokens | integer | Total number of tokens used |
text/event-stream — chunk / 事件对象
○ 未支持
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Optional id of the server-sent event. |
| event | string | Name of the server-sent event. |
| data | string | Payload of the server-sent event. |
/model/v1/rerank● 支持modelstring必填Rerank model id; list candidates with listModels?type=reranking. Router support (supported): Verified to take effect.
已验证生效。
querystring必填Query to rank the documents against, at least 1 character. Router support (supported): Verified to take effect.
已验证生效。
documentsarray必填◐ 部分支持Documents to rank, as plain strings, at least one. Router support (partial): Only string arrays are supported; object arrays return 400.
只支持字符串数组;对象数组返回 400。
top_ninteger可选Number of best results to return, at least 1; omit it to return every document. Router support (supported): Controls returned result count; zero returns 400.
控制返回条数;0 返回 400。
return_documentsboolean可选○ 未支持bge-reranker-base 返回 400;只支持 model、query、documents、top_n。
max_tokens_per_docinteger可选○ 未支持bge-reranker-base 返回 400;只支持 model、query、documents、top_n。
rank_fieldsarray可选○ 未支持bge-reranker-base 返回 400;只支持 model、query、documents、top_n。
max_chunks_per_docinteger可选○ 未支持bge-reranker-base 返回 400;只支持 model、query、documents、top_n。
userstring可选○ 未支持bge-reranker-base 返回 400;只支持 model、query、documents、top_n。
200
标准请求字段;不能表达的参数返回 input_not_representable。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Cohere v2 rerank results.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| results | array<object> | Results ordered by relevance, best first. Each entry points back to a document with `index`. |
| results[].index | integer | Zero-based position of the document in the request `documents` array. |
| results[].relevance_score | number | Relevance of the document to the query, from 0 to 1; larger is more relevant. |
/model/v1/audio/speech● 支持modelstring必填Speech model id, for example `melotts` or `aura-2-en`; list candidates with listModels?type=speech. Router support (supported): Verified to take effect.
已验证生效。
inputstring可选Text to synthesize, 1 to 4096 characters. `text` and `prompt` are aliases; when several are given, `input` wins. Router support (supported): melotts supports input, lang and response_format=wav; text/prompt aliases also work.
melotts 支持 input、lang、response_format=wav;也可用 text/prompt 别名。
response_formatstring可选◐ 部分支持MeloTTS supports only wav (default); all other explicit formats return 400. When omitted the actual upstream format is returned. Aura defaults to mp3 and supports all listed formats.
melotts 仅 WAV。aura-2-en 支持 mp3/opus/flac/wav/pcm;aac 报错。
promptstring可选MeloTTS alias for input; input then text take precedence.
input 的别名,input 优先。
voicestring | object可选◐ 部分支持Aura speaker name. Custom voice objects and selectable MeloTTS voices return 400.
仅 aura-2-en 支持原生说话人名,如 thalia/apollo/orion/luna/zeus;不支持 alloy 或对象。melotts 必须省略。
idstring必填Id of a custom voice. Custom voice objects are not supported by these models and answer 400; use the string form of `voice` with an Aura speaker name.
instructionsstring可选○ 未支持Accepted by the protocol; these Cloudflare models reject it with 400.
melotts、aura-2-en 均返回 400。
speednumber可选◐ 部分支持Only 1 is representable by these Cloudflare models.
只接受默认值 1;非默认速度不支持,返回错误。
stream_formatstring可选◐ 部分支持Only audio is supported; the response is buffered binary audio.
audio 生效;sse 返回 400。
textstring可选Native alias for input; input wins.
input 的别名,input 优先。
speakerstring可选◐ 部分支持Aura alias for voice; voice wins.
aura-2-en 支持原生说话人名;melotts 返回 400。
langstring可选◐ 部分支持MeloTTS language; defaults to en. Use this field to select language; voice is not supported by MeloTTS.
melotts 支持 en/fr/es/zh;ja/ko 报错。aura-2-en 不支持 lang。
encodingstring可选◐ 部分支持Aura native encoding; response_format wins; mulaw/alaw return 400.
melotts 仅 linear16;aura-2-en 支持 linear16/flac 等已测编码,mulaw 返回 400;response_format 优先。
containerstring可选◐ 部分支持Aura container; response_format wins.
aura-2-en 支持 opus+ogg、linear16+none;container=wav 返回 400。melotts 不支持此字段。
sample_rateinteger可选◐ 部分支持Aura WAV supports 8000/16000/24000/32000/48000; FLAC supports 8000/16000/22050/32000/48000; PCM requires 24000; other formats reject this control.
仅 aura-2-en;wav 已测 8000/16000、pcm 已测 24000;44100 或 mp3 自定义采样率报错。melotts 不支持。
bit_rateinteger可选◐ 部分支持Aura MP3 supports 32000/48000; Opus 4000–650000; AAC 4000–192000. Other formats reject this control.
仅 aura-2-en:mp3 已测 32000/48000、opus 已测 64000;mp3=64000 报错。melotts 不支持。
200
melotts 输出 WAV,只支持 input(含 text/prompt 别名)、lang 和默认音频选项;aura-2-en 使用原生 speaker 名称。逐字段限制见参数表。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Audio bytes in the requested format.
audio/mpeg
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | string (binary) |
audio/ogg
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | string (binary) |
audio/aac
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | string (binary) |
audio/flac
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | string (binary) |
audio/wav
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | string (binary) |
audio/pcm
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | string (binary) |
响应体为音频字节;右侧描述对象仅记录实采的 Content-Type 和字节数。
/model/v1/audio/transcriptions● 支持modelstring必填Transcription model id, for example `whisper-large-v3-turbo` or `qwen3-asr-flash`; list candidates with listModels?type=transcription. Router support (supported): Verified to take effect.
已验证生效。
temperaturenumber可选○ 未支持whisper-large-v3-turbo、qwen3-asr-flash 均返回 400。
response_formatstring可选◐ 部分支持Format of the response body. `json` and `text` are the commonly supported formats. Router support (partial): json/text work on both; verbose_json works only on whisper-large-v3-turbo. srt/vtt return 400.
json/text 均生效;verbose_json 仅 whisper-large-v3-turbo 支持。srt/vtt 均返回 400。
promptstring可选◐ 部分支持Text that primes the model with vocabulary or context. Router support (partial): Vocabulary hints work on whisper-large-v3-turbo only; qwen3-asr-flash returns 400.
仅 whisper-large-v3-turbo 的词表提示已验证生效;qwen3-asr-flash 返回 400。
filestring必填Audio file to transcribe, uploaded as multipart/form-data. Router support (supported): Verified to take effect.
已验证生效。
languagestring可选◐ 部分支持Language of the audio as an ISO-639-1 code such as `en` or `zh`. Router support (partial): Both models accept ISO language codes. qwen3-asr-flash may translate output to that language; whisper-large-v3-turbo treats it as an input hint. Non-ISO names may return 502.
两模型接受 ISO 语言码;qwen3-asr-flash 可能按指定语言翻译输出,whisper-large-v3-turbo 用作输入语言提示。非 ISO 名称可能报 502。
timestamp_granularities[]array可选◐ 部分支持Timestamp levels to include with `verbose_json`; only `segment` exists in this schema. Router support (partial): Only whisper-large-v3-turbo supports segment with verbose_json. word returns 400; qwen3-asr-flash does not support timestamps.
仅 whisper-large-v3-turbo 在 verbose_json 下支持 segment;word 返回 400;qwen3-asr-flash 不支持时间戳。
200
标准请求字段;不能表达的参数返回 input_not_representable。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Transcription in the requested format.
text/plain
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | string |
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| text | string | The transcribed text. |
| task | string | Task performed; always `transcribe`. |
| language | string | Language of the audio as detected or as requested. |
| duration | number | Duration of the audio in seconds. |
| segments | array<object> | Segments with timestamps, returned with `verbose_json` on models that support it. |
| segments[].id | integer | Zero-based index of the segment. |
| segments[].start | number | Start time of the segment in seconds. |
| segments[].end | number | End time of the segment in seconds. |
| segments[].text | string | The transcribed text. |
| segments[].temperature | number | Sampling temperature used for the segment. |
| segments[].avg_logprob | number | Average log probability of the tokens of the segment; low values mean low confidence. |
| segments[].compression_ratio | number | Gzip compression ratio of the segment text; high values indicate repetitive output. |
| segments[].no_speech_prob | number | Probability that the segment contains no speech. |
/model/v1/images/generations● 支持modelstring必填Image model id; list candidates with listModels?type=image. Router support (supported): Verified to take effect.
已验证生效。
response_formatstring可选◐ 部分支持Image response encoding. Only b64_json is accepted; url returns 400.
gpt-image-2 支持 b64_json;url 返回 400。
promptstring必填Text description of the image to generate. Router support (supported): Verified to take effect.
已验证生效。
ninteger可选Number of images to generate, from 1 to 10; defaults to 1. Router support (supported): Controls image count; zero returns 400 and values 1–10 are accepted.
控制图片数量,0 返回 400,允许 1–10。
sizestring可选◐ 部分支持Size of the generated images. Router support (partial): gpt-image-2 supports tested 1024x1024 and 1024x1536 sizes; 512x512 returns 400.
gpt-image-2 已验证 1024x1024、1024x1536;512x512 返回 400。
qualitystring可选Quality of the generated images. Router support (supported): Verified to take effect.
已验证生效。
backgroundstring可选gpt-image-2 的 transparent 返回透明 PNG。
output_formatstring可选gpt-image-2 的 jpeg 返回 JPEG。
200
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Image generation response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| created | integer | Unix time in seconds at which the images were created. |
| data | array<object> | Generated images. |
| data[].url | string | URL of the image; present when response_format is `url`. |
| data[].b64_json | string | Base64-encoded image; present when response_format is `b64_json`. |
| data[].revised_prompt | string | Prompt after the image model rewrote it, when the model reports it. |
/model/v1/images/edits● 支持modelstring必填Image model id; list candidates with listModels?type=image. Router support (supported): Verified to take effect.
已验证生效。
promptstring必填Text description of the desired edit. Router support (supported): Verified to take effect.
已验证生效。
imagearray必填Source images as base64 data URLs.
maskstring可选○ 未支持Mask that marks the region to edit, as a base64 data URL or multipart file. Router support (unsupported): The tested PNG mask returns 400 and is currently unusable.
已测 PNG mask 返回 400;当前不可用。
nnumber可选Number of edited images to generate. Router support (supported): Verified to take effect.
已验证生效。
sizestring可选Size of the edited images. Router support (supported): Verified to take effect.
已验证生效。
image[]array可选Source images, uploaded as multipart files. Router support (supported): Accepts multipart files or JSON data URLs.
支持 multipart 文件或 JSON data URL。
200
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Edited images
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| created | number | Unix time in seconds at which the images were created. |
| data | array<object> | Edited images. |
| data[].url | string | URL of the image; present when response_format is `url`. |
| data[].b64_json | string | Base64-encoded image; present when response_format is `b64_json`. |
/model/v1/ocr● 支持modelstring必填OCR model ID, for example glm-ocr.
已验证生效。
documentobject必填Choose document_url, image_url (HTTPS or data URL), or {type: file, file_id: string}.
支持 PDF data URL、image_url 和已上传文件的 file_id;远端 URL 需可下载。
typestring必填Always `file`. Discriminator of the `type`-tagged union this object belongs to.
document_urlstring必填HTTPS or base64 data URL; required when type is document_url.
document_namestring可选Optional file name of the document, used by the provider for display.
image_urlstring必填HTTPS or base64 data URL; required when type is image_url.
file_idstring必填File ID owned by the authenticated tenant. The file_id read limit is 24 MiB (25165824 bytes; shared 96 MiB memory budget / 4); PNG/JPEG remain limited to 10 MiB. Larger files return 413: use HTTPS document_url for PDFs up to 50 MiB. Image pages must be [0].
pagesarray可选Zero-based page indices to process.
零起始页码,可选择多页并去重;越界页会报错。
include_image_base64boolean可选◐ 部分支持Include extracted images as base64.
glm-ocr 仅接受 false;true 返回 400。
table_formatstring可选◐ 部分支持Format for tables that are extracted separately: when set, tables come back in `tables` in this format and the page markdown keeps a link to each; when null they stay inline in the markdown. Router support (partial): glm-ocr accepts markdown or null only; html returns 400.
glm-ocr 仅接受 markdown 或 null;html 返回 400。
extract_headerboolean可选○ 未支持Whether to extract page headers separately into `header`. Router support (unsupported): Unsupported on glm-ocr; passing it returns 400.
glm-ocr 不支持,传入返回 400。
extract_footerboolean可选○ 未支持Whether to extract page footers separately into `footer`. Router support (unsupported): Unsupported on glm-ocr; passing it returns 400.
glm-ocr 不支持,传入返回 400。
bbox_annotation_formatobject可选○ 未支持Structured image annotations; OCR requires json_schema. Availability depends on the model.
glm-ocr 不支持,传入返回 400。
typestring可选Response format type of the annotation.
json_schemaobject可选JSON Schema the annotation of each detected image region must follow.
document_annotation_formatobject可选○ 未支持Structured document annotation; OCR requires json_schema. Availability depends on the model.
glm-ocr 不支持,传入返回 400。
typestring可选Response format type of the annotation.
json_schemaobject可选JSON Schema the document annotation must follow.
document_annotation_promptstring可选○ 未支持Instruction for the document annotation, which says what to extract. Router support (unsupported): Unsupported on glm-ocr; passing it returns 400.
glm-ocr 不支持,传入返回 400。
image_limitinteger可选○ 未支持Maximum number of images to extract per document; null for no limit. Router support (unsupported): Unsupported on glm-ocr; passing it returns 400.
glm-ocr 不支持,传入返回 400。
image_min_sizeinteger可选○ 未支持Minimum height and width in pixels of images to extract; null for no minimum. Router support (unsupported): Unsupported on glm-ocr; passing it returns 400.
glm-ocr 不支持,传入返回 400。
include_blocksboolean可选○ 未支持Whether to return layout `blocks` for each page. Router support (unsupported): Unsupported on glm-ocr; passing it returns 400.
glm-ocr 不支持,传入返回 400。
confidence_scores_granularitystring可选○ 未支持Level at which confidence scores are returned. Router support (unsupported): Unsupported on glm-ocr; passing it returns 400.
glm-ocr 不支持,传入返回 400。
200
采用 Mistral OCR 请求与响应形状,仅提供 /model/v1/ocr。model 必填;document 接受 document_url 或 image_url(HTTPS 或 base64 data URL),也接受 `{type:"file", file_id:"<上传所得 ID>"}`,直接读取当前租户的 File。file_id 读取上限为 24 MiB(25,165,824 字节,共享 96 MiB 内存预算按四倍预留);超过此上限返回 413,并提示改用 HTTPS document_url(PDF 上限 50 MiB)。PNG/JPEG 仍限 10 MiB,按文件头识别类型;不存在或其他租户的文件统一返回 404。pages 是从 0 开始的页码数组;图片如指定 pages,只能为 `[0]`。文件读取失败不计费,请求日志仅记录 file_id,不保存文件原文。可选功能依模型而定,不支持的选项返回 400。错误为 problem+json;providerOptions.praxis 不适用于此端点。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
OCR pages and usage
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| pages | array<object> | Result per processed page, in page order. |
| pages[].index | integer | Zero-based index of the page in the document. |
| pages[].markdown | string | Page content as markdown. |
| pages[].images | array<object> | Images found on the page. |
| pages[].dimensions | object | null | Size of the rendered page; null when unknown. |
| pages[].tables | array<object> | Tables extracted from the page when table_format is set. |
| pages[].hyperlinks | array<string> | Hyperlinks found on the page. |
| pages[].header | string | null | Page header text; null when none was extracted. |
| pages[].footer | string | null | Page footer text; null when none was extracted. |
| pages[].blocks | array<object> | null | Layout blocks of the page, in reading order, when include_blocks is true. |
| pages[].confidence_scores | object | null | Confidence scores of the page; null when not requested. |
| model | string | OCR model that processed the document. |
| usage_info | object | Usage of the request. |
| usage_info.pages_processed | integer | Number of pages that were processed. |
| usage_info.doc_size_bytes | integer | null | Size of the document in bytes; null when unknown. |
| document_annotation | string | null | Document annotation as a JSON string, when document_annotation_format was requested; null otherwise. |
/model/v1/videos● 支持modelstring可选◐ 部分支持Video model id, for example `wan2.7-t2v`; list candidates with listModels?type=video. Router support (partial): Select a registered video model explicitly, for example wan2.7-t2v (size=1280x720, seconds=4). Capability preflight errors are reported before creation.
请显式选择已注册的视频模型,例如 wan2.7-t2v(size=1280x720,seconds=4)。能力预检失败会在创建前报错。
promptstring必填Text description of the video, at least 1 character. Router support (supported): Controls video content; missing or empty values return 400.
控制视频内容;缺失或空值返回 400。
secondsstring | integer可选同时提供时优先于 duration。
已验证 wan2.7-t2v 的时长生效;不合法或超出模型能力的值在预检阶段返回 400。
durationinteger可选Length of the video in whole seconds. `seconds` takes precedence when both are given.
sizestring可选◐ 部分支持Output resolution as `WIDTHxHEIGHT`, for example `1280x720`. Router support (partial): Subject to model capability preflight. Earlier wan2.7-t2v samples always produced 1280x720; accepted sizes are not guaranteed pixel-for-pixel.
受模型能力预检限制;早期 wan2.7-t2v 样本始终输出 1280x720,不保证所有接受的尺寸都会按像素兑现。
input_referencestring | object可选Reference image for image-to-video: a URL or base64 data URL, an object with `image_url`, or an uploaded image file (multipart, at most 20 MiB).
image_urlstring | object必填URL or base64 data URL of the reference image, as a string or an object with `url`.
input_referencesarray可选Several reference images; each entry is a URL or base64 data URL, or an object with `image_url`.
image_urlstring | object可选URL or base64 data URL of the reference image, as a string or an object with `url`.
frame_imagesarray可选Images that pin the first and last frame; at most 2 entries.
typeany可选Always `image_url`. Discriminator of the `type`-tagged union this object belongs to.
frame_typeany必填Frame to constrain with the supplied image: first_frame or last_frame. Each frame type may occur at most once.
image_urlobject必填The image to pin.
resolutionstring可选Output resolution label such as `720p`, for models that take a label instead of `size`.
aspect_ratiostring可选Aspect ratio of the video such as `16:9`.
generate_audioboolean可选Whether the video carries a generated audio track. Router support (supported): false produces no audio track on wan2.7-t2v; the default output includes audio.
wan2.7-t2v 的 false 输出无音轨,默认输出含音轨。
seedinteger可选Seed for reproducible generation, on models that support it.
callback_urlstring可选HTTP or HTTPS callback URL, forwarded to models that support completion callbacks.
qualitystring可选Provider-specific quality setting.
200
按输出秒数计费;每秒价格见 GET /model/v1/models 的 pricing.video_second(USD/秒)。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Success
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Id of the video job; pass it as `video_id` to retrieve, download or delete it. |
| object | string | Object type; always `video`. |
| model | string | Model that generates the video. |
| status | string | Lifecycle of the job. Poll until it is `completed` or `failed`. |
| progress | integer | Progress from 0 to 100. It is 0 until the job completes and 100 once it has. |
| created_at | integer | Unix time in seconds at which the job was created. |
| completed_at | integer | null | Unix time in seconds at which the job completed; null until then. |
| expires_at | integer | null | Unix time in seconds after which the output expires; null because outputs currently have no expiry. |
| seconds | string | Length of the video in seconds, as a string; for a completed job it is the delivered length. |
| size | string | Resolution of the video as `WIDTHxHEIGHT`; null when the provider did not report one. |
| prompt | string | null | Prompt the job was created with. |
| remixed_from_video_id | null | Always null; remix is not supported. |
| error | object | null | Why the job failed; null unless status is `failed`. |
| error.code | string | Machine-readable failure code. |
| error.message | string | Human-readable failure message. |
| polling_url | string | Relative URL to poll for the job state; same as retrieveVideo for this job. |
| unsigned_urls | array<string> | Relative URLs of the finished output; empty until the video is ready. Download them with the same API key. |
| usage | object | Cost of the job; present once a price applies. |
| usage.cost | number | Cost of the job in USD: delivered seconds times the per-second price once completed, 0 while running. |
先创建视频,保存返回的 id;再读取视频轮询 status,queued / in_progress 时继续等待,failed 时停止并查看 error;只有 completed 后才下载视频内容。
典型耗时为 10–15 分钟;以下示例最多轮询 30 分钟,超时后可用同一个任务 ID 继续查询。
# Requires curl and jq. Set PRAXIS_API_KEY and API_BASE (your API origin).
job=$(curl --fail-with-body -sS "$API_BASE/model/v1/videos" \
-H "Authorization: Bearer $PRAXIS_API_KEY" -H "Content-Type: application/json" \
-d '{"model":"wan2.7-t2v","prompt":"A cat stretching in the morning sun","seconds":"4","size":"1280x720"}') || exit 1
VIDEO_ID=$(printf '%s' "$job" | jq -er '.id') || exit 1
for attempt in $(seq 1 360); do
job=$(curl --fail-with-body -sS "$API_BASE/model/v1/videos/$VIDEO_ID" \
-H "Authorization: Bearer $PRAXIS_API_KEY") || exit 1
status=$(printf '%s' "$job" | jq -er '.status') || exit 1
case "$status" in
completed) break ;;
failed) printf '%s\n' "$job"; exit 1 ;;
queued|in_progress) sleep 5 ;;
*) printf 'Unexpected status: %s\n' "$status"; exit 1 ;;
esac
done
[ "$status" = completed ] || { printf 'Still processing; resume polling %s\n' "$VIDEO_ID"; exit 1; }
curl --fail-with-body -sS "$API_BASE/model/v1/videos/$VIDEO_ID/content" \
-H "Authorization: Bearer $PRAXIS_API_KEY" -o video.mp4/model/v1/videos● 支持afterstring可选query: Cursor: the id of the video job after which the page starts, normally the `last_id` of the previous page. It must refer to an existing job of yours, otherwise the call fails.
分页参数生效;limit 为 1–100,order 为 asc/desc,after 必须引用存在的任务。
limitinteger可选query: Maximum number of jobs per page, from 1 to 100; defaults to 20.
分页参数生效;limit 为 1–100,order 为 asc/desc,after 必须引用存在的任务。
orderany可选query: Sort order by creation time: desc (default) lists the newest job first, asc the oldest first.
分页参数生效;limit 为 1–100,order 为 asc/desc,after 必须引用存在的任务。
200
按输出秒数计费;每秒价格见 GET /model/v1/models 的 pricing.video_second(USD/秒)。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Success
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| object | string | Object type; always `list`. |
| data | array<object> | Video jobs of the caller, newest first by default. |
| data[].id | string | Id of the video job; pass it as `video_id` to retrieve, download or delete it. |
| data[].object | string | Object type; always `video`. |
| data[].model | string | Model that generates the video. |
| data[].status | string | Lifecycle of the job. Poll until it is `completed` or `failed`. |
| data[].progress | integer | Progress from 0 to 100. It is 0 until the job completes and 100 once it has. |
| data[].created_at | integer | Unix time in seconds at which the job was created. |
| data[].completed_at | integer | null | Unix time in seconds at which the job completed; null until then. |
| data[].expires_at | integer | null | Unix time in seconds after which the output expires; null because outputs currently have no expiry. |
| data[].seconds | string | Length of the video in seconds, as a string; for a completed job it is the delivered length. |
| data[].size | string | Resolution of the video as `WIDTHxHEIGHT`; null when the provider did not report one. |
| data[].prompt | string | null | Prompt the job was created with. |
| data[].remixed_from_video_id | null | Always null; remix is not supported. |
| data[].error | object | null | Why the job failed; null unless status is `failed`. |
| data[].polling_url | string | Relative URL to poll for the job state; same as retrieveVideo for this job. |
| data[].unsigned_urls | array<string> | Relative URLs of the finished output; empty until the video is ready. Download them with the same API key. |
| data[].usage | object | Cost of the job; present once a price applies. |
| has_more | boolean | Whether more jobs exist beyond this page; pass `last_id` as `after` to read them. |
| first_id | string | null | Id of the first job in this page; null for an empty page. |
| last_id | string | null | Id of the last job in this page; null for an empty page. |
先创建视频,保存返回的 id;再读取视频轮询 status,queued / in_progress 时继续等待,failed 时停止并查看 error;只有 completed 后才下载视频内容。
先调用「创建视频」,用返回的 ID 替换 video_123;下载前须轮询至 completed。
/model/v1/videos/{video_id}● 支持video_idstring必填path: Id of the video job whose output you want, the `id` returned by createVideo. The job must be completed; before that the call answers 400.
200
按输出秒数计费;每秒价格见 GET /model/v1/models 的 pricing.video_second(USD/秒)。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Success
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Id of the video job; pass it as `video_id` to retrieve, download or delete it. |
| object | string | Object type; always `video`. |
| model | string | Model that generates the video. |
| status | string | Lifecycle of the job. Poll until it is `completed` or `failed`. |
| progress | integer | Progress from 0 to 100. It is 0 until the job completes and 100 once it has. |
| created_at | integer | Unix time in seconds at which the job was created. |
| completed_at | integer | null | Unix time in seconds at which the job completed; null until then. |
| expires_at | integer | null | Unix time in seconds after which the output expires; null because outputs currently have no expiry. |
| seconds | string | Length of the video in seconds, as a string; for a completed job it is the delivered length. |
| size | string | Resolution of the video as `WIDTHxHEIGHT`; null when the provider did not report one. |
| prompt | string | null | Prompt the job was created with. |
| remixed_from_video_id | null | Always null; remix is not supported. |
| error | object | null | Why the job failed; null unless status is `failed`. |
| error.code | string | Machine-readable failure code. |
| error.message | string | Human-readable failure message. |
| polling_url | string | Relative URL to poll for the job state; same as retrieveVideo for this job. |
| unsigned_urls | array<string> | Relative URLs of the finished output; empty until the video is ready. Download them with the same API key. |
| usage | object | Cost of the job; present once a price applies. |
| usage.cost | number | Cost of the job in USD: delivered seconds times the per-second price once completed, 0 while running. |
先创建视频,保存返回的 id;再读取视频轮询 status,queued / in_progress 时继续等待,failed 时停止并查看 error;只有 completed 后才下载视频内容。
先调用「创建视频」,用返回的 ID 替换 video_123;下载前须轮询至 completed。
/model/v1/videos/{video_id}/content● 支持video_idstring必填path: Id of the video job whose output you want, the `id` returned by createVideo. The job must be completed; before that the call answers 400.
variantany可选◐ 部分支持query: Spritesheet is not available in this release (400).
video、thumbnail 生效;spritesheet 返回 400。
indexinteger可选◐ 部分支持query: Output index; this release produces index 0. variant takes precedence.
视频仅支持 index=0;大于 0 或负数返回 400。variant=thumbnail 时 index 接受但当前不生效。
200
按输出秒数计费;每秒价格见 GET /model/v1/models 的 pricing.video_second(USD/秒)。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Video or thumbnail bytes
video/mp4
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | string (binary) |
image/jpeg
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | string (binary) |
先创建视频,保存返回的 id;再读取视频轮询 status,queued / in_progress 时继续等待,failed 时停止并查看 error;只有 completed 后才下载视频内容。
先调用「创建视频」,用返回的 ID 替换 video_123;下载前须轮询至 completed。
/model/v1/videos/{video_id}● 支持video_idstring必填path: Id of the video job whose output you want, the `id` returned by createVideo. The job must be completed; before that the call answers 400.
200
按输出秒数计费;每秒价格见 GET /model/v1/models 的 pricing.video_second(USD/秒)。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Success
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Id of the deleted video job. |
| object | string | Object type; always `video.deleted`. |
| deleted | boolean | Always true; the job is no longer readable. |
先创建视频,保存返回的 id;再读取视频轮询 status,queued / in_progress 时继续等待,failed 时停止并查看 error;只有 completed 后才下载视频内容。
先调用「创建视频」,用返回的 ID 替换 video_123;下载前须轮询至 completed。
/model/v1/videos/{video_id}/remix○ 未支持video_idstring必填path: Id of the video job whose output you want, the `id` returned by createVideo. The job must be completed; before that the call answers 400.
400 混剪尚未支持,请勿重试。
未支持,调用返回 400;不要重试。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
此端点没有声明成功响应。
先创建视频,保存返回的 id;再读取视频轮询 status,queued / in_progress 时继续等待,failed 时停止并查看 error;只有 completed 后才下载视频内容。
/model/v1/messages● 支持modelstring必填◐ 部分支持Body param: The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.
deepseek-v4-pro、glm-5.3-flash、qwen3.8-flash、claude-opus-5 可调用;deepseek-v4-flash 在此协议面返回 400。
messagesarray必填◐ 部分支持Body param: Input messages. Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn. Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages. If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response. Example with a single `user` message: ```json [{ "role": "user", "content": "Hello, Claude" }] ``` Example with multiple conversational turns: ```json [ { "role": "user", "content": "Hello there." }, { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" }, { "role": "user", "content": "Can you explain LLMs in plain English?" } ] ``` Example with a partially-filled response from Claude: ```json [ { "role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun" }, { "role": "assistant", "content": "The best answer is (" } ] ``` Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent: ```json { "role": "user", "content": "Hello, Claude" } ``` ```json { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] } ``` See [input examples](https://platform.claude.com/docs/en/build-with-claude/working-with-messages). Note that if you want to include a [system prompt](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. There is a limit of 100,000 messages in a single request.
文本和工具往返生效;document 的托管 file_id 返回 400,qwen3.8-flash 可读取内联 PDF;图片有模型尺寸限制。
contentstring | array必填Message content: a plain string (shorthand for one text block) or an array of content blocks such as text, image, document, tool_use and tool_result.
rolestring必填Who produced the message. Use user for your turns and assistant to replay earlier model turns; system-role messages are accepted by the shape but system instructions normally go in the top-level system field.
max_tokensnumber必填Body param: The maximum number of tokens to generate before stopping. Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate. Set to `0` to populate the [prompt cache](https://platform.claude.com/docs/en/build-with-claude/prompt-caching#pre-warming-the-cache) without generating a response. Different models have different maximum values for this parameter. See [models](https://platform.claude.com/docs/en/about-claude/models/overview) for details.
限制输出 token,思考也占用预算。
streamboolean可选◐ 部分支持Body param: Whether to incrementally stream the response using server-sent events. See [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming) for details.
流式正文和工具事件可用;可能在正文前出现额外 message_delta,message_start 的用量为 0。
systemstring | array可选Body param: System prompt. A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role).
已验证生效。
temperaturenumber可选Sampling temperature between 0 and 1; defaults are model specific.
top_pnumber可选Nucleus sampling: only tokens within this cumulative probability are considered.
toolsarray可选Body param: Definitions of tools that the model may use. If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks. There are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool)). Each tool definition includes: - `name`: Name of the tool. - `description`: Optional, but strongly-recommended description of the tool. - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks. For example, if you defined `tools` as: ```json [ { "name": "get_stock_price", "description": "Get the current stock price for a given ticker symbol.", "input_schema": { "type": "object", "properties": { "ticker": { "type": "string", "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." } }, "required": ["ticker"] } } ] ``` And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this: ```json [ { "type": "tool_use", "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", "name": "get_stock_price", "input": { "ticker": "^GSPC" } } ] ``` You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message: ```json [ { "type": "tool_result", "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", "content": "259.75 USD" } ] ``` Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output. See our [guide](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview) for more details.
已验证生效。
tool_choiceobject可选◐ 部分支持Body param: How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all.
qwen3.8-flash 四种模式生效;deepseek-v4-pro 忽略 any/tool/none;glm-5.3-flash 忽略 none。
typestring必填Disable tool calls for this request.
disable_parallel_tool_useboolean可选○ 当前不生效Whether to disable parallel tool use. Defaults to `false`. If set to `true`, the model will output exactly one tool use.
接受但当前不生效。true 仍可能返回多个工具调用。
namestring必填The name of the tool to use.
cache_controlobject可选◐ 部分支持Body param: Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request.
deepseek-v4-pro、qwen3.8-flash、glm-5.3-flash 有隐式缓存命中,但不能据此确认标记生效;claude-opus-5 未命中缓存,ttl=1h 未见效果。
typestring必填Always `ephemeral`. Discriminator that marks this object as a CacheControlEphemeral in a `type`-tagged union.
ttlstring可选The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
containerstring | object可选○ 当前不生效接受并忽略 container;平台尚未实现此能力。
idstring可选Container id
skillsarray可选List of skills to load in the container
inference_geostring可选○ 当前不生效接受并忽略 inference_geo;平台尚未实现此能力。
metadataobject可选◐ 部分支持Body param: An object describing metadata about the request.
接受 metadata;metadata.user_id 由同协议线路传递,不承诺上游回显。
user_idstring可选An external identifier for the user who is associated with the request. This should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number.
output_configobject可选Body param: Configuration options for the model's output, such as the output format.
effortstring可选◐ 部分支持All possible effort levels.
deepseek-v4-pro 仅 high/xhigh 可用,其余返回 400;qwen3.8-flash 全档返回 400;glm-5.3-flash 接受各档但消耗不随档位单调变化。
formatobject可选◐ 部分支持A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
json_schema 在 deepseek-v4-pro、qwen3.8-flash 生效;glm-5.3-flash 与 thinking 同传返回 400。
service_tierstring可选○ 当前不生效接受并忽略 service_tier;平台尚未实现此能力。
stop_sequencesarray可选◐ 部分支持Body param: Custom text sequences that will cause the model to stop generating. Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`. If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence.
deepseek-v4-pro、qwen3.8-flash 生效;glm-5.3-flash 文本截断但 stop_reason 和 stop_sequence 未准确反映。
thinkingobject可选◐ 部分支持Body param: Configuration for enabling Claude's extended thinking. When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit. See [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) for details.
disabled 在 deepseek-v4-pro、qwen3.8-flash 生效;glm-5.3-flash 携带任何 thinking 都返回 400。adaptive 在已测的 deepseek-v4-pro、qwen3.8-flash 也返回 400。
budget_tokensnumber必填◐ 部分支持Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality. Must be ≥1024 and less than `max_tokens`. See [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) for details.
deepseek-v4-pro、qwen3.8-flash 接受,但预算不构成可靠上限;glm-5.3-flash 返回 400。
typestring必填Let the model choose its reasoning budget, subject to output_config.effort when supplied.
displaystring可选○ 当前不生效Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`.
接受但当前不生效。omitted 仍返回完整思考内容。
top_knumber可选Sample only from the top K options for each token.
context_managementobject可选○ 当前不生效接受并忽略 context_management;平台尚未实现此能力。
diagnosticsobject可选○ 当前不生效接受并忽略 diagnostics;平台尚未实现此能力。
mcp_serversarray可选○ 当前不生效接受并忽略 mcp_servers;平台尚未实现此能力。
speedstring可选○ 当前不生效接受并忽略 speed;平台尚未实现此能力。
output_formatobject可选○ 当前不生效接受并忽略此旧字段;结构化输出使用 output_config.format。
compactionobject可选○ 未支持已识别 compaction;尚未实现,传入返回 400 并明确说明不支持。
fallback_credit_tokenstring可选○ 未支持已识别 fallback_credit_token;尚未实现,传入返回 400 并明确说明不支持。
fallbacksstring可选○ 未支持已识别 fallbacks;尚未实现,传入返回 400 并明确说明不支持。
200
stream=true 时以 SSE 增量返回(text/event-stream)。
未知顶层字段原样转发给同协议上游,由上游决定是否接受;已声明字段的类型与取值范围仍会校验,不合法时返回 400 并点名字段。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Message created
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique object identifier. The format and length of IDs may change over time. |
| container | null | object | Information about the container used in the request (for the code execution tool) |
| container.id | string | Identifier for the container used in this request |
| container.expires_at | string | The time at which the container will expire. |
| container.skills | null | array<object> | Skills loaded in the container |
| content | array<object> | Content generated by the model. This is an array of content blocks, each of which has a `type` that determines its shape. Example: ```json [{ "type": "text", "text": "Hi, I'm Claude." }] ``` If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. For example, if the input `messages` were: ```json [ { "role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun" }, { "role": "assistant", "content": "The best answer is (" } ] ``` Then the response `content` might be: ```json [{ "type": "text", "text": "B)" }] ``` |
| content[].citations | null | array<object> | Citations supporting the text block. The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`. |
| content[].text | string | The text generated by the model. |
| content[].type | string | Always `text`. Discriminator that marks this object as a TextBlock in a `type`-tagged union. / Always `thinking`. Discriminator that marks this object as a ThinkingBlock in a `type`-tagged union. / Always `redacted_thinking`. Discriminator that marks this object as a RedactedThinkingBlock in a `type`-tagged union. / Always `tool_use`. Discriminator that marks this object as a ToolUseBlock in a `type`-tagged union. / Always `server_tool_use`. Discriminator that marks this object as a ServerToolUseBlock in a `type`-tagged union. / Always `web_search_tool_result`. Discriminator that marks this object as a WebSearchToolResultBlock in a `type`-tagged union. / Always `web_fetch_tool_result`. Discriminator that marks this object as a WebFetchToolResultBlock in a `type`-tagged union. / Always `code_execution_tool_result`. Discriminator that marks this object as a CodeExecutionToolResultBlock in a `type`-tagged union. / Always `bash_code_execution_tool_result`. Discriminator that marks this object as a BashCodeExecutionToolResultBlock in a `type`-tagged union. / Always `text_editor_code_execution_tool_result`. Discriminator that marks this object as a TextEditorCodeExecutionToolResultBlock in a `type`-tagged union. / Always `tool_search_tool_result`. Discriminator that marks this object as a ToolSearchToolResultBlock in a `type`-tagged union. / Always `container_upload`. Discriminator that marks this object as a ContainerUploadBlock in a `type`-tagged union. |
| content[].signature | string | A value used to verify that this thinking block was generated by Claude when it is passed back to the API. This is an opaque field and should not be interpreted or parsed. When passing thinking blocks back to the API (required when using tools with extended thinking), pass them back exactly as received, with this field intact. See extended thinking for details. |
| content[].thinking | string | The text of Claude's thinking process for this block. |
| content[].data | string | The contents of this redacted thinking block, returned when portions of the model's thinking were safety-redacted. This field is opaque and encrypted, with no readable content. Pass `redacted_thinking` blocks back to the API unchanged when continuing a multi-turn conversation. See extended thinking for details. |
| content[].id | string | Id of the tool call; send it back as tool_use_id in the tool_result block that answers it. / Id of the server tool call; the matching result block repeats it as tool_use_id. |
| content[].caller | object | Which party invoked the tool: the model directly or a code execution tool. / Which party invoked the server tool: the model directly or a code execution tool. / Which party invoked the search: the model directly or a code execution tool. / Which party invoked the fetch: the model directly or a code execution tool. |
| content[].input | any | Arguments the model chose, as a JSON object that follows the tool's input_schema. / Arguments the model passed to the server tool, as a JSON object. |
| content[].name | string | Name of the tool the model wants to call. / Name of the server tool the model called, such as web_search, web_fetch or code_execution. |
| content[].toolset_name | null | string | For a toolset member tool_use, the toolset family. |
| content[].content | object | array<object> | object | object | object | object | object | Search results (array of web_search_result blocks) or an error object. / The fetched document or an error object. / Result of the code execution: a result block, an encrypted result block, or an error object. / Result of the bash command: a result block or an error object. / Result of the text editor command: a view, create or str_replace result block, or an error object. / Result of the tool search: a search result block that lists tool references, or an error object. |
| content[].tool_use_id | string | Id of the web_search server tool call this result belongs to. / Id of the web_fetch server tool call this result belongs to. / Id of the code_execution server tool call this result belongs to. / Id of the bash_code_execution server tool call this result belongs to. / Id of the text_editor_code_execution server tool call this result belongs to. / Id of the tool search server tool call this result belongs to. |
| content[].file_id | string | Id of the file that was uploaded into the code execution container. |
| model | string | The model that will complete your prompt. See models for additional details and options. |
| role | string | Conversational role of the generated message. This will always be `"assistant"`. |
| stop_details | null | object | Structured information about a refusal. |
| stop_details.category | null | string | The policy category that triggered a refusal. - `cyber` - The request could enable cyber harm, such as malware or exploit development. Benign cybersecurity work can also trigger this category. - `bio` - The request could enable biological harm, such as dangerous lab methods. Beneficial life sciences work can also trigger this category. - `frontier_llm` - The request could assist the development of competing AI models, which is restricted under Anthropic's commercial terms. Benign machine learning work can also trigger this category. - `reasoning_extraction` - The request asks the model to reproduce its internal reasoning in the response text. To get reasoning in a structured form instead, use adaptive thinking. - `general_harms` - The request could be related to an area that was determined as harmful. Benign work might sometimes trigger this category. |
| stop_details.explanation | null | string | Human-readable explanation of the refusal. This text is not guaranteed to be stable. `null` when no explanation is available for the category. |
| stop_details.type | string | Always `refusal`. Discriminator that marks this object as a RefusalStopDetails in a `type`-tagged union. |
| stop_reason | null | string | The reason that we stopped. This may be one the following values: - `"end_turn"`: the model reached a natural stopping point - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated - `"tool_use"`: the model invoked one or more tools - `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. - `"refusal"`: when streaming classifiers intervene to handle potential policy violations - `"model_context_window_exceeded"`: we exceeded the model's context window In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise. |
| stop_sequence | null | string | Which custom stop sequence was generated, if any. This value will be a non-null string if one of your custom stop sequences was generated. |
| type | string | Object type. For Messages, this is always `"message"`. |
| usage | object | Billing and rate-limit usage. Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. For example, `output_tokens` will be non-zero, even for an empty string response from Claude. Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. |
| usage.cache_creation | null | object | Breakdown of cached tokens by TTL |
| usage.cache_creation_input_tokens | null | number | The number of input tokens used to create the cache entry. |
| usage.cache_read_input_tokens | null | number | The number of input tokens read from the cache. |
| usage.inference_geo | null | string | The geographic region where inference was performed for this request. |
| usage.input_tokens | number | The number of input tokens which were used. |
| usage.output_tokens | number | The number of output tokens which were used. |
| usage.output_tokens_details | null | object | Breakdown of output tokens by category. `output_tokens` remains the inclusive, authoritative total used for billing. This object provides a read-only decomposition for observability — for example, how many of the billed output tokens were spent on internal reasoning that may have been summarized before being returned to you. |
| usage.server_tool_use | null | object | The number of server tool requests. |
| usage.service_tier | null | string | If the request used the priority, standard, or batch tier. |
text/event-stream — chunk / 事件对象
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Optional id of the server-sent event. |
| event | string | Name of the server-sent event. |
| data | object | 完整 SDK RawMessageStreamEvent union |
| data.delta | object | Final fields of the message sent with message_delta: why generation stopped and the container. / The incremental change to the content block at index. |
| data.type | string | Always `message_delta`. Discriminator that marks this object as a RawMessageDeltaEvent in a `type`-tagged union. / Always `content_block_delta`. Discriminator that marks this object as a RawContentBlockDeltaEvent in a `type`-tagged union. / Always `message_start`. Discriminator that marks this object as a RawMessageStartEvent in a `type`-tagged union. / Always `message_stop`. Discriminator that marks this object as a RawMessageStopEvent in a `type`-tagged union. / Always `content_block_start`. Discriminator that marks this object as a RawContentBlockStartEvent in a `type`-tagged union. / Always `content_block_stop`. Discriminator that marks this object as a RawContentBlockStopEvent in a `type`-tagged union. |
| data.usage | object | Billing and rate-limit usage. Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. For example, `output_tokens` will be non-zero, even for an empty string response from Claude. Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`. |
| data.index | number | Zero-based index of the content block this delta applies to. / Zero-based index of the content block that starts. / Zero-based index of the content block that ends. |
| data.message | object | The complete Message object being started; its content is empty at message_start and filled by the following content_block events. |
| data.content_block | object | The content block as it starts, with empty text or input to be filled by deltas. |
/model/v1/messages/count_tokens◐ 部分支持modelstring必填○ 当前不生效Body param: The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.
接受但当前不生效。估算与模型无关,缺失或不存在的模型名仍可返回计数。
messagesarray必填◐ 部分支持Body param: Input messages. Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn. Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages. If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response. Example with a single `user` message: ```json [{ "role": "user", "content": "Hello, Claude" }] ``` Example with multiple conversational turns: ```json [ { "role": "user", "content": "Hello there." }, { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" }, { "role": "user", "content": "Can you explain LLMs in plain English?" } ] ``` Example with a partially-filled response from Claude: ```json [ { "role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun" }, { "role": "assistant", "content": "The best answer is (" } ] ``` Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent: ```json { "role": "user", "content": "Hello, Claude" } ``` ```json { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] } ``` See [input examples](https://platform.claude.com/docs/en/build-with-claude/working-with-messages). Note that if you want to include a [system prompt](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. There is a limit of 100,000 messages in a single request.
仅按字符粗估,不能作为模型精确 token 数。
contentstring | array必填Message content: a plain string (shorthand for one text block) or an array of content blocks such as text, image, document, tool_use and tool_result.
rolestring必填Who produced the message. Use user for your turns and assistant to replay earlier model turns; system-role messages are accepted by the shape but system instructions normally go in the top-level system field.
systemstring | array可选Body param: System prompt. A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role).
计入估算。
toolsarray可选Body param: Definitions of tools that the model may use. If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks. There are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool)). Each tool definition includes: - `name`: Name of the tool. - `description`: Optional, but strongly-recommended description of the tool. - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks. For example, if you defined `tools` as: ```json [ { "name": "get_stock_price", "description": "Get the current stock price for a given ticker symbol.", "input_schema": { "type": "object", "properties": { "ticker": { "type": "string", "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." } }, "required": ["ticker"] } } ] ``` And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this: ```json [ { "type": "tool_use", "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", "name": "get_stock_price", "input": { "ticker": "^GSPC" } } ] ``` You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message: ```json [ { "type": "tool_result", "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", "content": "259.75 USD" } ] ``` Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output. See our [guide](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview) for more details.
计入估算。
tool_choiceobject可选○ 当前不生效Body param: How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all.
接受但当前不生效。不影响计数。
typestring必填Disable tool calls for this request.
disable_parallel_tool_useboolean可选Whether to disable parallel tool use. Defaults to `false`. If set to `true`, the model will output exactly one tool use.
namestring必填The name of the tool to use.
cache_controlobject可选○ 当前不生效Body param: Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request.
接受但当前不生效。不影响计数。
typestring必填Always `ephemeral`. Discriminator that marks this object as a CacheControlEphemeral in a `type`-tagged union.
ttlstring可选The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
output_configobject可选○ 当前不生效Body param: Configuration options for the model's output, such as the output format.
接受但当前不生效。不影响计数。
effortstring可选All possible effort levels.
formatobject可选A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
thinkingobject可选○ 当前不生效Body param: Configuration for enabling Claude's extended thinking. When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit. See [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) for details.
接受但当前不生效。不影响计数。
budget_tokensnumber必填Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality. Must be ≥1024 and less than `max_tokens`. See [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) for details.
typestring必填Let the model choose its reasoning budget, subject to output_config.effort when supplied.
displaystring可选Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`.
200
按模型族校准的估算值(包括中文和工具定义),响应头为 x-praxis-token-count: estimated;不能用作精确用量或计费依据。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Token count
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| input_tokens | number | The total number of tokens across the provided list of messages, system prompt, and tools. |
/model/v1/models● 支持supported_apiarray可选query: Match any comma-separated declared protocol ID; omitted or empty includes all models. Combined with type and output_modalities using AND. Invalid IDs return 400 with all legal values.
typearray可选query: Filter by one or more model types (comma-separated).
按 type 筛选,多个值用逗号分隔;非法值返回 400 并列出合法值。
output_modalitiesarray可选query: Match any comma-separated output modality; all disables modality filtering. Combined with type using AND.
匹配任一逗号分隔的输出模态;all 不限制模态,与 type 条件同时生效。
limitstring可选○ 当前不生效query: Accepted for compatibility and ignored: this endpoint always returns the full model catalog. Filter with type and output_modalities instead.
接受但当前不生效;此端点返回完整模型目录。
qstring可选○ 当前不生效query: Accepted for compatibility and ignored: this endpoint always returns the full model catalog. Filter with type and output_modalities, or match ids on the client.
接受但当前不生效;此端点返回完整模型目录。
200 list
OCR 模型的 type 为 ocr,pricing.page 是 USD/页的十进制字符串,为 Praxis 对 Vercel 模型列表形状的扩展;其余四项 token 价格为 0。其它模型不带 pricing.page。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Model list
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| object | string | Object type; always `list`. |
| data | array<object> | Published models, in the order the catalog returns them, filtered by type and output_modalities when given. |
| data[].id | string | Model id to pass as `model` in other calls. It can carry a creator prefix such as deepseek/deepseek-v4-pro. |
| data[].object | string | Object type; always `model`. |
| data[].created | number | Unix time in seconds at which the model was first published. |
| data[].owned_by | string | Organization that serves the model on this platform; always `deepractice`. |
| data[].name | string | Display name, prefixed with the vendor when one is known, for example `Vendor: Model`. |
| data[].description | string | null | Free-text description of the model; null when none is published. |
| data[].context_window | number | null | Maximum context length in tokens (input plus output); null when the catalog has no figure. |
| data[].max_tokens | number | null | Maximum number of output tokens the model can produce in one call; null when the catalog has no figure. |
| data[].type | string | Kind of model; it decides which endpoint accepts it. |
| data[].supported_apis | array<string> | Declared protocol IDs in stable lexicographic order; an empty array means no protocol is declared. Use these IDs with supported_api to find models for an operation. |
| data[].tags | array<string> | Capability tags of the model such as `tools`, `vision` or `reasoning`; use them to filter for features. |
| data[].architecture | object | Native modalities of the model. |
| data[].x_praxis | object | Platform extension. input_modalities states, per input format, how the model takes it. |
| data[].pricing | object | Prices in USD per named unit, as decimal strings. A unit that is absent is unpriced, which is not the same as free. |
| data[].released | string | Date (YYYY-MM-DD, UTC) on which the model was first published. |
/model/v1/models/{model}● 支持modelstring必填path: Id of the model to read. It may carry a creator prefix with a slash, such as deepseek/deepseek-v4-pro, so the value runs to the end of the path. Ids come from the `id` field of listModels; an unknown id answers 404.
200 model
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Model
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Model id to pass as `model` in other calls. It can carry a creator prefix such as deepseek/deepseek-v4-pro. |
| object | string | Object type; always `model`. |
| created | number | Unix time in seconds at which the model was first published. |
| owned_by | string | Organization that serves the model on this platform; always `deepractice`. |
| name | string | Display name, prefixed with the vendor when one is known, for example `Vendor: Model`. |
| description | string | null | Free-text description of the model; null when none is published. |
| context_window | number | null | Maximum context length in tokens (input plus output); null when the catalog has no figure. |
| max_tokens | number | null | Maximum number of output tokens the model can produce in one call; null when the catalog has no figure. |
| type | string | Kind of model; it decides which endpoint accepts it. |
| supported_apis | array<string> | Declared protocol IDs in stable lexicographic order; an empty array means no protocol is declared. Use these IDs with supported_api to find models for an operation. |
| tags | array<string> | Capability tags of the model such as `tools`, `vision` or `reasoning`; use them to filter for features. |
| architecture | object | Native modalities of the model. |
| architecture.modality | string | Native modalities as `input+input->output+output`, for example `text+image->text`. |
| architecture.input_modalities | array<string> | Input modalities the model accepts natively, for example text, image, file or audio. |
| architecture.output_modalities | array<string> | Output modalities the model produces, for example text, image, audio, video, embeddings or rerank. |
| architecture.tokenizer | string | null | Tokenizer family; null because the platform does not publish it. |
| architecture.instruct_type | string | null | Instruction template type; null because the platform does not publish it. |
| x_praxis | object | Platform extension. input_modalities states, per input format, how the model takes it. |
| x_praxis.input_modalities | object | Per input format, whether the model takes it natively, through a conversion step, or not at all. Conversion depends on the file-parser plugin settings. |
| pricing | object | Prices in USD per named unit, as decimal strings. A unit that is absent is unpriced, which is not the same as free. |
| pricing.input | string | USD per input token. |
| pricing.output | string | USD per output token. |
| pricing.input_cache_read | string | USD per input token that is read from the prompt cache. |
| pricing.input_cache_write | string | USD per input token that is written to the prompt cache. |
| pricing.image | string | USD per image; present only for a flat registry price. |
| pricing.video_second | string | Praxis extension: USD per second of output video. |
| pricing.audio_input_minute | string | Praxis extension: USD per minute of input audio. |
| pricing.audio_output_minute | string | Praxis extension: USD per minute of output audio. |
| pricing.input_character | string | Praxis extension: USD per input character. |
| pricing.page | string | Praxis extension: USD per page, present only for OCR models; not a Vercel AI Gateway pricing field. |
| released | string | Date (YYYY-MM-DD, UTC) on which the model was first published. |
先调用「对话」,从响应头 X-Praxis-Generation-Id 取得 id,替换 gen_123。
/model/v1/generation● 支持idstring必填◐ 部分支持query: Generation ID from the X-Praxis-Generation-Id response header of the model request.
使用 /model 响应头 X-Praxis-Generation-Id;响应体 id 和 X-Request-Id 不能查询,返回 404。
200
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Generation record
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Generation id that was queried. |
| model | string | Model that served the generation. |
| cost | number | null | Cost charged for the generation in USD; null when not yet priced. |
| usage | object | Token usage of the generation. |
| usage.prompt_tokens | number | Number of prompt tokens. |
| usage.completion_tokens | number | Number of tokens in the completion. |
| usage.total_tokens | number | Prompt plus completion tokens. |
| usage.cached_input_tokens | number | Prompt tokens served from the prompt cache; null when not reported. |
| latency_ms | number | null | Latency of the generation in milliseconds; null when not recorded. |
| created | number | Unix time in seconds at which the generation was recorded. |
/model/v1/conversations● 支持itemsarray可选Initial items, at most 20 per request. Router support (supported): Verified to take effect.
已验证生效。
metadataobject可选Up to 16 string key/value pairs stored with the conversation; keys at most 64 characters and values at most 512. Router support (supported): Verified to take effect.
已验证生效。
200 conversation
创建一个会话,可选携带初始 items(一次最多 20 条)与 metadata。会话按租户分区,创建者是唯一能引用它的租户。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
The created conversation
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Id of the conversation, such as `conv_...`; use it as `conversation_id` in conversation calls and as `conversation` in createResponse. |
| object | string | Object type; always `conversation`. |
| created_at | integer | Unix time in seconds at which the conversation was created. |
| metadata | object | Up to 16 string key/value pairs; keys at most 64 characters and values at most 512. |
先调用「创建对话」拿到 conv_ 开头的 ID,替换 conv_123。
/model/v1/conversations/{conversation_id}● 支持conversation_idstring必填path: Id of the conversation, the `id` of the object returned by createConversation (it looks like conv_...). Another tenant's conversation, an unknown id and a deleted conversation all answer 404 conversation_not_found.
200 conversation
按 ID 读取一个会话。不存在或属于其他租户都返回 404 conversation_not_found。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
The conversation
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Id of the conversation, such as `conv_...`; use it as `conversation_id` in conversation calls and as `conversation` in createResponse. |
| object | string | Object type; always `conversation`. |
| created_at | integer | Unix time in seconds at which the conversation was created. |
| metadata | object | Up to 16 string key/value pairs; keys at most 64 characters and values at most 512. |
先调用「创建对话」拿到 conv_ 开头的 ID,替换 conv_123。
/model/v1/conversations/{conversation_id}● 支持conversation_idstring必填path: Id of the conversation, the `id` of the object returned by createConversation (it looks like conv_...). Another tenant's conversation, an unknown id and a deleted conversation all answer 404 conversation_not_found.
metadataobject必填Replacement metadata. The whole object replaces the old one; it is not merged. Up to 16 pairs, keys at most 64 characters and values at most 512. Router support (supported): Verified to take effect.
已验证生效。
200 conversation
更新一个会话的 metadata——整体替换,不与已有 metadata 合并。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
The updated conversation
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Id of the conversation, such as `conv_...`; use it as `conversation_id` in conversation calls and as `conversation` in createResponse. |
| object | string | Object type; always `conversation`. |
| created_at | integer | Unix time in seconds at which the conversation was created. |
| metadata | object | Up to 16 string key/value pairs; keys at most 64 characters and values at most 512. |
先调用「创建对话」拿到 conv_ 开头的 ID,替换 conv_123。
/model/v1/conversations/{conversation_id}/items● 支持conversation_idstring必填path: Id of the conversation, the `id` of the object returned by createConversation (it looks like conv_...). Another tenant's conversation, an unknown id and a deleted conversation all answer 404 conversation_not_found.
itemsarray必填Items to append, between 1 and 20 per request. Router support (supported): Verified to take effect.
已验证生效。
200 list
向一个会话追加 items(一次最多 20 条),返回刚追加的这些 items。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
The items just added
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| object | string | Object type; always `list`. |
| data | array<object> | Items of the conversation, in the order the list requested. |
| first_id | string | Id of the first item of this page; null for an empty page. |
| last_id | string | Id of the last item of this page; null for an empty page. |
| has_more | boolean | Whether more items exist beyond this page; pass `last_id` as `after` to read them. |
先调用「创建对话」拿到 conv_ 开头的 ID,替换 conv_123。
/model/v1/conversations/{conversation_id}/items● 支持conversation_idstring必填path: Id of the conversation, the `id` of the object returned by createConversation (it looks like conv_...). Another tenant's conversation, an unknown id and a deleted conversation all answer 404 conversation_not_found.
limitinteger可选query: Maximum items per page (values above 100 are clamped).
afterstring可选query: Item ID from the previous page; returns items after this cursor.
orderstring可选query: Sort by stored creation order.
200 list
按创建顺序列出会话的 items,支持 limit/after/order 分页参数。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
The conversation's items
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| object | string | Object type; always `list`. |
| data | array<object> | Items of the conversation, in the order the list requested. |
| first_id | string | Id of the first item of this page; null for an empty page. |
| last_id | string | Id of the last item of this page; null for an empty page. |
| has_more | boolean | Whether more items exist beyond this page; pass `last_id` as `after` to read them. |
先调用「创建对话」拿到 conv_ 开头的 ID,替换 conv_123。 条目 ID 取自「添加对话条目」或「列出对话条目」,替换 item_123。
/model/v1/conversations/{conversation_id}/items/{item_id}● 支持conversation_idstring必填path: Id of the conversation, the `id` of the object returned by createConversation (it looks like conv_...). Another tenant's conversation, an unknown id and a deleted conversation all answer 404 conversation_not_found.
item_idstring必填path: Id of the item to read, from the `id` of an item returned by createConversationItems or listConversationItems. An id that is not in the conversation answers 404.
200
按 ID 读取会话里的单条 item。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
The item
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | object |
先调用「创建对话」拿到 conv_ 开头的 ID,替换 conv_123。 条目 ID 取自「添加对话条目」或「列出对话条目」,替换 item_123。
/model/v1/conversations/{conversation_id}/items/{item_id}● 支持conversation_idstring必填path: Id of the conversation, the `id` of the object returned by createConversation (it looks like conv_...). Another tenant's conversation, an unknown id and a deleted conversation all answer 404 conversation_not_found.
item_idstring必填path: Id of the item to delete, from the `id` of an item returned by createConversationItems or listConversationItems. An id that is not in the conversation answers 404.
200 conversation
删除会话里的单条 item,返回该会话对象(不是被删除的 item)。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
The conversation, with the item removed
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Id of the conversation, such as `conv_...`; use it as `conversation_id` in conversation calls and as `conversation` in createResponse. |
| object | string | Object type; always `conversation`. |
| created_at | integer | Unix time in seconds at which the conversation was created. |
| metadata | object | Up to 16 string key/value pairs; keys at most 64 characters and values at most 512. |
先调用「创建对话」拿到 conv_ 开头的 ID,替换 conv_123。
/model/v1/conversations/{conversation_id}● 支持conversation_idstring必填path: Id of the conversation, the `id` of the object returned by createConversation (it looks like conv_...). Another tenant's conversation, an unknown id and a deleted conversation all answer 404 conversation_not_found.
200 conversation.deleted
删除一个会话。删除后该会话与其 items 都不能再被引用(包括作为 Responses create 的 conversation 参数)。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
Deletion confirmation
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Id of the deleted conversation. |
| object | string | Object type; always `conversation.deleted`. |
| deleted | boolean | Always true; neither the conversation nor its items can be referenced again. |
加载中…用 HTTP 直接调用 /sandbox/v1,请求携带 X-API-Key。官方 E2B SDK 请使用 E2B 兼容接口,不能只修改 API 地址来调用这里的接口。
HTTP 基础地址:。
| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| POST | /v1/sandboxes | 创建沙箱 | ● 支持 |
| POST | /v1/sandboxes/{sandboxID}/upgrade | 升级为完整沙箱 | ● 支持 |
| GET | /v1/sandboxes | 列出沙箱 | ● 支持 |
| GET | /v1/sandboxes/{sandboxID} | 读取沙箱 | ● 支持 |
| PATCH | /v1/sandboxes/{sandboxID} | 重命名沙箱 | ● 支持 |
| GET | /v1/sandboxes/{sandboxID}/metrics | 沙箱指标 | ● 支持 |
| POST | /v1/sandboxes/{sandboxID}/timeout | 设置超时 | ● 支持 |
| POST | /v1/sandboxes/{sandboxID}/pause | 暂停沙箱 | ● 支持 |
| POST | /v1/sandboxes/{sandboxID}/connect | 连接沙箱 | ● 支持 |
| DELETE | /v1/sandboxes/{sandboxID} | 终止沙箱 | ● 支持 |
| GET | /v1/templates | 列出模板 | ● 支持 |
| POST | /v1/volumes | 创建卷 | ● 支持 |
| GET | /v1/volumes | 列出卷 | ● 支持 |
| GET | /v1/volumes/{volumeID} | 读取卷 | ● 支持 |
| DELETE | /v1/volumes/{volumeID} | 删除卷 | ● 支持 |
| POST | /v1/sandboxes/{sandboxID}/fork | 复制沙箱 | ● 支持 |
| POST | /v1/sandboxes/{sandboxID}/snapshots | 创建快照 | ● 支持 |
| GET | /v1/snapshots | 列出快照 | ● 支持 |
| DELETE | /v1/snapshots/{snapshotID} | 删除快照 | ● 支持 |
| PUT | /v1/sandboxes/{sandboxID}/network | 更新网络策略 | ● 支持 |
| GET | /v1/sandboxes/{sandboxID}/logs | 读取沙箱日志 | ● 支持 |
| POST | /v1/sandboxes/{sandboxID}/extend | 延长沙箱 | ● 支持 |
| GET | /v1/sandboxes/{sandboxID}/processes | 列出进程 | ● 支持 |
| GET | /v1/sandboxes/{sandboxID}/processes/{processID}/output | 读取输出 | ● 支持 |
参数与字段的权威定义以 E2B 官方文档为准。
/sandbox/v1/sandboxes● 支持templateIDstring必填Identifier of the required template
timeoutinteger可选Lifetime of the new sandbox in seconds. Defaults to 300 seconds when omitted.
autoPauseboolean可选Automatically pauses the sandbox after the timeout
metadataany可选Your own string key/value pairs stored with the sandbox; usable as a filter in listSandboxes.
envVarsany可选Environment variables as name to value string pairs.
allow_internet_accessboolean可选Allow sandbox to access the internet. When set to false, it behaves the same as specifying denyOut to 0.0.0.0/0 in the network config.
autoPauseMemoryboolean可选Controls the snapshot kind taken when the sandbox auto-pauses on timeout (only relevant when autoPause is true). When false, the auto-pause drops the in-memory state and persists only the filesystem (a filesystem-only snapshot); resuming it cold-boots (reboots) the sandbox from disk. Such a snapshot cannot be auto-resumed by traffic and must be resumed explicitly, so it cannot be combined with autoResume. Defaults to true (full memory snapshot).
autoResumeobject可选Auto-resume configuration for paused sandboxes.
enabledboolean必填Auto-resume enabled flag for paused sandboxes. Default false.
networkobject可选Network policy of the sandbox: public access, egress allow and deny lists and proxy.
allowPublicTrafficboolean可选Specify if the sandbox URLs should be accessible only with authentication.
allowOutarray可选List of allowed destinations for egress traffic. Each entry can be a CIDR block (e.g. "8.8.8.8/32"), a bare IP address (e.g. "8.8.8.8"), or a domain name (e.g. "example.com", "*.example.com"). Allowed entries always take precedence over denied entries.
denyOutarray可选List of denied CIDR blocks or IP addresses for egress traffic. Domain names are not supported for deny rules.
egressProxyobject可选SOCKS5 proxy for sandbox egress. Outbound TCP is tunneled through the proxy after allow/deny filtering; the sandbox is unaware. Domain-matched flows use remote DNS (ATYP=domain).
maskRequestHoststring可选Specify host mask which will be used for all sandbox requests
httpsPortsarray可选Sandbox ports that serve HTTPS rather than plaintext HTTP. Affects how the proxy reaches the service inside the sandbox; the public URL is HTTPS either way. Certificates are not verified, so self-signed ones work. The envd port (49983) cannot be listed.
rulesobject可选Per-domain transform rules applied to matching outbound HTTPS requests. Keys may be exact DNS names (for example, "api.example.com") or a leading wildcard (for example, "*.example.com"), and are normalized to lowercase on write. Wildcards match subdomains at any depth but not the apex domain; a bare "*" is invalid. Exact rules take precedence, followed by the longest matching wildcard suffix, and matching rule sets are not merged. Broad wildcards such as "*.com" are allowed and may expose transformed credentials to every matching destination the sandbox contacts. Rules do not grant network access; configure allowOut separately to permit the destination.
mcpobject可选MCP configuration for the sandbox
iamobject可选Sandbox workload identity configuration. A non-empty, valid tokens map enables workload identity for the sandbox.
tokensobject可选Named workload-token definitions, keyed by a caller-chosen token name.
volumeMountsarray可选Volumes to mount into the sandbox, each with the volume name and the path inside the sandbox.
namestring必填Name of the volume
pathstring必填Path of the volume
201
平台暂未提供 E2B 默认的 base 模板:不带模板参数的 Sandbox.create() 会返回 404,请显式指定模板(可用模板见「列出模板」)。
错误按 E2B 格式返回,参见 错误码
The sandbox was created successfully
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| templateID | string | Identifier of the template from which is the sandbox created |
| sandboxID | string | Identifier of the sandbox |
| alias | string | Alias of the template |
| clientID | string | Identifier of the client |
| envdVersion | string | Version of the envd running in the sandbox |
| envdAccessToken | string | Access token used for envd communication |
| trafficAccessToken | string | Token required for accessing sandbox via proxy. |
| domain | string | Base domain where the sandbox traffic is accessible |
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/sandbox/v1/sandboxes/{sandboxID}/upgrade● 支持sandboxIDstring必填path: 沙箱 ID。
templateIDstring可选目标模板,默认 base(node22 别名);必须包含 E2B 镜像,否则返回 INVALID_PARAMS。升级期间文件、进程与数据面操作返回 409。
200
错误按 E2B 格式返回,参见 错误码
Upgraded sandbox detail with a replacement access token
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| templateID | string | Identifier of the template from which is the sandbox created |
| alias | string | Alias of the template |
| sandboxID | string | Identifier of the sandbox |
| clientID | string | Identifier of the client |
| startedAt | string | Time when the sandbox was started |
| endAt | string | Time when the sandbox will expire |
| envdVersion | string | Version of the envd running in the sandbox |
| envdAccessToken | string | Access token used for envd communication |
| allowInternetAccess | boolean | Whether internet access was explicitly enabled or disabled for the sandbox. Null means it was not explicitly set. |
| domain | string | Base domain where the sandbox traffic is accessible |
| cpuCount | integer | CPU cores for the sandbox |
| memoryMB | integer | Memory for the sandbox in MiB |
| diskSizeMB | integer | Disk size for the sandbox in MiB |
| metadata | any | Your own string key/value pairs stored with the sandbox; usable as a filter in listSandboxes. |
| state | string | State of the sandbox |
| network | object | Network policy of the sandbox: public access, egress allow and deny lists and proxy. |
| network.allowPublicTraffic | boolean | Specify if the sandbox URLs should be accessible only with authentication. |
| network.allowOut | array<string> | List of allowed destinations for egress traffic. Each entry can be a CIDR block (e.g. "8.8.8.8/32"), a bare IP address (e.g. "8.8.8.8"), or a domain name (e.g. "example.com", "*.example.com"). Allowed entries always take precedence over denied entries. |
| network.denyOut | array<string> | List of denied CIDR blocks or IP addresses for egress traffic. Domain names are not supported for deny rules. |
| network.egressProxy | object | SOCKS5 proxy for sandbox egress. Outbound TCP is tunneled through the proxy after allow/deny filtering; the sandbox is unaware. Domain-matched flows use remote DNS (ATYP=domain). |
| network.maskRequestHost | string | Specify host mask which will be used for all sandbox requests |
| network.httpsPorts | array<integer> | Sandbox ports that serve HTTPS rather than plaintext HTTP. Affects how the proxy reaches the service inside the sandbox; the public URL is HTTPS either way. Certificates are not verified, so self-signed ones work. The envd port (49983) cannot be listed. |
| network.rules | object | Per-domain transform rules applied to matching outbound HTTPS requests. Keys may be exact DNS names (for example, "api.example.com") or a leading wildcard (for example, ".example.com"), and are normalized to lowercase on write. Wildcards match subdomains at any depth but not the apex domain; a bare "" is invalid. Exact rules take precedence, followed by the longest matching wildcard suffix, and matching rule sets are not merged. Broad wildcards such as "*.com" are allowed and may expose transformed credentials to every matching destination the sandbox contacts. Rules do not grant network access; configure allowOut separately to permit the destination. |
| lifecycle | object | Sandbox lifecycle policy returned by sandbox info. |
| lifecycle.autoResume | boolean | Whether the sandbox can auto-resume. |
| lifecycle.onTimeout | string | Action taken when the sandbox times out. |
| volumeMounts | array<object> | Volumes mounted into the sandbox. |
| volumeMounts[].name | string | Name of the volume |
| volumeMounts[].path | string | Path of the volume |
/sandbox/v1/sandboxes● 支持metadatastring可选query: Metadata query used to filter the sandboxes (e.g. "user=abc&app=prod"). Each key and values must be URL encoded.
statearray可选query: live:运行中;exited:已退出;all:全部保留记录。默认 live。
orderstring可选query: Sort direction by sandbox start time. Defaults to desc (newest first).
startedAfterstring可选query: Return sandboxes started at or after this timestamp.
templatestring可选query: Filter sandboxes by a template ID or alias.
nextTokenstring可选query: Cursor to start the list from
limitinteger可选query: Maximum number of items to return per page
namestring可选query: 按名称子串搜索,不区分大小写;中文、%、_ 和反斜杠按原样匹配。去除首尾空白后须为 1–64 个字符。可与状态及分页参数组合;历史空名称不匹配。
200
错误按 E2B 格式返回,参见 错误码
Successfully returned all running sandboxes
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].templateID | string | Identifier of the template from which is the sandbox created |
| [].alias | string | Alias of the template |
| [].sandboxID | string | Identifier of the sandbox |
| [].clientID | string | Identifier of the client |
| [].startedAt | string | Time when the sandbox was started |
| [].endAt | string | Time when the sandbox will expire |
| [].cpuCount | integer | CPU cores for the sandbox |
| [].memoryMB | integer | Memory for the sandbox in MiB |
| [].diskSizeMB | integer | Disk size for the sandbox in MiB |
| [].metadata | any | Your own string key/value pairs stored with the sandbox; usable as a filter in listSandboxes. |
| [].state | string | State of the sandbox |
| [].envdVersion | string | Version of the envd running in the sandbox |
| [].volumeMounts | array<object> | Volumes mounted into the sandbox. |
| [].volumeMounts[].name | string | Name of the volume |
| [].volumeMounts[].path | string | Path of the volume |
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
Successfully returned the sandbox
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| templateID | string | Identifier of the template from which is the sandbox created |
| alias | string | Alias of the template |
| sandboxID | string | Identifier of the sandbox |
| clientID | string | Identifier of the client |
| startedAt | string | Time when the sandbox was started |
| endAt | string | Time when the sandbox will expire |
| envdVersion | string | Version of the envd running in the sandbox |
| envdAccessToken | string | Access token used for envd communication |
| allowInternetAccess | boolean | Whether internet access was explicitly enabled or disabled for the sandbox. Null means it was not explicitly set. |
| domain | string | Base domain where the sandbox traffic is accessible |
| cpuCount | integer | CPU cores for the sandbox |
| memoryMB | integer | Memory for the sandbox in MiB |
| diskSizeMB | integer | Disk size for the sandbox in MiB |
| metadata | any | Your own string key/value pairs stored with the sandbox; usable as a filter in listSandboxes. |
| state | string | State of the sandbox |
| network | object | Network policy of the sandbox: public access, egress allow and deny lists and proxy. |
| network.allowPublicTraffic | boolean | Specify if the sandbox URLs should be accessible only with authentication. |
| network.allowOut | array<string> | List of allowed destinations for egress traffic. Each entry can be a CIDR block (e.g. "8.8.8.8/32"), a bare IP address (e.g. "8.8.8.8"), or a domain name (e.g. "example.com", "*.example.com"). Allowed entries always take precedence over denied entries. |
| network.denyOut | array<string> | List of denied CIDR blocks or IP addresses for egress traffic. Domain names are not supported for deny rules. |
| network.egressProxy | object | SOCKS5 proxy for sandbox egress. Outbound TCP is tunneled through the proxy after allow/deny filtering; the sandbox is unaware. Domain-matched flows use remote DNS (ATYP=domain). |
| network.maskRequestHost | string | Specify host mask which will be used for all sandbox requests |
| network.httpsPorts | array<integer> | Sandbox ports that serve HTTPS rather than plaintext HTTP. Affects how the proxy reaches the service inside the sandbox; the public URL is HTTPS either way. Certificates are not verified, so self-signed ones work. The envd port (49983) cannot be listed. |
| network.rules | object | Per-domain transform rules applied to matching outbound HTTPS requests. Keys may be exact DNS names (for example, "api.example.com") or a leading wildcard (for example, ".example.com"), and are normalized to lowercase on write. Wildcards match subdomains at any depth but not the apex domain; a bare "" is invalid. Exact rules take precedence, followed by the longest matching wildcard suffix, and matching rule sets are not merged. Broad wildcards such as "*.com" are allowed and may expose transformed credentials to every matching destination the sandbox contacts. Rules do not grant network access; configure allowOut separately to permit the destination. |
| lifecycle | object | Sandbox lifecycle policy returned by sandbox info. |
| lifecycle.autoResume | boolean | Whether the sandbox can auto-resume. |
| lifecycle.onTimeout | string | Action taken when the sandbox times out. |
| volumeMounts | array<object> | Volumes mounted into the sandbox. |
| volumeMounts[].name | string | Name of the volume |
| volumeMounts[].path | string | Path of the volume |
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/sandbox/v1/sandboxes/{sandboxID}● 支持sandboxIDstring必填path: 沙箱 ID。
namestring必填新名称;去除首尾空白后须为 1–64 个字符。同团队重名返回 409。请求只允许 name 字段。
200
错误按 E2B 格式返回,参见 错误码
Updated sandbox detail
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| templateID | string | Identifier of the template from which is the sandbox created |
| alias | string | Alias of the template |
| sandboxID | string | Identifier of the sandbox |
| clientID | string | Identifier of the client |
| startedAt | string | Time when the sandbox was started |
| endAt | string | Time when the sandbox will expire |
| envdVersion | string | Version of the envd running in the sandbox |
| envdAccessToken | string | Access token used for envd communication |
| allowInternetAccess | boolean | Whether internet access was explicitly enabled or disabled for the sandbox. Null means it was not explicitly set. |
| domain | string | Base domain where the sandbox traffic is accessible |
| cpuCount | integer | CPU cores for the sandbox |
| memoryMB | integer | Memory for the sandbox in MiB |
| diskSizeMB | integer | Disk size for the sandbox in MiB |
| metadata | any | Your own string key/value pairs stored with the sandbox; usable as a filter in listSandboxes. |
| state | string | State of the sandbox |
| network | object | Network policy of the sandbox: public access, egress allow and deny lists and proxy. |
| network.allowPublicTraffic | boolean | Specify if the sandbox URLs should be accessible only with authentication. |
| network.allowOut | array<string> | List of allowed destinations for egress traffic. Each entry can be a CIDR block (e.g. "8.8.8.8/32"), a bare IP address (e.g. "8.8.8.8"), or a domain name (e.g. "example.com", "*.example.com"). Allowed entries always take precedence over denied entries. |
| network.denyOut | array<string> | List of denied CIDR blocks or IP addresses for egress traffic. Domain names are not supported for deny rules. |
| network.egressProxy | object | SOCKS5 proxy for sandbox egress. Outbound TCP is tunneled through the proxy after allow/deny filtering; the sandbox is unaware. Domain-matched flows use remote DNS (ATYP=domain). |
| network.maskRequestHost | string | Specify host mask which will be used for all sandbox requests |
| network.httpsPorts | array<integer> | Sandbox ports that serve HTTPS rather than plaintext HTTP. Affects how the proxy reaches the service inside the sandbox; the public URL is HTTPS either way. Certificates are not verified, so self-signed ones work. The envd port (49983) cannot be listed. |
| network.rules | object | Per-domain transform rules applied to matching outbound HTTPS requests. Keys may be exact DNS names (for example, "api.example.com") or a leading wildcard (for example, ".example.com"), and are normalized to lowercase on write. Wildcards match subdomains at any depth but not the apex domain; a bare "" is invalid. Exact rules take precedence, followed by the longest matching wildcard suffix, and matching rule sets are not merged. Broad wildcards such as "*.com" are allowed and may expose transformed credentials to every matching destination the sandbox contacts. Rules do not grant network access; configure allowOut separately to permit the destination. |
| lifecycle | object | Sandbox lifecycle policy returned by sandbox info. |
| lifecycle.autoResume | boolean | Whether the sandbox can auto-resume. |
| lifecycle.onTimeout | string | Action taken when the sandbox times out. |
| volumeMounts | array<object> | Volumes mounted into the sandbox. |
| volumeMounts[].name | string | Name of the volume |
| volumeMounts[].path | string | Path of the volume |
| name | string | Current name of the sandbox. |
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/sandbox/v1/sandboxes/{sandboxID}/metrics● 支持sandboxIDstring必填path: 沙箱 ID。
startinteger可选query: Unix timestamp for the start of the interval, in seconds, for which the metrics
endinteger可选query: Unix timestamp in seconds at which the metrics window ends. Omit it to read up to the latest sample.
200
错误按 E2B 格式返回,参见 错误码
Successfully returned the sandbox metrics
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].timestamp | string | Timestamp of the metric entry |
| [].timestampUnix | integer | Timestamp of the metric entry in Unix time (seconds since epoch) |
| [].cpuCount | integer | Number of CPU cores |
| [].cpuUsedPct | number | CPU usage percentage |
| [].memUsed | integer | Memory used in bytes |
| [].memTotal | integer | Total memory in bytes |
| [].memCache | integer | Cached memory (page cache) in bytes |
| [].diskUsed | integer | Disk used in bytes |
| [].diskTotal | integer | Total disk space in bytes |
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/sandbox/v1/sandboxes/{sandboxID}/timeout● 支持sandboxIDstring必填path: 沙箱 ID。
timeoutinteger必填New lifetime in seconds from now, replacing the current expiry rather than adding to it. May shorten the remaining lifetime.
204
错误按 E2B 格式返回,参见 错误码
Successfully set the sandbox timeout
未声明响应体。
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/sandbox/v1/sandboxes/{sandboxID}/pause● 支持sandboxIDstring必填path: 沙箱 ID。
memoryboolean可选Whether to capture a full memory snapshot. When false, only the filesystem is persisted and resuming the sandbox cold-boots (reboots) it from disk, losing in-memory state, running processes, and open connections. Resume it with an explicit request (connect or resume); auto-resume, which can be triggered by arbitrary traffic, refuses such a sandbox. Defaults to true.
204
错误按 E2B 格式返回,参见 错误码
The sandbox was paused successfully and can be resumed
未声明响应体。
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/sandbox/v1/sandboxes/{sandboxID}/connect● 支持sandboxIDstring必填path: 沙箱 ID。
timeoutinteger可选Requested remaining lifetime in seconds from the connection. Defaults to 300 seconds; an existing later expiry is preserved.
memoryboolean可选Defaults to true. When false and the sandbox is paused, resume from disk state only: the sandbox cold-boots fresh and any memory in the snapshot is ignored, never modified or deleted. Disk state has crash-recovery semantics — writes not flushed before the pause may be lost. A no-op for snapshots that contain no memory. Rejected with an error in environments where this capability is not enabled, never silently downgraded to a memory restore.
201
错误按 E2B 格式返回,参见 错误码
The sandbox was already running
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| templateID | string | Identifier of the template from which is the sandbox created |
| sandboxID | string | Identifier of the sandbox |
| alias | string | Alias of the template |
| clientID | string | Identifier of the client |
| envdVersion | string | Version of the envd running in the sandbox |
| envdAccessToken | string | Access token used for envd communication |
| trafficAccessToken | string | Token required for accessing sandbox via proxy. |
| domain | string | Base domain where the sandbox traffic is accessible |
The sandbox was resumed successfully
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| templateID | string | Identifier of the template from which is the sandbox created |
| sandboxID | string | Identifier of the sandbox |
| alias | string | Alias of the template |
| clientID | string | Identifier of the client |
| envdVersion | string | Version of the envd running in the sandbox |
| envdAccessToken | string | Access token used for envd communication |
| trafficAccessToken | string | Token required for accessing sandbox via proxy. |
| domain | string | Base domain where the sandbox traffic is accessible |
/sandbox/v1/templates● 支持teamIDstring可选query: Id of the team whose templates to list. Omit it to list the templates of your own team; a team you do not belong to answers 403.
nextTokenstring可选query: Cursor to start the list from
limitinteger可选query: Maximum number of items to return per page
200
错误按 E2B 格式返回,参见 错误码
Successfully returned all templates
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].templateID | string | Identifier of the template |
| [].buildID | string | Identifier of the last successful build for given template |
| [].cpuCount | integer | CPU cores for the sandbox |
| [].memoryMB | integer | Memory for the sandbox in MiB |
| [].diskSizeMB | integer | Disk size for the sandbox in MiB |
| [].public | boolean | Whether the template is public or only accessible by the team |
| [].aliases | array<string> | Aliases of the template |
| [].names | array<string> | Names of the template (namespace/alias format when namespaced) |
| [].createdAt | string | Time when the template was created |
| [].updatedAt | string | Time when the template was last updated |
| [].createdBy | object | User who created the template; null for templates created by the platform. |
| [].createdBy.id | string | Identifier of the user |
| [].createdBy.email | string | Email of the user |
| [].lastSpawnedAt | string | Time when the template was last used |
| [].spawnCount | integer | Number of times the template was used |
| [].buildCount | integer | Number of times the template was built |
| [].envdVersion | string | Version of the envd running in the sandbox |
| [].buildStatus | string | Status of the template build |
/sandbox/v1/volumes● 支持namestring必填Volume name, unique within your team. Use one or more ASCII letters, digits, underscores or hyphens.
201
错误按 E2B 格式返回,参见 错误码
Successfully created a new team volume
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| volumeID | string | ID of the volume |
| name | string | Name of the volume |
| token | string | Auth token to use for interacting with volume content |
| domain | string | Domain to use as the destination for volume content requests, replacing the default `api.<E2B_DOMAIN>`. Only returned when the team is connected to a custom (BYOC) cluster; absent otherwise, in which case the default domain is used. |
自有入口在响应对象(列表为每行)追加 createdAt:创建时间,ISO 8601 UTC 字符串。
网关自动设置 X-Praxis-Face: own-v1,客户端无需传入;/e2b 兼容入口会剥除该头,保留厂商响应形状。
/sandbox/v1/volumes/{volumeID}● 支持volumeIDstring必填path: Id of the team volume, the `volumeID` returned by createVolume or listVolumes.
200
错误按 E2B 格式返回,参见 错误码
Successfully retrieved a team volume
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| volumeID | string | ID of the volume |
| name | string | Name of the volume |
| token | string | Auth token to use for interacting with volume content |
| domain | string | Domain to use as the destination for volume content requests, replacing the default `api.<E2B_DOMAIN>`. Only returned when the team is connected to a custom (BYOC) cluster; absent otherwise, in which case the default domain is used. |
自有入口在响应对象(列表为每行)追加 createdAt:创建时间,ISO 8601 UTC 字符串。
网关自动设置 X-Praxis-Face: own-v1,客户端无需传入;/e2b 兼容入口会剥除该头,保留厂商响应形状。
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/sandbox/v1/sandboxes/{sandboxID}/fork● 支持sandboxIDstring必填path: 沙箱 ID。
timeoutinteger可选新副本的存活时间,单位为秒。
countinteger可选要创建的独立副本数。所有副本来自同一次快照,每个副本分别返回成功结果或错误。
201
错误按 E2B 格式返回,参见 错误码
The sandbox was snapshotted and the forks were attempted; each entry reports one fork's outcome
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].sandbox | object | Sandbox created from a template. |
| [].sandbox.templateID | string | Identifier of the template from which is the sandbox created |
| [].sandbox.sandboxID | string | Identifier of the sandbox |
| [].sandbox.alias | string | Alias of the template |
| [].sandbox.clientID | string | Identifier of the client |
| [].sandbox.envdVersion | string | Version of the envd running in the sandbox |
| [].sandbox.envdAccessToken | string | Access token used for envd communication |
| [].sandbox.trafficAccessToken | string | Token required for accessing sandbox via proxy. |
| [].sandbox.domain | string | Base domain where the sandbox traffic is accessible |
| [].error | object | Error body: numeric code, machine-readable error_code and a message. |
| [].error.code | integer | Error code |
| [].error.error_code | string | Machine-readable semantic error code. Not a closed set; initial values: sandbox_capacity_unavailable, sandbox_placement_timeout, sandbox_no_compatible_node, sandbox_create_failed, internal_server_error. |
| [].error.message | string | Human-readable description of the error. |
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/sandbox/v1/sandboxes/{sandboxID}/snapshots● 支持sandboxIDstring必填path: 沙箱 ID。
namestring可选可选别名。同一主体重复使用该别名会更新既有快照,保留本平台快照 ID。
201
错误按 E2B 格式返回,参见 错误码
Snapshot created successfully
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| snapshotID | string | Identifier of the snapshot template including the tag. Uses namespace/alias when a name was provided (e.g. team-slug/my-snapshot:default), otherwise falls back to the raw template ID (e.g. abc123:default). |
| names | array<string> | Full names of the snapshot template including team namespace and tag (e.g. team-slug/my-snapshot:v2) |
自有入口在响应对象(列表为每行)追加 createdAt:创建时间,ISO 8601 UTC 字符串。
快照还包括 sourceSandboxID(string,来源沙箱公开 ID)与 sourceSandboxName(string 或 null)。名称无法取得时返回 null,界面可回退显示 ID。
网关自动设置 X-Praxis-Face: own-v1,客户端无需传入;/e2b 兼容入口会剥除该头,保留厂商响应形状。
向 POST /sandbox/v1/sandboxes/{sandboxID}/snapshots 发送 JSON body {"name":"my-snapshot"} 即可命名;名称会持久保存,并通过 names 返回。
/sandbox/v1/snapshots● 支持sandboxIDstring可选query: 按来源沙箱 ID 筛选。
namestring可选query: 按原始别名或本平台 snap_ 快照 ID 筛选。
limitinteger可选query: 每页返回的快照数量上限。
nextTokenstring可选query: 上一页响应头 X-Next-Token 返回的游标。
200
错误按 E2B 格式返回,参见 错误码
Successfully returned snapshots
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].snapshotID | string | Identifier of the snapshot template including the tag. Uses namespace/alias when a name was provided (e.g. team-slug/my-snapshot:default), otherwise falls back to the raw template ID (e.g. abc123:default). |
| [].names | array<string> | Full names of the snapshot template including team namespace and tag (e.g. team-slug/my-snapshot:v2) |
自有入口在响应对象(列表为每行)追加 createdAt:创建时间,ISO 8601 UTC 字符串。
快照还包括 sourceSandboxID(string,来源沙箱公开 ID)与 sourceSandboxName(string 或 null)。名称无法取得时返回 null,界面可回退显示 ID。
网关自动设置 X-Praxis-Face: own-v1,客户端无需传入;/e2b 兼容入口会剥除该头,保留厂商响应形状。
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/sandbox/v1/sandboxes/{sandboxID}/network● 支持sandboxIDstring必填path: 沙箱 ID。
allow_internet_accessboolean可选是否允许访问外网。false 等效于 denyOut 包含 0.0.0.0/0。
allowOutarray可选出站目标白名单,可用 CIDR、IP 或域名;白名单优先于拒绝规则。
denyOutarray可选出站目标黑名单,支持 CIDR 或 IP,不支持域名。
egressProxyobject可选上游代理配置字段,当前平台尚未应用。
addressstring必填SOCKS5 proxy address in host:port format (e.g. "proxy.example.com:1080").
usernamestring可选Optional SOCKS5 username (RFC 1929), max 255 bytes.
passwordstring可选Optional SOCKS5 password (RFC 1929), max 255 bytes.
rulesobject可选上游按域名转换规则字段,当前平台尚未应用。
204
错误按 E2B 格式返回,参见 错误码
Successfully updated the sandbox network configuration
未声明响应体。
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/sandbox/v1/sandboxes/{sandboxID}/logs● 支持sandboxIDstring必填path: 沙箱 ID。
cursorinteger可选query: 起始时间戳,单位为 Unix 毫秒。
limitinteger可选query: 最多返回的日志条数。
directionstring可选query: forward 按时间向后读取;backward 按时间向前读取。
levelstring可选query: 最低日志级别,低于该级别的日志会被过滤。
searchstring可选query: 按日志正文的子串筛选,区分大小写。
200
错误按 E2B 格式返回,参见 错误码
Successfully returned the sandbox logs
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| logs | array<object> | Sandbox logs structured |
| logs[].timestamp | string | Timestamp of the log entry |
| logs[].message | string | Log message content |
| logs[].level | string | State of the sandbox |
| logs[].fields | object | Structured key/value fields attached to the log line. |
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/sandbox/v1/sandboxes/{sandboxID}/extend● 支持sandboxIDstring必填path: 沙箱 ID。
timeoutnumber必填从当前时刻起计算的有效秒数:900、1800 或 3600。必须延长现有截止时间。
200
错误按 E2B 格式返回,参见 错误码
Authoritative extended deadline
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| endAt | string | New expiry time of the sandbox, UTC. |
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/sandbox/v1/sandboxes/{sandboxID}/processes● 支持sandboxIDstring必填path: 沙箱 ID。
statestring可选query: live:运行中;exited:已退出;all:全部保留记录。默认 live。
200
错误按 E2B 格式返回,参见 错误码
Bounded observation with explicit completeness
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| processes | array<object> | Processes of the sandbox: running ones and retained observations of exited ones, newest first. |
| processes[].processId | string | Id of the process: `obs-<n>` for a process whose start was observed, `live-<pid>` for one that was only seen running. |
| processes[].pid | integer | Operating-system process id inside the sandbox. |
| processes[].tag | string | Tag the process was started with; absent when none. |
| processes[].config | object | Command the process was started with. |
| processes[].pty | boolean | Whether the process runs in a pseudo-terminal; present for observed processes. |
| processes[].startedAt | string | Time at which the process start was observed, UTC. |
| processes[].exitedAt | string | Time at which the process exit was observed, UTC; absent until an exit was witnessed. |
| processes[].exitCode | integer | Exit code; present only when the exit was witnessed. |
| processes[].state | string | Current state of the process. |
| processes[].observed | boolean | Whether the platform watched this process start. False for a process that was only seen running. |
| processes[].observationGap | boolean | True when observation was interrupted, so output or the exit may be missing; the state can then be unknown. |
| processes[].outputTruncated | boolean | True when old output chunks were dropped to stay within the retention limits. |
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/sandbox/v1/sandboxes/{sandboxID}/processes/{processID}/output● 支持sandboxIDstring必填path: 沙箱 ID。
processIDstring必填path: 从进程列表取得的 processId。
200
错误按 E2B 格式返回,参见 错误码
Bounded observation with explicit completeness
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| chunks | array<object> | Retained output chunks of the process, oldest first. |
| chunks[].seq | integer | Sequence number of the chunk; it increases with time and orders chunks. |
| chunks[].stream | string | Which stream the chunk came from. |
| chunks[].data | string | Output bytes of the chunk, base64 encoded. |
| chunks[].timestamp | number | Time at which the chunk was recorded, in Unix milliseconds. |
| complete | boolean | True when the output is whole: the exit was witnessed, no gap occurred and nothing was truncated. |
| gap | boolean | True when observation was interrupted, so chunks or the exit may be missing. |
| truncated | boolean | True when old chunks were dropped to stay within the retention limits. |
| exitCode | integer | null | Exit code of the process; null until an exit was witnessed. |
加载中…| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| POST | /v1/search | 搜索 | ● 支持 |
| POST | /v1/extract | 提取网页内容 | ● 支持 |
| POST | /v1/crawl | 站内爬取 | ● 支持 |
| POST | /v1/map | 站点地图 | ● 支持 |
参数与字段的权威定义以 Tavily 官方文档为准。
/search/v1/search● 支持querystring必填The search query to execute with Tavily.
search_depthstring可选Controls the latency vs. relevance tradeoff and how `results[].content` is generated: - `advanced`: Highest relevance with increased latency. Best for detailed, high-precision queries. Returns multiple semantically relevant snippets per URL (configurable via `chunks_per_source`). - `basic`: A balanced option for relevance and latency. Ideal for general-purpose searches. Returns multiple semantically relevant snippets per URL (configurable via `chunks_per_source`). - `fast`: Prioritizes lower latency while maintaining good relevance. Returns multiple semantically relevant snippets per URL (configurable via `chunks_per_source`). - `ultra-fast`: Minimizes latency above all else. Best for time-critical use cases. Returns one NLP summary per URL. **Cost**: - `basic`, `fast`, `ultra-fast`: 1 API Credit - `advanced`: 2 API Credits See [Search Best Practices](/documentation/best-practices/best-practices-search#search-depth) for guidance on choosing the right search depth.
chunks_per_sourceinteger可选Chunks are short content snippets (maximum 500 characters each) pulled directly from the source. Use `chunks_per_source` to define the maximum number of relevant chunks returned per source and to control the `content` length. Chunks will appear in the `content` field as: `<chunk 1> [...] <chunk 2> [...] <chunk 3>`. Available when `search_depth` is `advanced`, `basic` or `fast`.
max_resultsinteger可选The maximum number of search results to return.
topicstring可选The category of the search.`news` is useful for retrieving real-time updates, particularly about politics, sports, and major current events covered by mainstream media sources. `general` is for broader, more general-purpose searches that may include a wide range of sources.
time_rangestring可选The time range back from the current date to filter results based on publish date or last updated date. Useful when looking for sources that have published or updated data. By default, results with no detectable published date are not removed; set `filter_by_published_date` to `true` to remove them.
start_datestring可选Will return all results after the specified start date based on publish date or last updated date. Required to be written in the format YYYY-MM-DD. By default, results with no detectable published date are not removed; set `filter_by_published_date` to `true` to remove them.
end_datestring可选Will return all results before the specified end date based on publish date or last updated date. Required to be written in the format YYYY-MM-DD. By default, results with no detectable published date are not removed; set `filter_by_published_date` to `true` to remove them.
include_published_dateboolean可选Include a `published_date` field in each result. The date is Tavily's best estimate of when the source was published or last updated, so it can be later than the original publish date. Results with no detectable date return `null`. Automatically enabled when `topic` is `news`. **Note**: this feature is currently in beta.
filter_by_published_dateboolean可选Remove results whose published date falls outside the `time_range`, `start_date`, or `end_date` window. Results with no detectable published date are also removed. Setting this to `true` also enables `include_published_date`. If you want date-window filtering but don't want to lose sources without a detectable date, leave this `false` and set `include_published_date: true` together with a date range instead.
include_answerboolean | string可选Include an LLM-generated answer to the provided query. `basic` or `true` returns a quick answer. `advanced` returns a more detailed answer.
include_raw_contentboolean | string可选Include the cleaned and parsed HTML content of each search result. `markdown` or `true` returns search result content in markdown format. `text` returns the plain text from the results and may increase latency.
include_imagesboolean可选Include images in the response. Returns both a top-level `images` list of query-related images and an `images` array inside each result object with images extracted from that specific source.
include_image_descriptionsboolean可选When `include_images` is `true`, also add a descriptive text for each image.
include_faviconboolean可选Whether to include the favicon URL for each result.
include_domainsarray可选A list of domains to specifically include in the search results. Maximum 300 domains.
exclude_domainsarray可选A list of domains to specifically exclude from the search results. Maximum 150 domains.
include_domains_modestring可选Controls how `include_domains` is applied. `restrict` limits results to only the listed domains. `prefer` also searches the rest of the web, so results outside `include_domains` can still surface, rather than excluding them. Requires `include_domains` to be set; returns a 400 error otherwise.
countrystring可选Boost search results from a specific country. This will prioritize content from the selected country in the search results. Available only if topic is `general`.
languagestring可选Boost search results in a specific language. Accepts an ISO 639-1 code (e.g. `en`, `fr`, `zh-cn`) or an English language name (e.g. `english`, `french`). By default this only boosts matching-language results in ranking; pass `filter_by_language: true` to strictly filter out non-matching results instead. For best results, write your `query` in the same language you set here.
filter_by_languageboolean可选Strictly filter out search results that don't match the `language` parameter, instead of only boosting them in ranking. Requires `language` to be set; returns a 400 error otherwise.
auto_parametersboolean可选When `auto_parameters` is enabled, Tavily automatically configures search parameters based on your query's content and intent. You can still set other parameters manually, and your explicit values will override the automatic ones. The parameters `include_answer`, `include_raw_content`, and `max_results` must always be set manually, as they directly affect response size. Note: `search_depth` may be automatically set to advanced when it's likely to improve results. This uses 2 API credits per request. To avoid the extra cost, you can explicitly set `search_depth` to `basic`.
exact_matchboolean可选Ensure that only search results containing the exact quoted phrase(s) in the query are returned, bypassing synonyms or semantic variations. Wrap target phrases in quotes within your query (e.g. `"John Smith" CEO Acme Corp`). Punctuation is typically ignored inside quotes.
include_usageboolean可选Whether to include credit usage information in the response.
safe_searchboolean可选Whether to filter out adult or unsafe content from results. Not supported for `fast` or `ultra-fast` search depths.
200
错误按 Tavily 格式返回,参见 错误码
Search results returned successfully
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| query | string | The search query that was executed. |
| answer | string | A short answer to the user's query, generated by an LLM. Included in the response only if `include_answer` is requested (i.e., set to `true`, `basic`, or `advanced`) |
| images | array<object> | A list of query-related images from image search. If `include_image_descriptions` is true, each item will have `url` and `description`. Note: per-result images are also returned inside each result object's `images` field. |
| images[].url | string | URL of the image. |
| images[].description | string | Description of the image, when the search was asked to describe images. |
| results | array<object> | A list of sorted search results, ranked by relevancy. |
| results[].title | string | The title of the search result. |
| results[].url | string | The URL of the search result. |
| results[].content | string | A short description of the search result. |
| results[].score | number | The relevance score of the search result. |
| results[].raw_content | string | The cleaned and parsed HTML content of the search result. Only if `include_raw_content` is true. |
| results[].published_date | string | Tavily's best estimate of when the source was published or last updated. Can be later than the original publish date. `null` if no date could be detected. Only returned when `include_published_date` is `true` (automatically enabled when `topic` is `news`). |
| results[].favicon | string | The favicon URL for the result. |
| results[].images | array<object> | A list of images extracted from this search result. Only included when `include_images` is `true`. If `include_image_descriptions` is `true`, each item will have `url` and `description`. |
| results[].id | string | Unique identifier for this result |
| auto_parameters | object | A dictionary of the selected auto_parameters, only shown when `auto_parameters` is true. |
| response_time | number | Time in seconds it took to complete the request. |
| usage | object | Credit usage details for the request. |
| request_id | string | A unique request identifier you can share with customer support to help resolve issues with specific requests. |
/search/v1/extract● 支持querystring可选User intent for reranking extracted content chunks. When provided, chunks are reranked based on relevance to this query.
urlsstring | array必填URL to extract, or an array of up to 20 URLs. Per-URL failures are listed in `failed_results` of the response, which can come with HTTP 200.
chunks_per_sourceinteger可选Chunks are short content snippets (maximum 500 characters each) pulled directly from the source. Use `chunks_per_source` to define the maximum number of relevant chunks returned per source and to control the `raw_content` length. Chunks will appear in the `raw_content` field as: `<chunk 1> [...] <chunk 2> [...] <chunk 3>`. Available only when `query` is provided. Must be between 1 and 5.
extract_depthstring可选The depth of the extraction process. `advanced` extraction retrieves more data, including tables and embedded content, with higher success but may increase latency.`basic` extraction costs 1 credit per 5 successful URL extractions, while `advanced` extraction costs 2 credits per 5 successful URL extractions.
include_imagesboolean可选Include a list of images extracted from the URLs in the response. Default is false.
include_faviconboolean可选Whether to include the favicon URL for each result.
formatstring可选The format of the extracted web page content. `markdown` returns content in markdown format. `text` returns plain text and may increase latency.
timeoutnumber可选Maximum time in seconds to wait for the URL extraction before timing out. Must be between 1.0 and 60.0 seconds. If not specified, default timeouts are applied based on extract_depth: 10 seconds for basic extraction and 30 seconds for advanced extraction.
include_usageboolean可选Whether to include credit usage information in the response. `NOTE:`The value may be 0 if the total successful URL extractions has not yet reached 5 calls. See our [Credits & Pricing documentation](https://docs.tavily.com/documentation/api-credits) for details.
200
错误按 Tavily 格式返回,参见 错误码
Extraction completed. Check results and failed_results for each URL. HTTP 200 can have an empty results array when all valid URLs fail during extraction; output order is not guaranteed.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| results | array<object> | A list of extracted content from the provided URLs. |
| results[].url | string | The URL from which the content was extracted. |
| results[].raw_content | string | The full content extracted from the page. When `query` is provided, contains the top-ranked chunks joined by `[...]` separator. |
| results[].images | array<string> | This is only available if `include_images` is set to `true`. A list of image URLs extracted from the page. |
| results[].favicon | string | The favicon URL for the result. |
| failed_results | array<object> | A list of URLs that could not be processed. |
| failed_results[].url | string | The URL that failed to be processed. |
| failed_results[].error | string | An error message describing why the URL couldn't be processed. |
| response_time | number | Time in seconds it took to complete the request. |
| usage | object | Credit usage details for the request. |
| request_id | string | A unique request identifier you can share with customer support to help resolve issues with specific requests. |
/search/v1/crawl● 支持urlstring必填The root URL to begin the crawl.
limitinteger可选Total number of links the crawler will process before stopping.
instructionsstring可选Natural language instructions for the crawler. When specified, the mapping cost increases to 2 API credits per 10 successful pages instead of 1 API credit per 10 pages.
chunks_per_sourceinteger可选Chunks are short content snippets (maximum 500 characters each) pulled directly from the source. Use `chunks_per_source` to define the maximum number of relevant chunks returned per source and to control the `raw_content` length. Chunks will appear in the `raw_content` field as: `<chunk 1> [...] <chunk 2> [...] <chunk 3>`. Available only when `instructions` are provided. Must be between 1 and 5.
max_depthinteger可选Max depth of the crawl. Defines how far from the base URL the crawler can explore.
max_breadthinteger可选Max number of links to follow per level of the tree (i.e., per page).
select_pathsarray可选Regex patterns to select only URLs with specific path patterns (e.g., `/docs/.*`, `/api/v1.*`).
select_domainsarray可选Regex patterns to select crawling to specific domains or subdomains (e.g., `^docs\.example\.com$`).
exclude_pathsarray可选Regex patterns to exclude URLs with specific path patterns (e.g., `/private/.*`, `/admin/.*`).
exclude_domainsarray可选Regex patterns to exclude specific domains or subdomains from crawling (e.g., `^private\.example\.com$`).
allow_externalboolean可选Whether to include external domain links in the final results list.
include_imagesboolean可选Whether to include images in the crawl results.
extract_depthstring可选Advanced extraction retrieves more data, including tables and embedded content, with higher success but may increase latency. `basic` extraction costs 1 credit per 5 successful extractions, while `advanced` extraction costs 2 credits per 5 successful extractions.
formatstring可选The format of the extracted web page content. `markdown` returns content in markdown format. `text` returns plain text and may increase latency.
include_faviconboolean可选Whether to include the favicon URL for each result.
timeoutnumber可选Maximum time in seconds to wait for the crawl operation before timing out. Must be between 10 and 150 seconds.
include_usageboolean可选Whether to include credit usage information in the response. `NOTE:`The value may be 0 if the total use of /extract and /map have not yet reached minimum requirements. See our [Credits & Pricing documentation](https://docs.tavily.com/documentation/api-credits) for details.
200
调用前要求账户余额大于 0;按本次调用实际消耗的 credits 计费,每 credit $0.01;上游未返回用量时,按本次请求可能消耗的上限计费。
错误按 Tavily 格式返回,参见 错误码
Crawl results returned successfully
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| base_url | string | The base URL that was crawled. |
| results | array<object> | A list of extracted content from the crawled URLs. |
| results[].url | string | The URL that was crawled. |
| results[].raw_content | string | The full content extracted from the page. When `query` is provided, contains the top-ranked chunks joined by `[...]` separator. |
| results[].favicon | string | The favicon URL for the result. |
| response_time | number | Time in seconds it took to complete the request. |
| usage | object | Credit usage details for the request. |
| request_id | string | A unique request identifier you can share with customer support to help resolve issues with specific requests. |
/search/v1/map● 支持urlstring必填The root URL to begin the mapping.
limitinteger可选Total number of links the crawler will process before stopping.
instructionsstring可选Natural language instructions for the crawler. When specified, the cost increases to 2 API credits per 10 successful pages instead of 1 API credit per 10 pages.
max_depthinteger可选Max depth of the mapping. Defines how far from the base URL the crawler can explore.
max_breadthinteger可选Max number of links to follow per level of the tree (i.e., per page).
select_pathsarray可选Regex patterns to select only URLs with specific path patterns (e.g., `/docs/.*`, `/api/v1.*`).
select_domainsarray可选Regex patterns to select crawling to specific domains or subdomains (e.g., `^docs\.example\.com$`).
exclude_pathsarray可选Regex patterns to exclude URLs with specific path patterns (e.g., `/private/.*`, `/admin/.*`).
exclude_domainsarray可选Regex patterns to exclude specific domains or subdomains from crawling (e.g., `^private\.example\.com$`).
allow_externalboolean可选Whether to include external domain links in the final results list.
timeoutnumber可选Maximum time in seconds to wait for the map operation before timing out. Must be between 10 and 150 seconds.
include_usageboolean可选Whether to include credit usage information in the response.`NOTE:`The value may be 0 if the total successful pages mapped has not yet reached 10 calls. See our [Credits & Pricing documentation](https://docs.tavily.com/documentation/api-credits) for details.
200
调用前要求账户余额大于 0;按本次调用实际消耗的 credits 计费,每 credit $0.01;上游未返回用量时,按本次请求可能消耗的上限计费。
错误按 Tavily 格式返回,参见 错误码
Map results returned successfully
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| base_url | string | The base URL that was mapped. |
| results | array<string> | A list of URLs that were discovered during the mapping. |
| response_time | number | Time in seconds it took to complete the request. |
| usage | object | Credit usage details for the request. |
| request_id | string | A unique request identifier you can share with customer support to help resolve issues with specific requests. |
管理动作、发布脚本与工作流、查看运行并接收入站 webhook。
https://api.deepraxis.ai/automation/v1
使用 Authorization: Bearer $PRAXIS_API_KEY。入站 webhook 使用创建或轮换时返回的 secret URL,无需 API Key。
SDK 尚未发布到 npm。从本地源码安装,再用 Bun 运行示例;将命令中的路径替换为本地 SDK 目录。
bun add /absolute/path/to/packages/sdk/typescript
bun example.ts示例使用 develop。curl 请求体带变量时需安装 jq。资源示例名称以 sample- 开头;创建前换成尚未占用的名称。动作、脚本和工作流使用 docs-samples 命名空间,完成后归档;触发器完成后删除。
筛选可见动作并读取修订摘要。可按名称或说明筛选,包含近七天统计;不含实现源码,默认排除已归档动作。
GET /automation/v1/actions
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| query: limit | integer | 可选;每页条数,整数 1–100,默认 20。 minimum: 1;maximum: 100 |
| query: cursor | string | 可选;上一页返回的 next_cursor,不透明字符串;保持原查询条件继续翻页。 |
| query: q | string | 可选;不区分大小写,按名称或说明的字面子串匹配;% 与 _ 无通配含义。 |
| query: namespace | string[] | 可选;仅返回指定命名空间的定义,名称按小写匹配。 多个值以逗号分隔,匹配任一值。 minItems: 1 |
| query: scope | "platform" / "own"[] | 可选;platform 仅平台定义,own 仅租户自建定义;省略返回两者。 多个值以逗号分隔,匹配任一值。 minItems: 1 |
| query: archived | boolean | 可选;true 仅已归档,false 仅未归档;默认 false。 |
| query: implementation | "code" / "container" / "shell"[] | 可选;按实现类型筛选:code、container 或 shell;省略不过滤。 多个值以逗号分隔,匹配任一值。 minItems: 1 |
| query: labels | object | 可选;按标签过滤,使用 labels[k]=v;同键逗号多值取任一,不同键同时满足。 |
| query: created_at[gte] | string | 可选;创建时间下界,包含边界;使用带时区的 ISO 8601 时间。 format: "date-time" |
| query: created_at[lte] | string | 可选;创建时间上界,包含边界;使用带时区的 ISO 8601 时间。 format: "date-time" |
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/actions" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
--get \
--data-urlencode "namespace=docs-samples" \
--data-urlencode "limit=1"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.actions.list({
"query": {
"namespace": [
"docs-samples"
],
"limit": 1
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| data | object[] | 必填 / 必有;本页的动作(含当前修订摘要与近七天统计),按 created_at 倒序、id 倒序排列。 |
| data[].id | string | 必填 / 必有;动作 ID,前缀 act_;日常调用使用 namespace 与 name,而不是 id。 |
| data[].namespace | string | 必填 / 必有;动作命名空间;平台动作为 praxis,裸名引用解析到 praxis。 |
| data[].name | string | 必填 / 必有;动作名,与 namespace 一起唯一标识动作;小写字母、数字、点、下划线、连字符,最长 64 字符。 |
| data[].description | string | 必填 / 必有;动作说明,最多 1000 字符。 |
| data[].labels | object | 必填 / 必有;用户自定义标签:字符串键值对,用于分类与列表过滤(labels[key]=value);键不能以 praxis. 开头。 |
| data[].owner | string | 必填 / 必有;动作所属租户,由网关注入;按不透明字符串处理。 |
| data[].builtin | boolean | 必填 / 必有;true 表示平台内置动作(命名空间 praxis);用户创建的动作为 false。 |
| data[].stats_7d | object | 必填 / 必有;近七天统计;平台动作按调用方租户隔离,只反映当前调用方的调用,不是平台全局统计。 不接受额外字段。 |
| data[].stats_7d.calls | number | 必填 / 必有;近七天内对该动作的调用次数,按小时汇总。 |
| data[].stats_7d.failures | number | 必填 / 必有;近七天内失败的调用次数。 |
| data[].stats_7d.p50_ms | null / number | 必填 / 必有;耗时中位数的近似上界,单位毫秒;正耗时向上归入 2 的幂分桶(9 ms → 16 ms),0 独立一桶;无有效耗时样本时为 null。 |
| data[].dependents | object | 必填 / 必有;引用该动作的脚本与工作流数量,口径为最新版本加草稿。 不接受额外字段。 |
| data[].dependents.scripts | number | 必填 / 必有;引用该动作的脚本数量。 |
| data[].dependents.workflows | number | 必填 / 必有;引用该动作的工作流数量。 |
| data[].archived_at | null / string | 必填 / 必有;归档时间;未归档为 null。归档后名字保留,不能复用。 |
| data[].created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 |
| data[].updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 |
| data[].current_revision | object | 必填 / 必有;列表使用的修订摘要:只含契约与运行位置,不含实现源码。 不接受额外字段。 |
| data[].current_revision.id | string | 必填 / 必有;修订 ID,前缀 actr_。 |
| data[].current_revision.implementation | object | 必填 / 必有;动作列表只返回 {kind, host},不含源码;动作详情返回完整 implementation。 不接受额外字段。 |
| data[].current_revision.implementation.kind | "code" / "container" / "shell" | 必填 / 必有;动作实现方式。code 为源码实现(目前仅 language=ts 可用);container 为容器镜像加命令,暂未开放;shell 为 shell 脚本,暂未开放。 |
| data[].current_revision.implementation.host | "builtin" / "isolate" / "sandbox" | 必填 / 必有;动作运行位置,发布时计算。builtin 为平台内置动作;isolate 为在隔离的 Worker isolate 中运行用户代码;sandbox 为在沙箱中运行(container 与 shell 实现)。 |
| data[].current_revision.host | "builtin" / "isolate" / "sandbox" | 必填 / 必有;动作运行位置,发布时计算。builtin 为平台内置动作;isolate 为在隔离的 Worker isolate 中运行用户代码;sandbox 为在沙箱中运行(container 与 shell 实现)。 |
| data[].current_revision.input_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| data[].current_revision.input_schema.*(分支5) | object | 递归 JSON 值。 |
| data[].current_revision.input_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[].current_revision.output_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| data[].current_revision.output_schema.*(分支5) | object | 递归 JSON 值。 |
| data[].current_revision.output_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[].current_revision.created_at | string | 必填 / 必有;该修订的创建时间(RFC 3339 UTC)。 |
| next_cursor | null / string | 必填 / 必有;下一页游标,原样传给 cursor 参数并保持原查询条件;没有更多页为 null。接口不返回总数。 |
HTTP 200
{
"data": [
{
"id": "act_00mv67loz4fe4f27bdf89346c885b3a28b2038c091",
"owner": "tnt_3a9759864ccb4e00",
"namespace": "docs-samples",
"name": "sample-action-1791867412840-b05e8a",
"description": "",
"labels": {},
"builtin": false,
"archived_at": null,
"created_at": "2026-10-13T04:57:09.039Z",
"updated_at": "2026-10-13T04:57:09.039Z",
"current_revision": {
"id": "actr_00mv67loz3e46938b8ecf54e57b8f31297df016a1c",
"implementation": {
"kind": "code",
"host": "isolate"
},
"host": "isolate",
"input_schema": {
"type": "object",
"properties": {
"n": {
"type": "number"
}
},
"required": [
"n"
],
"additionalProperties": false
},
"output_schema": {
"type": "object",
"properties": {
"answer": {
"type": "number"
}
},
"required": [
"answer"
],
"additionalProperties": false
},
"created_at": "2026-10-13T04:57:09.039Z"
},
"stats_7d": {
"calls": 0,
"failures": 0,
"p50_ms": null
},
"dependents": {
"scripts": 0,
"workflows": 0
}
}
],
"next_cursor": null
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
创建动作定义和首个修订,名称折叠为小写;同租户重名返回 NAME_TAKEN,praxis 命名空间只读。
POST /automation/v1/actions
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| header: Idempotency-Key | string | 可选;可选;1–256 字符。24 小时内同一 key 重放首个响应并带 Idempotent-Replayed: true;同 key 不同请求体返回 422;处理中返回 409。 minLength: 1;maxLength: 256 |
不接受额外字段。
| 字段 | 类型 | 说明 |
|---|---|---|
| namespace | string | 必填 / 必有;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9.-]{0,63};praxis 只读。 pattern: "^[a-zA-Z0-9][a-zA-Z0-9.-]{0,63}$" |
| name | string | 必填 / 必有;名称,存储前转为小写,格式 [a-z0-9][a-z0-9.-]{0,63}。 pattern: "^[a-zA-Z0-9][a-zA-Z0-9.-]{0,63}$" |
| description | string | 可选;说明,最多 1000 个字符。 maxLength: 1000 |
| input_schema | object | 必填 / 必有;输入 JSON Schema;更新时只能放宽已接受的输入。 |
| input_schema.(分支5). | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| input_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output_schema | object | 必填 / 必有;输出 JSON Schema;更新时只能收紧输出约束。 |
| output_schema.(分支5). | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| errors | object[] | 可选;声明的错误类型与说明;更新时不能删除已有错误。 |
| errors[].type | string | 必填 / 必有;错误类型:稳定的 URI,或 Open Workflow 标准类型(如 validation、timeout、communication、runtime)。 |
| errors[].code | string | 可选;可选的稳定错误码,供调用方按码分支处理。 |
| errors[].description | string | 必填 / 必有;该错误的含义与触发条件,面向调用方阅读。 |
| annotations | object | 可选;read_only 与 idempotent 为布尔值,缺省均为 false。 不接受额外字段。 |
| annotations.read_only | boolean | 可选;true 表示动作不修改外部状态,只读取数据。默认 false。 |
| annotations.idempotent | boolean | 可选;true 表示同一输入重复调用与调用一次效果相同;此类动作的重试使用同一幂等键(run_id 加步骤路径,不含尝试次数)。默认 false。 |
| timeout_ms | number | 可选;正整数毫秒;当前 code 默认且最多 30000,container/shell 暂未开放。 |
| implementation | object / object / object | 必填 / 必有;实现:code 使用 language=ts 与 source;container(image、command)和 shell(script)暂未开放,创建或更新时返回 OPERATION_NOT_SUPPORTED。 |
| implementation(分支1).kind | "code" | 必填 / 必有;固定为 code:以源码实现。 |
| implementation(分支1).language | "ts" | 必填 / 必有;源码语言,目前只支持 ts(TypeScript)。 |
| implementation(分支1).source | string | 必填 / 必有;动作的完整 TypeScript 源码。 |
| implementation(分支2).kind | "container" | 必填 / 必有;固定为 container:以容器镜像实现(暂未开放,返回 OPERATION_NOT_SUPPORTED)。 |
| implementation(分支2).image | string | 必填 / 必有;容器镜像引用。 |
| implementation(分支2).command | string[] | 必填 / 必有;在容器中执行的命令及参数列表。 |
| implementation(分支3).kind | "shell" | 必填 / 必有;固定为 shell:以 shell 脚本实现(暂未开放,返回 OPERATION_NOT_SUPPORTED)。 |
| implementation(分支3).script | string | 必填 / 必有;要执行的 shell 脚本全文。 |
| labels | object | 可选;最多 50 个标签;键为 1–40 个字符,值最多 500 个字符。 |
| message | string | 可选;本次修订的说明。 |
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/actions" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"namespace": "docs-samples",
"name": "sample-action",
"input_schema": {
"type": "object",
"properties": {
"n": {
"type": "number"
}
},
"required": [
"n"
],
"additionalProperties": false
},
"output_schema": {
"type": "object",
"properties": {
"answer": {
"type": "number"
}
},
"required": [
"answer"
],
"additionalProperties": false
},
"implementation": {
"kind": "code",
"language": "ts",
"source": "export default async (input: { n: number }) => ({ answer: input.n + 1 });"
}
}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.actions.create({
"body": {
"namespace": "docs-samples",
"name": "sample-action",
"input_schema": {
"type": "object",
"properties": {
"n": {
"type": "number"
}
},
"required": [
"n"
],
"additionalProperties": false
},
"output_schema": {
"type": "object",
"properties": {
"answer": {
"type": "number"
}
},
"required": [
"answer"
],
"additionalProperties": false
},
"implementation": {
"kind": "code",
"language": "ts",
"source": "export default async (input: { n: number }) => ({ answer: input.n + 1 });"
}
}
});
console.log(result);Success
| 响应头 | 类型 | 说明 |
|---|---|---|
| Idempotent-Replayed | boolean | Present and true when replaying the first response for this key. |
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;动作 ID,前缀 act_;日常调用使用 namespace 与 name,而不是 id。 |
| namespace | string | 必填 / 必有;动作命名空间;平台动作为 praxis,裸名引用解析到 praxis。 |
| name | string | 必填 / 必有;动作名,与 namespace 一起唯一标识动作;小写字母、数字、点、下划线、连字符,最长 64 字符。 |
| description | string | 必填 / 必有;动作说明,最多 1000 字符。 |
| labels | object | 必填 / 必有;用户自定义标签:字符串键值对,用于分类与列表过滤(labels[key]=value);键不能以 praxis. 开头。 |
| owner | string | 必填 / 必有;动作所属租户,由网关注入;按不透明字符串处理。 |
| builtin | boolean | 必填 / 必有;true 表示平台内置动作(命名空间 praxis);用户创建的动作为 false。 |
| current_revision | object | 必填 / 必有;动作的一个不可变修订:契约、实现和运行参数的快照。每次更新兼容的内容变化都会产生新修订。 不接受额外字段。 |
| current_revision.id | string | 必填 / 必有;修订 ID,前缀 actr_;仅用于展示与回滚(rollback 的 revision),不能被脚本直接引用。 |
| current_revision.digest | string | 必填 / 必有;契约与实现的内容摘要;内容相同的更新不会产生新修订。 |
| current_revision.input_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| current_revision.input_schema.*(分支5) | object | 递归 JSON 值。 |
| current_revision.input_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| current_revision.output_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| current_revision.output_schema.*(分支5) | object | 递归 JSON 值。 |
| current_revision.output_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| current_revision.errors | object[] | 必填 / 必有;动作声明的可能错误列表,每项含 type、code、description。 |
| current_revision.errors[].type | string | 必填 / 必有;错误类型:稳定的 URI,或 Open Workflow 标准类型(如 validation、timeout、communication、runtime)。 |
| current_revision.errors[].code | string | 可选;可选的稳定错误码,供调用方按码分支处理。 |
| current_revision.errors[].description | string | 必填 / 必有;该错误的含义与触发条件,面向调用方阅读。 |
| current_revision.annotations | object | 必填 / 必有;动作行为声明 {read_only, idempotent};创建时未给出的键默认为 false。 不接受额外字段。 |
| current_revision.annotations.read_only | boolean | 必填 / 必有;true 表示动作不修改外部状态,只读取数据。 |
| current_revision.annotations.idempotent | boolean | 必填 / 必有;true 表示同一输入重复调用与调用一次效果相同;此类动作的重试使用同一幂等键(run_id 加步骤路径,不含尝试次数)。 |
| current_revision.timeout_ms | number | 必填 / 必有;单次执行的超时毫秒数;创建时未给出,code 实现默认 30000,容器或 shell 实现默认 600000。 |
| current_revision.implementation | object / object / object | 必填 / 必有;code 使用 language=ts 与 source。container 和 shell 暂未开放,创建时返回 OPERATION_NOT_SUPPORTED。 |
| current_revision.implementation(分支1).kind | "code" | 必填 / 必有;固定为 code:以源码实现。 |
| current_revision.implementation(分支1).language | "ts" | 必填 / 必有;源码语言,目前只支持 ts(TypeScript)。 |
| current_revision.implementation(分支1).source | string | 必填 / 必有;动作的完整 TypeScript 源码;内置动作为空。 |
| current_revision.implementation(分支2).kind | "container" | 必填 / 必有;固定为 container:以容器镜像实现(暂未开放)。 |
| current_revision.implementation(分支2).image | string | 必填 / 必有;容器镜像引用。 |
| current_revision.implementation(分支2).command | string[] | 必填 / 必有;在容器中执行的命令及参数列表。 |
| current_revision.implementation(分支3).kind | "shell" | 必填 / 必有;固定为 shell:以 shell 脚本实现(暂未开放)。 |
| current_revision.implementation(分支3).script | string | 必填 / 必有;要执行的 shell 脚本全文。 |
| current_revision.host | "builtin" / "isolate" / "sandbox" | 必填 / 必有;动作运行位置,发布时计算。builtin 为平台内置动作;isolate 为在隔离的 Worker isolate 中运行用户代码;sandbox 为在沙箱中运行(container 与 shell 实现)。 |
| current_revision.platform_apis | string[] | 必填 / 必有;从代码推导出的平台 API 集合,同时是该动作运行令牌的权限范围(最小权限)。 |
| current_revision.created_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| current_revision.created_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| current_revision.created_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| current_revision.message | null / string | 必填 / 必有;创建该修订时附带的说明;未提供为 null。 |
| current_revision.created_at | string | 必填 / 必有;该修订的创建时间(RFC 3339 UTC)。 |
| stats_7d | object | 必填 / 必有;近七天统计;平台动作按调用方租户隔离,只反映当前调用方的调用,不是平台全局统计。 不接受额外字段。 |
| stats_7d.calls | number | 必填 / 必有;近七天内对该动作的调用次数,按小时汇总。 |
| stats_7d.failures | number | 必填 / 必有;近七天内失败的调用次数。 |
| stats_7d.p50_ms | null / number | 必填 / 必有;耗时中位数的近似上界,单位毫秒;正耗时向上归入 2 的幂分桶(9 ms → 16 ms),0 独立一桶;无有效耗时样本时为 null。 |
| dependents | object | 必填 / 必有;引用该动作的脚本与工作流数量,口径为最新版本加草稿。 不接受额外字段。 |
| dependents.scripts | number | 必填 / 必有;引用该动作的脚本数量。 |
| dependents.workflows | number | 必填 / 必有;引用该动作的工作流数量。 |
| archived_at | null / string | 必填 / 必有;归档时间;未归档为 null。归档后名字保留,不能复用。 |
| created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 |
| updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 |
HTTP 200
{
"id": "act_00mv67loz4fe4f27bdf89346c885b3a28b2038c091",
"owner": "tnt_3a9759864ccb4e00",
"namespace": "docs-samples",
"name": "sample-action-1791867412840-b05e8a",
"description": "",
"labels": {},
"builtin": false,
"current_revision": {
"input_schema": {
"type": "object",
"properties": {
"n": {
"type": "number"
}
},
"required": [
"n"
],
"additionalProperties": false
},
"output_schema": {
"type": "object",
"properties": {
"answer": {
"type": "number"
}
},
"required": [
"answer"
],
"additionalProperties": false
},
"errors": [],
"annotations": {
"read_only": false,
"idempotent": false
},
"timeout_ms": 30000,
"implementation": {
"kind": "code",
"language": "ts",
"source": "export default async (input: { n: number }) => ({ answer: input.n + 1 });"
},
"host": "isolate",
"platform_apis": [],
"id": "actr_00mv67loz3e46938b8ecf54e57b8f31297df016a1c",
"digest": "e35c209873c60486ca8da455878062cb7ea572a6147ce3ca03e0693b4769fa45",
"created_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"message": null,
"created_at": "2026-10-13T04:57:09.039Z"
},
"stats_7d": {
"calls": 0,
"failures": 0,
"p50_ms": null
},
"dependents": {
"scripts": 0,
"workflows": 0
},
"archived_at": null,
"created_at": "2026-10-13T04:57:09.039Z",
"updated_at": "2026-10-13T04:57:09.039Z"
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 INPUT_INVALID:输入不满足目标契约或业务校验。 |
| 403 | NAMESPACE_FORBIDDEN:命名空间只读或运行令牌不允许此调用。 |
| 409 | IDEMPOTENCY_IN_FLIGHT:同一幂等键的请求仍在处理中。 NAME_TAKEN:名称已被同一租户占用。 |
| 413 | PAYLOAD_TOO_LARGE:请求内容超过本操作允许的大小。 |
| 422 | IDEMPOTENCY_KEY_MISMATCH:同一幂等键已用于不同请求内容。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
读取动作及当前修订的完整实现;响应 ETag 是当前修订 ID,可用于更新时的 If-Match。
GET /automation/v1/actions/{ns}/{name}
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| ACTION_NAME | 创建动作返回的 name |
: "${ACTION_NAME:?Set ACTION_NAME}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/actions/docs-samples/${ACTION_NAME}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.actions.retrieve({
"path": {
"ns": "docs-samples",
"name": env("ACTION_NAME")
}
});
console.log(result);Success
| 响应头 | 类型 | 说明 |
|---|---|---|
| ETag | string | Current resource revision for conditional updates. |
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;动作 ID,前缀 act_;日常调用使用 namespace 与 name,而不是 id。 |
| namespace | string | 必填 / 必有;动作命名空间;平台动作为 praxis,裸名引用解析到 praxis。 |
| name | string | 必填 / 必有;动作名,与 namespace 一起唯一标识动作;小写字母、数字、点、下划线、连字符,最长 64 字符。 |
| description | string | 必填 / 必有;动作说明,最多 1000 字符。 |
| labels | object | 必填 / 必有;用户自定义标签:字符串键值对,用于分类与列表过滤(labels[key]=value);键不能以 praxis. 开头。 |
| owner | string | 必填 / 必有;动作所属租户,由网关注入;按不透明字符串处理。 |
| builtin | boolean | 必填 / 必有;true 表示平台内置动作(命名空间 praxis);用户创建的动作为 false。 |
| current_revision | object | 必填 / 必有;动作的一个不可变修订:契约、实现和运行参数的快照。每次更新兼容的内容变化都会产生新修订。 不接受额外字段。 |
| current_revision.id | string | 必填 / 必有;修订 ID,前缀 actr_;仅用于展示与回滚(rollback 的 revision),不能被脚本直接引用。 |
| current_revision.digest | string | 必填 / 必有;契约与实现的内容摘要;内容相同的更新不会产生新修订。 |
| current_revision.input_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| current_revision.input_schema.*(分支5) | object | 递归 JSON 值。 |
| current_revision.input_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| current_revision.output_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| current_revision.output_schema.*(分支5) | object | 递归 JSON 值。 |
| current_revision.output_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| current_revision.errors | object[] | 必填 / 必有;动作声明的可能错误列表,每项含 type、code、description。 |
| current_revision.errors[].type | string | 必填 / 必有;错误类型:稳定的 URI,或 Open Workflow 标准类型(如 validation、timeout、communication、runtime)。 |
| current_revision.errors[].code | string | 可选;可选的稳定错误码,供调用方按码分支处理。 |
| current_revision.errors[].description | string | 必填 / 必有;该错误的含义与触发条件,面向调用方阅读。 |
| current_revision.annotations | object | 必填 / 必有;动作行为声明 {read_only, idempotent};创建时未给出的键默认为 false。 不接受额外字段。 |
| current_revision.annotations.read_only | boolean | 必填 / 必有;true 表示动作不修改外部状态,只读取数据。 |
| current_revision.annotations.idempotent | boolean | 必填 / 必有;true 表示同一输入重复调用与调用一次效果相同;此类动作的重试使用同一幂等键(run_id 加步骤路径,不含尝试次数)。 |
| current_revision.timeout_ms | number | 必填 / 必有;单次执行的超时毫秒数;创建时未给出,code 实现默认 30000,容器或 shell 实现默认 600000。 |
| current_revision.implementation | object / object / object | 必填 / 必有;code 使用 language=ts 与 source。container 和 shell 暂未开放,创建时返回 OPERATION_NOT_SUPPORTED。 |
| current_revision.implementation(分支1).kind | "code" | 必填 / 必有;固定为 code:以源码实现。 |
| current_revision.implementation(分支1).language | "ts" | 必填 / 必有;源码语言,目前只支持 ts(TypeScript)。 |
| current_revision.implementation(分支1).source | string | 必填 / 必有;动作的完整 TypeScript 源码;内置动作为空。 |
| current_revision.implementation(分支2).kind | "container" | 必填 / 必有;固定为 container:以容器镜像实现(暂未开放)。 |
| current_revision.implementation(分支2).image | string | 必填 / 必有;容器镜像引用。 |
| current_revision.implementation(分支2).command | string[] | 必填 / 必有;在容器中执行的命令及参数列表。 |
| current_revision.implementation(分支3).kind | "shell" | 必填 / 必有;固定为 shell:以 shell 脚本实现(暂未开放)。 |
| current_revision.implementation(分支3).script | string | 必填 / 必有;要执行的 shell 脚本全文。 |
| current_revision.host | "builtin" / "isolate" / "sandbox" | 必填 / 必有;动作运行位置,发布时计算。builtin 为平台内置动作;isolate 为在隔离的 Worker isolate 中运行用户代码;sandbox 为在沙箱中运行(container 与 shell 实现)。 |
| current_revision.platform_apis | string[] | 必填 / 必有;从代码推导出的平台 API 集合,同时是该动作运行令牌的权限范围(最小权限)。 |
| current_revision.created_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| current_revision.created_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| current_revision.created_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| current_revision.message | null / string | 必填 / 必有;创建该修订时附带的说明;未提供为 null。 |
| current_revision.created_at | string | 必填 / 必有;该修订的创建时间(RFC 3339 UTC)。 |
| stats_7d | object | 必填 / 必有;近七天统计;平台动作按调用方租户隔离,只反映当前调用方的调用,不是平台全局统计。 不接受额外字段。 |
| stats_7d.calls | number | 必填 / 必有;近七天内对该动作的调用次数,按小时汇总。 |
| stats_7d.failures | number | 必填 / 必有;近七天内失败的调用次数。 |
| stats_7d.p50_ms | null / number | 必填 / 必有;耗时中位数的近似上界,单位毫秒;正耗时向上归入 2 的幂分桶(9 ms → 16 ms),0 独立一桶;无有效耗时样本时为 null。 |
| dependents | object | 必填 / 必有;引用该动作的脚本与工作流数量,口径为最新版本加草稿。 不接受额外字段。 |
| dependents.scripts | number | 必填 / 必有;引用该动作的脚本数量。 |
| dependents.workflows | number | 必填 / 必有;引用该动作的工作流数量。 |
| archived_at | null / string | 必填 / 必有;归档时间;未归档为 null。归档后名字保留,不能复用。 |
| created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 |
| updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 |
HTTP 200
{
"id": "act_00mv67loz4fe4f27bdf89346c885b3a28b2038c091",
"owner": "tnt_3a9759864ccb4e00",
"namespace": "docs-samples",
"name": "sample-action-1791867412840-b05e8a",
"description": "",
"labels": {},
"builtin": false,
"archived_at": null,
"created_at": "2026-10-13T04:57:09.039Z",
"updated_at": "2026-10-13T04:57:09.039Z",
"current_revision": {
"id": "actr_00mv67loz3e46938b8ecf54e57b8f31297df016a1c",
"digest": "e35c209873c60486ca8da455878062cb7ea572a6147ce3ca03e0693b4769fa45",
"input_schema": {
"type": "object",
"properties": {
"n": {
"type": "number"
}
},
"required": [
"n"
],
"additionalProperties": false
},
"output_schema": {
"type": "object",
"properties": {
"answer": {
"type": "number"
}
},
"required": [
"answer"
],
"additionalProperties": false
},
"errors": [],
"annotations": {
"read_only": false,
"idempotent": false
},
"timeout_ms": 30000,
"implementation": {
"kind": "code",
"language": "ts",
"source": "export default async (input: { n: number }) => ({ answer: input.n + 1 });"
},
"host": "isolate",
"platform_apis": [],
"created_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"message": null,
"created_at": "2026-10-13T04:57:09.039Z"
},
"stats_7d": {
"calls": 0,
"failures": 0,
"p50_ms": null
},
"dependents": {
"scripts": 0,
"workflows": 0
}
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | ACTION_NOT_FOUND:动作不存在或当前租户不可见;同名脚本/工作流存在时,hint 指向相应接口。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
检查当前和最近五个历史修订的兼容性后更新。输入放宽、输出收紧为兼容,包括长度、条目数、属性数、type(integer/number)与 multipleOf(输入新因子可整除旧因子,输出相反)。dry_run=true 仅返回 CompatResult,可不带 If-Match;带了仍校验,* 匹配任何当前存在的表示。正常更新必须带 If-Match,返回 ActionDef 与 ETag;预检不返回 ETag。省略的可选字段保持原值仅适用于 description、labels;errors 默认 [],annotations 未提供的键默认 false,timeout_ms 默认 30000,message 默认 null。 正常更新不兼容时返回 422 SCHEMA_INCOMPATIBLE 与 issues;内容未变则保留现有修订。
PUT /automation/v1/actions/{ns}/{name}
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
| query: dry_run | boolean | 可选;true 仅检查兼容性,不落库,可省略 If-Match;省略或 false 正常更新。 |
| header: If-Match | string | 可选;正常更新必填;dry_run=true 可省略,提供时仍校验。* 匹配任何当前存在的表示;也可提供当前修订 ETag。 |
不接受额外字段。
| 字段 | 类型 | 说明 |
|---|---|---|
| description | string | 可选;说明,最多 1000 个字符。 maxLength: 1000 |
| labels | object | 可选;最多 50 个标签;键为 1–40 个字符,值最多 500 个字符。 |
| input_schema | object | 必填 / 必有;输入 JSON Schema;更新时只能放宽已接受的输入。 |
| input_schema.(分支5). | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| input_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output_schema | object | 必填 / 必有;输出 JSON Schema;更新时只能收紧输出约束。 |
| output_schema.(分支5). | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| errors | object[] | 可选;声明的错误类型与说明;更新时不能删除已有错误。 |
| errors[].type | string | 必填 / 必有;错误类型:稳定的 URI,或 Open Workflow 标准类型(如 validation、timeout、communication、runtime)。 |
| errors[].code | string | 可选;可选的稳定错误码,供调用方按码分支处理。 |
| errors[].description | string | 必填 / 必有;该错误的含义与触发条件,面向调用方阅读。 |
| annotations | object | 可选;read_only 与 idempotent 为布尔值,缺省均为 false。 不接受额外字段。 |
| annotations.read_only | boolean | 可选;true 表示动作不修改外部状态,只读取数据。默认 false。 |
| annotations.idempotent | boolean | 可选;true 表示同一输入重复调用与调用一次效果相同;此类动作的重试使用同一幂等键(run_id 加步骤路径,不含尝试次数)。默认 false。 |
| timeout_ms | number | 可选;正整数毫秒;当前 code 默认且最多 30000,container/shell 暂未开放。 |
| implementation | object / object / object | 必填 / 必有;实现:code 使用 language=ts 与 source;container(image、command)和 shell(script)暂未开放,创建或更新时返回 OPERATION_NOT_SUPPORTED。 |
| implementation(分支1).kind | "code" | 必填 / 必有;固定为 code:以源码实现。 |
| implementation(分支1).language | "ts" | 必填 / 必有;源码语言,目前只支持 ts(TypeScript)。 |
| implementation(分支1).source | string | 必填 / 必有;动作的完整 TypeScript 源码。 |
| implementation(分支2).kind | "container" | 必填 / 必有;固定为 container:以容器镜像实现(暂未开放,返回 OPERATION_NOT_SUPPORTED)。 |
| implementation(分支2).image | string | 必填 / 必有;容器镜像引用。 |
| implementation(分支2).command | string[] | 必填 / 必有;在容器中执行的命令及参数列表。 |
| implementation(分支3).kind | "shell" | 必填 / 必有;固定为 shell:以 shell 脚本实现(暂未开放,返回 OPERATION_NOT_SUPPORTED)。 |
| implementation(分支3).script | string | 必填 / 必有;要执行的 shell 脚本全文。 |
| message | string | 可选;本次修订的说明。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| ACTION_NAME | 创建动作返回的 name |
| ETAG | 最新 GET 响应头 ETag(保留引号) |
: "${ACTION_NAME:?Set ACTION_NAME}"
: "${ETAG:?Set ETAG}"
curl --fail-with-body -X PUT "https://api.deepraxis.ai/automation/v1/actions/docs-samples/${ACTION_NAME}" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "If-Match: ${ETAG}" \
-H "Content-Type: application/json" \
--data '{
"input_schema": {
"type": "object",
"properties": {
"n": {
"type": "number"
}
},
"required": [
"n"
],
"additionalProperties": false
},
"output_schema": {
"type": "object",
"properties": {
"answer": {
"type": "number"
}
},
"required": [
"answer"
],
"additionalProperties": false
},
"implementation": {
"kind": "code",
"language": "ts",
"source": "export default async (input: { n: number }) => ({ answer: input.n + 1 });"
},
"message": "Sample revision"
}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.actions.update({
"path": {
"ns": "docs-samples",
"name": env("ACTION_NAME")
},
"headers": {
"If-Match": env("ETAG")
},
"body": {
"input_schema": {
"type": "object",
"properties": {
"n": {
"type": "number"
}
},
"required": [
"n"
],
"additionalProperties": false
},
"output_schema": {
"type": "object",
"properties": {
"answer": {
"type": "number"
}
},
"required": [
"answer"
],
"additionalProperties": false
},
"implementation": {
"kind": "code",
"language": "ts",
"source": "export default async (input: { n: number }) => ({ answer: input.n + 1 });"
},
"message": "Sample revision"
}
});
console.log(result);Success
| 响应头 | 类型 | 说明 |
|---|---|---|
| ETag | string | Current revision returned only for normal updates; absent for dry_run=true. |
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| (分支1).id | string | 必填 / 必有;动作 ID,前缀 act_;日常调用使用 namespace 与 name,而不是 id。 |
| (分支1).namespace | string | 必填 / 必有;动作命名空间;平台动作为 praxis,裸名引用解析到 praxis。 |
| (分支1).name | string | 必填 / 必有;动作名,与 namespace 一起唯一标识动作;小写字母、数字、点、下划线、连字符,最长 64 字符。 |
| (分支1).description | string | 必填 / 必有;动作说明,最多 1000 字符。 |
| (分支1).labels | object | 必填 / 必有;用户自定义标签:字符串键值对,用于分类与列表过滤(labels[key]=value);键不能以 praxis. 开头。 |
| (分支1).owner | string | 必填 / 必有;动作所属租户,由网关注入;按不透明字符串处理。 |
| (分支1).builtin | boolean | 必填 / 必有;true 表示平台内置动作(命名空间 praxis);用户创建的动作为 false。 |
| (分支1).current_revision | object | 必填 / 必有;动作的一个不可变修订:契约、实现和运行参数的快照。每次更新兼容的内容变化都会产生新修订。 不接受额外字段。 |
| (分支1).current_revision.id | string | 必填 / 必有;修订 ID,前缀 actr_;仅用于展示与回滚(rollback 的 revision),不能被脚本直接引用。 |
| (分支1).current_revision.digest | string | 必填 / 必有;契约与实现的内容摘要;内容相同的更新不会产生新修订。 |
| (分支1).current_revision.input_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| (分支1).current_revision.input_schema.*(分支5) | object | 递归 JSON 值。 |
| (分支1).current_revision.input_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| (分支1).current_revision.output_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| (分支1).current_revision.output_schema.*(分支5) | object | 递归 JSON 值。 |
| (分支1).current_revision.output_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| (分支1).current_revision.errors | object[] | 必填 / 必有;动作声明的可能错误列表,每项含 type、code、description。 |
| (分支1).current_revision.errors[].type | string | 必填 / 必有;错误类型:稳定的 URI,或 Open Workflow 标准类型(如 validation、timeout、communication、runtime)。 |
| (分支1).current_revision.errors[].code | string | 可选;可选的稳定错误码,供调用方按码分支处理。 |
| (分支1).current_revision.errors[].description | string | 必填 / 必有;该错误的含义与触发条件,面向调用方阅读。 |
| (分支1).current_revision.annotations | object | 必填 / 必有;动作行为声明 {read_only, idempotent};创建时未给出的键默认为 false。 不接受额外字段。 |
| (分支1).current_revision.annotations.read_only | boolean | 必填 / 必有;true 表示动作不修改外部状态,只读取数据。 |
| (分支1).current_revision.annotations.idempotent | boolean | 必填 / 必有;true 表示同一输入重复调用与调用一次效果相同;此类动作的重试使用同一幂等键(run_id 加步骤路径,不含尝试次数)。 |
| (分支1).current_revision.timeout_ms | number | 必填 / 必有;单次执行的超时毫秒数;创建时未给出,code 实现默认 30000,容器或 shell 实现默认 600000。 |
| (分支1).current_revision.implementation | object / object / object | 必填 / 必有;code 使用 language=ts 与 source。container 和 shell 暂未开放,创建时返回 OPERATION_NOT_SUPPORTED。 |
| (分支1).current_revision.implementation(分支1).kind | "code" | 必填 / 必有;固定为 code:以源码实现。 |
| (分支1).current_revision.implementation(分支1).language | "ts" | 必填 / 必有;源码语言,目前只支持 ts(TypeScript)。 |
| (分支1).current_revision.implementation(分支1).source | string | 必填 / 必有;动作的完整 TypeScript 源码;内置动作为空。 |
| (分支1).current_revision.implementation(分支2).kind | "container" | 必填 / 必有;固定为 container:以容器镜像实现(暂未开放)。 |
| (分支1).current_revision.implementation(分支2).image | string | 必填 / 必有;容器镜像引用。 |
| (分支1).current_revision.implementation(分支2).command | string[] | 必填 / 必有;在容器中执行的命令及参数列表。 |
| (分支1).current_revision.implementation(分支3).kind | "shell" | 必填 / 必有;固定为 shell:以 shell 脚本实现(暂未开放)。 |
| (分支1).current_revision.implementation(分支3).script | string | 必填 / 必有;要执行的 shell 脚本全文。 |
| (分支1).current_revision.host | "builtin" / "isolate" / "sandbox" | 必填 / 必有;动作运行位置,发布时计算。builtin 为平台内置动作;isolate 为在隔离的 Worker isolate 中运行用户代码;sandbox 为在沙箱中运行(container 与 shell 实现)。 |
| (分支1).current_revision.platform_apis | string[] | 必填 / 必有;从代码推导出的平台 API 集合,同时是该动作运行令牌的权限范围(最小权限)。 |
| (分支1).current_revision.created_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| (分支1).current_revision.created_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| (分支1).current_revision.created_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| (分支1).current_revision.message | null / string | 必填 / 必有;创建该修订时附带的说明;未提供为 null。 |
| (分支1).current_revision.created_at | string | 必填 / 必有;该修订的创建时间(RFC 3339 UTC)。 |
| (分支1).stats_7d | object | 必填 / 必有;近七天统计;平台动作按调用方租户隔离,只反映当前调用方的调用,不是平台全局统计。 不接受额外字段。 |
| (分支1).stats_7d.calls | number | 必填 / 必有;近七天内对该动作的调用次数,按小时汇总。 |
| (分支1).stats_7d.failures | number | 必填 / 必有;近七天内失败的调用次数。 |
| (分支1).stats_7d.p50_ms | null / number | 必填 / 必有;耗时中位数的近似上界,单位毫秒;正耗时向上归入 2 的幂分桶(9 ms → 16 ms),0 独立一桶;无有效耗时样本时为 null。 |
| (分支1).dependents | object | 必填 / 必有;引用该动作的脚本与工作流数量,口径为最新版本加草稿。 不接受额外字段。 |
| (分支1).dependents.scripts | number | 必填 / 必有;引用该动作的脚本数量。 |
| (分支1).dependents.workflows | number | 必填 / 必有;引用该动作的工作流数量。 |
| (分支1).archived_at | null / string | 必填 / 必有;归档时间;未归档为 null。归档后名字保留,不能复用。 |
| (分支1).created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 |
| (分支1).updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 |
| (分支2)(分支1).compatible | true | 必填 / 必有;固定为 true:新契约与当前及最近五个历史修订兼容。 |
| (分支2)(分支2).compatible | false | 必填 / 必有;固定为 false:新契约至少在一处与历史修订不兼容。 |
| (分支2)(分支2).issues | object[] | 必填 / 必有;全部不兼容之处,每项含 pointer 与 reason。 |
| (分支2)(分支2).issues[].pointer | string | 必填 / 必有;不兼容位置的 JSON Pointer(RFC 6901),相对于动作的 input_schema 或 output_schema。 |
| (分支2)(分支2).issues[].reason | string | 必填 / 必有;该位置为何与历史修订不兼容(输入应放宽、输出应收紧)。 |
HTTP 200
{
"id": "act_00mv67loz4fe4f27bdf89346c885b3a28b2038c091",
"owner": "tnt_3a9759864ccb4e00",
"namespace": "docs-samples",
"name": "sample-action-1791867412840-b05e8a",
"description": "",
"labels": {},
"builtin": false,
"archived_at": null,
"created_at": "2026-10-13T04:57:09.039Z",
"updated_at": "2026-10-13T04:57:12.709Z",
"current_revision": {
"input_schema": {
"type": "object",
"properties": {
"n": {
"type": "number"
}
},
"required": [
"n"
],
"additionalProperties": false
},
"output_schema": {
"type": "object",
"properties": {
"answer": {
"type": "number"
}
},
"required": [
"answer"
],
"additionalProperties": false
},
"errors": [],
"annotations": {
"read_only": false,
"idempotent": false
},
"timeout_ms": 30000,
"implementation": {
"kind": "code",
"language": "ts",
"source": "export default async (input: { n: number }) => ({ answer: input.n + 1 });"
},
"host": "isolate",
"platform_apis": [],
"id": "actr_00mv67lrt1370820a9daaa4fd3882332e4899a4c9e",
"digest": "e35c209873c60486ca8da455878062cb7ea572a6147ce3ca03e0693b4769fa45",
"created_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"message": "Sample revision",
"created_at": "2026-10-13T04:57:12.709Z"
},
"stats_7d": {
"calls": 0,
"failures": 0,
"p50_ms": null
},
"dependents": {
"scripts": 0,
"workflows": 0
}
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 INPUT_INVALID:输入不满足目标契约或业务校验。 |
| 403 | NAMESPACE_FORBIDDEN:命名空间只读或运行令牌不允许此调用。 |
| 404 | ACTION_NOT_FOUND:动作不存在或当前租户不可见;同名脚本/工作流存在时,hint 指向相应接口。 |
| 409 | TARGET_ARCHIVED:目标已归档,不能用于本操作;动作执行错误的 detail 包含 ns/name。 |
| 412 | PRECONDITION_FAILED:修订、源码摘要或并发写入条件不匹配。 |
| 413 | PAYLOAD_TOO_LARGE:请求内容超过本操作允许的大小。 |
| 422 | SCHEMA_INCOMPATIBLE:新动作契约与历史修订不兼容。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
按创建时间倒序列出修订。结果包含当前标记及通过兼容门回滚的可行性和原因。 默认不带源码;仅 expand=source 带完整源码,其它值返回 400。详情接口保持全文。
GET /automation/v1/actions/{ns}/{name}/revisions
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
| query: limit | integer | 可选;每页条数,整数 1–100,默认 20。 minimum: 1;maximum: 100 |
| query: cursor | string | 可选;上一页返回的 next_cursor,不透明字符串;保持原查询条件继续翻页。 |
| query: expand | "source" | 可选;仅接受 source;默认不带源码,其它值返回 400。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| ACTION_NAME | 创建动作返回的 name |
: "${ACTION_NAME:?Set ACTION_NAME}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/actions/docs-samples/${ACTION_NAME}/revisions" \
-H "Authorization: Bearer $PRAXIS_API_KEY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.actions.revisions.list({
"path": {
"ns": "docs-samples",
"name": env("ACTION_NAME")
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| data | object[] | 必填 / 必有;本页的动作修订(默认不含实现源码,expand=source 才带),按 created_at 倒序、id 倒序排列。 |
| data[].current | boolean | 必填 / 必有;true 表示这是动作当前生效的修订。 |
| data[].rollback | object | 必填 / 必有;回滚到该修订是否可行,由服务端对当前修订做兼容判定。 不接受额外字段。 |
| data[].rollback.allowed | boolean | 必填 / 必有;true 表示可以回滚到此修订;false 时 issues 说明原因。 |
| data[].rollback.issues | object[] | 必填 / 必有;回滚会产生的不兼容项,每项含 pointer 与 reason;allowed 为 true 时为空数组。 |
| data[].rollback.issues[].pointer | string | 必填 / 必有;不兼容位置的 JSON Pointer(RFC 6901),相对于动作的 input_schema 或 output_schema。 |
| data[].rollback.issues[].reason | string | 必填 / 必有;该位置为何与历史修订不兼容(输入应放宽、输出应收紧)。 |
| data[].id | string | 必填 / 必有;修订 ID,前缀 actr_;仅用于展示与回滚(rollback 的 revision),不能被脚本直接引用。 |
| data[].digest | string | 必填 / 必有;契约与实现的内容摘要;内容相同的更新不会产生新修订。 |
| data[].input_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| data[].input_schema.*(分支5) | object | 递归 JSON 值。 |
| data[].input_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[].output_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| data[].output_schema.*(分支5) | object | 递归 JSON 值。 |
| data[].output_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[].errors | object[] | 必填 / 必有;动作声明的可能错误列表,每项含 type、code、description。 |
| data[].errors[].type | string | 必填 / 必有;错误类型:稳定的 URI,或 Open Workflow 标准类型(如 validation、timeout、communication、runtime)。 |
| data[].errors[].code | string | 可选;可选的稳定错误码,供调用方按码分支处理。 |
| data[].errors[].description | string | 必填 / 必有;该错误的含义与触发条件,面向调用方阅读。 |
| data[].annotations | object | 必填 / 必有;动作行为声明 {read_only, idempotent};创建时未给出的键默认为 false。 不接受额外字段。 |
| data[].annotations.read_only | boolean | 必填 / 必有;true 表示动作不修改外部状态,只读取数据。 |
| data[].annotations.idempotent | boolean | 必填 / 必有;true 表示同一输入重复调用与调用一次效果相同;此类动作的重试使用同一幂等键(run_id 加步骤路径,不含尝试次数)。 |
| data[].timeout_ms | number | 必填 / 必有;单次执行的超时毫秒数;创建时未给出,code 实现默认 30000,容器或 shell 实现默认 600000。 |
| data[].implementation | object / object / object / object | 必填 / 必有;实现信息:完整实现,或仅含 kind;列表不返回源码,需源码用 expand=source 或读取单个修订。 |
| data[].implementation(分支1)(分支1).kind | "code" | 必填 / 必有;固定为 code:以源码实现。 |
| data[].implementation(分支1)(分支1).language | "ts" | 必填 / 必有;源码语言,目前只支持 ts(TypeScript)。 |
| data[].implementation(分支1)(分支1).source | string | 必填 / 必有;动作的完整 TypeScript 源码;内置动作为空。 |
| data[].implementation(分支1)(分支2).kind | "container" | 必填 / 必有;固定为 container:以容器镜像实现(暂未开放)。 |
| data[].implementation(分支1)(分支2).image | string | 必填 / 必有;容器镜像引用。 |
| data[].implementation(分支1)(分支2).command | string[] | 必填 / 必有;在容器中执行的命令及参数列表。 |
| data[].implementation(分支1)(分支3).kind | "shell" | 必填 / 必有;固定为 shell:以 shell 脚本实现(暂未开放)。 |
| data[].implementation(分支1)(分支3).script | string | 必填 / 必有;要执行的 shell 脚本全文。 |
| data[].implementation(分支2).kind | "code" / "container" / "shell" | 必填 / 必有;动作实现方式。code 为源码实现(目前仅 language=ts 可用);container 为容器镜像加命令,暂未开放;shell 为 shell 脚本,暂未开放。 |
| data[].host | "builtin" / "isolate" / "sandbox" | 必填 / 必有;动作运行位置,发布时计算。builtin 为平台内置动作;isolate 为在隔离的 Worker isolate 中运行用户代码;sandbox 为在沙箱中运行(container 与 shell 实现)。 |
| data[].platform_apis | string[] | 必填 / 必有;从代码推导出的平台 API 集合,同时是该动作运行令牌的权限范围(最小权限)。 |
| data[].created_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| data[].created_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| data[].created_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| data[].message | null / string | 必填 / 必有;创建该修订时附带的说明;未提供为 null。 |
| data[].created_at | string | 必填 / 必有;该修订的创建时间(RFC 3339 UTC)。 |
| next_cursor | null / string | 必填 / 必有;下一页游标,原样传给 cursor 参数并保持原查询条件;没有更多页为 null。接口不返回总数。 |
HTTP 200
{
"data": [
{
"id": "actr_00mv67lrt1370820a9daaa4fd3882332e4899a4c9e",
"digest": "e35c209873c60486ca8da455878062cb7ea572a6147ce3ca03e0693b4769fa45",
"input_schema": {
"type": "object",
"properties": {
"n": {
"type": "number"
}
},
"required": [
"n"
],
"additionalProperties": false
},
"output_schema": {
"type": "object",
"properties": {
"answer": {
"type": "number"
}
},
"required": [
"answer"
],
"additionalProperties": false
},
"errors": [],
"annotations": {
"read_only": false,
"idempotent": false
},
"timeout_ms": 30000,
"host": "isolate",
"platform_apis": [],
"created_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"message": "Sample revision",
"created_at": "2026-10-13T04:57:12.709Z",
"current": true,
"rollback": {
"allowed": true,
"issues": []
},
"implementation": {
"kind": "code"
}
},
{
"id": "actr_00mv67loz3e46938b8ecf54e57b8f31297df016a1c",
"digest": "e35c209873c60486ca8da455878062cb7ea572a6147ce3ca03e0693b4769fa45",
"input_schema": {
"type": "object",
"properties": {
"n": {
"type": "number"
}
},
"required": [
"n"
],
"additionalProperties": false
},
"output_schema": {
"type": "object",
"properties": {
"answer": {
"type": "number"
}
},
"required": [
"answer"
],
"additionalProperties": false
},
"errors": [],
"annotations": {
"read_only": false,
"idempotent": false
},
"timeout_ms": 30000,
"host": "isolate",
"platform_apis": [],
"created_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"message": null,
"created_at": "2026-10-13T04:57:09.039Z",
"current": false,
"rollback": {
"allowed": true,
"issues": []
},
"implementation": {
"kind": "code"
}
}
],
"next_cursor": null
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | ACTION_NOT_FOUND:动作不存在或当前租户不可见;同名脚本/工作流存在时,hint 指向相应接口。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
读取指定修订的完整实现及回滚兼容判定;修订不存在时返回 VERSION_NOT_FOUND。 详情始终返回完整源码。
GET /automation/v1/actions/{ns}/{name}/revisions/{revision}
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
| path: revision | string | 必填;动作修订 ID(actr_);查询参数用于筛选调用记录。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| ACTION_NAME | 创建动作返回的 name |
| REVISION_ID | 已有动作修订 id |
: "${ACTION_NAME:?Set ACTION_NAME}"
: "${REVISION_ID:?Set REVISION_ID}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/actions/docs-samples/${ACTION_NAME}/revisions/${REVISION_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.actions.revisions.retrieve({
"path": {
"ns": "docs-samples",
"name": env("ACTION_NAME"),
"revision": env("REVISION_ID")
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| current | boolean | 必填 / 必有;true 表示这是动作当前生效的修订。 |
| rollback | object | 必填 / 必有;回滚到该修订是否可行,由服务端对当前修订做兼容判定。 不接受额外字段。 |
| rollback.allowed | boolean | 必填 / 必有;true 表示可以回滚到此修订;false 时 issues 说明原因。 |
| rollback.issues | object[] | 必填 / 必有;回滚会产生的不兼容项,每项含 pointer 与 reason;allowed 为 true 时为空数组。 |
| rollback.issues[].pointer | string | 必填 / 必有;不兼容位置的 JSON Pointer(RFC 6901),相对于动作的 input_schema 或 output_schema。 |
| rollback.issues[].reason | string | 必填 / 必有;该位置为何与历史修订不兼容(输入应放宽、输出应收紧)。 |
| id | string | 必填 / 必有;修订 ID,前缀 actr_;仅用于展示与回滚(rollback 的 revision),不能被脚本直接引用。 |
| digest | string | 必填 / 必有;契约与实现的内容摘要;内容相同的更新不会产生新修订。 |
| input_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| input_schema.*(分支5) | object | 递归 JSON 值。 |
| input_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| output_schema.*(分支5) | object | 递归 JSON 值。 |
| output_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| errors | object[] | 必填 / 必有;动作声明的可能错误列表,每项含 type、code、description。 |
| errors[].type | string | 必填 / 必有;错误类型:稳定的 URI,或 Open Workflow 标准类型(如 validation、timeout、communication、runtime)。 |
| errors[].code | string | 可选;可选的稳定错误码,供调用方按码分支处理。 |
| errors[].description | string | 必填 / 必有;该错误的含义与触发条件,面向调用方阅读。 |
| annotations | object | 必填 / 必有;动作行为声明 {read_only, idempotent};创建时未给出的键默认为 false。 不接受额外字段。 |
| annotations.read_only | boolean | 必填 / 必有;true 表示动作不修改外部状态,只读取数据。 |
| annotations.idempotent | boolean | 必填 / 必有;true 表示同一输入重复调用与调用一次效果相同;此类动作的重试使用同一幂等键(run_id 加步骤路径,不含尝试次数)。 |
| timeout_ms | number | 必填 / 必有;单次执行的超时毫秒数;创建时未给出,code 实现默认 30000,容器或 shell 实现默认 600000。 |
| implementation | object / object / object | 必填 / 必有;code 使用 language=ts 与 source。container 和 shell 暂未开放,创建时返回 OPERATION_NOT_SUPPORTED。 |
| implementation(分支1).kind | "code" | 必填 / 必有;固定为 code:以源码实现。 |
| implementation(分支1).language | "ts" | 必填 / 必有;源码语言,目前只支持 ts(TypeScript)。 |
| implementation(分支1).source | string | 必填 / 必有;动作的完整 TypeScript 源码;内置动作为空。 |
| implementation(分支2).kind | "container" | 必填 / 必有;固定为 container:以容器镜像实现(暂未开放)。 |
| implementation(分支2).image | string | 必填 / 必有;容器镜像引用。 |
| implementation(分支2).command | string[] | 必填 / 必有;在容器中执行的命令及参数列表。 |
| implementation(分支3).kind | "shell" | 必填 / 必有;固定为 shell:以 shell 脚本实现(暂未开放)。 |
| implementation(分支3).script | string | 必填 / 必有;要执行的 shell 脚本全文。 |
| host | "builtin" / "isolate" / "sandbox" | 必填 / 必有;动作运行位置,发布时计算。builtin 为平台内置动作;isolate 为在隔离的 Worker isolate 中运行用户代码;sandbox 为在沙箱中运行(container 与 shell 实现)。 |
| platform_apis | string[] | 必填 / 必有;从代码推导出的平台 API 集合,同时是该动作运行令牌的权限范围(最小权限)。 |
| created_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| created_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| created_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| message | null / string | 必填 / 必有;创建该修订时附带的说明;未提供为 null。 |
| created_at | string | 必填 / 必有;该修订的创建时间(RFC 3339 UTC)。 |
HTTP 200
{
"id": "actr_00mv67loz3e46938b8ecf54e57b8f31297df016a1c",
"digest": "e35c209873c60486ca8da455878062cb7ea572a6147ce3ca03e0693b4769fa45",
"input_schema": {
"type": "object",
"properties": {
"n": {
"type": "number"
}
},
"required": [
"n"
],
"additionalProperties": false
},
"output_schema": {
"type": "object",
"properties": {
"answer": {
"type": "number"
}
},
"required": [
"answer"
],
"additionalProperties": false
},
"errors": [],
"annotations": {
"read_only": false,
"idempotent": false
},
"timeout_ms": 30000,
"implementation": {
"kind": "code",
"language": "ts",
"source": "export default async (input: { n: number }) => ({ answer: input.n + 1 });"
},
"host": "isolate",
"platform_apis": [],
"created_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"message": null,
"created_at": "2026-10-13T04:57:09.039Z",
"current": false,
"rollback": {
"allowed": true,
"issues": []
}
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | ACTION_NOT_FOUND:动作不存在或当前租户不可见;同名脚本/工作流存在时,hint 指向相应接口。 VERSION_NOT_FOUND:指定版本或修订不存在。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
用历史内容创建通过兼容检查的新修订。检查覆盖当前及最近五个历史修订;不会把当前指针直接退回旧 ID。可选 If-Match 可指定当前修订或 ; 匹配任何当前存在的表示。
POST /automation/v1/actions/{ns}/{name}/rollback
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
| header: If-Match | string | 可选;可选当前修订或 ;提供时执行条件校验, 匹配任何当前存在的表示。 |
| header: Idempotency-Key | string | 可选;可选;1–256 字符。24 小时内同一 key 重放首个响应并带 Idempotent-Replayed: true;同 key 不同请求体返回 422;处理中返回 409。 minLength: 1;maxLength: 256 |
不接受额外字段。
| 字段 | 类型 | 说明 |
|---|---|---|
| revision | string | 必填 / 必有;要回滚到的历史修订 ID(actr_);回滚会创建新修订。 |
| message | string | 可选;本次修订的说明。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| ACTION_NAME | 创建动作返回的 name |
| REVISION_ID | 已有动作修订 id |
: "${ACTION_NAME:?Set ACTION_NAME}"
: "${REVISION_ID:?Set REVISION_ID}"
BODY=$(jq -n --arg REVISION_ID "$REVISION_ID" '{
"revision": $REVISION_ID
}')
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/actions/docs-samples/${ACTION_NAME}/rollback" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data "$BODY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.actions.rollback({
"path": {
"ns": "docs-samples",
"name": env("ACTION_NAME")
},
"body": {
"revision": env("REVISION_ID")
}
});
console.log(result);Success
| 响应头 | 类型 | 说明 |
|---|---|---|
| Idempotent-Replayed | boolean | Present and true when replaying the first response for this key. |
| ETag | string | Current revision ID after rollback. |
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;动作 ID,前缀 act_;日常调用使用 namespace 与 name,而不是 id。 |
| namespace | string | 必填 / 必有;动作命名空间;平台动作为 praxis,裸名引用解析到 praxis。 |
| name | string | 必填 / 必有;动作名,与 namespace 一起唯一标识动作;小写字母、数字、点、下划线、连字符,最长 64 字符。 |
| description | string | 必填 / 必有;动作说明,最多 1000 字符。 |
| labels | object | 必填 / 必有;用户自定义标签:字符串键值对,用于分类与列表过滤(labels[key]=value);键不能以 praxis. 开头。 |
| owner | string | 必填 / 必有;动作所属租户,由网关注入;按不透明字符串处理。 |
| builtin | boolean | 必填 / 必有;true 表示平台内置动作(命名空间 praxis);用户创建的动作为 false。 |
| current_revision | object | 必填 / 必有;动作的一个不可变修订:契约、实现和运行参数的快照。每次更新兼容的内容变化都会产生新修订。 不接受额外字段。 |
| current_revision.id | string | 必填 / 必有;修订 ID,前缀 actr_;仅用于展示与回滚(rollback 的 revision),不能被脚本直接引用。 |
| current_revision.digest | string | 必填 / 必有;契约与实现的内容摘要;内容相同的更新不会产生新修订。 |
| current_revision.input_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| current_revision.input_schema.*(分支5) | object | 递归 JSON 值。 |
| current_revision.input_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| current_revision.output_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| current_revision.output_schema.*(分支5) | object | 递归 JSON 值。 |
| current_revision.output_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| current_revision.errors | object[] | 必填 / 必有;动作声明的可能错误列表,每项含 type、code、description。 |
| current_revision.errors[].type | string | 必填 / 必有;错误类型:稳定的 URI,或 Open Workflow 标准类型(如 validation、timeout、communication、runtime)。 |
| current_revision.errors[].code | string | 可选;可选的稳定错误码,供调用方按码分支处理。 |
| current_revision.errors[].description | string | 必填 / 必有;该错误的含义与触发条件,面向调用方阅读。 |
| current_revision.annotations | object | 必填 / 必有;动作行为声明 {read_only, idempotent};创建时未给出的键默认为 false。 不接受额外字段。 |
| current_revision.annotations.read_only | boolean | 必填 / 必有;true 表示动作不修改外部状态,只读取数据。 |
| current_revision.annotations.idempotent | boolean | 必填 / 必有;true 表示同一输入重复调用与调用一次效果相同;此类动作的重试使用同一幂等键(run_id 加步骤路径,不含尝试次数)。 |
| current_revision.timeout_ms | number | 必填 / 必有;单次执行的超时毫秒数;创建时未给出,code 实现默认 30000,容器或 shell 实现默认 600000。 |
| current_revision.implementation | object / object / object | 必填 / 必有;code 使用 language=ts 与 source。container 和 shell 暂未开放,创建时返回 OPERATION_NOT_SUPPORTED。 |
| current_revision.implementation(分支1).kind | "code" | 必填 / 必有;固定为 code:以源码实现。 |
| current_revision.implementation(分支1).language | "ts" | 必填 / 必有;源码语言,目前只支持 ts(TypeScript)。 |
| current_revision.implementation(分支1).source | string | 必填 / 必有;动作的完整 TypeScript 源码;内置动作为空。 |
| current_revision.implementation(分支2).kind | "container" | 必填 / 必有;固定为 container:以容器镜像实现(暂未开放)。 |
| current_revision.implementation(分支2).image | string | 必填 / 必有;容器镜像引用。 |
| current_revision.implementation(分支2).command | string[] | 必填 / 必有;在容器中执行的命令及参数列表。 |
| current_revision.implementation(分支3).kind | "shell" | 必填 / 必有;固定为 shell:以 shell 脚本实现(暂未开放)。 |
| current_revision.implementation(分支3).script | string | 必填 / 必有;要执行的 shell 脚本全文。 |
| current_revision.host | "builtin" / "isolate" / "sandbox" | 必填 / 必有;动作运行位置,发布时计算。builtin 为平台内置动作;isolate 为在隔离的 Worker isolate 中运行用户代码;sandbox 为在沙箱中运行(container 与 shell 实现)。 |
| current_revision.platform_apis | string[] | 必填 / 必有;从代码推导出的平台 API 集合,同时是该动作运行令牌的权限范围(最小权限)。 |
| current_revision.created_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| current_revision.created_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| current_revision.created_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| current_revision.message | null / string | 必填 / 必有;创建该修订时附带的说明;未提供为 null。 |
| current_revision.created_at | string | 必填 / 必有;该修订的创建时间(RFC 3339 UTC)。 |
| stats_7d | object | 必填 / 必有;近七天统计;平台动作按调用方租户隔离,只反映当前调用方的调用,不是平台全局统计。 不接受额外字段。 |
| stats_7d.calls | number | 必填 / 必有;近七天内对该动作的调用次数,按小时汇总。 |
| stats_7d.failures | number | 必填 / 必有;近七天内失败的调用次数。 |
| stats_7d.p50_ms | null / number | 必填 / 必有;耗时中位数的近似上界,单位毫秒;正耗时向上归入 2 的幂分桶(9 ms → 16 ms),0 独立一桶;无有效耗时样本时为 null。 |
| dependents | object | 必填 / 必有;引用该动作的脚本与工作流数量,口径为最新版本加草稿。 不接受额外字段。 |
| dependents.scripts | number | 必填 / 必有;引用该动作的脚本数量。 |
| dependents.workflows | number | 必填 / 必有;引用该动作的工作流数量。 |
| archived_at | null / string | 必填 / 必有;归档时间;未归档为 null。归档后名字保留,不能复用。 |
| created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 |
| updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 |
HTTP 200
{
"id": "act_00mv67loz4fe4f27bdf89346c885b3a28b2038c091",
"owner": "tnt_3a9759864ccb4e00",
"namespace": "docs-samples",
"name": "sample-action-1791867412840-b05e8a",
"description": "",
"labels": {},
"builtin": false,
"archived_at": null,
"created_at": "2026-10-13T04:57:09.039Z",
"updated_at": "2026-10-13T04:57:15.629Z",
"current_revision": {
"input_schema": {
"type": "object",
"properties": {
"n": {
"type": "number"
}
},
"required": [
"n"
],
"additionalProperties": false
},
"output_schema": {
"type": "object",
"properties": {
"answer": {
"type": "number"
}
},
"required": [
"answer"
],
"additionalProperties": false
},
"errors": [],
"annotations": {
"read_only": false,
"idempotent": false
},
"timeout_ms": 30000,
"implementation": {
"kind": "code",
"language": "ts",
"source": "export default async (input: { n: number }) => ({ answer: input.n + 1 });"
},
"host": "isolate",
"platform_apis": [],
"id": "actr_00mv67lu25f7f28dd81a924c698b9d2557056a7b62",
"digest": "e35c209873c60486ca8da455878062cb7ea572a6147ce3ca03e0693b4769fa45",
"created_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"message": "回滚到 actr_00mv67loz3e46938b8ecf54e57b8f31297df016a1c",
"created_at": "2026-10-13T04:57:15.629Z"
},
"stats_7d": {
"calls": 0,
"failures": 0,
"p50_ms": null
},
"dependents": {
"scripts": 0,
"workflows": 0
}
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 INPUT_INVALID:输入不满足目标契约或业务校验。 |
| 403 | NAMESPACE_FORBIDDEN:命名空间只读或运行令牌不允许此调用。 |
| 404 | ACTION_NOT_FOUND:动作不存在或当前租户不可见;同名脚本/工作流存在时,hint 指向相应接口。 VERSION_NOT_FOUND:指定版本或修订不存在。 |
| 409 | IDEMPOTENCY_IN_FLIGHT:同一幂等键的请求仍在处理中。 TARGET_ARCHIVED:目标已归档,不能用于本操作;动作执行错误的 detail 包含 ns/name。 |
| 412 | PRECONDITION_FAILED:修订、源码摘要或并发写入条件不匹配。 |
| 413 | PAYLOAD_TOO_LARGE:请求内容超过本操作允许的大小。 |
| 422 | IDEMPOTENCY_KEY_MISMATCH:同一幂等键已用于不同请求内容。 SCHEMA_INCOMPATIBLE:新动作契约与历史修订不兼容。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
列出该动作的调用记录,可按状态、修订、调用方编排和时间筛选;结果包含所属运行与调用位置。
GET /automation/v1/actions/{ns}/{name}/invocations
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
| query: limit | integer | 可选;每页条数,整数 1–100,默认 20。 minimum: 1;maximum: 100 |
| query: cursor | string | 可选;上一页返回的 next_cursor,不透明字符串;保持原查询条件继续翻页。 |
| query: status | "running" / "completed" / "faulted" / "cancelled"[] | 可选;逗号分隔的状态,可选 running、completed、faulted、cancelled;省略不过滤。 |
| query: revision | string | 可选;动作修订 ID(actr_);查询参数用于筛选调用记录。 |
| query: caller | string | 可选;调用方脚本或工作流的精确名称,格式 ns/name。 |
| query: run_kind | "script" / "workflow" | 可选;调用方运行类型:script 或 workflow。 |
| query: created_at[gte] | string | 可选;创建时间下界(包含),RFC 3339 且带时区,如 2026-10-01T00:00:00Z。 format: "date-time" |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| ACTION_NAME | 创建动作返回的 name |
: "${ACTION_NAME:?Set ACTION_NAME}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/actions/docs-samples/${ACTION_NAME}/invocations" \
-H "Authorization: Bearer $PRAXIS_API_KEY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.actions.invocations.list({
"path": {
"ns": "docs-samples",
"name": env("ACTION_NAME")
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| data | object[] | 必填 / 必有;本页的动作调用记录,按 created_at 倒序、id 倒序排列。 |
| data[].id | string | 必填 / 必有;调用标识,无独立 inv_ 前缀:脚本为 run_id:seq(运行 ID 与调用序号);工作流为任务执行键加尝试次数。请按不透明字符串保存。 |
| data[].created_at | string | 必填 / 必有;调用记录的创建时间(RFC 3339 UTC)。 |
| data[].started_at | null / string | 必填 / 必有;动作开始执行的时间;尚未开始为 null。 |
| data[].ended_at | null / string | 必填 / 必有;动作结束的时间;仍在执行为 null。 |
| data[].status | "running" / "completed" / "faulted" / "cancelled" | 必填 / 必有;调用状态。running 执行中;completed 已正常返回;faulted 失败,error 给出原因;cancelled 因运行被取消而中止。 |
| data[].duration_ms | null / number | 必填 / 必有;执行耗时毫秒数;未结束为 null。 |
| data[].revision | string | 必填 / 必有;本次执行使用的动作修订 ID(actr_ 前缀)。 |
| data[].run | object | 必填 / 必有;发起这次调用的运行:{id, kind, definition, number, source_digest}。 不接受额外字段。 |
| data[].run.id | string | 必填 / 必有;发起调用的运行 ID(run_ 前缀),可用于读取该运行。 |
| data[].run.kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| data[].run.definition | null / object | 必填 / 必有;该运行所属的脚本或工作流 {namespace, name};临时运行为 null。 |
| data[].run.definition(分支2).namespace | string | 必填 / 必有;脚本或工作流的命名空间。 |
| data[].run.definition(分支2).name | string | 必填 / 必有;脚本或工作流的名字。 |
| data[].run.number | null / number | 必填 / 必有;运行在其脚本或工作流内的序号;临时运行为 null。 |
| data[].run.source_digest | null / string | 必填 / 必有;临时运行的源码摘要;由已发布定义启动的运行为 null。 |
| data[].site | object / object | 必填 / 必有;调用发生的位置:脚本中的一次调用(kind=call,带 seq),或工作流的一个步骤(kind=task,带 reference 与 iteration)。 |
| data[].site(分支1).kind | "call" | 必填 / 必有;固定为 call:来自脚本中的调用。 |
| data[].site(分支1).seq | number | 必填 / 必有;该调用在脚本运行中的序号,与 Call.seq 对应。 |
| data[].site(分支2).kind | "task" | 必填 / 必有;固定为 task:来自工作流步骤。 |
| data[].site(分支2).reference | string | 必填 / 必有;工作流文档内该步骤的 JSON Pointer,与 Task.reference 对应。 |
| data[].site(分支2).iteration | number[] | 必填 / 必有;外层 for 循环的当前迭代下标,由外到内;不在循环中为空数组。 |
| data[].error | null / object | 必填 / 必有;失败时的 {code, message};成功或仍在执行为 null。 |
| data[].error(分支2).code | string | 必填 / 必有;错误码,例如动作声明的 code 或平台错误码。 |
| data[].error(分支2).message | string | 必填 / 必有;错误说明文字。 |
| data[].result_preview | null / string | 必填 / 必有;返回值的单行预览,由服务端截断;未结束或失败为 null。 |
| data[].request_id | string / null | 必填 / 必有;下游响应的 X-Request-Id;响应未提供该头时为 null,可用于追查失败调用。 |
| next_cursor | null / string | 必填 / 必有;下一页游标,原样传给 cursor 参数并保持原查询条件;没有更多页为 null。接口不返回总数。 |
HTTP 200
{
"data": [],
"next_cursor": null
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | ACTION_NOT_FOUND:动作不存在或当前租户不可见;同名脚本/工作流存在时,hint 指向相应接口。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
列出引用该动作的编排。检查范围为脚本和工作流的草稿及最新版本。
GET /automation/v1/actions/{ns}/{name}/dependents
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
| query: limit | integer | 可选;每页条数,整数 1–100,默认 20。 minimum: 1;maximum: 100 |
| query: cursor | string | 可选;上一页返回的 next_cursor,不透明字符串;保持原查询条件继续翻页。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| ACTION_NAME | 创建动作返回的 name |
: "${ACTION_NAME:?Set ACTION_NAME}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/actions/docs-samples/${ACTION_NAME}/dependents" \
-H "Authorization: Bearer $PRAXIS_API_KEY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.actions.dependents.list({
"path": {
"ns": "docs-samples",
"name": env("ACTION_NAME")
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| data | object[] | 必填 / 必有;本页的引用方(脚本与工作流,口径为最新版本加草稿),按 created_at 倒序、id 倒序排列。 |
| data[].kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| data[].namespace | string | 必填 / 必有;引用方的命名空间。 |
| data[].name | string | 必填 / 必有;引用方的名字。 |
| data[].at | string | 必填 / 必有;引用所在的草稿或最新版本号:draft 表示草稿,其余值为该编排最新发布的版本号。 |
| next_cursor | null / string | 必填 / 必有;下一页游标,原样传给 cursor 参数并保持原查询条件;没有更多页为 null。接口不返回总数。 |
HTTP 200
{
"data": [],
"next_cursor": null
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | ACTION_NOT_FOUND:动作不存在或当前租户不可见;同名脚本/工作流存在时,hint 指向相应接口。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
归档后保留名称和历史,默认列表不再显示;响应包含 dependents_count,便于判断对引用方的影响。
POST /automation/v1/actions/{ns}/{name}/archive
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
不接受额外字段。 object
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| ACTION_NAME | 创建动作返回的 name |
: "${ACTION_NAME:?Set ACTION_NAME}"
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/actions/docs-samples/${ACTION_NAME}/archive" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.actions.archive({
"path": {
"ns": "docs-samples",
"name": env("ACTION_NAME")
},
"body": {}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;动作 ID,前缀 act_;日常调用使用 namespace 与 name,而不是 id。 |
| namespace | string | 必填 / 必有;动作命名空间;平台动作为 praxis,裸名引用解析到 praxis。 |
| name | string | 必填 / 必有;动作名,与 namespace 一起唯一标识动作;小写字母、数字、点、下划线、连字符,最长 64 字符。 |
| description | string | 必填 / 必有;动作说明,最多 1000 字符。 |
| labels | object | 必填 / 必有;用户自定义标签:字符串键值对,用于分类与列表过滤(labels[key]=value);键不能以 praxis. 开头。 |
| owner | string | 必填 / 必有;动作所属租户,由网关注入;按不透明字符串处理。 |
| builtin | boolean | 必填 / 必有;true 表示平台内置动作(命名空间 praxis);用户创建的动作为 false。 |
| current_revision | object | 必填 / 必有;动作的一个不可变修订:契约、实现和运行参数的快照。每次更新兼容的内容变化都会产生新修订。 不接受额外字段。 |
| current_revision.id | string | 必填 / 必有;修订 ID,前缀 actr_;仅用于展示与回滚(rollback 的 revision),不能被脚本直接引用。 |
| current_revision.digest | string | 必填 / 必有;契约与实现的内容摘要;内容相同的更新不会产生新修订。 |
| current_revision.input_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| current_revision.input_schema.*(分支5) | object | 递归 JSON 值。 |
| current_revision.input_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| current_revision.output_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| current_revision.output_schema.*(分支5) | object | 递归 JSON 值。 |
| current_revision.output_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| current_revision.errors | object[] | 必填 / 必有;动作声明的可能错误列表,每项含 type、code、description。 |
| current_revision.errors[].type | string | 必填 / 必有;错误类型:稳定的 URI,或 Open Workflow 标准类型(如 validation、timeout、communication、runtime)。 |
| current_revision.errors[].code | string | 可选;可选的稳定错误码,供调用方按码分支处理。 |
| current_revision.errors[].description | string | 必填 / 必有;该错误的含义与触发条件,面向调用方阅读。 |
| current_revision.annotations | object | 必填 / 必有;动作行为声明 {read_only, idempotent};创建时未给出的键默认为 false。 不接受额外字段。 |
| current_revision.annotations.read_only | boolean | 必填 / 必有;true 表示动作不修改外部状态,只读取数据。 |
| current_revision.annotations.idempotent | boolean | 必填 / 必有;true 表示同一输入重复调用与调用一次效果相同;此类动作的重试使用同一幂等键(run_id 加步骤路径,不含尝试次数)。 |
| current_revision.timeout_ms | number | 必填 / 必有;单次执行的超时毫秒数;创建时未给出,code 实现默认 30000,容器或 shell 实现默认 600000。 |
| current_revision.implementation | object / object / object | 必填 / 必有;code 使用 language=ts 与 source。container 和 shell 暂未开放,创建时返回 OPERATION_NOT_SUPPORTED。 |
| current_revision.implementation(分支1).kind | "code" | 必填 / 必有;固定为 code:以源码实现。 |
| current_revision.implementation(分支1).language | "ts" | 必填 / 必有;源码语言,目前只支持 ts(TypeScript)。 |
| current_revision.implementation(分支1).source | string | 必填 / 必有;动作的完整 TypeScript 源码;内置动作为空。 |
| current_revision.implementation(分支2).kind | "container" | 必填 / 必有;固定为 container:以容器镜像实现(暂未开放)。 |
| current_revision.implementation(分支2).image | string | 必填 / 必有;容器镜像引用。 |
| current_revision.implementation(分支2).command | string[] | 必填 / 必有;在容器中执行的命令及参数列表。 |
| current_revision.implementation(分支3).kind | "shell" | 必填 / 必有;固定为 shell:以 shell 脚本实现(暂未开放)。 |
| current_revision.implementation(分支3).script | string | 必填 / 必有;要执行的 shell 脚本全文。 |
| current_revision.host | "builtin" / "isolate" / "sandbox" | 必填 / 必有;动作运行位置,发布时计算。builtin 为平台内置动作;isolate 为在隔离的 Worker isolate 中运行用户代码;sandbox 为在沙箱中运行(container 与 shell 实现)。 |
| current_revision.platform_apis | string[] | 必填 / 必有;从代码推导出的平台 API 集合,同时是该动作运行令牌的权限范围(最小权限)。 |
| current_revision.created_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| current_revision.created_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| current_revision.created_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| current_revision.message | null / string | 必填 / 必有;创建该修订时附带的说明;未提供为 null。 |
| current_revision.created_at | string | 必填 / 必有;该修订的创建时间(RFC 3339 UTC)。 |
| stats_7d | object | 必填 / 必有;近七天统计;平台动作按调用方租户隔离,只反映当前调用方的调用,不是平台全局统计。 不接受额外字段。 |
| stats_7d.calls | number | 必填 / 必有;近七天内对该动作的调用次数,按小时汇总。 |
| stats_7d.failures | number | 必填 / 必有;近七天内失败的调用次数。 |
| stats_7d.p50_ms | null / number | 必填 / 必有;耗时中位数的近似上界,单位毫秒;正耗时向上归入 2 的幂分桶(9 ms → 16 ms),0 独立一桶;无有效耗时样本时为 null。 |
| dependents | object | 必填 / 必有;引用该动作的脚本与工作流数量,口径为最新版本加草稿。 不接受额外字段。 |
| dependents.scripts | number | 必填 / 必有;引用该动作的脚本数量。 |
| dependents.workflows | number | 必填 / 必有;引用该动作的工作流数量。 |
| archived_at | null / string | 必填 / 必有;归档时间;未归档为 null。归档后名字保留,不能复用。 |
| created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 |
| updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 |
| dependents_count | integer | 必填 / 必有;归档时仍引用该动作的脚本与工作流数量之和(dependents.scripts 加 dependents.workflows)。 minimum: 0 |
HTTP 200
{
"id": "act_00mv67loz4fe4f27bdf89346c885b3a28b2038c091",
"owner": "tnt_3a9759864ccb4e00",
"namespace": "docs-samples",
"name": "sample-action-1791867412840-b05e8a",
"description": "",
"labels": {},
"builtin": false,
"archived_at": "2026-10-13T04:57:17.830Z",
"created_at": "2026-10-13T04:57:09.039Z",
"updated_at": "2026-10-13T04:57:17.830Z",
"current_revision": {
"id": "actr_00mv67lu25f7f28dd81a924c698b9d2557056a7b62",
"digest": "e35c209873c60486ca8da455878062cb7ea572a6147ce3ca03e0693b4769fa45",
"input_schema": {
"type": "object",
"properties": {
"n": {
"type": "number"
}
},
"required": [
"n"
],
"additionalProperties": false
},
"output_schema": {
"type": "object",
"properties": {
"answer": {
"type": "number"
}
},
"required": [
"answer"
],
"additionalProperties": false
},
"errors": [],
"annotations": {
"read_only": false,
"idempotent": false
},
"timeout_ms": 30000,
"implementation": {
"kind": "code",
"language": "ts",
"source": "export default async (input: { n: number }) => ({ answer: input.n + 1 });"
},
"host": "isolate",
"platform_apis": [],
"created_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"message": "回滚到 actr_00mv67loz3e46938b8ecf54e57b8f31297df016a1c",
"created_at": "2026-10-13T04:57:15.629Z"
},
"stats_7d": {
"calls": 0,
"failures": 0,
"p50_ms": null
},
"dependents": {
"scripts": 0,
"workflows": 0
},
"dependents_count": 0
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 403 | NAMESPACE_FORBIDDEN:命名空间只读或运行令牌不允许此调用。 |
| 404 | ACTION_NOT_FOUND:动作不存在或当前租户不可见;同名脚本/工作流存在时,hint 指向相应接口。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
恢复已归档动作,保留当前修订。恢复后重新出现在默认列表。
POST /automation/v1/actions/{ns}/{name}/restore
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
不接受额外字段。 object
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| ACTION_NAME | 创建动作返回的 name |
: "${ACTION_NAME:?Set ACTION_NAME}"
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/actions/docs-samples/${ACTION_NAME}/restore" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.actions.restore({
"path": {
"ns": "docs-samples",
"name": env("ACTION_NAME")
},
"body": {}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;动作 ID,前缀 act_;日常调用使用 namespace 与 name,而不是 id。 |
| namespace | string | 必填 / 必有;动作命名空间;平台动作为 praxis,裸名引用解析到 praxis。 |
| name | string | 必填 / 必有;动作名,与 namespace 一起唯一标识动作;小写字母、数字、点、下划线、连字符,最长 64 字符。 |
| description | string | 必填 / 必有;动作说明,最多 1000 字符。 |
| labels | object | 必填 / 必有;用户自定义标签:字符串键值对,用于分类与列表过滤(labels[key]=value);键不能以 praxis. 开头。 |
| owner | string | 必填 / 必有;动作所属租户,由网关注入;按不透明字符串处理。 |
| builtin | boolean | 必填 / 必有;true 表示平台内置动作(命名空间 praxis);用户创建的动作为 false。 |
| current_revision | object | 必填 / 必有;动作的一个不可变修订:契约、实现和运行参数的快照。每次更新兼容的内容变化都会产生新修订。 不接受额外字段。 |
| current_revision.id | string | 必填 / 必有;修订 ID,前缀 actr_;仅用于展示与回滚(rollback 的 revision),不能被脚本直接引用。 |
| current_revision.digest | string | 必填 / 必有;契约与实现的内容摘要;内容相同的更新不会产生新修订。 |
| current_revision.input_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| current_revision.input_schema.*(分支5) | object | 递归 JSON 值。 |
| current_revision.input_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| current_revision.output_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| current_revision.output_schema.*(分支5) | object | 递归 JSON 值。 |
| current_revision.output_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| current_revision.errors | object[] | 必填 / 必有;动作声明的可能错误列表,每项含 type、code、description。 |
| current_revision.errors[].type | string | 必填 / 必有;错误类型:稳定的 URI,或 Open Workflow 标准类型(如 validation、timeout、communication、runtime)。 |
| current_revision.errors[].code | string | 可选;可选的稳定错误码,供调用方按码分支处理。 |
| current_revision.errors[].description | string | 必填 / 必有;该错误的含义与触发条件,面向调用方阅读。 |
| current_revision.annotations | object | 必填 / 必有;动作行为声明 {read_only, idempotent};创建时未给出的键默认为 false。 不接受额外字段。 |
| current_revision.annotations.read_only | boolean | 必填 / 必有;true 表示动作不修改外部状态,只读取数据。 |
| current_revision.annotations.idempotent | boolean | 必填 / 必有;true 表示同一输入重复调用与调用一次效果相同;此类动作的重试使用同一幂等键(run_id 加步骤路径,不含尝试次数)。 |
| current_revision.timeout_ms | number | 必填 / 必有;单次执行的超时毫秒数;创建时未给出,code 实现默认 30000,容器或 shell 实现默认 600000。 |
| current_revision.implementation | object / object / object | 必填 / 必有;code 使用 language=ts 与 source。container 和 shell 暂未开放,创建时返回 OPERATION_NOT_SUPPORTED。 |
| current_revision.implementation(分支1).kind | "code" | 必填 / 必有;固定为 code:以源码实现。 |
| current_revision.implementation(分支1).language | "ts" | 必填 / 必有;源码语言,目前只支持 ts(TypeScript)。 |
| current_revision.implementation(分支1).source | string | 必填 / 必有;动作的完整 TypeScript 源码;内置动作为空。 |
| current_revision.implementation(分支2).kind | "container" | 必填 / 必有;固定为 container:以容器镜像实现(暂未开放)。 |
| current_revision.implementation(分支2).image | string | 必填 / 必有;容器镜像引用。 |
| current_revision.implementation(分支2).command | string[] | 必填 / 必有;在容器中执行的命令及参数列表。 |
| current_revision.implementation(分支3).kind | "shell" | 必填 / 必有;固定为 shell:以 shell 脚本实现(暂未开放)。 |
| current_revision.implementation(分支3).script | string | 必填 / 必有;要执行的 shell 脚本全文。 |
| current_revision.host | "builtin" / "isolate" / "sandbox" | 必填 / 必有;动作运行位置,发布时计算。builtin 为平台内置动作;isolate 为在隔离的 Worker isolate 中运行用户代码;sandbox 为在沙箱中运行(container 与 shell 实现)。 |
| current_revision.platform_apis | string[] | 必填 / 必有;从代码推导出的平台 API 集合,同时是该动作运行令牌的权限范围(最小权限)。 |
| current_revision.created_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| current_revision.created_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| current_revision.created_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| current_revision.message | null / string | 必填 / 必有;创建该修订时附带的说明;未提供为 null。 |
| current_revision.created_at | string | 必填 / 必有;该修订的创建时间(RFC 3339 UTC)。 |
| stats_7d | object | 必填 / 必有;近七天统计;平台动作按调用方租户隔离,只反映当前调用方的调用,不是平台全局统计。 不接受额外字段。 |
| stats_7d.calls | number | 必填 / 必有;近七天内对该动作的调用次数,按小时汇总。 |
| stats_7d.failures | number | 必填 / 必有;近七天内失败的调用次数。 |
| stats_7d.p50_ms | null / number | 必填 / 必有;耗时中位数的近似上界,单位毫秒;正耗时向上归入 2 的幂分桶(9 ms → 16 ms),0 独立一桶;无有效耗时样本时为 null。 |
| dependents | object | 必填 / 必有;引用该动作的脚本与工作流数量,口径为最新版本加草稿。 不接受额外字段。 |
| dependents.scripts | number | 必填 / 必有;引用该动作的脚本数量。 |
| dependents.workflows | number | 必填 / 必有;引用该动作的工作流数量。 |
| archived_at | null / string | 必填 / 必有;归档时间;未归档为 null。归档后名字保留,不能复用。 |
| created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 |
| updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 |
HTTP 200
{
"id": "act_00mv67loz4fe4f27bdf89346c885b3a28b2038c091",
"owner": "tnt_3a9759864ccb4e00",
"namespace": "docs-samples",
"name": "sample-action-1791867412840-b05e8a",
"description": "",
"labels": {},
"builtin": false,
"archived_at": null,
"created_at": "2026-10-13T04:57:09.039Z",
"updated_at": "2026-10-13T04:57:18.573Z",
"current_revision": {
"id": "actr_00mv67lu25f7f28dd81a924c698b9d2557056a7b62",
"digest": "e35c209873c60486ca8da455878062cb7ea572a6147ce3ca03e0693b4769fa45",
"input_schema": {
"type": "object",
"properties": {
"n": {
"type": "number"
}
},
"required": [
"n"
],
"additionalProperties": false
},
"output_schema": {
"type": "object",
"properties": {
"answer": {
"type": "number"
}
},
"required": [
"answer"
],
"additionalProperties": false
},
"errors": [],
"annotations": {
"read_only": false,
"idempotent": false
},
"timeout_ms": 30000,
"implementation": {
"kind": "code",
"language": "ts",
"source": "export default async (input: { n: number }) => ({ answer: input.n + 1 });"
},
"host": "isolate",
"platform_apis": [],
"created_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"message": "回滚到 actr_00mv67loz3e46938b8ecf54e57b8f31297df016a1c",
"created_at": "2026-10-13T04:57:15.629Z"
},
"stats_7d": {
"calls": 0,
"failures": 0,
"p50_ms": null
},
"dependents": {
"scripts": 0,
"workflows": 0
}
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 403 | NAMESPACE_FORBIDDEN:命名空间只读或运行令牌不允许此调用。 |
| 404 | ACTION_NOT_FOUND:动作不存在或当前租户不可见;同名脚本/工作流存在时,hint 指向相应接口。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
列出可见脚本的摘要、最新版本、标签及近七天统计;默认排除已归档条目。
GET /automation/v1/scripts
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| query: limit | integer | 可选;每页条数,整数 1–100,默认 25。 minimum: 1;maximum: 100 |
| query: cursor | string | 可选;上一页返回的 next_cursor,不透明字符串;保持原查询条件继续翻页。 |
| query: q | string | 可选;不区分大小写,按名称或说明的字面子串匹配;% 与 _ 无通配含义。 |
| query: namespace | string[] | 可选;仅返回指定命名空间的定义,名称按小写匹配。 多个值以逗号分隔,匹配任一值。 minItems: 1 |
| query: scope | "platform" / "own"[] | 可选;platform 仅平台定义,own 仅租户自建定义;省略返回两者。 多个值以逗号分隔,匹配任一值。 minItems: 1 |
| query: archived | boolean | 可选;true 仅已归档,false 仅未归档;默认 false。 |
| query: labels | object | 可选;按标签过滤,使用 labels[k]=v;同键逗号多值取任一,不同键同时满足。 |
| query: created_at[gte] | string | 可选;创建时间下界,包含边界;使用带时区的 ISO 8601 时间。 format: "date-time" |
| query: created_at[lte] | string | 可选;创建时间上界,包含边界;使用带时区的 ISO 8601 时间。 format: "date-time" |
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/scripts" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
--get \
--data-urlencode "namespace=docs-samples" \
--data-urlencode "limit=1"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.scripts.list({
"query": {
"namespace": [
"docs-samples"
],
"limit": 1
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| data | object[] | 必填 / 必有;本页的脚本摘要,按 created_at 倒序、id 倒序排列。 |
| data[].id | string | 必填 / 必有;编排 ID,脚本前缀 scr_,工作流前缀 wf_;日常使用 namespace 与 name。 |
| data[].kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| data[].namespace | string | 必填 / 必有;命名空间,引用形如 namespace/name@版本。 |
| data[].name | string | 必填 / 必有;名字,与 namespace 一起在租户内唯一,脚本与工作流共用命名空间,重名返回 409 NAME_TAKEN。 |
| data[].description | string | 必填 / 必有;说明文字,最多 1000 字符。 |
| data[].labels | object | 必填 / 必有;用户自定义标签:字符串键值对,用于分类与列表过滤(labels[key]=value);键不能以 praxis. 开头。 |
| data[].owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| data[].latest_version | null / object | 必填 / 必有;latest 标签指向的已发布版本 {version, published_at};尚未发布为 null。 |
| data[].latest_version(分支2).version | string | 必填 / 必有;最新发布版本的版本号(semver)。 |
| data[].latest_version(分支2).published_at | string | 必填 / 必有;该版本的发布时间(RFC 3339 UTC)。 |
| data[].dist_tags | object | 必填 / 必有;标签到精确版本号的映射,例如 latest 指向 1.2.0;用 ns/name@标签 运行时按此解析。 |
| data[].draft_changed | boolean | 必填 / 必有;true 表示草稿内容(摘要)不同于 latest 版本,即有未发布的改动。 |
| data[].latest_run | null / object | 必填 / 必有;该编排最近一次运行的摘要;还没有运行为 null。 |
| data[].latest_run(分支2).id | string | 必填 / 必有;运行 ID(run_ 前缀),可用于 runs.retrieve。 |
| data[].latest_run(分支2).number | null / number | 必填 / 必有;运行在该脚本或工作流内的递增序号。 |
| data[].latest_run(分支2).status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;运行状态。pending 已创建尚未开始;running 执行中;waiting 工作流在等待事件、定时器或子运行;suspended 工作流被暂停;cancelled 已取消;faulted 失败;completed 成功完成。 |
| data[].latest_run(分支2).created_at | string | 必填 / 必有;运行创建时间(RFC 3339 UTC)。 |
| data[].latest_run(分支2).current_wait | null / object | 必填 / 必有;当前未完成的等待点;没有等待为 null。 |
| data[].latest_run(分支2).current_wait(分支2).id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| data[].latest_run(分支2).current_wait(分支2).run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| data[].latest_run(分支2).current_wait(分支2).kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| data[].latest_run(分支2).current_wait(分支2).state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| data[].latest_run(分支2).current_wait(分支2).task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| data[].latest_run(分支2).current_wait(分支2).task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| data[].latest_run(分支2).current_wait(分支2).task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| data[].latest_run(分支2).current_wait(分支2).resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| data[].latest_run(分支2).current_wait(分支2).event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| data[].latest_run(分支2).current_wait(分支2).child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| data[].latest_run(分支2).current_wait(分支2).created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| data[].latest_run(分支2).current_wait(分支2).expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| data[].latest_run(分支2).current_wait(分支2).resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| data[].stats_7d | object | 必填 / 必有;近七天的运行统计:按运行结束日期累计,在运行结束时更新,读取时不扫描运行。 不接受额外字段。 |
| data[].stats_7d.runs | number | 必填 / 必有;近七天内结束的运行总数(任意终态)。 |
| data[].stats_7d.failures | number | 必填 / 必有;其中以 faulted 结束的运行数。 |
| data[].archived_at | null / string | 必填 / 必有;归档时间;未归档为 null。归档后名字保留,不可复用。 |
| data[].created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 |
| data[].updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 |
| next_cursor | null / string | 必填 / 必有;下一页游标,原样传给 cursor 参数并保持原查询条件;没有更多页为 null。接口不返回总数。 |
HTTP 200
{
"data": [
{
"id": "scr_00mv67lwvh08624c70ef824a0d8b14b0315c88452e",
"owner": "tnt_3a9759864ccb4e00",
"kind": "script",
"namespace": "docs-samples",
"name": "sample-scripts-1791867412840-b05e8a",
"description": "",
"labels": {},
"latest_version": null,
"dist_tags": {},
"draft_changed": true,
"latest_run": null,
"stats_7d": {
"runs": 0,
"failures": 0
},
"archived_at": null,
"created_at": "2026-10-13T04:57:19.277Z",
"updated_at": "2026-10-13T04:57:19.277Z"
}
],
"next_cursor": null
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
创建脚本及可编辑草稿,不会发布或启动运行;脚本与工作流共用名称空间,同租户重名返回 NAME_TAKEN。
POST /automation/v1/scripts
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| header: Idempotency-Key | string | 可选;可选;1–256 字符。24 小时内同一 key 重放首个响应并带 Idempotent-Replayed: true;同 key 不同请求体返回 422;处理中返回 409。 minLength: 1;maxLength: 256 |
不接受额外字段。
| 字段 | 类型 | 说明 |
|---|---|---|
| namespace | string | 必填 / 必有;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9.-]{0,63};praxis 只读。 pattern: "^[a-zA-Z0-9][a-zA-Z0-9.-]{0,63}$" |
| name | string | 必填 / 必有;名称,存储前转为小写,格式 [a-z0-9][a-z0-9.-]{0,63}。 pattern: "^[a-zA-Z0-9][a-zA-Z0-9.-]{0,63}$" |
| description | string | 可选;说明,最多 1000 个字符。 maxLength: 1000 |
| draft | string | 可选;可编辑源码;脚本为 TypeScript,工作流为 YAML。创建时省略为空字符串。 |
| labels | object | 可选;最多 50 个标签;键为 1–40 个字符,值最多 500 个字符。 |
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/scripts" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"namespace": "docs-samples",
"name": "sample-scripts",
"draft": "export default async (input: { n: number }) => ({ answer: input.n + 1 });"
}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.scripts.create({
"body": {
"namespace": "docs-samples",
"name": "sample-scripts",
"draft": "export default async (input: { n: number }) => ({ answer: input.n + 1 });"
}
});
console.log(result);Success
| 响应头 | 类型 | 说明 |
|---|---|---|
| Idempotent-Replayed | boolean | Present and true when replaying the first response for this key. |
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| draft | object | 必填 / 必有;脚本或工作流的可编辑草稿;发布版本时以草稿或某次运行的源码为准。 不接受额外字段。 |
| draft.source | string | 必填 / 必有;草稿源码:脚本为 TypeScript,工作流为 YAML。 |
| draft.revision | string | 必填 / 必有;草稿修订标识(ETag),发布时作为 expected_draft_revision,更新草稿时作为 If-Match;与当前不一致返回 412。 |
| draft.updated_at | string | 必填 / 必有;草稿最近一次修改的时间(RFC 3339 UTC)。 |
| draft.updated_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| draft.updated_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| draft.updated_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| id | string | 必填 / 必有;编排 ID,脚本前缀 scr_,工作流前缀 wf_;日常使用 namespace 与 name。 |
| kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| namespace | string | 必填 / 必有;命名空间,引用形如 namespace/name@版本。 |
| name | string | 必填 / 必有;名字,与 namespace 一起在租户内唯一,脚本与工作流共用命名空间,重名返回 409 NAME_TAKEN。 |
| description | string | 必填 / 必有;说明文字,最多 1000 字符。 |
| labels | object | 必填 / 必有;用户自定义标签:字符串键值对,用于分类与列表过滤(labels[key]=value);键不能以 praxis. 开头。 |
| owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| latest_version | null / object | 必填 / 必有;latest 标签指向的已发布版本 {version, published_at};尚未发布为 null。 |
| latest_version(分支2).version | string | 必填 / 必有;最新发布版本的版本号(semver)。 |
| latest_version(分支2).published_at | string | 必填 / 必有;该版本的发布时间(RFC 3339 UTC)。 |
| dist_tags | object | 必填 / 必有;标签到精确版本号的映射,例如 latest 指向 1.2.0;用 ns/name@标签 运行时按此解析。 |
| draft_changed | boolean | 必填 / 必有;true 表示草稿内容(摘要)不同于 latest 版本,即有未发布的改动。 |
| latest_run | null / object | 必填 / 必有;该编排最近一次运行的摘要;还没有运行为 null。 |
| latest_run(分支2).id | string | 必填 / 必有;运行 ID(run_ 前缀),可用于 runs.retrieve。 |
| latest_run(分支2).number | null / number | 必填 / 必有;运行在该脚本或工作流内的递增序号。 |
| latest_run(分支2).status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;运行状态。pending 已创建尚未开始;running 执行中;waiting 工作流在等待事件、定时器或子运行;suspended 工作流被暂停;cancelled 已取消;faulted 失败;completed 成功完成。 |
| latest_run(分支2).created_at | string | 必填 / 必有;运行创建时间(RFC 3339 UTC)。 |
| latest_run(分支2).current_wait | null / object | 必填 / 必有;当前未完成的等待点;没有等待为 null。 |
| latest_run(分支2).current_wait(分支2).id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| latest_run(分支2).current_wait(分支2).run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| latest_run(分支2).current_wait(分支2).kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| latest_run(分支2).current_wait(分支2).state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| latest_run(分支2).current_wait(分支2).task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| latest_run(分支2).current_wait(分支2).task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| latest_run(分支2).current_wait(分支2).task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| latest_run(分支2).current_wait(分支2).resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| latest_run(分支2).current_wait(分支2).expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| latest_run(分支2).current_wait(分支2).resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| stats_7d | object | 必填 / 必有;近七天的运行统计:按运行结束日期累计,在运行结束时更新,读取时不扫描运行。 不接受额外字段。 |
| stats_7d.runs | number | 必填 / 必有;近七天内结束的运行总数(任意终态)。 |
| stats_7d.failures | number | 必填 / 必有;其中以 faulted 结束的运行数。 |
| archived_at | null / string | 必填 / 必有;归档时间;未归档为 null。归档后名字保留,不可复用。 |
| created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 |
| updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 |
HTTP 200
{
"id": "scr_00mv67lwvh08624c70ef824a0d8b14b0315c88452e",
"owner": "tnt_3a9759864ccb4e00",
"kind": "script",
"namespace": "docs-samples",
"name": "sample-scripts-1791867412840-b05e8a",
"description": "",
"labels": {},
"latest_version": null,
"dist_tags": {},
"draft_changed": true,
"latest_run": null,
"stats_7d": {
"runs": 0,
"failures": 0
},
"archived_at": null,
"created_at": "2026-10-13T04:57:19.277Z",
"updated_at": "2026-10-13T04:57:19.277Z",
"draft": {
"source": "export default async (input: { n: number }) => ({ answer: input.n + 1 });",
"revision": "draft_00mv67lwvh333793ba7d9e47cb89b5fd8b43fb4fa3",
"updated_at": "2026-10-13T04:57:19.277Z",
"updated_by": {
"type": "api_key",
"id": "key_3e00b8984967"
}
}
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 403 | NAMESPACE_FORBIDDEN:命名空间只读或运行令牌不允许此调用。 |
| 409 | IDEMPOTENCY_IN_FLIGHT:同一幂等键的请求仍在处理中。 NAME_TAKEN:名称已被同一租户占用。 |
| 422 | IDEMPOTENCY_KEY_MISMATCH:同一幂等键已用于不同请求内容。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
读取脚本详情及草稿源码;ETag 是草稿修订,可作为修改请求的 If-Match。
GET /automation/v1/scripts/{ns}/{name}
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| SCRIPT_NAME | 创建脚本返回的 name |
: "${SCRIPT_NAME:?Set SCRIPT_NAME}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/scripts/docs-samples/${SCRIPT_NAME}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.scripts.retrieve({
"path": {
"ns": "docs-samples",
"name": env("SCRIPT_NAME")
}
});
console.log(result);Success
| 响应头 | 类型 | 说明 |
|---|---|---|
| ETag | string | Current resource revision for conditional updates. |
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| draft | object | 必填 / 必有;脚本或工作流的可编辑草稿;发布版本时以草稿或某次运行的源码为准。 不接受额外字段。 |
| draft.source | string | 必填 / 必有;草稿源码:脚本为 TypeScript,工作流为 YAML。 |
| draft.revision | string | 必填 / 必有;草稿修订标识(ETag),发布时作为 expected_draft_revision,更新草稿时作为 If-Match;与当前不一致返回 412。 |
| draft.updated_at | string | 必填 / 必有;草稿最近一次修改的时间(RFC 3339 UTC)。 |
| draft.updated_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| draft.updated_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| draft.updated_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| id | string | 必填 / 必有;编排 ID,脚本前缀 scr_,工作流前缀 wf_;日常使用 namespace 与 name。 |
| kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| namespace | string | 必填 / 必有;命名空间,引用形如 namespace/name@版本。 |
| name | string | 必填 / 必有;名字,与 namespace 一起在租户内唯一,脚本与工作流共用命名空间,重名返回 409 NAME_TAKEN。 |
| description | string | 必填 / 必有;说明文字,最多 1000 字符。 |
| labels | object | 必填 / 必有;用户自定义标签:字符串键值对,用于分类与列表过滤(labels[key]=value);键不能以 praxis. 开头。 |
| owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| latest_version | null / object | 必填 / 必有;latest 标签指向的已发布版本 {version, published_at};尚未发布为 null。 |
| latest_version(分支2).version | string | 必填 / 必有;最新发布版本的版本号(semver)。 |
| latest_version(分支2).published_at | string | 必填 / 必有;该版本的发布时间(RFC 3339 UTC)。 |
| dist_tags | object | 必填 / 必有;标签到精确版本号的映射,例如 latest 指向 1.2.0;用 ns/name@标签 运行时按此解析。 |
| draft_changed | boolean | 必填 / 必有;true 表示草稿内容(摘要)不同于 latest 版本,即有未发布的改动。 |
| latest_run | null / object | 必填 / 必有;该编排最近一次运行的摘要;还没有运行为 null。 |
| latest_run(分支2).id | string | 必填 / 必有;运行 ID(run_ 前缀),可用于 runs.retrieve。 |
| latest_run(分支2).number | null / number | 必填 / 必有;运行在该脚本或工作流内的递增序号。 |
| latest_run(分支2).status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;运行状态。pending 已创建尚未开始;running 执行中;waiting 工作流在等待事件、定时器或子运行;suspended 工作流被暂停;cancelled 已取消;faulted 失败;completed 成功完成。 |
| latest_run(分支2).created_at | string | 必填 / 必有;运行创建时间(RFC 3339 UTC)。 |
| latest_run(分支2).current_wait | null / object | 必填 / 必有;当前未完成的等待点;没有等待为 null。 |
| latest_run(分支2).current_wait(分支2).id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| latest_run(分支2).current_wait(分支2).run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| latest_run(分支2).current_wait(分支2).kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| latest_run(分支2).current_wait(分支2).state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| latest_run(分支2).current_wait(分支2).task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| latest_run(分支2).current_wait(分支2).task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| latest_run(分支2).current_wait(分支2).task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| latest_run(分支2).current_wait(分支2).resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| latest_run(分支2).current_wait(分支2).expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| latest_run(分支2).current_wait(分支2).resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| stats_7d | object | 必填 / 必有;近七天的运行统计:按运行结束日期累计,在运行结束时更新,读取时不扫描运行。 不接受额外字段。 |
| stats_7d.runs | number | 必填 / 必有;近七天内结束的运行总数(任意终态)。 |
| stats_7d.failures | number | 必填 / 必有;其中以 faulted 结束的运行数。 |
| archived_at | null / string | 必填 / 必有;归档时间;未归档为 null。归档后名字保留,不可复用。 |
| created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 |
| updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 |
HTTP 200
{
"id": "scr_00mv67lwvh08624c70ef824a0d8b14b0315c88452e",
"owner": "tnt_3a9759864ccb4e00",
"kind": "script",
"namespace": "docs-samples",
"name": "sample-scripts-1791867412840-b05e8a",
"description": "",
"labels": {},
"latest_version": null,
"dist_tags": {},
"draft_changed": true,
"latest_run": null,
"stats_7d": {
"runs": 0,
"failures": 0
},
"archived_at": null,
"created_at": "2026-10-13T04:57:19.277Z",
"updated_at": "2026-10-13T04:57:19.277Z",
"draft": {
"source": "export default async (input: { n: number }) => ({ answer: input.n + 1 });",
"revision": "draft_00mv67lwvh333793ba7d9e47cb89b5fd8b43fb4fa3",
"updated_at": "2026-10-13T04:57:19.277Z",
"updated_by": {
"type": "api_key",
"id": "key_3e00b8984967"
}
}
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
修改说明、标签或草稿,必须携带与当前草稿匹配的 If-Match;即使只改元数据也会生成新的草稿修订。
PATCH /automation/v1/scripts/{ns}/{name}
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
| header: If-Match | string | 必填;当前资源的 ETag,可直接使用对象里的 draft.revision 或 etag 字段值:裸值、带双引号或弱校验写法 W/"…" 均接受(RFC 7232 弱比较);缺失返回 400,修订不匹配返回 412。 |
不接受额外字段。
| 字段 | 类型 | 说明 |
|---|---|---|
| description | string | 可选;说明,最多 1000 个字符。 maxLength: 1000 |
| labels | object | 可选;最多 50 个标签;键为 1–40 个字符,值最多 500 个字符。 |
| draft | string | 可选;可编辑源码;脚本为 TypeScript,工作流为 YAML。创建时省略为空字符串。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| SCRIPT_NAME | 创建脚本返回的 name |
| ETAG | 最新 GET 响应头 ETag(保留引号) |
: "${SCRIPT_NAME:?Set SCRIPT_NAME}"
: "${ETAG:?Set ETAG}"
curl --fail-with-body -X PATCH "https://api.deepraxis.ai/automation/v1/scripts/docs-samples/${SCRIPT_NAME}" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "If-Match: ${ETAG}" \
-H "Content-Type: application/json" \
--data '{
"description": "Sample definition",
"draft": "export default async (input: { n: number }) => ({ answer: input.n + 1 });"
}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.scripts.update({
"path": {
"ns": "docs-samples",
"name": env("SCRIPT_NAME")
},
"headers": {
"If-Match": env("ETAG")
},
"body": {
"description": "Sample definition",
"draft": "export default async (input: { n: number }) => ({ answer: input.n + 1 });"
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| draft | object | 必填 / 必有;脚本或工作流的可编辑草稿;发布版本时以草稿或某次运行的源码为准。 不接受额外字段。 |
| draft.source | string | 必填 / 必有;草稿源码:脚本为 TypeScript,工作流为 YAML。 |
| draft.revision | string | 必填 / 必有;草稿修订标识(ETag),发布时作为 expected_draft_revision,更新草稿时作为 If-Match;与当前不一致返回 412。 |
| draft.updated_at | string | 必填 / 必有;草稿最近一次修改的时间(RFC 3339 UTC)。 |
| draft.updated_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| draft.updated_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| draft.updated_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| id | string | 必填 / 必有;编排 ID,脚本前缀 scr_,工作流前缀 wf_;日常使用 namespace 与 name。 |
| kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| namespace | string | 必填 / 必有;命名空间,引用形如 namespace/name@版本。 |
| name | string | 必填 / 必有;名字,与 namespace 一起在租户内唯一,脚本与工作流共用命名空间,重名返回 409 NAME_TAKEN。 |
| description | string | 必填 / 必有;说明文字,最多 1000 字符。 |
| labels | object | 必填 / 必有;用户自定义标签:字符串键值对,用于分类与列表过滤(labels[key]=value);键不能以 praxis. 开头。 |
| owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| latest_version | null / object | 必填 / 必有;latest 标签指向的已发布版本 {version, published_at};尚未发布为 null。 |
| latest_version(分支2).version | string | 必填 / 必有;最新发布版本的版本号(semver)。 |
| latest_version(分支2).published_at | string | 必填 / 必有;该版本的发布时间(RFC 3339 UTC)。 |
| dist_tags | object | 必填 / 必有;标签到精确版本号的映射,例如 latest 指向 1.2.0;用 ns/name@标签 运行时按此解析。 |
| draft_changed | boolean | 必填 / 必有;true 表示草稿内容(摘要)不同于 latest 版本,即有未发布的改动。 |
| latest_run | null / object | 必填 / 必有;该编排最近一次运行的摘要;还没有运行为 null。 |
| latest_run(分支2).id | string | 必填 / 必有;运行 ID(run_ 前缀),可用于 runs.retrieve。 |
| latest_run(分支2).number | null / number | 必填 / 必有;运行在该脚本或工作流内的递增序号。 |
| latest_run(分支2).status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;运行状态。pending 已创建尚未开始;running 执行中;waiting 工作流在等待事件、定时器或子运行;suspended 工作流被暂停;cancelled 已取消;faulted 失败;completed 成功完成。 |
| latest_run(分支2).created_at | string | 必填 / 必有;运行创建时间(RFC 3339 UTC)。 |
| latest_run(分支2).current_wait | null / object | 必填 / 必有;当前未完成的等待点;没有等待为 null。 |
| latest_run(分支2).current_wait(分支2).id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| latest_run(分支2).current_wait(分支2).run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| latest_run(分支2).current_wait(分支2).kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| latest_run(分支2).current_wait(分支2).state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| latest_run(分支2).current_wait(分支2).task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| latest_run(分支2).current_wait(分支2).task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| latest_run(分支2).current_wait(分支2).task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| latest_run(分支2).current_wait(分支2).resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| latest_run(分支2).current_wait(分支2).expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| latest_run(分支2).current_wait(分支2).resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| stats_7d | object | 必填 / 必有;近七天的运行统计:按运行结束日期累计,在运行结束时更新,读取时不扫描运行。 不接受额外字段。 |
| stats_7d.runs | number | 必填 / 必有;近七天内结束的运行总数(任意终态)。 |
| stats_7d.failures | number | 必填 / 必有;其中以 faulted 结束的运行数。 |
| archived_at | null / string | 必填 / 必有;归档时间;未归档为 null。归档后名字保留,不可复用。 |
| created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 |
| updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 |
HTTP 200
{
"id": "scr_00mv67lwvh08624c70ef824a0d8b14b0315c88452e",
"owner": "tnt_3a9759864ccb4e00",
"kind": "script",
"namespace": "docs-samples",
"name": "sample-scripts-1791867412840-b05e8a",
"description": "Sample definition",
"labels": {},
"latest_version": null,
"dist_tags": {},
"draft_changed": true,
"latest_run": null,
"stats_7d": {
"runs": 0,
"failures": 0
},
"archived_at": null,
"created_at": "2026-10-13T04:57:19.277Z",
"updated_at": "2026-10-13T04:57:21.691Z",
"draft": {
"source": "export default async (input: { n: number }) => ({ answer: input.n + 1 });",
"revision": "draft_00mv67lwvh333793ba7d9e47cb89b5fd8b43fb4fa3",
"updated_at": "2026-10-13T04:57:19.277Z",
"updated_by": {
"type": "api_key",
"id": "key_3e00b8984967"
}
}
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 403 | NAMESPACE_FORBIDDEN:命名空间只读或运行令牌不允许此调用。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 |
| 409 | TARGET_ARCHIVED:目标已归档,不能用于本操作;动作执行错误的 detail 包含 ns/name。 |
| 412 | PRECONDITION_FAILED:修订、源码摘要或并发写入条件不匹配。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
归档后保留名称、版本和草稿;默认列表隐藏该条目,新的目标解析和运行请求拒绝已归档目标。
POST /automation/v1/scripts/{ns}/{name}/archive
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
不接受额外字段。 object
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| SCRIPT_NAME | 创建脚本返回的 name |
: "${SCRIPT_NAME:?Set SCRIPT_NAME}"
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/scripts/docs-samples/${SCRIPT_NAME}/archive" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.scripts.archive({
"path": {
"ns": "docs-samples",
"name": env("SCRIPT_NAME")
},
"body": {}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;编排 ID,脚本前缀 scr_,工作流前缀 wf_;日常使用 namespace 与 name。 |
| kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| namespace | string | 必填 / 必有;命名空间,引用形如 namespace/name@版本。 |
| name | string | 必填 / 必有;名字,与 namespace 一起在租户内唯一,脚本与工作流共用命名空间,重名返回 409 NAME_TAKEN。 |
| description | string | 必填 / 必有;说明文字,最多 1000 字符。 |
| labels | object | 必填 / 必有;用户自定义标签:字符串键值对,用于分类与列表过滤(labels[key]=value);键不能以 praxis. 开头。 |
| owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| latest_version | null / object | 必填 / 必有;latest 标签指向的已发布版本 {version, published_at};尚未发布为 null。 |
| latest_version(分支2).version | string | 必填 / 必有;最新发布版本的版本号(semver)。 |
| latest_version(分支2).published_at | string | 必填 / 必有;该版本的发布时间(RFC 3339 UTC)。 |
| dist_tags | object | 必填 / 必有;标签到精确版本号的映射,例如 latest 指向 1.2.0;用 ns/name@标签 运行时按此解析。 |
| draft_changed | boolean | 必填 / 必有;true 表示草稿内容(摘要)不同于 latest 版本,即有未发布的改动。 |
| latest_run | null / object | 必填 / 必有;该编排最近一次运行的摘要;还没有运行为 null。 |
| latest_run(分支2).id | string | 必填 / 必有;运行 ID(run_ 前缀),可用于 runs.retrieve。 |
| latest_run(分支2).number | null / number | 必填 / 必有;运行在该脚本或工作流内的递增序号。 |
| latest_run(分支2).status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;运行状态。pending 已创建尚未开始;running 执行中;waiting 工作流在等待事件、定时器或子运行;suspended 工作流被暂停;cancelled 已取消;faulted 失败;completed 成功完成。 |
| latest_run(分支2).created_at | string | 必填 / 必有;运行创建时间(RFC 3339 UTC)。 |
| latest_run(分支2).current_wait | null / object | 必填 / 必有;当前未完成的等待点;没有等待为 null。 |
| latest_run(分支2).current_wait(分支2).id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| latest_run(分支2).current_wait(分支2).run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| latest_run(分支2).current_wait(分支2).kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| latest_run(分支2).current_wait(分支2).state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| latest_run(分支2).current_wait(分支2).task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| latest_run(分支2).current_wait(分支2).task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| latest_run(分支2).current_wait(分支2).task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| latest_run(分支2).current_wait(分支2).resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| latest_run(分支2).current_wait(分支2).expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| latest_run(分支2).current_wait(分支2).resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| stats_7d | object | 必填 / 必有;近七天的运行统计:按运行结束日期累计,在运行结束时更新,读取时不扫描运行。 不接受额外字段。 |
| stats_7d.runs | number | 必填 / 必有;近七天内结束的运行总数(任意终态)。 |
| stats_7d.failures | number | 必填 / 必有;其中以 faulted 结束的运行数。 |
| archived_at | null / string | 必填 / 必有;归档时间;未归档为 null。归档后名字保留,不可复用。 |
| created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 |
| updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 |
HTTP 200
{
"id": "scr_00mv67lwvh08624c70ef824a0d8b14b0315c88452e",
"owner": "tnt_3a9759864ccb4e00",
"kind": "script",
"namespace": "docs-samples",
"name": "sample-scripts-1791867412840-b05e8a",
"description": "Sample definition",
"labels": {},
"latest_version": {
"version": "1.0.0",
"published_at": "2026-10-13T04:57:22.398Z"
},
"dist_tags": {
"latest": "1.0.0"
},
"draft_changed": false,
"latest_run": null,
"stats_7d": {
"runs": 0,
"failures": 0
},
"archived_at": "2026-10-13T04:57:27.639Z",
"created_at": "2026-10-13T04:57:19.277Z",
"updated_at": "2026-10-13T04:57:27.639Z"
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 403 | NAMESPACE_FORBIDDEN:命名空间只读或运行令牌不允许此调用。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 |
| 412 | PRECONDITION_FAILED:修订、源码摘要或并发写入条件不匹配。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
恢复已归档定义,保留版本和标签。名称无需重新分配。
POST /automation/v1/scripts/{ns}/{name}/restore
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
不接受额外字段。 object
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| SCRIPT_NAME | 创建脚本返回的 name |
: "${SCRIPT_NAME:?Set SCRIPT_NAME}"
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/scripts/docs-samples/${SCRIPT_NAME}/restore" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.scripts.restore({
"path": {
"ns": "docs-samples",
"name": env("SCRIPT_NAME")
},
"body": {}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;编排 ID,脚本前缀 scr_,工作流前缀 wf_;日常使用 namespace 与 name。 |
| kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| namespace | string | 必填 / 必有;命名空间,引用形如 namespace/name@版本。 |
| name | string | 必填 / 必有;名字,与 namespace 一起在租户内唯一,脚本与工作流共用命名空间,重名返回 409 NAME_TAKEN。 |
| description | string | 必填 / 必有;说明文字,最多 1000 字符。 |
| labels | object | 必填 / 必有;用户自定义标签:字符串键值对,用于分类与列表过滤(labels[key]=value);键不能以 praxis. 开头。 |
| owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| latest_version | null / object | 必填 / 必有;latest 标签指向的已发布版本 {version, published_at};尚未发布为 null。 |
| latest_version(分支2).version | string | 必填 / 必有;最新发布版本的版本号(semver)。 |
| latest_version(分支2).published_at | string | 必填 / 必有;该版本的发布时间(RFC 3339 UTC)。 |
| dist_tags | object | 必填 / 必有;标签到精确版本号的映射,例如 latest 指向 1.2.0;用 ns/name@标签 运行时按此解析。 |
| draft_changed | boolean | 必填 / 必有;true 表示草稿内容(摘要)不同于 latest 版本,即有未发布的改动。 |
| latest_run | null / object | 必填 / 必有;该编排最近一次运行的摘要;还没有运行为 null。 |
| latest_run(分支2).id | string | 必填 / 必有;运行 ID(run_ 前缀),可用于 runs.retrieve。 |
| latest_run(分支2).number | null / number | 必填 / 必有;运行在该脚本或工作流内的递增序号。 |
| latest_run(分支2).status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;运行状态。pending 已创建尚未开始;running 执行中;waiting 工作流在等待事件、定时器或子运行;suspended 工作流被暂停;cancelled 已取消;faulted 失败;completed 成功完成。 |
| latest_run(分支2).created_at | string | 必填 / 必有;运行创建时间(RFC 3339 UTC)。 |
| latest_run(分支2).current_wait | null / object | 必填 / 必有;当前未完成的等待点;没有等待为 null。 |
| latest_run(分支2).current_wait(分支2).id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| latest_run(分支2).current_wait(分支2).run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| latest_run(分支2).current_wait(分支2).kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| latest_run(分支2).current_wait(分支2).state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| latest_run(分支2).current_wait(分支2).task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| latest_run(分支2).current_wait(分支2).task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| latest_run(分支2).current_wait(分支2).task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| latest_run(分支2).current_wait(分支2).resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| latest_run(分支2).current_wait(分支2).expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| latest_run(分支2).current_wait(分支2).resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| stats_7d | object | 必填 / 必有;近七天的运行统计:按运行结束日期累计,在运行结束时更新,读取时不扫描运行。 不接受额外字段。 |
| stats_7d.runs | number | 必填 / 必有;近七天内结束的运行总数(任意终态)。 |
| stats_7d.failures | number | 必填 / 必有;其中以 faulted 结束的运行数。 |
| archived_at | null / string | 必填 / 必有;归档时间;未归档为 null。归档后名字保留,不可复用。 |
| created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 |
| updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 |
HTTP 200
{
"id": "scr_00mv67lwvh08624c70ef824a0d8b14b0315c88452e",
"owner": "tnt_3a9759864ccb4e00",
"kind": "script",
"namespace": "docs-samples",
"name": "sample-scripts-1791867412840-b05e8a",
"description": "Sample definition",
"labels": {},
"latest_version": {
"version": "1.0.0",
"published_at": "2026-10-13T04:57:22.398Z"
},
"dist_tags": {
"latest": "1.0.0"
},
"draft_changed": false,
"latest_run": null,
"stats_7d": {
"runs": 0,
"failures": 0
},
"archived_at": null,
"created_at": "2026-10-13T04:57:19.277Z",
"updated_at": "2026-10-13T04:57:28.559Z"
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 403 | NAMESPACE_FORBIDDEN:命名空间只读或运行令牌不允许此调用。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 |
| 412 | PRECONDITION_FAILED:修订、源码摘要或并发写入条件不匹配。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
从草稿或临时运行源码发布版本,校验定义并锁定依赖。草稿须匹配 expected_draft_revision;临时运行由 from_run 与 expected_source_sha256 指定。版本相同且内容相同返回已有版本,内容不同返回 VERSION_EXISTS;预发布版本必须显式带 tag(不能是 latest,tag 只能含 URL 安全字符且不能是版本号或范围,违规返回 TAG_REQUIRED 或 TAG_INVALID,hint 给出完整规则),校验不通过返回 DEFINITION_INVALID。稳定版本仅高于已有最高稳定版本时自动移动 latest;工作流成为 latest 时同步定义中的定时触发器。 发布会去掉版本号的 +build 元数据。
POST /automation/v1/scripts/{ns}/{name}/versions
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
| header: Idempotency-Key | string | 可选;可选;1–256 字符。24 小时内同一 key 重放首个响应并带 Idempotent-Replayed: true;同 key 不同请求体返回 422;处理中返回 409。 minLength: 1;maxLength: 256 |
| 字段 | 类型 | 说明 |
|---|---|---|
| (分支1).version | string | 必填 / 必有;规范的精确语义版本,例如 1.2.0 或 1.3.0-beta.1;不能是范围。 |
| (分支1).expected_draft_revision | string | 必填 / 必有;发布的草稿修订,必须匹配当前草稿;与 from_run 发布方式二选一。 |
| (分支1).tag | string | 可选;发布标签。预发布版本(如 1.3.0-beta.1)必须带 tag 且不能是 latest;tag 只能由 URL 安全字符组成(字母、数字及 - _ . ! ~ * ' ( )),不含空格和 / ? #,首尾无空白;不能是版本号或版本范围(如 1.2.3、^1、1.x、*);beta、next、debug 等其余名称均可。违规返回 TAG_INVALID 或 TAG_REQUIRED,hint 给出完整规则。 |
| (分支2).version | string | 必填 / 必有;规范的精确语义版本,例如 1.2.0 或 1.3.0-beta.1;不能是范围。 |
| (分支2).from_run | string | 必填 / 必有;提供源码快照的临时运行 ID;已发布目标的运行当前没有可用于此入口的快照。须同时给出 expected_source_sha256,不能同时给 expected_draft_revision。 |
| (分支2).expected_source_sha256 | string | 必填 / 必有;运行源码的 SHA-256 摘要,必须与快照匹配。 |
| (分支2).tag | string | 可选;发布标签。预发布版本(如 1.3.0-beta.1)必须带 tag 且不能是 latest;tag 只能由 URL 安全字符组成(字母、数字及 - _ . ! ~ * ' ( )),不含空格和 / ? #,首尾无空白;不能是版本号或版本范围(如 1.2.3、^1、1.x、*);beta、next、debug 等其余名称均可。违规返回 TAG_INVALID 或 TAG_REQUIRED,hint 给出完整规则。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| SCRIPT_NAME | 创建脚本返回的 name |
| DRAFT_REVISION | 当前 draft.revision |
: "${SCRIPT_NAME:?Set SCRIPT_NAME}"
: "${DRAFT_REVISION:?Set DRAFT_REVISION}"
BODY=$(jq -n --arg DRAFT_REVISION "$DRAFT_REVISION" '{
"version": "1.0.0",
"expected_draft_revision": $DRAFT_REVISION
}')
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/scripts/docs-samples/${SCRIPT_NAME}/versions" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data "$BODY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.scripts.versions.publish({
"path": {
"ns": "docs-samples",
"name": env("SCRIPT_NAME")
},
"body": {
"version": "1.0.0",
"expected_draft_revision": env("DRAFT_REVISION")
}
});
console.log(result);Success
| 响应头 | 类型 | 说明 |
|---|---|---|
| Idempotent-Replayed | boolean | Present and true when replaying the first response for this key. |
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;版本 ID,脚本前缀 scv_,工作流前缀 wfv_。 |
| kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| version | string | 必填 / 必有;版本号(semver,已去掉 +build 元数据)。 |
| digest | string | 必填 / 必有;源码与契约的内容摘要。 |
| source | string | 必填 / 必有;该版本的完整源码。版本列表默认不返回,需要时加 expand=source。 |
| input_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| input_schema.*(分支5) | object | 递归 JSON 值。 |
| input_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output_schema | object | 必填 / 必有;脚本从返回类型推导,支持 Promise 解包、Record、交叉类型和 Date(date-time);推不出时为空 schema,并在 /validate 的 warnings 给出 warning。 |
| output_schema.*(分支5) | object | 递归 JSON 值。 |
| output_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| references | object[] | 必填 / 必有;该版本依赖的动作、平台 API、脚本与工作流。脚本和工作流依赖在发布时锁定到精确版本。 |
| references[].kind | "action" / "script" / "workflow" / "platform_api" / "run" | 必填 / 必有;依赖类型。action 为动作;platform_api 为平台 API 操作;script 为脚本;workflow 为工作流;run 为脚本中 invoke("ns/name") 调用的子运行目标(脚本或工作流,发布时解析)。 |
| references[].name | string | 必填 / 必有;被依赖对象:动作为 ns/name,平台 API 为操作名,脚本与工作流为 ns/name。 |
| references[].range | string | 可选;引用时写的版本范围或标签(npm 规则);未写时为空。 |
| references[].locked_version | string | 可选;发布时锁定的精确版本;仅脚本与工作流依赖有,动作与平台 API 不锁定。 |
| outline | null / object[] | 必填 / 必有;工作流的步骤大纲(OutlineNode 数组),由解析器静态生成;脚本为 null。 |
| outline(分支2)[].name | string | 必填 / 必有;步骤名,即工作流 YAML 中该步骤的键。 |
| outline(分支2)[].reference | string | 必填 / 必有;该步骤在工作流文档中的 JSON Pointer,例如 /do/0/start;与运行时 Task.reference 一致。 |
| outline(分支2)[].kind | "run" / "call" / "wait" / "set" / "for" / "fork" / "try" / "switch" / "emit" / "raise" / "listen" / "do" | 必填 / 必有;工作流步骤类型。call 调用动作;run 运行子脚本或子工作流;wait 等待时长;set 设置变量;for 循环;fork 并行分支;try 带捕获的块;switch 条件分支;emit 发出事件;raise 抛出错误;listen 等待事件;do 顺序执行的步骤块。 |
| outline(分支2)[].target | string | 可选;步骤调用的目标:call 步骤为动作 ns/name,run 步骤为 ns/name@范围;其它类型没有。 |
| outline(分支2)[].wait | object | 可选;等待步骤的摘要:时长(seconds 或 duration)或等待的事件类型(event)。 不接受额外字段。 |
| outline(分支2)[].wait.until | string | 可选;等待结束的绝对时刻,仅在可静态确定时给出;目前大纲不填充该字段。 |
| outline(分支2)[].wait.seconds | number | 可选;可静态换算的等待秒数;时长对象与可换算的 ISO 时长均投影到此字段。 |
| outline(分支2)[].wait.event | string | 可选;listen 步骤等待的事件类型。 |
| outline(分支2)[].wait.duration | string | 可选;无法静态换算成秒的原始时长或运行时表达式;不与 seconds 强行换算。 |
| outline(分支2)[].loop | object | 可选;for 步骤的循环信息 {each, in}。 不接受额外字段。 |
| outline(分支2)[].loop.each | string | 必填 / 必有;循环变量名;未指定时为 item。 |
| outline(分支2)[].loop.in | string | 必填 / 必有;被遍历的集合表达式原文。 |
| outline(分支2)[].children | object[] | 可选;嵌套的子步骤(do、fork 分支、try 与 catch 内的步骤)。 |
| outline(分支2)[].children[] | object | 递归 JSON 值。 |
| sdk_version | null / string | 必填 / 必有;发布脚本所用的 SDK 版本;工作流为 null。 |
| published_at | string | 必填 / 必有;发布时间(RFC 3339 UTC)。 |
| published_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| published_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| published_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| deprecated | null / string | 必填 / 必有;弃用说明;未弃用为 null。弃用的版本仍可运行,但按范围或标签解析时优先选用未弃用的版本。 |
| deprecated_at | null / string | 必填 / 必有;弃用时间(RFC 3339 UTC);未弃用为 null。 |
| deprecated_by | null / object | 必填 / 必有;执行弃用的主体;未弃用为 null。 |
| deprecated_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| deprecated_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
HTTP 200
{
"id": "scv_00mv67lza679fc5498438040079f0c5684208c4915",
"kind": "script",
"version": "1.0.0",
"digest": "7ae6678882a4ef2ea96e401c105d5c6ef512917cd72a9235289d2a3bf1f1b49d",
"input_schema": {
"type": "object",
"properties": {
"n": {
"type": "number"
}
},
"required": [
"n"
]
},
"output_schema": {
"type": "object",
"properties": {
"answer": {
"type": "number"
}
},
"required": [
"answer"
]
},
"references": [],
"outline": null,
"sdk_version": "0.1.0",
"published_at": "2026-10-13T04:57:22.398Z",
"published_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"deprecated": null,
"deprecated_at": null,
"deprecated_by": null,
"source": "export default async (input: { n: number }) => ({ answer: input.n + 1 });"
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 TAG_REQUIRED:预发布版本必须显式指定发布标签(例如 beta,不能是 latest);响应 hint 列出完整规则。 TAG_INVALID:标签无效:预发布版本不能打 latest;tag 只能含 URL 安全字符(不含空格和 / ? #);不能是版本号或范围;latest 不能删除。响应 hint 列出完整规则。 DEFINITION_INVALID:源码未通过定义校验。 |
| 403 | NAMESPACE_FORBIDDEN:命名空间只读或运行令牌不允许此调用。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 RUN_NOT_FOUND:运行不存在或当前租户不可见。 |
| 409 | IDEMPOTENCY_IN_FLIGHT:同一幂等键的请求仍在处理中。 TARGET_ARCHIVED:目标已归档,不能用于本操作;动作执行错误的 detail 包含 ns/name。 VERSION_EXISTS:版本号已存在且源码内容不同。 |
| 412 | PRECONDITION_FAILED:修订、源码摘要或并发写入条件不匹配。 |
| 422 | IDEMPOTENCY_KEY_MISMATCH:同一幂等键已用于不同请求内容。 DEFINITION_IDENTITY_MISMATCH:源码声明或运行语言与发布目标不一致。 NO_MATCHING_VERSION:没有满足标签、版本或范围的已发布版本。 CYCLE_DETECTED:发布后依赖会形成环(A 依赖 B、B 又依赖 A);detail 给出环路径。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
按语义版本倒序分页列出不可变的 schema 和锁定依赖。默认不带源码;仅 expand=source 带完整源码,其它值返回 400。详情接口保持全文。
GET /automation/v1/scripts/{ns}/{name}/versions
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
| query: limit | integer | 可选;每页条数,整数 1–100,默认 25。 minimum: 1;maximum: 100 |
| query: cursor | string | 可选;上一页返回的 next_cursor,不透明字符串;保持原查询条件继续翻页。 |
| query: expand | "source" | 可选;仅接受 source;默认不带源码,其它值返回 400。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| SCRIPT_NAME | 创建脚本返回的 name |
: "${SCRIPT_NAME:?Set SCRIPT_NAME}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/scripts/docs-samples/${SCRIPT_NAME}/versions" \
-H "Authorization: Bearer $PRAXIS_API_KEY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.scripts.versions.list({
"path": {
"ns": "docs-samples",
"name": env("SCRIPT_NAME")
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| data | object[] | 必填 / 必有;本页的脚本版本(默认不含源码,expand=source 才带),按 semver 降序排列。 |
| data[].id | string | 必填 / 必有;版本 ID,脚本前缀 scv_,工作流前缀 wfv_。 |
| data[].kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| data[].version | string | 必填 / 必有;版本号(semver,已去掉 +build 元数据)。 |
| data[].digest | string | 必填 / 必有;源码与契约的内容摘要。 |
| data[].source | string | 可选;该版本的完整源码。版本列表默认不返回,需要时加 expand=source。 |
| data[].input_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| data[].input_schema.*(分支5) | object | 递归 JSON 值。 |
| data[].input_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[].output_schema | object | 必填 / 必有;脚本从返回类型推导,支持 Promise 解包、Record、交叉类型和 Date(date-time);推不出时为空 schema,并在 /validate 的 warnings 给出 warning。 |
| data[].output_schema.*(分支5) | object | 递归 JSON 值。 |
| data[].output_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[].references | object[] | 必填 / 必有;该版本依赖的动作、平台 API、脚本与工作流。脚本和工作流依赖在发布时锁定到精确版本。 |
| data[].references[].kind | "action" / "script" / "workflow" / "platform_api" / "run" | 必填 / 必有;依赖类型。action 为动作;platform_api 为平台 API 操作;script 为脚本;workflow 为工作流;run 为脚本中 invoke("ns/name") 调用的子运行目标(脚本或工作流,发布时解析)。 |
| data[].references[].name | string | 必填 / 必有;被依赖对象:动作为 ns/name,平台 API 为操作名,脚本与工作流为 ns/name。 |
| data[].references[].range | string | 可选;引用时写的版本范围或标签(npm 规则);未写时为空。 |
| data[].references[].locked_version | string | 可选;发布时锁定的精确版本;仅脚本与工作流依赖有,动作与平台 API 不锁定。 |
| data[].outline | null / object[] | 必填 / 必有;工作流的步骤大纲(OutlineNode 数组),由解析器静态生成;脚本为 null。 |
| data[].outline(分支2)[].name | string | 必填 / 必有;步骤名,即工作流 YAML 中该步骤的键。 |
| data[].outline(分支2)[].reference | string | 必填 / 必有;该步骤在工作流文档中的 JSON Pointer,例如 /do/0/start;与运行时 Task.reference 一致。 |
| data[].outline(分支2)[].kind | "run" / "call" / "wait" / "set" / "for" / "fork" / "try" / "switch" / "emit" / "raise" / "listen" / "do" | 必填 / 必有;工作流步骤类型。call 调用动作;run 运行子脚本或子工作流;wait 等待时长;set 设置变量;for 循环;fork 并行分支;try 带捕获的块;switch 条件分支;emit 发出事件;raise 抛出错误;listen 等待事件;do 顺序执行的步骤块。 |
| data[].outline(分支2)[].target | string | 可选;步骤调用的目标:call 步骤为动作 ns/name,run 步骤为 ns/name@范围;其它类型没有。 |
| data[].outline(分支2)[].wait | object | 可选;等待步骤的摘要:时长(seconds 或 duration)或等待的事件类型(event)。 不接受额外字段。 |
| data[].outline(分支2)[].wait.until | string | 可选;等待结束的绝对时刻,仅在可静态确定时给出;目前大纲不填充该字段。 |
| data[].outline(分支2)[].wait.seconds | number | 可选;可静态换算的等待秒数;时长对象与可换算的 ISO 时长均投影到此字段。 |
| data[].outline(分支2)[].wait.event | string | 可选;listen 步骤等待的事件类型。 |
| data[].outline(分支2)[].wait.duration | string | 可选;无法静态换算成秒的原始时长或运行时表达式;不与 seconds 强行换算。 |
| data[].outline(分支2)[].loop | object | 可选;for 步骤的循环信息 {each, in}。 不接受额外字段。 |
| data[].outline(分支2)[].loop.each | string | 必填 / 必有;循环变量名;未指定时为 item。 |
| data[].outline(分支2)[].loop.in | string | 必填 / 必有;被遍历的集合表达式原文。 |
| data[].outline(分支2)[].children | object[] | 可选;嵌套的子步骤(do、fork 分支、try 与 catch 内的步骤)。 |
| data[].outline(分支2)[].children[] | object | 递归 JSON 值。 |
| data[].sdk_version | null / string | 必填 / 必有;发布脚本所用的 SDK 版本;工作流为 null。 |
| data[].published_at | string | 必填 / 必有;发布时间(RFC 3339 UTC)。 |
| data[].published_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| data[].published_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| data[].published_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| data[].deprecated | null / string | 必填 / 必有;弃用说明;未弃用为 null。弃用的版本仍可运行,但按范围或标签解析时优先选用未弃用的版本。 |
| data[].deprecated_at | null / string | 必填 / 必有;弃用时间(RFC 3339 UTC);未弃用为 null。 |
| data[].deprecated_by | null / object | 必填 / 必有;执行弃用的主体;未弃用为 null。 |
| data[].deprecated_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| data[].deprecated_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| next_cursor | null / string | 必填 / 必有;下一页游标,原样传给 cursor 参数并保持原查询条件;没有更多页为 null。接口不返回总数。 |
HTTP 200
{
"data": [
{
"id": "scv_00mv67lza679fc5498438040079f0c5684208c4915",
"kind": "script",
"version": "1.0.0",
"digest": "7ae6678882a4ef2ea96e401c105d5c6ef512917cd72a9235289d2a3bf1f1b49d",
"input_schema": {
"type": "object",
"properties": {
"n": {
"type": "number"
}
},
"required": [
"n"
]
},
"output_schema": {
"type": "object",
"properties": {
"answer": {
"type": "number"
}
},
"required": [
"answer"
]
},
"references": [],
"outline": null,
"sdk_version": "0.1.0",
"published_at": "2026-10-13T04:57:22.398Z",
"published_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"deprecated": null,
"deprecated_at": null,
"deprecated_by": null
}
],
"next_cursor": null
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
读取精确版本的源码、输入输出契约及弃用说明;版本缺失返回 VERSION_NOT_FOUND。 详情始终返回完整源码。 version 接受精确版本或 dist-tag;range 返回 400,hint 提示改用 /resolve。
GET /automation/v1/scripts/{ns}/{name}/versions/{version}
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
| path: version | string | 必填;精确版本或 dist-tag;不接受 range(400,带 hint)。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| SCRIPT_NAME | 创建脚本返回的 name |
: "${SCRIPT_NAME:?Set SCRIPT_NAME}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/scripts/docs-samples/${SCRIPT_NAME}/versions/1.0.0" \
-H "Authorization: Bearer $PRAXIS_API_KEY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.scripts.versions.retrieve({
"path": {
"ns": "docs-samples",
"name": env("SCRIPT_NAME"),
"version": "1.0.0"
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;版本 ID,脚本前缀 scv_,工作流前缀 wfv_。 |
| kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| version | string | 必填 / 必有;版本号(semver,已去掉 +build 元数据)。 |
| digest | string | 必填 / 必有;源码与契约的内容摘要。 |
| source | string | 必填 / 必有;该版本的完整源码。版本列表默认不返回,需要时加 expand=source。 |
| input_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| input_schema.*(分支5) | object | 递归 JSON 值。 |
| input_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output_schema | object | 必填 / 必有;脚本从返回类型推导,支持 Promise 解包、Record、交叉类型和 Date(date-time);推不出时为空 schema,并在 /validate 的 warnings 给出 warning。 |
| output_schema.*(分支5) | object | 递归 JSON 值。 |
| output_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| references | object[] | 必填 / 必有;该版本依赖的动作、平台 API、脚本与工作流。脚本和工作流依赖在发布时锁定到精确版本。 |
| references[].kind | "action" / "script" / "workflow" / "platform_api" / "run" | 必填 / 必有;依赖类型。action 为动作;platform_api 为平台 API 操作;script 为脚本;workflow 为工作流;run 为脚本中 invoke("ns/name") 调用的子运行目标(脚本或工作流,发布时解析)。 |
| references[].name | string | 必填 / 必有;被依赖对象:动作为 ns/name,平台 API 为操作名,脚本与工作流为 ns/name。 |
| references[].range | string | 可选;引用时写的版本范围或标签(npm 规则);未写时为空。 |
| references[].locked_version | string | 可选;发布时锁定的精确版本;仅脚本与工作流依赖有,动作与平台 API 不锁定。 |
| outline | null / object[] | 必填 / 必有;工作流的步骤大纲(OutlineNode 数组),由解析器静态生成;脚本为 null。 |
| outline(分支2)[].name | string | 必填 / 必有;步骤名,即工作流 YAML 中该步骤的键。 |
| outline(分支2)[].reference | string | 必填 / 必有;该步骤在工作流文档中的 JSON Pointer,例如 /do/0/start;与运行时 Task.reference 一致。 |
| outline(分支2)[].kind | "run" / "call" / "wait" / "set" / "for" / "fork" / "try" / "switch" / "emit" / "raise" / "listen" / "do" | 必填 / 必有;工作流步骤类型。call 调用动作;run 运行子脚本或子工作流;wait 等待时长;set 设置变量;for 循环;fork 并行分支;try 带捕获的块;switch 条件分支;emit 发出事件;raise 抛出错误;listen 等待事件;do 顺序执行的步骤块。 |
| outline(分支2)[].target | string | 可选;步骤调用的目标:call 步骤为动作 ns/name,run 步骤为 ns/name@范围;其它类型没有。 |
| outline(分支2)[].wait | object | 可选;等待步骤的摘要:时长(seconds 或 duration)或等待的事件类型(event)。 不接受额外字段。 |
| outline(分支2)[].wait.until | string | 可选;等待结束的绝对时刻,仅在可静态确定时给出;目前大纲不填充该字段。 |
| outline(分支2)[].wait.seconds | number | 可选;可静态换算的等待秒数;时长对象与可换算的 ISO 时长均投影到此字段。 |
| outline(分支2)[].wait.event | string | 可选;listen 步骤等待的事件类型。 |
| outline(分支2)[].wait.duration | string | 可选;无法静态换算成秒的原始时长或运行时表达式;不与 seconds 强行换算。 |
| outline(分支2)[].loop | object | 可选;for 步骤的循环信息 {each, in}。 不接受额外字段。 |
| outline(分支2)[].loop.each | string | 必填 / 必有;循环变量名;未指定时为 item。 |
| outline(分支2)[].loop.in | string | 必填 / 必有;被遍历的集合表达式原文。 |
| outline(分支2)[].children | object[] | 可选;嵌套的子步骤(do、fork 分支、try 与 catch 内的步骤)。 |
| outline(分支2)[].children[] | object | 递归 JSON 值。 |
| sdk_version | null / string | 必填 / 必有;发布脚本所用的 SDK 版本;工作流为 null。 |
| published_at | string | 必填 / 必有;发布时间(RFC 3339 UTC)。 |
| published_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| published_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| published_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| deprecated | null / string | 必填 / 必有;弃用说明;未弃用为 null。弃用的版本仍可运行,但按范围或标签解析时优先选用未弃用的版本。 |
| deprecated_at | null / string | 必填 / 必有;弃用时间(RFC 3339 UTC);未弃用为 null。 |
| deprecated_by | null / object | 必填 / 必有;执行弃用的主体;未弃用为 null。 |
| deprecated_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| deprecated_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
HTTP 200
{
"id": "scv_00mv67lza679fc5498438040079f0c5684208c4915",
"kind": "script",
"version": "1.0.0",
"digest": "7ae6678882a4ef2ea96e401c105d5c6ef512917cd72a9235289d2a3bf1f1b49d",
"input_schema": {
"type": "object",
"properties": {
"n": {
"type": "number"
}
},
"required": [
"n"
]
},
"output_schema": {
"type": "object",
"properties": {
"answer": {
"type": "number"
}
},
"required": [
"answer"
]
},
"references": [],
"outline": null,
"sdk_version": "0.1.0",
"published_at": "2026-10-13T04:57:22.398Z",
"published_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"deprecated": null,
"deprecated_at": null,
"deprecated_by": null,
"source": "export default async (input: { n: number }) => ({ answer: input.n + 1 });"
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 VERSION_NOT_FOUND:指定版本或修订不存在。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
记录版本弃用说明;message 为空字符串时取消弃用,版本源码不变。
POST /automation/v1/scripts/{ns}/{name}/versions/{version}/deprecate
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
| path: version | string | 必填;规范的精确语义版本,例如 1.2.0 或 1.3.0-beta.1;不能是范围。 |
不接受额外字段。
| 字段 | 类型 | 说明 |
|---|---|---|
| message | string | 必填 / 必有;弃用说明;空字符串取消弃用。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| SCRIPT_NAME | 创建脚本返回的 name |
: "${SCRIPT_NAME:?Set SCRIPT_NAME}"
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/scripts/docs-samples/${SCRIPT_NAME}/versions/1.0.0/deprecate" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"message": ""
}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.scripts.versions.deprecate({
"path": {
"ns": "docs-samples",
"name": env("SCRIPT_NAME"),
"version": "1.0.0"
},
"body": {
"message": ""
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;版本 ID,脚本前缀 scv_,工作流前缀 wfv_。 |
| kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| version | string | 必填 / 必有;版本号(semver,已去掉 +build 元数据)。 |
| digest | string | 必填 / 必有;源码与契约的内容摘要。 |
| source | string | 必填 / 必有;该版本的完整源码。版本列表默认不返回,需要时加 expand=source。 |
| input_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| input_schema.*(分支5) | object | 递归 JSON 值。 |
| input_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output_schema | object | 必填 / 必有;脚本从返回类型推导,支持 Promise 解包、Record、交叉类型和 Date(date-time);推不出时为空 schema,并在 /validate 的 warnings 给出 warning。 |
| output_schema.*(分支5) | object | 递归 JSON 值。 |
| output_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| references | object[] | 必填 / 必有;该版本依赖的动作、平台 API、脚本与工作流。脚本和工作流依赖在发布时锁定到精确版本。 |
| references[].kind | "action" / "script" / "workflow" / "platform_api" / "run" | 必填 / 必有;依赖类型。action 为动作;platform_api 为平台 API 操作;script 为脚本;workflow 为工作流;run 为脚本中 invoke("ns/name") 调用的子运行目标(脚本或工作流,发布时解析)。 |
| references[].name | string | 必填 / 必有;被依赖对象:动作为 ns/name,平台 API 为操作名,脚本与工作流为 ns/name。 |
| references[].range | string | 可选;引用时写的版本范围或标签(npm 规则);未写时为空。 |
| references[].locked_version | string | 可选;发布时锁定的精确版本;仅脚本与工作流依赖有,动作与平台 API 不锁定。 |
| outline | null / object[] | 必填 / 必有;工作流的步骤大纲(OutlineNode 数组),由解析器静态生成;脚本为 null。 |
| outline(分支2)[].name | string | 必填 / 必有;步骤名,即工作流 YAML 中该步骤的键。 |
| outline(分支2)[].reference | string | 必填 / 必有;该步骤在工作流文档中的 JSON Pointer,例如 /do/0/start;与运行时 Task.reference 一致。 |
| outline(分支2)[].kind | "run" / "call" / "wait" / "set" / "for" / "fork" / "try" / "switch" / "emit" / "raise" / "listen" / "do" | 必填 / 必有;工作流步骤类型。call 调用动作;run 运行子脚本或子工作流;wait 等待时长;set 设置变量;for 循环;fork 并行分支;try 带捕获的块;switch 条件分支;emit 发出事件;raise 抛出错误;listen 等待事件;do 顺序执行的步骤块。 |
| outline(分支2)[].target | string | 可选;步骤调用的目标:call 步骤为动作 ns/name,run 步骤为 ns/name@范围;其它类型没有。 |
| outline(分支2)[].wait | object | 可选;等待步骤的摘要:时长(seconds 或 duration)或等待的事件类型(event)。 不接受额外字段。 |
| outline(分支2)[].wait.until | string | 可选;等待结束的绝对时刻,仅在可静态确定时给出;目前大纲不填充该字段。 |
| outline(分支2)[].wait.seconds | number | 可选;可静态换算的等待秒数;时长对象与可换算的 ISO 时长均投影到此字段。 |
| outline(分支2)[].wait.event | string | 可选;listen 步骤等待的事件类型。 |
| outline(分支2)[].wait.duration | string | 可选;无法静态换算成秒的原始时长或运行时表达式;不与 seconds 强行换算。 |
| outline(分支2)[].loop | object | 可选;for 步骤的循环信息 {each, in}。 不接受额外字段。 |
| outline(分支2)[].loop.each | string | 必填 / 必有;循环变量名;未指定时为 item。 |
| outline(分支2)[].loop.in | string | 必填 / 必有;被遍历的集合表达式原文。 |
| outline(分支2)[].children | object[] | 可选;嵌套的子步骤(do、fork 分支、try 与 catch 内的步骤)。 |
| outline(分支2)[].children[] | object | 递归 JSON 值。 |
| sdk_version | null / string | 必填 / 必有;发布脚本所用的 SDK 版本;工作流为 null。 |
| published_at | string | 必填 / 必有;发布时间(RFC 3339 UTC)。 |
| published_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| published_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| published_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| deprecated | null / string | 必填 / 必有;弃用说明;未弃用为 null。弃用的版本仍可运行,但按范围或标签解析时优先选用未弃用的版本。 |
| deprecated_at | null / string | 必填 / 必有;弃用时间(RFC 3339 UTC);未弃用为 null。 |
| deprecated_by | null / object | 必填 / 必有;执行弃用的主体;未弃用为 null。 |
| deprecated_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| deprecated_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
HTTP 200
{
"id": "scv_00mv67lza679fc5498438040079f0c5684208c4915",
"kind": "script",
"version": "1.0.0",
"digest": "7ae6678882a4ef2ea96e401c105d5c6ef512917cd72a9235289d2a3bf1f1b49d",
"input_schema": {
"type": "object",
"properties": {
"n": {
"type": "number"
}
},
"required": [
"n"
]
},
"output_schema": {
"type": "object",
"properties": {
"answer": {
"type": "number"
}
},
"required": [
"answer"
]
},
"references": [],
"outline": null,
"sdk_version": "0.1.0",
"published_at": "2026-10-13T04:57:22.398Z",
"published_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"deprecated": null,
"deprecated_at": null,
"deprecated_by": null,
"source": "export default async (input: { n: number }) => ({ answer: input.n + 1 });"
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 403 | NAMESPACE_FORBIDDEN:命名空间只读或运行令牌不允许此调用。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 VERSION_NOT_FOUND:指定版本或修订不存在。 |
| 409 | TARGET_ARCHIVED:目标已归档,不能用于本操作;动作执行错误的 detail 包含 ns/name。 |
| 412 | PRECONDITION_FAILED:修订、源码摘要或并发写入条件不匹配。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
读取发布标签指向的精确版本。同时返回更新时间和更新者。
GET /automation/v1/scripts/{ns}/{name}/dist-tags
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| SCRIPT_NAME | 创建脚本返回的 name |
: "${SCRIPT_NAME:?Set SCRIPT_NAME}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/scripts/docs-samples/${SCRIPT_NAME}/dist-tags" \
-H "Authorization: Bearer $PRAXIS_API_KEY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.scripts.distTags.list({
"path": {
"ns": "docs-samples",
"name": env("SCRIPT_NAME")
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| .*.version | string | 必填 / 必有;标签当前指向的精确版本号。 |
| .*.updated_at | string | 必填 / 必有;标签最近一次移动的时间(RFC 3339 UTC)。 |
| .*.updated_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| .*.updated_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| .*.updated_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
HTTP 200
{
"latest": {
"version": "1.0.0",
"updated_at": "2026-10-13T04:57:22.398Z",
"updated_by": {
"type": "api_key",
"id": "key_3e00b8984967"
}
}
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
将发布标签指向已有精确版本,标签不能是版本号或版本范围;移动 latest 可用于回滚,工作流会同步定时触发器。
PUT /automation/v1/scripts/{ns}/{name}/dist-tags/{tag}
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
| path: tag | string | 必填;发布标签。预发布版本(如 1.3.0-beta.1)必须带 tag 且不能是 latest;tag 只能由 URL 安全字符组成(字母、数字及 - _ . ! ~ * ' ( )),不含空格和 / ? #,首尾无空白;不能是版本号或版本范围(如 1.2.3、^1、1.x、*);beta、next、debug 等其余名称均可。违规返回 TAG_INVALID 或 TAG_REQUIRED,hint 给出完整规则。 |
不接受额外字段。
| 字段 | 类型 | 说明 |
|---|---|---|
| version | string | 必填 / 必有;规范的精确语义版本,例如 1.2.0 或 1.3.0-beta.1;不能是范围。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| SCRIPT_NAME | 创建脚本返回的 name |
: "${SCRIPT_NAME:?Set SCRIPT_NAME}"
curl --fail-with-body -X PUT "https://api.deepraxis.ai/automation/v1/scripts/docs-samples/${SCRIPT_NAME}/dist-tags/sample" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"version": "1.0.0"
}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.scripts.distTags.set({
"path": {
"ns": "docs-samples",
"name": env("SCRIPT_NAME"),
"tag": "sample"
},
"body": {
"version": "1.0.0"
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| .*.version | string | 必填 / 必有;标签当前指向的精确版本号。 |
| .*.updated_at | string | 必填 / 必有;标签最近一次移动的时间(RFC 3339 UTC)。 |
| .*.updated_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| .*.updated_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| .*.updated_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
HTTP 200
{
"latest": {
"version": "1.0.0",
"updated_at": "2026-10-13T04:57:22.398Z",
"updated_by": {
"type": "api_key",
"id": "key_3e00b8984967"
}
},
"sample": {
"version": "1.0.0",
"updated_at": "2026-10-13T04:57:26.232Z",
"updated_by": {
"type": "api_key",
"id": "key_3e00b8984967"
}
}
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 TAG_INVALID:标签无效:预发布版本不能打 latest;tag 只能含 URL 安全字符(不含空格和 / ? #);不能是版本号或范围;latest 不能删除。响应 hint 列出完整规则。 |
| 403 | NAMESPACE_FORBIDDEN:命名空间只读或运行令牌不允许此调用。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 VERSION_NOT_FOUND:指定版本或修订不存在。 |
| 409 | TARGET_ARCHIVED:目标已归档,不能用于本操作;动作执行错误的 detail 包含 ns/name。 |
| 412 | PRECONDITION_FAILED:修订、源码摘要或并发写入条件不匹配。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
删除发布标签但保留版本;latest 不可删除,标签不能是版本号或范围,不存在的合法标签可重复删除。
DELETE /automation/v1/scripts/{ns}/{name}/dist-tags/{tag}
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
| path: tag | string | 必填;发布标签。预发布版本(如 1.3.0-beta.1)必须带 tag 且不能是 latest;tag 只能由 URL 安全字符组成(字母、数字及 - _ . ! ~ * ' ( )),不含空格和 / ? #,首尾无空白;不能是版本号或版本范围(如 1.2.3、^1、1.x、*);beta、next、debug 等其余名称均可。违规返回 TAG_INVALID 或 TAG_REQUIRED,hint 给出完整规则。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| SCRIPT_NAME | 创建脚本返回的 name |
: "${SCRIPT_NAME:?Set SCRIPT_NAME}"
curl --fail-with-body -X DELETE "https://api.deepraxis.ai/automation/v1/scripts/docs-samples/${SCRIPT_NAME}/dist-tags/sample" \
-H "Authorization: Bearer $PRAXIS_API_KEY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.scripts.distTags.delete({
"path": {
"ns": "docs-samples",
"name": env("SCRIPT_NAME"),
"tag": "sample"
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| .*.version | string | 必填 / 必有;标签当前指向的精确版本号。 |
| .*.updated_at | string | 必填 / 必有;标签最近一次移动的时间(RFC 3339 UTC)。 |
| .*.updated_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| .*.updated_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| .*.updated_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
HTTP 200
{
"latest": {
"version": "1.0.0",
"updated_at": "2026-10-13T04:57:22.398Z",
"updated_by": {
"type": "api_key",
"id": "key_3e00b8984967"
}
}
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 TAG_INVALID:标签无效:预发布版本不能打 latest;tag 只能含 URL 安全字符(不含空格和 / ? #);不能是版本号或范围;latest 不能删除。响应 hint 列出完整规则。 |
| 403 | NAMESPACE_FORBIDDEN:命名空间只读或运行令牌不允许此调用。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 |
| 409 | TARGET_ARCHIVED:目标已归档,不能用于本操作;动作执行错误的 detail 包含 ns/name。 |
| 412 | PRECONDITION_FAILED:修订、源码摘要或并发写入条件不匹配。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
列出可见工作流的摘要、最新版本、标签及近七天统计;默认排除已归档条目。
GET /automation/v1/workflows
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| query: limit | integer | 可选;每页条数,整数 1–100,默认 25。 minimum: 1;maximum: 100 |
| query: cursor | string | 可选;上一页返回的 next_cursor,不透明字符串;保持原查询条件继续翻页。 |
| query: q | string | 可选;不区分大小写,按名称或说明的字面子串匹配;% 与 _ 无通配含义。 |
| query: namespace | string[] | 可选;仅返回指定命名空间的定义,名称按小写匹配。 多个值以逗号分隔,匹配任一值。 minItems: 1 |
| query: scope | "platform" / "own"[] | 可选;platform 仅平台定义,own 仅租户自建定义;省略返回两者。 多个值以逗号分隔,匹配任一值。 minItems: 1 |
| query: archived | boolean | 可选;true 仅已归档,false 仅未归档;默认 false。 |
| query: labels | object | 可选;按标签过滤,使用 labels[k]=v;同键逗号多值取任一,不同键同时满足。 |
| query: created_at[gte] | string | 可选;创建时间下界,包含边界;使用带时区的 ISO 8601 时间。 format: "date-time" |
| query: created_at[lte] | string | 可选;创建时间上界,包含边界;使用带时区的 ISO 8601 时间。 format: "date-time" |
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/workflows" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
--get \
--data-urlencode "namespace=docs-samples" \
--data-urlencode "limit=1"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.workflows.list({
"query": {
"namespace": [
"docs-samples"
],
"limit": 1
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| data | object[] | 必填 / 必有;本页的工作流摘要,按 created_at 倒序、id 倒序排列。 |
| data[].id | string | 必填 / 必有;编排 ID,脚本前缀 scr_,工作流前缀 wf_;日常使用 namespace 与 name。 |
| data[].kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| data[].namespace | string | 必填 / 必有;命名空间,引用形如 namespace/name@版本。 |
| data[].name | string | 必填 / 必有;名字,与 namespace 一起在租户内唯一,脚本与工作流共用命名空间,重名返回 409 NAME_TAKEN。 |
| data[].description | string | 必填 / 必有;说明文字,最多 1000 字符。 |
| data[].labels | object | 必填 / 必有;用户自定义标签:字符串键值对,用于分类与列表过滤(labels[key]=value);键不能以 praxis. 开头。 |
| data[].owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| data[].latest_version | null / object | 必填 / 必有;latest 标签指向的已发布版本 {version, published_at};尚未发布为 null。 |
| data[].latest_version(分支2).version | string | 必填 / 必有;最新发布版本的版本号(semver)。 |
| data[].latest_version(分支2).published_at | string | 必填 / 必有;该版本的发布时间(RFC 3339 UTC)。 |
| data[].dist_tags | object | 必填 / 必有;标签到精确版本号的映射,例如 latest 指向 1.2.0;用 ns/name@标签 运行时按此解析。 |
| data[].draft_changed | boolean | 必填 / 必有;true 表示草稿内容(摘要)不同于 latest 版本,即有未发布的改动。 |
| data[].latest_run | null / object | 必填 / 必有;该编排最近一次运行的摘要;还没有运行为 null。 |
| data[].latest_run(分支2).id | string | 必填 / 必有;运行 ID(run_ 前缀),可用于 runs.retrieve。 |
| data[].latest_run(分支2).number | null / number | 必填 / 必有;运行在该脚本或工作流内的递增序号。 |
| data[].latest_run(分支2).status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;运行状态。pending 已创建尚未开始;running 执行中;waiting 工作流在等待事件、定时器或子运行;suspended 工作流被暂停;cancelled 已取消;faulted 失败;completed 成功完成。 |
| data[].latest_run(分支2).created_at | string | 必填 / 必有;运行创建时间(RFC 3339 UTC)。 |
| data[].latest_run(分支2).current_wait | null / object | 必填 / 必有;当前未完成的等待点;没有等待为 null。 |
| data[].latest_run(分支2).current_wait(分支2).id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| data[].latest_run(分支2).current_wait(分支2).run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| data[].latest_run(分支2).current_wait(分支2).kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| data[].latest_run(分支2).current_wait(分支2).state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| data[].latest_run(分支2).current_wait(分支2).task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| data[].latest_run(分支2).current_wait(分支2).task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| data[].latest_run(分支2).current_wait(分支2).task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| data[].latest_run(分支2).current_wait(分支2).resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| data[].latest_run(分支2).current_wait(分支2).event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| data[].latest_run(分支2).current_wait(分支2).child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| data[].latest_run(分支2).current_wait(分支2).created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| data[].latest_run(分支2).current_wait(分支2).expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| data[].latest_run(分支2).current_wait(分支2).resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| data[].stats_7d | object | 必填 / 必有;近七天的运行统计:按运行结束日期累计,在运行结束时更新,读取时不扫描运行。 不接受额外字段。 |
| data[].stats_7d.runs | number | 必填 / 必有;近七天内结束的运行总数(任意终态)。 |
| data[].stats_7d.failures | number | 必填 / 必有;其中以 faulted 结束的运行数。 |
| data[].archived_at | null / string | 必填 / 必有;归档时间;未归档为 null。归档后名字保留,不可复用。 |
| data[].created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 |
| data[].updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 |
| next_cursor | null / string | 必填 / 必有;下一页游标,原样传给 cursor 参数并保持原查询条件;没有更多页为 null。接口不返回总数。 |
HTTP 200
{
"data": [
{
"id": "wf_00mv67m4jad0d5c2a3d1e04dc9ac4c18cff616eca7",
"owner": "tnt_3a9759864ccb4e00",
"kind": "workflow",
"namespace": "docs-samples",
"name": "sample-workflows-1791867412840-b05e8a",
"description": "",
"labels": {},
"latest_version": null,
"dist_tags": {},
"draft_changed": true,
"latest_run": null,
"stats_7d": {
"runs": 0,
"failures": 0
},
"archived_at": null,
"created_at": "2026-10-13T04:57:29.206Z",
"updated_at": "2026-10-13T04:57:29.206Z"
}
],
"next_cursor": null
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
创建工作流及可编辑草稿,不会发布或启动运行;脚本与工作流共用名称空间,同租户重名返回 NAME_TAKEN。 run.workflow 支持 ns/name@range 或 {namespace, name, version, input};run.script 使用相同引用形状(平台扩展)。 对象的 namespace、name、version 必填;version 支持精确版本、dist-tag 或范围,发布时锁定依赖。 对象 input 默认为 {},支持表达式;字符串引用继续使用任务级 with。run.await 默认 true,等待子运行输出; false 以 detach 创建子运行,任务立即输出 {run_id},父取消不级联。内联 script.code 返回 DEFINITION_INVALID, detail 提示「请先保存为脚本再引用」。raise.error 的 type URI、status、title、detail 保留到运行错误。
POST /automation/v1/workflows
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| header: Idempotency-Key | string | 可选;可选;1–256 字符。24 小时内同一 key 重放首个响应并带 Idempotent-Replayed: true;同 key 不同请求体返回 422;处理中返回 409。 minLength: 1;maxLength: 256 |
不接受额外字段。
| 字段 | 类型 | 说明 |
|---|---|---|
| namespace | string | 必填 / 必有;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9.-]{0,63};praxis 只读。 pattern: "^[a-zA-Z0-9][a-zA-Z0-9.-]{0,63}$" |
| name | string | 必填 / 必有;名称,存储前转为小写,格式 [a-z0-9][a-z0-9.-]{0,63}。 pattern: "^[a-zA-Z0-9][a-zA-Z0-9.-]{0,63}$" |
| description | string | 可选;说明,最多 1000 个字符。 maxLength: 1000 |
| draft | string | 可选;可编辑源码;脚本为 TypeScript,工作流为 YAML。创建时省略为空字符串。 |
| labels | object | 可选;最多 50 个标签;键为 1–40 个字符,值最多 500 个字符。 |
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/workflows" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"namespace": "docs-samples",
"name": "sample-workflows",
"draft": "document:\n dsl: '\''1.0.3'\''\n namespace: docs-samples\n name: sample-workflows\n version: '\''1.0.0'\''\ndo:\n - answer:\n set:\n answer: 42\n"
}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.workflows.create({
"body": {
"namespace": "docs-samples",
"name": "sample-workflows",
"draft": "document:\n dsl: '1.0.3'\n namespace: docs-samples\n name: sample-workflows\n version: '1.0.0'\ndo:\n - answer:\n set:\n answer: 42\n"
}
});
console.log(result);Success
| 响应头 | 类型 | 说明 |
|---|---|---|
| Idempotent-Replayed | boolean | Present and true when replaying the first response for this key. |
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| draft | object | 必填 / 必有;脚本或工作流的可编辑草稿;发布版本时以草稿或某次运行的源码为准。 不接受额外字段。 |
| draft.source | string | 必填 / 必有;草稿源码:脚本为 TypeScript,工作流为 YAML。 |
| draft.revision | string | 必填 / 必有;草稿修订标识(ETag),发布时作为 expected_draft_revision,更新草稿时作为 If-Match;与当前不一致返回 412。 |
| draft.updated_at | string | 必填 / 必有;草稿最近一次修改的时间(RFC 3339 UTC)。 |
| draft.updated_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| draft.updated_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| draft.updated_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| id | string | 必填 / 必有;编排 ID,脚本前缀 scr_,工作流前缀 wf_;日常使用 namespace 与 name。 |
| kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| namespace | string | 必填 / 必有;命名空间,引用形如 namespace/name@版本。 |
| name | string | 必填 / 必有;名字,与 namespace 一起在租户内唯一,脚本与工作流共用命名空间,重名返回 409 NAME_TAKEN。 |
| description | string | 必填 / 必有;说明文字,最多 1000 字符。 |
| labels | object | 必填 / 必有;用户自定义标签:字符串键值对,用于分类与列表过滤(labels[key]=value);键不能以 praxis. 开头。 |
| owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| latest_version | null / object | 必填 / 必有;latest 标签指向的已发布版本 {version, published_at};尚未发布为 null。 |
| latest_version(分支2).version | string | 必填 / 必有;最新发布版本的版本号(semver)。 |
| latest_version(分支2).published_at | string | 必填 / 必有;该版本的发布时间(RFC 3339 UTC)。 |
| dist_tags | object | 必填 / 必有;标签到精确版本号的映射,例如 latest 指向 1.2.0;用 ns/name@标签 运行时按此解析。 |
| draft_changed | boolean | 必填 / 必有;true 表示草稿内容(摘要)不同于 latest 版本,即有未发布的改动。 |
| latest_run | null / object | 必填 / 必有;该编排最近一次运行的摘要;还没有运行为 null。 |
| latest_run(分支2).id | string | 必填 / 必有;运行 ID(run_ 前缀),可用于 runs.retrieve。 |
| latest_run(分支2).number | null / number | 必填 / 必有;运行在该脚本或工作流内的递增序号。 |
| latest_run(分支2).status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;运行状态。pending 已创建尚未开始;running 执行中;waiting 工作流在等待事件、定时器或子运行;suspended 工作流被暂停;cancelled 已取消;faulted 失败;completed 成功完成。 |
| latest_run(分支2).created_at | string | 必填 / 必有;运行创建时间(RFC 3339 UTC)。 |
| latest_run(分支2).current_wait | null / object | 必填 / 必有;当前未完成的等待点;没有等待为 null。 |
| latest_run(分支2).current_wait(分支2).id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| latest_run(分支2).current_wait(分支2).run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| latest_run(分支2).current_wait(分支2).kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| latest_run(分支2).current_wait(分支2).state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| latest_run(分支2).current_wait(分支2).task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| latest_run(分支2).current_wait(分支2).task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| latest_run(分支2).current_wait(分支2).task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| latest_run(分支2).current_wait(分支2).resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| latest_run(分支2).current_wait(分支2).expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| latest_run(分支2).current_wait(分支2).resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| stats_7d | object | 必填 / 必有;近七天的运行统计:按运行结束日期累计,在运行结束时更新,读取时不扫描运行。 不接受额外字段。 |
| stats_7d.runs | number | 必填 / 必有;近七天内结束的运行总数(任意终态)。 |
| stats_7d.failures | number | 必填 / 必有;其中以 faulted 结束的运行数。 |
| archived_at | null / string | 必填 / 必有;归档时间;未归档为 null。归档后名字保留,不可复用。 |
| created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 |
| updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 |
HTTP 200
{
"id": "wf_00mv67m4jad0d5c2a3d1e04dc9ac4c18cff616eca7",
"owner": "tnt_3a9759864ccb4e00",
"kind": "workflow",
"namespace": "docs-samples",
"name": "sample-workflows-1791867412840-b05e8a",
"description": "",
"labels": {},
"latest_version": null,
"dist_tags": {},
"draft_changed": true,
"latest_run": null,
"stats_7d": {
"runs": 0,
"failures": 0
},
"archived_at": null,
"created_at": "2026-10-13T04:57:29.206Z",
"updated_at": "2026-10-13T04:57:29.206Z",
"draft": {
"source": "document:\n dsl: '1.0.3'\n namespace: docs-samples\n name: sample-workflows-1791867412840-b05e8a\n version: '1.0.0'\ndo:\n - answer:\n set:\n answer: 42\n",
"revision": "draft_00mv67m4ja0e38625d463646e3a526bb774bf453ee",
"updated_at": "2026-10-13T04:57:29.206Z",
"updated_by": {
"type": "api_key",
"id": "key_3e00b8984967"
}
}
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 403 | NAMESPACE_FORBIDDEN:命名空间只读或运行令牌不允许此调用。 |
| 409 | IDEMPOTENCY_IN_FLIGHT:同一幂等键的请求仍在处理中。 NAME_TAKEN:名称已被同一租户占用。 |
| 422 | IDEMPOTENCY_KEY_MISMATCH:同一幂等键已用于不同请求内容。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
读取工作流详情及草稿源码;ETag 是草稿修订,可作为修改请求的 If-Match。
GET /automation/v1/workflows/{ns}/{name}
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| WORKFLOW_NAME | 创建工作流返回的 name |
: "${WORKFLOW_NAME:?Set WORKFLOW_NAME}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/workflows/docs-samples/${WORKFLOW_NAME}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.workflows.retrieve({
"path": {
"ns": "docs-samples",
"name": env("WORKFLOW_NAME")
}
});
console.log(result);Success
| 响应头 | 类型 | 说明 |
|---|---|---|
| ETag | string | Current resource revision for conditional updates. |
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| draft | object | 必填 / 必有;脚本或工作流的可编辑草稿;发布版本时以草稿或某次运行的源码为准。 不接受额外字段。 |
| draft.source | string | 必填 / 必有;草稿源码:脚本为 TypeScript,工作流为 YAML。 |
| draft.revision | string | 必填 / 必有;草稿修订标识(ETag),发布时作为 expected_draft_revision,更新草稿时作为 If-Match;与当前不一致返回 412。 |
| draft.updated_at | string | 必填 / 必有;草稿最近一次修改的时间(RFC 3339 UTC)。 |
| draft.updated_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| draft.updated_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| draft.updated_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| id | string | 必填 / 必有;编排 ID,脚本前缀 scr_,工作流前缀 wf_;日常使用 namespace 与 name。 |
| kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| namespace | string | 必填 / 必有;命名空间,引用形如 namespace/name@版本。 |
| name | string | 必填 / 必有;名字,与 namespace 一起在租户内唯一,脚本与工作流共用命名空间,重名返回 409 NAME_TAKEN。 |
| description | string | 必填 / 必有;说明文字,最多 1000 字符。 |
| labels | object | 必填 / 必有;用户自定义标签:字符串键值对,用于分类与列表过滤(labels[key]=value);键不能以 praxis. 开头。 |
| owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| latest_version | null / object | 必填 / 必有;latest 标签指向的已发布版本 {version, published_at};尚未发布为 null。 |
| latest_version(分支2).version | string | 必填 / 必有;最新发布版本的版本号(semver)。 |
| latest_version(分支2).published_at | string | 必填 / 必有;该版本的发布时间(RFC 3339 UTC)。 |
| dist_tags | object | 必填 / 必有;标签到精确版本号的映射,例如 latest 指向 1.2.0;用 ns/name@标签 运行时按此解析。 |
| draft_changed | boolean | 必填 / 必有;true 表示草稿内容(摘要)不同于 latest 版本,即有未发布的改动。 |
| latest_run | null / object | 必填 / 必有;该编排最近一次运行的摘要;还没有运行为 null。 |
| latest_run(分支2).id | string | 必填 / 必有;运行 ID(run_ 前缀),可用于 runs.retrieve。 |
| latest_run(分支2).number | null / number | 必填 / 必有;运行在该脚本或工作流内的递增序号。 |
| latest_run(分支2).status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;运行状态。pending 已创建尚未开始;running 执行中;waiting 工作流在等待事件、定时器或子运行;suspended 工作流被暂停;cancelled 已取消;faulted 失败;completed 成功完成。 |
| latest_run(分支2).created_at | string | 必填 / 必有;运行创建时间(RFC 3339 UTC)。 |
| latest_run(分支2).current_wait | null / object | 必填 / 必有;当前未完成的等待点;没有等待为 null。 |
| latest_run(分支2).current_wait(分支2).id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| latest_run(分支2).current_wait(分支2).run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| latest_run(分支2).current_wait(分支2).kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| latest_run(分支2).current_wait(分支2).state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| latest_run(分支2).current_wait(分支2).task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| latest_run(分支2).current_wait(分支2).task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| latest_run(分支2).current_wait(分支2).task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| latest_run(分支2).current_wait(分支2).resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| latest_run(分支2).current_wait(分支2).expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| latest_run(分支2).current_wait(分支2).resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| stats_7d | object | 必填 / 必有;近七天的运行统计:按运行结束日期累计,在运行结束时更新,读取时不扫描运行。 不接受额外字段。 |
| stats_7d.runs | number | 必填 / 必有;近七天内结束的运行总数(任意终态)。 |
| stats_7d.failures | number | 必填 / 必有;其中以 faulted 结束的运行数。 |
| archived_at | null / string | 必填 / 必有;归档时间;未归档为 null。归档后名字保留,不可复用。 |
| created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 |
| updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 |
HTTP 200
{
"id": "wf_00mv67m4jad0d5c2a3d1e04dc9ac4c18cff616eca7",
"owner": "tnt_3a9759864ccb4e00",
"kind": "workflow",
"namespace": "docs-samples",
"name": "sample-workflows-1791867412840-b05e8a",
"description": "",
"labels": {},
"latest_version": null,
"dist_tags": {},
"draft_changed": true,
"latest_run": null,
"stats_7d": {
"runs": 0,
"failures": 0
},
"archived_at": null,
"created_at": "2026-10-13T04:57:29.206Z",
"updated_at": "2026-10-13T04:57:29.206Z",
"draft": {
"source": "document:\n dsl: '1.0.3'\n namespace: docs-samples\n name: sample-workflows-1791867412840-b05e8a\n version: '1.0.0'\ndo:\n - answer:\n set:\n answer: 42\n",
"revision": "draft_00mv67m4ja0e38625d463646e3a526bb774bf453ee",
"updated_at": "2026-10-13T04:57:29.206Z",
"updated_by": {
"type": "api_key",
"id": "key_3e00b8984967"
}
}
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
修改说明、标签或草稿,必须携带与当前草稿匹配的 If-Match;即使只改元数据也会生成新的草稿修订。
PATCH /automation/v1/workflows/{ns}/{name}
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
| header: If-Match | string | 必填;当前资源的 ETag,可直接使用对象里的 draft.revision 或 etag 字段值:裸值、带双引号或弱校验写法 W/"…" 均接受(RFC 7232 弱比较);缺失返回 400,修订不匹配返回 412。 |
不接受额外字段。
| 字段 | 类型 | 说明 |
|---|---|---|
| description | string | 可选;说明,最多 1000 个字符。 maxLength: 1000 |
| labels | object | 可选;最多 50 个标签;键为 1–40 个字符,值最多 500 个字符。 |
| draft | string | 可选;可编辑源码;脚本为 TypeScript,工作流为 YAML。创建时省略为空字符串。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| WORKFLOW_NAME | 创建工作流返回的 name |
| ETAG | 最新 GET 响应头 ETag(保留引号) |
: "${WORKFLOW_NAME:?Set WORKFLOW_NAME}"
: "${ETAG:?Set ETAG}"
curl --fail-with-body -X PATCH "https://api.deepraxis.ai/automation/v1/workflows/docs-samples/${WORKFLOW_NAME}" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "If-Match: ${ETAG}" \
-H "Content-Type: application/json" \
--data '{
"description": "Sample definition",
"draft": "document:\n dsl: '\''1.0.3'\''\n namespace: docs-samples\n name: sample-workflows-1791867412840-b05e8a\n version: '\''1.0.0'\''\ndo:\n - answer:\n set:\n answer: 42\n"
}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.workflows.update({
"path": {
"ns": "docs-samples",
"name": env("WORKFLOW_NAME")
},
"headers": {
"If-Match": env("ETAG")
},
"body": {
"description": "Sample definition",
"draft": "document:\n dsl: '1.0.3'\n namespace: docs-samples\n name: sample-workflows-1791867412840-b05e8a\n version: '1.0.0'\ndo:\n - answer:\n set:\n answer: 42\n"
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| draft | object | 必填 / 必有;脚本或工作流的可编辑草稿;发布版本时以草稿或某次运行的源码为准。 不接受额外字段。 |
| draft.source | string | 必填 / 必有;草稿源码:脚本为 TypeScript,工作流为 YAML。 |
| draft.revision | string | 必填 / 必有;草稿修订标识(ETag),发布时作为 expected_draft_revision,更新草稿时作为 If-Match;与当前不一致返回 412。 |
| draft.updated_at | string | 必填 / 必有;草稿最近一次修改的时间(RFC 3339 UTC)。 |
| draft.updated_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| draft.updated_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| draft.updated_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| id | string | 必填 / 必有;编排 ID,脚本前缀 scr_,工作流前缀 wf_;日常使用 namespace 与 name。 |
| kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| namespace | string | 必填 / 必有;命名空间,引用形如 namespace/name@版本。 |
| name | string | 必填 / 必有;名字,与 namespace 一起在租户内唯一,脚本与工作流共用命名空间,重名返回 409 NAME_TAKEN。 |
| description | string | 必填 / 必有;说明文字,最多 1000 字符。 |
| labels | object | 必填 / 必有;用户自定义标签:字符串键值对,用于分类与列表过滤(labels[key]=value);键不能以 praxis. 开头。 |
| owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| latest_version | null / object | 必填 / 必有;latest 标签指向的已发布版本 {version, published_at};尚未发布为 null。 |
| latest_version(分支2).version | string | 必填 / 必有;最新发布版本的版本号(semver)。 |
| latest_version(分支2).published_at | string | 必填 / 必有;该版本的发布时间(RFC 3339 UTC)。 |
| dist_tags | object | 必填 / 必有;标签到精确版本号的映射,例如 latest 指向 1.2.0;用 ns/name@标签 运行时按此解析。 |
| draft_changed | boolean | 必填 / 必有;true 表示草稿内容(摘要)不同于 latest 版本,即有未发布的改动。 |
| latest_run | null / object | 必填 / 必有;该编排最近一次运行的摘要;还没有运行为 null。 |
| latest_run(分支2).id | string | 必填 / 必有;运行 ID(run_ 前缀),可用于 runs.retrieve。 |
| latest_run(分支2).number | null / number | 必填 / 必有;运行在该脚本或工作流内的递增序号。 |
| latest_run(分支2).status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;运行状态。pending 已创建尚未开始;running 执行中;waiting 工作流在等待事件、定时器或子运行;suspended 工作流被暂停;cancelled 已取消;faulted 失败;completed 成功完成。 |
| latest_run(分支2).created_at | string | 必填 / 必有;运行创建时间(RFC 3339 UTC)。 |
| latest_run(分支2).current_wait | null / object | 必填 / 必有;当前未完成的等待点;没有等待为 null。 |
| latest_run(分支2).current_wait(分支2).id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| latest_run(分支2).current_wait(分支2).run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| latest_run(分支2).current_wait(分支2).kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| latest_run(分支2).current_wait(分支2).state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| latest_run(分支2).current_wait(分支2).task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| latest_run(分支2).current_wait(分支2).task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| latest_run(分支2).current_wait(分支2).task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| latest_run(分支2).current_wait(分支2).resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| latest_run(分支2).current_wait(分支2).expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| latest_run(分支2).current_wait(分支2).resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| stats_7d | object | 必填 / 必有;近七天的运行统计:按运行结束日期累计,在运行结束时更新,读取时不扫描运行。 不接受额外字段。 |
| stats_7d.runs | number | 必填 / 必有;近七天内结束的运行总数(任意终态)。 |
| stats_7d.failures | number | 必填 / 必有;其中以 faulted 结束的运行数。 |
| archived_at | null / string | 必填 / 必有;归档时间;未归档为 null。归档后名字保留,不可复用。 |
| created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 |
| updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 |
HTTP 200
{
"id": "wf_00mv67m4jad0d5c2a3d1e04dc9ac4c18cff616eca7",
"owner": "tnt_3a9759864ccb4e00",
"kind": "workflow",
"namespace": "docs-samples",
"name": "sample-workflows-1791867412840-b05e8a",
"description": "Sample definition",
"labels": {},
"latest_version": null,
"dist_tags": {},
"draft_changed": true,
"latest_run": null,
"stats_7d": {
"runs": 0,
"failures": 0
},
"archived_at": null,
"created_at": "2026-10-13T04:57:29.206Z",
"updated_at": "2026-10-13T04:57:31.570Z",
"draft": {
"source": "document:\n dsl: '1.0.3'\n namespace: docs-samples\n name: sample-workflows-1791867412840-b05e8a\n version: '1.0.0'\ndo:\n - answer:\n set:\n answer: 42\n",
"revision": "draft_00mv67m4ja0e38625d463646e3a526bb774bf453ee",
"updated_at": "2026-10-13T04:57:29.206Z",
"updated_by": {
"type": "api_key",
"id": "key_3e00b8984967"
}
}
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 403 | NAMESPACE_FORBIDDEN:命名空间只读或运行令牌不允许此调用。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 |
| 409 | TARGET_ARCHIVED:目标已归档,不能用于本操作;动作执行错误的 detail 包含 ns/name。 |
| 412 | PRECONDITION_FAILED:修订、源码摘要或并发写入条件不匹配。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
归档后保留名称、版本和草稿;默认列表隐藏该条目,新的目标解析和运行请求拒绝已归档目标。
POST /automation/v1/workflows/{ns}/{name}/archive
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
不接受额外字段。 object
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| WORKFLOW_NAME | 创建工作流返回的 name |
: "${WORKFLOW_NAME:?Set WORKFLOW_NAME}"
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/workflows/docs-samples/${WORKFLOW_NAME}/archive" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.workflows.archive({
"path": {
"ns": "docs-samples",
"name": env("WORKFLOW_NAME")
},
"body": {}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;编排 ID,脚本前缀 scr_,工作流前缀 wf_;日常使用 namespace 与 name。 |
| kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| namespace | string | 必填 / 必有;命名空间,引用形如 namespace/name@版本。 |
| name | string | 必填 / 必有;名字,与 namespace 一起在租户内唯一,脚本与工作流共用命名空间,重名返回 409 NAME_TAKEN。 |
| description | string | 必填 / 必有;说明文字,最多 1000 字符。 |
| labels | object | 必填 / 必有;用户自定义标签:字符串键值对,用于分类与列表过滤(labels[key]=value);键不能以 praxis. 开头。 |
| owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| latest_version | null / object | 必填 / 必有;latest 标签指向的已发布版本 {version, published_at};尚未发布为 null。 |
| latest_version(分支2).version | string | 必填 / 必有;最新发布版本的版本号(semver)。 |
| latest_version(分支2).published_at | string | 必填 / 必有;该版本的发布时间(RFC 3339 UTC)。 |
| dist_tags | object | 必填 / 必有;标签到精确版本号的映射,例如 latest 指向 1.2.0;用 ns/name@标签 运行时按此解析。 |
| draft_changed | boolean | 必填 / 必有;true 表示草稿内容(摘要)不同于 latest 版本,即有未发布的改动。 |
| latest_run | null / object | 必填 / 必有;该编排最近一次运行的摘要;还没有运行为 null。 |
| latest_run(分支2).id | string | 必填 / 必有;运行 ID(run_ 前缀),可用于 runs.retrieve。 |
| latest_run(分支2).number | null / number | 必填 / 必有;运行在该脚本或工作流内的递增序号。 |
| latest_run(分支2).status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;运行状态。pending 已创建尚未开始;running 执行中;waiting 工作流在等待事件、定时器或子运行;suspended 工作流被暂停;cancelled 已取消;faulted 失败;completed 成功完成。 |
| latest_run(分支2).created_at | string | 必填 / 必有;运行创建时间(RFC 3339 UTC)。 |
| latest_run(分支2).current_wait | null / object | 必填 / 必有;当前未完成的等待点;没有等待为 null。 |
| latest_run(分支2).current_wait(分支2).id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| latest_run(分支2).current_wait(分支2).run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| latest_run(分支2).current_wait(分支2).kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| latest_run(分支2).current_wait(分支2).state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| latest_run(分支2).current_wait(分支2).task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| latest_run(分支2).current_wait(分支2).task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| latest_run(分支2).current_wait(分支2).task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| latest_run(分支2).current_wait(分支2).resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| latest_run(分支2).current_wait(分支2).expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| latest_run(分支2).current_wait(分支2).resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| stats_7d | object | 必填 / 必有;近七天的运行统计:按运行结束日期累计,在运行结束时更新,读取时不扫描运行。 不接受额外字段。 |
| stats_7d.runs | number | 必填 / 必有;近七天内结束的运行总数(任意终态)。 |
| stats_7d.failures | number | 必填 / 必有;其中以 faulted 结束的运行数。 |
| archived_at | null / string | 必填 / 必有;归档时间;未归档为 null。归档后名字保留,不可复用。 |
| created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 |
| updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 |
HTTP 200
{
"id": "wf_00mv67m4jad0d5c2a3d1e04dc9ac4c18cff616eca7",
"owner": "tnt_3a9759864ccb4e00",
"kind": "workflow",
"namespace": "docs-samples",
"name": "sample-workflows-1791867412840-b05e8a",
"description": "Sample definition",
"labels": {},
"latest_version": {
"version": "1.0.0",
"published_at": "2026-10-13T04:57:32.297Z"
},
"dist_tags": {
"latest": "1.0.0"
},
"draft_changed": false,
"latest_run": null,
"stats_7d": {
"runs": 0,
"failures": 0
},
"archived_at": "2026-10-13T04:57:37.671Z",
"created_at": "2026-10-13T04:57:29.206Z",
"updated_at": "2026-10-13T04:57:37.671Z"
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 403 | NAMESPACE_FORBIDDEN:命名空间只读或运行令牌不允许此调用。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 |
| 412 | PRECONDITION_FAILED:修订、源码摘要或并发写入条件不匹配。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
恢复已归档定义,保留版本和标签。名称无需重新分配。
POST /automation/v1/workflows/{ns}/{name}/restore
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
不接受额外字段。 object
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| WORKFLOW_NAME | 创建工作流返回的 name |
: "${WORKFLOW_NAME:?Set WORKFLOW_NAME}"
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/workflows/docs-samples/${WORKFLOW_NAME}/restore" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.workflows.restore({
"path": {
"ns": "docs-samples",
"name": env("WORKFLOW_NAME")
},
"body": {}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;编排 ID,脚本前缀 scr_,工作流前缀 wf_;日常使用 namespace 与 name。 |
| kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| namespace | string | 必填 / 必有;命名空间,引用形如 namespace/name@版本。 |
| name | string | 必填 / 必有;名字,与 namespace 一起在租户内唯一,脚本与工作流共用命名空间,重名返回 409 NAME_TAKEN。 |
| description | string | 必填 / 必有;说明文字,最多 1000 字符。 |
| labels | object | 必填 / 必有;用户自定义标签:字符串键值对,用于分类与列表过滤(labels[key]=value);键不能以 praxis. 开头。 |
| owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| latest_version | null / object | 必填 / 必有;latest 标签指向的已发布版本 {version, published_at};尚未发布为 null。 |
| latest_version(分支2).version | string | 必填 / 必有;最新发布版本的版本号(semver)。 |
| latest_version(分支2).published_at | string | 必填 / 必有;该版本的发布时间(RFC 3339 UTC)。 |
| dist_tags | object | 必填 / 必有;标签到精确版本号的映射,例如 latest 指向 1.2.0;用 ns/name@标签 运行时按此解析。 |
| draft_changed | boolean | 必填 / 必有;true 表示草稿内容(摘要)不同于 latest 版本,即有未发布的改动。 |
| latest_run | null / object | 必填 / 必有;该编排最近一次运行的摘要;还没有运行为 null。 |
| latest_run(分支2).id | string | 必填 / 必有;运行 ID(run_ 前缀),可用于 runs.retrieve。 |
| latest_run(分支2).number | null / number | 必填 / 必有;运行在该脚本或工作流内的递增序号。 |
| latest_run(分支2).status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;运行状态。pending 已创建尚未开始;running 执行中;waiting 工作流在等待事件、定时器或子运行;suspended 工作流被暂停;cancelled 已取消;faulted 失败;completed 成功完成。 |
| latest_run(分支2).created_at | string | 必填 / 必有;运行创建时间(RFC 3339 UTC)。 |
| latest_run(分支2).current_wait | null / object | 必填 / 必有;当前未完成的等待点;没有等待为 null。 |
| latest_run(分支2).current_wait(分支2).id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| latest_run(分支2).current_wait(分支2).run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| latest_run(分支2).current_wait(分支2).kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| latest_run(分支2).current_wait(分支2).state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| latest_run(分支2).current_wait(分支2).task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| latest_run(分支2).current_wait(分支2).task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| latest_run(分支2).current_wait(分支2).task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| latest_run(分支2).current_wait(分支2).resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| latest_run(分支2).current_wait(分支2).created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| latest_run(分支2).current_wait(分支2).expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| latest_run(分支2).current_wait(分支2).resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| stats_7d | object | 必填 / 必有;近七天的运行统计:按运行结束日期累计,在运行结束时更新,读取时不扫描运行。 不接受额外字段。 |
| stats_7d.runs | number | 必填 / 必有;近七天内结束的运行总数(任意终态)。 |
| stats_7d.failures | number | 必填 / 必有;其中以 faulted 结束的运行数。 |
| archived_at | null / string | 必填 / 必有;归档时间;未归档为 null。归档后名字保留,不可复用。 |
| created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 |
| updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 |
HTTP 200
{
"id": "wf_00mv67m4jad0d5c2a3d1e04dc9ac4c18cff616eca7",
"owner": "tnt_3a9759864ccb4e00",
"kind": "workflow",
"namespace": "docs-samples",
"name": "sample-workflows-1791867412840-b05e8a",
"description": "Sample definition",
"labels": {},
"latest_version": {
"version": "1.0.0",
"published_at": "2026-10-13T04:57:32.297Z"
},
"dist_tags": {
"latest": "1.0.0"
},
"draft_changed": false,
"latest_run": null,
"stats_7d": {
"runs": 0,
"failures": 0
},
"archived_at": null,
"created_at": "2026-10-13T04:57:29.206Z",
"updated_at": "2026-10-13T04:57:38.354Z"
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 403 | NAMESPACE_FORBIDDEN:命名空间只读或运行令牌不允许此调用。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 |
| 412 | PRECONDITION_FAILED:修订、源码摘要或并发写入条件不匹配。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
从草稿或临时运行源码发布版本,校验定义并锁定依赖。草稿须匹配 expected_draft_revision;临时运行由 from_run 与 expected_source_sha256 指定。版本相同且内容相同返回已有版本,内容不同返回 VERSION_EXISTS;预发布版本必须显式带 tag(不能是 latest,tag 只能含 URL 安全字符且不能是版本号或范围,违规返回 TAG_REQUIRED 或 TAG_INVALID,hint 给出完整规则),校验不通过返回 DEFINITION_INVALID。稳定版本仅高于已有最高稳定版本时自动移动 latest;工作流成为 latest 时同步定义中的定时触发器。run.workflow/run.script 的字符串与对象引用使用相同版本解析和依赖锁定规则。 发布会去掉版本号的 +build 元数据。
POST /automation/v1/workflows/{ns}/{name}/versions
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
| header: Idempotency-Key | string | 可选;可选;1–256 字符。24 小时内同一 key 重放首个响应并带 Idempotent-Replayed: true;同 key 不同请求体返回 422;处理中返回 409。 minLength: 1;maxLength: 256 |
| 字段 | 类型 | 说明 |
|---|---|---|
| (分支1).version | string | 必填 / 必有;规范的精确语义版本,例如 1.2.0 或 1.3.0-beta.1;不能是范围。 |
| (分支1).expected_draft_revision | string | 必填 / 必有;发布的草稿修订,必须匹配当前草稿;与 from_run 发布方式二选一。 |
| (分支1).tag | string | 可选;发布标签。预发布版本(如 1.3.0-beta.1)必须带 tag 且不能是 latest;tag 只能由 URL 安全字符组成(字母、数字及 - _ . ! ~ * ' ( )),不含空格和 / ? #,首尾无空白;不能是版本号或版本范围(如 1.2.3、^1、1.x、*);beta、next、debug 等其余名称均可。违规返回 TAG_INVALID 或 TAG_REQUIRED,hint 给出完整规则。 |
| (分支2).version | string | 必填 / 必有;规范的精确语义版本,例如 1.2.0 或 1.3.0-beta.1;不能是范围。 |
| (分支2).from_run | string | 必填 / 必有;提供源码快照的临时运行 ID;已发布目标的运行当前没有可用于此入口的快照。须同时给出 expected_source_sha256,不能同时给 expected_draft_revision。 |
| (分支2).expected_source_sha256 | string | 必填 / 必有;运行源码的 SHA-256 摘要,必须与快照匹配。 |
| (分支2).tag | string | 可选;发布标签。预发布版本(如 1.3.0-beta.1)必须带 tag 且不能是 latest;tag 只能由 URL 安全字符组成(字母、数字及 - _ . ! ~ * ' ( )),不含空格和 / ? #,首尾无空白;不能是版本号或版本范围(如 1.2.3、^1、1.x、*);beta、next、debug 等其余名称均可。违规返回 TAG_INVALID 或 TAG_REQUIRED,hint 给出完整规则。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| WORKFLOW_NAME | 创建工作流返回的 name |
| DRAFT_REVISION | 当前 draft.revision |
: "${WORKFLOW_NAME:?Set WORKFLOW_NAME}"
: "${DRAFT_REVISION:?Set DRAFT_REVISION}"
BODY=$(jq -n --arg DRAFT_REVISION "$DRAFT_REVISION" '{
"version": "1.0.0",
"expected_draft_revision": $DRAFT_REVISION
}')
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/workflows/docs-samples/${WORKFLOW_NAME}/versions" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data "$BODY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.workflows.versions.publish({
"path": {
"ns": "docs-samples",
"name": env("WORKFLOW_NAME")
},
"body": {
"version": "1.0.0",
"expected_draft_revision": env("DRAFT_REVISION")
}
});
console.log(result);Success
| 响应头 | 类型 | 说明 |
|---|---|---|
| Idempotent-Replayed | boolean | Present and true when replaying the first response for this key. |
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;版本 ID,脚本前缀 scv_,工作流前缀 wfv_。 |
| kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| version | string | 必填 / 必有;版本号(semver,已去掉 +build 元数据)。 |
| digest | string | 必填 / 必有;源码与契约的内容摘要。 |
| source | string | 必填 / 必有;该版本的完整源码。版本列表默认不返回,需要时加 expand=source。 |
| input_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| input_schema.*(分支5) | object | 递归 JSON 值。 |
| input_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output_schema | object | 必填 / 必有;脚本从返回类型推导,支持 Promise 解包、Record、交叉类型和 Date(date-time);推不出时为空 schema,并在 /validate 的 warnings 给出 warning。 |
| output_schema.*(分支5) | object | 递归 JSON 值。 |
| output_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| references | object[] | 必填 / 必有;该版本依赖的动作、平台 API、脚本与工作流。脚本和工作流依赖在发布时锁定到精确版本。 |
| references[].kind | "action" / "script" / "workflow" / "platform_api" / "run" | 必填 / 必有;依赖类型。action 为动作;platform_api 为平台 API 操作;script 为脚本;workflow 为工作流;run 为脚本中 invoke("ns/name") 调用的子运行目标(脚本或工作流,发布时解析)。 |
| references[].name | string | 必填 / 必有;被依赖对象:动作为 ns/name,平台 API 为操作名,脚本与工作流为 ns/name。 |
| references[].range | string | 可选;引用时写的版本范围或标签(npm 规则);未写时为空。 |
| references[].locked_version | string | 可选;发布时锁定的精确版本;仅脚本与工作流依赖有,动作与平台 API 不锁定。 |
| outline | null / object[] | 必填 / 必有;工作流的步骤大纲(OutlineNode 数组),由解析器静态生成;脚本为 null。 |
| outline(分支2)[].name | string | 必填 / 必有;步骤名,即工作流 YAML 中该步骤的键。 |
| outline(分支2)[].reference | string | 必填 / 必有;该步骤在工作流文档中的 JSON Pointer,例如 /do/0/start;与运行时 Task.reference 一致。 |
| outline(分支2)[].kind | "run" / "call" / "wait" / "set" / "for" / "fork" / "try" / "switch" / "emit" / "raise" / "listen" / "do" | 必填 / 必有;工作流步骤类型。call 调用动作;run 运行子脚本或子工作流;wait 等待时长;set 设置变量;for 循环;fork 并行分支;try 带捕获的块;switch 条件分支;emit 发出事件;raise 抛出错误;listen 等待事件;do 顺序执行的步骤块。 |
| outline(分支2)[].target | string | 可选;步骤调用的目标:call 步骤为动作 ns/name,run 步骤为 ns/name@范围;其它类型没有。 |
| outline(分支2)[].wait | object | 可选;等待步骤的摘要:时长(seconds 或 duration)或等待的事件类型(event)。 不接受额外字段。 |
| outline(分支2)[].wait.until | string | 可选;等待结束的绝对时刻,仅在可静态确定时给出;目前大纲不填充该字段。 |
| outline(分支2)[].wait.seconds | number | 可选;可静态换算的等待秒数;时长对象与可换算的 ISO 时长均投影到此字段。 |
| outline(分支2)[].wait.event | string | 可选;listen 步骤等待的事件类型。 |
| outline(分支2)[].wait.duration | string | 可选;无法静态换算成秒的原始时长或运行时表达式;不与 seconds 强行换算。 |
| outline(分支2)[].loop | object | 可选;for 步骤的循环信息 {each, in}。 不接受额外字段。 |
| outline(分支2)[].loop.each | string | 必填 / 必有;循环变量名;未指定时为 item。 |
| outline(分支2)[].loop.in | string | 必填 / 必有;被遍历的集合表达式原文。 |
| outline(分支2)[].children | object[] | 可选;嵌套的子步骤(do、fork 分支、try 与 catch 内的步骤)。 |
| outline(分支2)[].children[] | object | 递归 JSON 值。 |
| sdk_version | null / string | 必填 / 必有;发布脚本所用的 SDK 版本;工作流为 null。 |
| published_at | string | 必填 / 必有;发布时间(RFC 3339 UTC)。 |
| published_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| published_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| published_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| deprecated | null / string | 必填 / 必有;弃用说明;未弃用为 null。弃用的版本仍可运行,但按范围或标签解析时优先选用未弃用的版本。 |
| deprecated_at | null / string | 必填 / 必有;弃用时间(RFC 3339 UTC);未弃用为 null。 |
| deprecated_by | null / object | 必填 / 必有;执行弃用的主体;未弃用为 null。 |
| deprecated_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| deprecated_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
HTTP 200
{
"id": "wfv_00mv67m6x5409408c354944fa8a960d207eb33c297",
"kind": "workflow",
"version": "1.0.0",
"digest": "ea7352d51087eca0113ee82230848ce1506fd97d27aad4c7b1911e5c4ef9b5fb",
"input_schema": {},
"output_schema": {},
"references": [],
"outline": [
{
"name": "answer",
"reference": "/do/0/answer",
"kind": "set"
}
],
"sdk_version": null,
"published_at": "2026-10-13T04:57:32.297Z",
"published_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"deprecated": null,
"deprecated_at": null,
"deprecated_by": null,
"source": "document:\n dsl: '1.0.3'\n namespace: docs-samples\n name: sample-workflows-1791867412840-b05e8a\n version: '1.0.0'\ndo:\n - answer:\n set:\n answer: 42\n"
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 TAG_REQUIRED:预发布版本必须显式指定发布标签(例如 beta,不能是 latest);响应 hint 列出完整规则。 TAG_INVALID:标签无效:预发布版本不能打 latest;tag 只能含 URL 安全字符(不含空格和 / ? #);不能是版本号或范围;latest 不能删除。响应 hint 列出完整规则。 DEFINITION_INVALID:源码未通过定义校验。 INPUT_INVALID:输入不满足目标契约或业务校验。 SCHEDULE_INVALID:定时规则或时间边界无效。 TIMEZONE_INVALID:时区不是有效的 IANA 时区。 INTERVAL_TOO_SHORT:定时间隔短于一分钟。 |
| 403 | NAMESPACE_FORBIDDEN:命名空间只读或运行令牌不允许此调用。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 RUN_NOT_FOUND:运行不存在或当前租户不可见。 |
| 409 | IDEMPOTENCY_IN_FLIGHT:同一幂等键的请求仍在处理中。 TARGET_ARCHIVED:目标已归档,不能用于本操作;动作执行错误的 detail 包含 ns/name。 VERSION_EXISTS:版本号已存在且源码内容不同。 |
| 412 | PRECONDITION_FAILED:修订、源码摘要或并发写入条件不匹配。 |
| 422 | IDEMPOTENCY_KEY_MISMATCH:同一幂等键已用于不同请求内容。 DEFINITION_IDENTITY_MISMATCH:源码声明或运行语言与发布目标不一致。 NO_MATCHING_VERSION:没有满足标签、版本或范围的已发布版本。 CYCLE_DETECTED:发布后依赖会形成环(A 依赖 B、B 又依赖 A);detail 给出环路径。 |
| 429 | TRIGGER_LIMIT:租户已达到 100 个启用触发器的上限。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
按语义版本倒序分页列出不可变的 schema 和锁定依赖。默认不带源码;仅 expand=source 带完整源码,其它值返回 400。详情接口保持全文。
GET /automation/v1/workflows/{ns}/{name}/versions
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
| query: limit | integer | 可选;每页条数,整数 1–100,默认 25。 minimum: 1;maximum: 100 |
| query: cursor | string | 可选;上一页返回的 next_cursor,不透明字符串;保持原查询条件继续翻页。 |
| query: expand | "source" | 可选;仅接受 source;默认不带源码,其它值返回 400。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| WORKFLOW_NAME | 创建工作流返回的 name |
: "${WORKFLOW_NAME:?Set WORKFLOW_NAME}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/workflows/docs-samples/${WORKFLOW_NAME}/versions" \
-H "Authorization: Bearer $PRAXIS_API_KEY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.workflows.versions.list({
"path": {
"ns": "docs-samples",
"name": env("WORKFLOW_NAME")
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| data | object[] | 必填 / 必有;本页的工作流版本(默认不含源码,expand=source 才带),按 semver 降序排列。 |
| data[].id | string | 必填 / 必有;版本 ID,脚本前缀 scv_,工作流前缀 wfv_。 |
| data[].kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| data[].version | string | 必填 / 必有;版本号(semver,已去掉 +build 元数据)。 |
| data[].digest | string | 必填 / 必有;源码与契约的内容摘要。 |
| data[].source | string | 可选;该版本的完整源码。版本列表默认不返回,需要时加 expand=source。 |
| data[].input_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| data[].input_schema.*(分支5) | object | 递归 JSON 值。 |
| data[].input_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[].output_schema | object | 必填 / 必有;脚本从返回类型推导,支持 Promise 解包、Record、交叉类型和 Date(date-time);推不出时为空 schema,并在 /validate 的 warnings 给出 warning。 |
| data[].output_schema.*(分支5) | object | 递归 JSON 值。 |
| data[].output_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[].references | object[] | 必填 / 必有;该版本依赖的动作、平台 API、脚本与工作流。脚本和工作流依赖在发布时锁定到精确版本。 |
| data[].references[].kind | "action" / "script" / "workflow" / "platform_api" / "run" | 必填 / 必有;依赖类型。action 为动作;platform_api 为平台 API 操作;script 为脚本;workflow 为工作流;run 为脚本中 invoke("ns/name") 调用的子运行目标(脚本或工作流,发布时解析)。 |
| data[].references[].name | string | 必填 / 必有;被依赖对象:动作为 ns/name,平台 API 为操作名,脚本与工作流为 ns/name。 |
| data[].references[].range | string | 可选;引用时写的版本范围或标签(npm 规则);未写时为空。 |
| data[].references[].locked_version | string | 可选;发布时锁定的精确版本;仅脚本与工作流依赖有,动作与平台 API 不锁定。 |
| data[].outline | null / object[] | 必填 / 必有;工作流的步骤大纲(OutlineNode 数组),由解析器静态生成;脚本为 null。 |
| data[].outline(分支2)[].name | string | 必填 / 必有;步骤名,即工作流 YAML 中该步骤的键。 |
| data[].outline(分支2)[].reference | string | 必填 / 必有;该步骤在工作流文档中的 JSON Pointer,例如 /do/0/start;与运行时 Task.reference 一致。 |
| data[].outline(分支2)[].kind | "run" / "call" / "wait" / "set" / "for" / "fork" / "try" / "switch" / "emit" / "raise" / "listen" / "do" | 必填 / 必有;工作流步骤类型。call 调用动作;run 运行子脚本或子工作流;wait 等待时长;set 设置变量;for 循环;fork 并行分支;try 带捕获的块;switch 条件分支;emit 发出事件;raise 抛出错误;listen 等待事件;do 顺序执行的步骤块。 |
| data[].outline(分支2)[].target | string | 可选;步骤调用的目标:call 步骤为动作 ns/name,run 步骤为 ns/name@范围;其它类型没有。 |
| data[].outline(分支2)[].wait | object | 可选;等待步骤的摘要:时长(seconds 或 duration)或等待的事件类型(event)。 不接受额外字段。 |
| data[].outline(分支2)[].wait.until | string | 可选;等待结束的绝对时刻,仅在可静态确定时给出;目前大纲不填充该字段。 |
| data[].outline(分支2)[].wait.seconds | number | 可选;可静态换算的等待秒数;时长对象与可换算的 ISO 时长均投影到此字段。 |
| data[].outline(分支2)[].wait.event | string | 可选;listen 步骤等待的事件类型。 |
| data[].outline(分支2)[].wait.duration | string | 可选;无法静态换算成秒的原始时长或运行时表达式;不与 seconds 强行换算。 |
| data[].outline(分支2)[].loop | object | 可选;for 步骤的循环信息 {each, in}。 不接受额外字段。 |
| data[].outline(分支2)[].loop.each | string | 必填 / 必有;循环变量名;未指定时为 item。 |
| data[].outline(分支2)[].loop.in | string | 必填 / 必有;被遍历的集合表达式原文。 |
| data[].outline(分支2)[].children | object[] | 可选;嵌套的子步骤(do、fork 分支、try 与 catch 内的步骤)。 |
| data[].outline(分支2)[].children[] | object | 递归 JSON 值。 |
| data[].sdk_version | null / string | 必填 / 必有;发布脚本所用的 SDK 版本;工作流为 null。 |
| data[].published_at | string | 必填 / 必有;发布时间(RFC 3339 UTC)。 |
| data[].published_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| data[].published_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| data[].published_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| data[].deprecated | null / string | 必填 / 必有;弃用说明;未弃用为 null。弃用的版本仍可运行,但按范围或标签解析时优先选用未弃用的版本。 |
| data[].deprecated_at | null / string | 必填 / 必有;弃用时间(RFC 3339 UTC);未弃用为 null。 |
| data[].deprecated_by | null / object | 必填 / 必有;执行弃用的主体;未弃用为 null。 |
| data[].deprecated_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| data[].deprecated_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| next_cursor | null / string | 必填 / 必有;下一页游标,原样传给 cursor 参数并保持原查询条件;没有更多页为 null。接口不返回总数。 |
HTTP 200
{
"data": [
{
"id": "wfv_00mv67m6x5409408c354944fa8a960d207eb33c297",
"kind": "workflow",
"version": "1.0.0",
"digest": "ea7352d51087eca0113ee82230848ce1506fd97d27aad4c7b1911e5c4ef9b5fb",
"input_schema": {},
"output_schema": {},
"references": [],
"outline": [
{
"name": "answer",
"reference": "/do/0/answer",
"kind": "set"
}
],
"sdk_version": null,
"published_at": "2026-10-13T04:57:32.297Z",
"published_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"deprecated": null,
"deprecated_at": null,
"deprecated_by": null
}
],
"next_cursor": null
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
读取精确版本的源码、输入输出契约及弃用说明;版本缺失返回 VERSION_NOT_FOUND。 详情始终返回完整源码。 version 接受精确版本或 dist-tag;range 返回 400,hint 提示改用 /resolve。
GET /automation/v1/workflows/{ns}/{name}/versions/{version}
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
| path: version | string | 必填;精确版本或 dist-tag;不接受 range(400,带 hint)。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| WORKFLOW_NAME | 创建工作流返回的 name |
: "${WORKFLOW_NAME:?Set WORKFLOW_NAME}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/workflows/docs-samples/${WORKFLOW_NAME}/versions/1.0.0" \
-H "Authorization: Bearer $PRAXIS_API_KEY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.workflows.versions.retrieve({
"path": {
"ns": "docs-samples",
"name": env("WORKFLOW_NAME"),
"version": "1.0.0"
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;版本 ID,脚本前缀 scv_,工作流前缀 wfv_。 |
| kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| version | string | 必填 / 必有;版本号(semver,已去掉 +build 元数据)。 |
| digest | string | 必填 / 必有;源码与契约的内容摘要。 |
| source | string | 必填 / 必有;该版本的完整源码。版本列表默认不返回,需要时加 expand=source。 |
| input_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| input_schema.*(分支5) | object | 递归 JSON 值。 |
| input_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output_schema | object | 必填 / 必有;脚本从返回类型推导,支持 Promise 解包、Record、交叉类型和 Date(date-time);推不出时为空 schema,并在 /validate 的 warnings 给出 warning。 |
| output_schema.*(分支5) | object | 递归 JSON 值。 |
| output_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| references | object[] | 必填 / 必有;该版本依赖的动作、平台 API、脚本与工作流。脚本和工作流依赖在发布时锁定到精确版本。 |
| references[].kind | "action" / "script" / "workflow" / "platform_api" / "run" | 必填 / 必有;依赖类型。action 为动作;platform_api 为平台 API 操作;script 为脚本;workflow 为工作流;run 为脚本中 invoke("ns/name") 调用的子运行目标(脚本或工作流,发布时解析)。 |
| references[].name | string | 必填 / 必有;被依赖对象:动作为 ns/name,平台 API 为操作名,脚本与工作流为 ns/name。 |
| references[].range | string | 可选;引用时写的版本范围或标签(npm 规则);未写时为空。 |
| references[].locked_version | string | 可选;发布时锁定的精确版本;仅脚本与工作流依赖有,动作与平台 API 不锁定。 |
| outline | null / object[] | 必填 / 必有;工作流的步骤大纲(OutlineNode 数组),由解析器静态生成;脚本为 null。 |
| outline(分支2)[].name | string | 必填 / 必有;步骤名,即工作流 YAML 中该步骤的键。 |
| outline(分支2)[].reference | string | 必填 / 必有;该步骤在工作流文档中的 JSON Pointer,例如 /do/0/start;与运行时 Task.reference 一致。 |
| outline(分支2)[].kind | "run" / "call" / "wait" / "set" / "for" / "fork" / "try" / "switch" / "emit" / "raise" / "listen" / "do" | 必填 / 必有;工作流步骤类型。call 调用动作;run 运行子脚本或子工作流;wait 等待时长;set 设置变量;for 循环;fork 并行分支;try 带捕获的块;switch 条件分支;emit 发出事件;raise 抛出错误;listen 等待事件;do 顺序执行的步骤块。 |
| outline(分支2)[].target | string | 可选;步骤调用的目标:call 步骤为动作 ns/name,run 步骤为 ns/name@范围;其它类型没有。 |
| outline(分支2)[].wait | object | 可选;等待步骤的摘要:时长(seconds 或 duration)或等待的事件类型(event)。 不接受额外字段。 |
| outline(分支2)[].wait.until | string | 可选;等待结束的绝对时刻,仅在可静态确定时给出;目前大纲不填充该字段。 |
| outline(分支2)[].wait.seconds | number | 可选;可静态换算的等待秒数;时长对象与可换算的 ISO 时长均投影到此字段。 |
| outline(分支2)[].wait.event | string | 可选;listen 步骤等待的事件类型。 |
| outline(分支2)[].wait.duration | string | 可选;无法静态换算成秒的原始时长或运行时表达式;不与 seconds 强行换算。 |
| outline(分支2)[].loop | object | 可选;for 步骤的循环信息 {each, in}。 不接受额外字段。 |
| outline(分支2)[].loop.each | string | 必填 / 必有;循环变量名;未指定时为 item。 |
| outline(分支2)[].loop.in | string | 必填 / 必有;被遍历的集合表达式原文。 |
| outline(分支2)[].children | object[] | 可选;嵌套的子步骤(do、fork 分支、try 与 catch 内的步骤)。 |
| outline(分支2)[].children[] | object | 递归 JSON 值。 |
| sdk_version | null / string | 必填 / 必有;发布脚本所用的 SDK 版本;工作流为 null。 |
| published_at | string | 必填 / 必有;发布时间(RFC 3339 UTC)。 |
| published_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| published_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| published_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| deprecated | null / string | 必填 / 必有;弃用说明;未弃用为 null。弃用的版本仍可运行,但按范围或标签解析时优先选用未弃用的版本。 |
| deprecated_at | null / string | 必填 / 必有;弃用时间(RFC 3339 UTC);未弃用为 null。 |
| deprecated_by | null / object | 必填 / 必有;执行弃用的主体;未弃用为 null。 |
| deprecated_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| deprecated_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
HTTP 200
{
"id": "wfv_00mv67m6x5409408c354944fa8a960d207eb33c297",
"kind": "workflow",
"version": "1.0.0",
"digest": "ea7352d51087eca0113ee82230848ce1506fd97d27aad4c7b1911e5c4ef9b5fb",
"input_schema": {},
"output_schema": {},
"references": [],
"outline": [
{
"name": "answer",
"reference": "/do/0/answer",
"kind": "set"
}
],
"sdk_version": null,
"published_at": "2026-10-13T04:57:32.297Z",
"published_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"deprecated": null,
"deprecated_at": null,
"deprecated_by": null,
"source": "document:\n dsl: '1.0.3'\n namespace: docs-samples\n name: sample-workflows-1791867412840-b05e8a\n version: '1.0.0'\ndo:\n - answer:\n set:\n answer: 42\n"
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 VERSION_NOT_FOUND:指定版本或修订不存在。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
记录版本弃用说明;message 为空字符串时取消弃用,版本源码不变。
POST /automation/v1/workflows/{ns}/{name}/versions/{version}/deprecate
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
| path: version | string | 必填;规范的精确语义版本,例如 1.2.0 或 1.3.0-beta.1;不能是范围。 |
不接受额外字段。
| 字段 | 类型 | 说明 |
|---|---|---|
| message | string | 必填 / 必有;弃用说明;空字符串取消弃用。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| WORKFLOW_NAME | 创建工作流返回的 name |
: "${WORKFLOW_NAME:?Set WORKFLOW_NAME}"
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/workflows/docs-samples/${WORKFLOW_NAME}/versions/1.0.0/deprecate" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"message": ""
}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.workflows.versions.deprecate({
"path": {
"ns": "docs-samples",
"name": env("WORKFLOW_NAME"),
"version": "1.0.0"
},
"body": {
"message": ""
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;版本 ID,脚本前缀 scv_,工作流前缀 wfv_。 |
| kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| version | string | 必填 / 必有;版本号(semver,已去掉 +build 元数据)。 |
| digest | string | 必填 / 必有;源码与契约的内容摘要。 |
| source | string | 必填 / 必有;该版本的完整源码。版本列表默认不返回,需要时加 expand=source。 |
| input_schema | object | 必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。 |
| input_schema.*(分支5) | object | 递归 JSON 值。 |
| input_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output_schema | object | 必填 / 必有;脚本从返回类型推导,支持 Promise 解包、Record、交叉类型和 Date(date-time);推不出时为空 schema,并在 /validate 的 warnings 给出 warning。 |
| output_schema.*(分支5) | object | 递归 JSON 值。 |
| output_schema.*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| references | object[] | 必填 / 必有;该版本依赖的动作、平台 API、脚本与工作流。脚本和工作流依赖在发布时锁定到精确版本。 |
| references[].kind | "action" / "script" / "workflow" / "platform_api" / "run" | 必填 / 必有;依赖类型。action 为动作;platform_api 为平台 API 操作;script 为脚本;workflow 为工作流;run 为脚本中 invoke("ns/name") 调用的子运行目标(脚本或工作流,发布时解析)。 |
| references[].name | string | 必填 / 必有;被依赖对象:动作为 ns/name,平台 API 为操作名,脚本与工作流为 ns/name。 |
| references[].range | string | 可选;引用时写的版本范围或标签(npm 规则);未写时为空。 |
| references[].locked_version | string | 可选;发布时锁定的精确版本;仅脚本与工作流依赖有,动作与平台 API 不锁定。 |
| outline | null / object[] | 必填 / 必有;工作流的步骤大纲(OutlineNode 数组),由解析器静态生成;脚本为 null。 |
| outline(分支2)[].name | string | 必填 / 必有;步骤名,即工作流 YAML 中该步骤的键。 |
| outline(分支2)[].reference | string | 必填 / 必有;该步骤在工作流文档中的 JSON Pointer,例如 /do/0/start;与运行时 Task.reference 一致。 |
| outline(分支2)[].kind | "run" / "call" / "wait" / "set" / "for" / "fork" / "try" / "switch" / "emit" / "raise" / "listen" / "do" | 必填 / 必有;工作流步骤类型。call 调用动作;run 运行子脚本或子工作流;wait 等待时长;set 设置变量;for 循环;fork 并行分支;try 带捕获的块;switch 条件分支;emit 发出事件;raise 抛出错误;listen 等待事件;do 顺序执行的步骤块。 |
| outline(分支2)[].target | string | 可选;步骤调用的目标:call 步骤为动作 ns/name,run 步骤为 ns/name@范围;其它类型没有。 |
| outline(分支2)[].wait | object | 可选;等待步骤的摘要:时长(seconds 或 duration)或等待的事件类型(event)。 不接受额外字段。 |
| outline(分支2)[].wait.until | string | 可选;等待结束的绝对时刻,仅在可静态确定时给出;目前大纲不填充该字段。 |
| outline(分支2)[].wait.seconds | number | 可选;可静态换算的等待秒数;时长对象与可换算的 ISO 时长均投影到此字段。 |
| outline(分支2)[].wait.event | string | 可选;listen 步骤等待的事件类型。 |
| outline(分支2)[].wait.duration | string | 可选;无法静态换算成秒的原始时长或运行时表达式;不与 seconds 强行换算。 |
| outline(分支2)[].loop | object | 可选;for 步骤的循环信息 {each, in}。 不接受额外字段。 |
| outline(分支2)[].loop.each | string | 必填 / 必有;循环变量名;未指定时为 item。 |
| outline(分支2)[].loop.in | string | 必填 / 必有;被遍历的集合表达式原文。 |
| outline(分支2)[].children | object[] | 可选;嵌套的子步骤(do、fork 分支、try 与 catch 内的步骤)。 |
| outline(分支2)[].children[] | object | 递归 JSON 值。 |
| sdk_version | null / string | 必填 / 必有;发布脚本所用的 SDK 版本;工作流为 null。 |
| published_at | string | 必填 / 必有;发布时间(RFC 3339 UTC)。 |
| published_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| published_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| published_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| deprecated | null / string | 必填 / 必有;弃用说明;未弃用为 null。弃用的版本仍可运行,但按范围或标签解析时优先选用未弃用的版本。 |
| deprecated_at | null / string | 必填 / 必有;弃用时间(RFC 3339 UTC);未弃用为 null。 |
| deprecated_by | null / object | 必填 / 必有;执行弃用的主体;未弃用为 null。 |
| deprecated_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| deprecated_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
HTTP 200
{
"id": "wfv_00mv67m6x5409408c354944fa8a960d207eb33c297",
"kind": "workflow",
"version": "1.0.0",
"digest": "ea7352d51087eca0113ee82230848ce1506fd97d27aad4c7b1911e5c4ef9b5fb",
"input_schema": {},
"output_schema": {},
"references": [],
"outline": [
{
"name": "answer",
"reference": "/do/0/answer",
"kind": "set"
}
],
"sdk_version": null,
"published_at": "2026-10-13T04:57:32.297Z",
"published_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"deprecated": null,
"deprecated_at": null,
"deprecated_by": null,
"source": "document:\n dsl: '1.0.3'\n namespace: docs-samples\n name: sample-workflows-1791867412840-b05e8a\n version: '1.0.0'\ndo:\n - answer:\n set:\n answer: 42\n"
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 403 | NAMESPACE_FORBIDDEN:命名空间只读或运行令牌不允许此调用。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 VERSION_NOT_FOUND:指定版本或修订不存在。 |
| 409 | TARGET_ARCHIVED:目标已归档,不能用于本操作;动作执行错误的 detail 包含 ns/name。 |
| 412 | PRECONDITION_FAILED:修订、源码摘要或并发写入条件不匹配。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
读取发布标签指向的精确版本。同时返回更新时间和更新者。
GET /automation/v1/workflows/{ns}/{name}/dist-tags
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| WORKFLOW_NAME | 创建工作流返回的 name |
: "${WORKFLOW_NAME:?Set WORKFLOW_NAME}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/workflows/docs-samples/${WORKFLOW_NAME}/dist-tags" \
-H "Authorization: Bearer $PRAXIS_API_KEY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.workflows.distTags.list({
"path": {
"ns": "docs-samples",
"name": env("WORKFLOW_NAME")
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| .*.version | string | 必填 / 必有;标签当前指向的精确版本号。 |
| .*.updated_at | string | 必填 / 必有;标签最近一次移动的时间(RFC 3339 UTC)。 |
| .*.updated_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| .*.updated_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| .*.updated_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
HTTP 200
{
"latest": {
"version": "1.0.0",
"updated_at": "2026-10-13T04:57:32.297Z",
"updated_by": {
"type": "api_key",
"id": "key_3e00b8984967"
}
}
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
将发布标签指向已有精确版本,标签不能是版本号或版本范围;移动 latest 可用于回滚,工作流会同步定时触发器。
PUT /automation/v1/workflows/{ns}/{name}/dist-tags/{tag}
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
| path: tag | string | 必填;发布标签。预发布版本(如 1.3.0-beta.1)必须带 tag 且不能是 latest;tag 只能由 URL 安全字符组成(字母、数字及 - _ . ! ~ * ' ( )),不含空格和 / ? #,首尾无空白;不能是版本号或版本范围(如 1.2.3、^1、1.x、*);beta、next、debug 等其余名称均可。违规返回 TAG_INVALID 或 TAG_REQUIRED,hint 给出完整规则。 |
不接受额外字段。
| 字段 | 类型 | 说明 |
|---|---|---|
| version | string | 必填 / 必有;规范的精确语义版本,例如 1.2.0 或 1.3.0-beta.1;不能是范围。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| WORKFLOW_NAME | 创建工作流返回的 name |
: "${WORKFLOW_NAME:?Set WORKFLOW_NAME}"
curl --fail-with-body -X PUT "https://api.deepraxis.ai/automation/v1/workflows/docs-samples/${WORKFLOW_NAME}/dist-tags/sample" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"version": "1.0.0"
}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.workflows.distTags.set({
"path": {
"ns": "docs-samples",
"name": env("WORKFLOW_NAME"),
"tag": "sample"
},
"body": {
"version": "1.0.0"
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| .*.version | string | 必填 / 必有;标签当前指向的精确版本号。 |
| .*.updated_at | string | 必填 / 必有;标签最近一次移动的时间(RFC 3339 UTC)。 |
| .*.updated_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| .*.updated_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| .*.updated_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
HTTP 200
{
"latest": {
"version": "1.0.0",
"updated_at": "2026-10-13T04:57:32.297Z",
"updated_by": {
"type": "api_key",
"id": "key_3e00b8984967"
}
},
"sample": {
"version": "1.0.0",
"updated_at": "2026-10-13T04:57:36.329Z",
"updated_by": {
"type": "api_key",
"id": "key_3e00b8984967"
}
}
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 TAG_INVALID:标签无效:预发布版本不能打 latest;tag 只能含 URL 安全字符(不含空格和 / ? #);不能是版本号或范围;latest 不能删除。响应 hint 列出完整规则。 INPUT_INVALID:输入不满足目标契约或业务校验。 SCHEDULE_INVALID:定时规则或时间边界无效。 TIMEZONE_INVALID:时区不是有效的 IANA 时区。 INTERVAL_TOO_SHORT:定时间隔短于一分钟。 |
| 403 | NAMESPACE_FORBIDDEN:命名空间只读或运行令牌不允许此调用。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 VERSION_NOT_FOUND:指定版本或修订不存在。 |
| 409 | TARGET_ARCHIVED:目标已归档,不能用于本操作;动作执行错误的 detail 包含 ns/name。 |
| 412 | PRECONDITION_FAILED:修订、源码摘要或并发写入条件不匹配。 |
| 429 | TRIGGER_LIMIT:租户已达到 100 个启用触发器的上限。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
删除发布标签但保留版本;latest 不可删除,标签不能是版本号或范围,不存在的合法标签可重复删除。
DELETE /automation/v1/workflows/{ns}/{name}/dist-tags/{tag}
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: ns | string | 必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。 |
| path: name | string | 必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。 |
| path: tag | string | 必填;发布标签。预发布版本(如 1.3.0-beta.1)必须带 tag 且不能是 latest;tag 只能由 URL 安全字符组成(字母、数字及 - _ . ! ~ * ' ( )),不含空格和 / ? #,首尾无空白;不能是版本号或版本范围(如 1.2.3、^1、1.x、*);beta、next、debug 等其余名称均可。违规返回 TAG_INVALID 或 TAG_REQUIRED,hint 给出完整规则。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| WORKFLOW_NAME | 创建工作流返回的 name |
: "${WORKFLOW_NAME:?Set WORKFLOW_NAME}"
curl --fail-with-body -X DELETE "https://api.deepraxis.ai/automation/v1/workflows/docs-samples/${WORKFLOW_NAME}/dist-tags/sample" \
-H "Authorization: Bearer $PRAXIS_API_KEY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.workflows.distTags.delete({
"path": {
"ns": "docs-samples",
"name": env("WORKFLOW_NAME"),
"tag": "sample"
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| .*.version | string | 必填 / 必有;标签当前指向的精确版本号。 |
| .*.updated_at | string | 必填 / 必有;标签最近一次移动的时间(RFC 3339 UTC)。 |
| .*.updated_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| .*.updated_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| .*.updated_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
HTTP 200
{
"latest": {
"version": "1.0.0",
"updated_at": "2026-10-13T04:57:32.297Z",
"updated_by": {
"type": "api_key",
"id": "key_3e00b8984967"
}
}
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 TAG_INVALID:标签无效:预发布版本不能打 latest;tag 只能含 URL 安全字符(不含空格和 / ? #);不能是版本号或范围;latest 不能删除。响应 hint 列出完整规则。 |
| 403 | NAMESPACE_FORBIDDEN:命名空间只读或运行令牌不允许此调用。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 |
| 409 | TARGET_ARCHIVED:目标已归档,不能用于本操作;动作执行错误的 detail 包含 ns/name。 |
| 412 | PRECONDITION_FAILED:修订、源码摘要或并发写入条件不匹配。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
校验源码并返回诊断及输入输出契约。支持动作、脚本和工作流;结果含 valid 及引用,不会保存定义,源码不合法通过 valid=false 返回。 脚本/动作输出 schema 支持返回类型推断:Promise 解包、Record、交叉类型、Date;推不出时使用空 schema 并给 warning(warnings)。源码诊断使用 /source 或 /implementation/source,line/column 从 1 起。kind=action 与创建动作使用同一套准入检查(禁止导入外部模块、平台操作必须写成 call(praxis/., 输入) 直接调用、不能调用 agent 或 automation 接口),校验通过的动作源码创建时不会再被拒绝。
POST /automation/v1/validate
Authorization: Bearer $PRAXIS_API_KEY
不接受额外字段。
| 字段 | 类型 | 说明 |
|---|---|---|
| kind | "action" / "script" / "workflow" | 必填 / 必有;源码类型:action、script 或 workflow。 |
| source | string | 必填 / 必有;待校验的源码;action 和 script 使用 TypeScript,workflow 使用 YAML。 |
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/validate" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"kind": "script",
"source": "export default async (input: { n: number }) => ({ answer: input.n + 1 });"
}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.validate.create({
"body": {
"kind": "script",
"source": "export default async (input: { n: number }) => ({ answer: input.n + 1 });"
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| valid | boolean | 必填 / 必有;源码是否通过校验:true 可发布或运行,false 见 errors。 |
| errors | object[] | 必填 / 必有;校验错误列表,每项含 pointer 与中文 detail;为空数组时 valid 为 true。 |
| errors[].pointer | string | 必填 / 必有;RFC 6901 字段指针。TypeScript 源码诊断为 /source(脚本)或 /implementation/source(动作);行列另见 line/column,不拼在指针后。 |
| errors[].detail | string | 必填 / 必有;中文修正说明,指出该位置出了什么问题以及怎样改。 |
| errors[].hint | string | 可选;可选的补充提示,给出下一步可执行的动作(例如改用另一个接口)。 |
| errors[].line | integer | 可选;行号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| errors[].column | integer | 可选;列号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| input_schema | null / object | 必填 / 必有;从源码推导出的输入 JSON Schema;无法解析源码时为 null。 |
| input_schema(分支2).*(分支5) | object | 递归 JSON 值。 |
| input_schema(分支2).*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output_schema | null / object | 必填 / 必有;脚本从返回类型推导,支持 Promise 解包、Record、交叉类型和 Date(date-time);推不出时为空 schema,并在 /validate 的 warnings 给出 warning。 |
| output_schema(分支2).*(分支5) | object | 递归 JSON 值。 |
| output_schema(分支2).*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| references | object[] | 必填 / 必有;源码依赖的动作、平台 API、脚本与工作流。 |
| references[].kind | "action" / "script" / "workflow" / "platform_api" / "run" | 必填 / 必有;依赖类型。action 为动作;platform_api 为平台 API 操作;script 为脚本;workflow 为工作流;run 为脚本中 invoke("ns/name") 调用的子运行目标(脚本或工作流,发布时解析)。 |
| references[].name | string | 必填 / 必有;被依赖对象:动作为 ns/name,平台 API 为操作名,脚本与工作流为 ns/name。 |
| references[].range | string | 可选;引用时写的版本范围或标签(npm 规则);未写时为空。 |
| references[].locked_version | string | 可选;发布时锁定的精确版本;仅脚本与工作流依赖有,动作与平台 API 不锁定。 |
| outline | null / object[] | 必填 / 必有;工作流步骤大纲;脚本和动作为 null。 |
| outline(分支2)[].name | string | 必填 / 必有;步骤名,即工作流 YAML 中该步骤的键。 |
| outline(分支2)[].reference | string | 必填 / 必有;该步骤在工作流文档中的 JSON Pointer,例如 /do/0/start;与运行时 Task.reference 一致。 |
| outline(分支2)[].kind | "run" / "call" / "wait" / "set" / "for" / "fork" / "try" / "switch" / "emit" / "raise" / "listen" / "do" | 必填 / 必有;工作流步骤类型。call 调用动作;run 运行子脚本或子工作流;wait 等待时长;set 设置变量;for 循环;fork 并行分支;try 带捕获的块;switch 条件分支;emit 发出事件;raise 抛出错误;listen 等待事件;do 顺序执行的步骤块。 |
| outline(分支2)[].target | string | 可选;步骤调用的目标:call 步骤为动作 ns/name,run 步骤为 ns/name@范围;其它类型没有。 |
| outline(分支2)[].wait | object | 可选;等待步骤的摘要:时长(seconds 或 duration)或等待的事件类型(event)。 不接受额外字段。 |
| outline(分支2)[].wait.until | string | 可选;等待结束的绝对时刻,仅在可静态确定时给出;目前大纲不填充该字段。 |
| outline(分支2)[].wait.seconds | number | 可选;可静态换算的等待秒数;时长对象与可换算的 ISO 时长均投影到此字段。 |
| outline(分支2)[].wait.event | string | 可选;listen 步骤等待的事件类型。 |
| outline(分支2)[].wait.duration | string | 可选;无法静态换算成秒的原始时长或运行时表达式;不与 seconds 强行换算。 |
| outline(分支2)[].loop | object | 可选;for 步骤的循环信息 {each, in}。 不接受额外字段。 |
| outline(分支2)[].loop.each | string | 必填 / 必有;循环变量名;未指定时为 item。 |
| outline(分支2)[].loop.in | string | 必填 / 必有;被遍历的集合表达式原文。 |
| outline(分支2)[].children | object[] | 可选;嵌套的子步骤(do、fork 分支、try 与 catch 内的步骤)。 |
| outline(分支2)[].children[] | object | 递归 JSON 值。 |
| warnings | object[] | 可选;脚本/动作静态分析的非阻断诊断;无法推导类型时使用空 schema 并给 warning。工作流分析可省略。 |
| warnings[].pointer | string | 必填 / 必有;RFC 6901 字段指针。TypeScript 源码诊断为 /source(脚本)或 /implementation/source(动作);行列另见 line/column,不拼在指针后。 |
| warnings[].detail | string | 必填 / 必有;中文修正说明,指出该位置出了什么问题以及怎样改。 |
| warnings[].hint | string | 可选;可选的补充提示,给出下一步可执行的动作(例如改用另一个接口)。 |
| warnings[].line | integer | 可选;行号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| warnings[].column | integer | 可选;列号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| platform_apis | string[] | 可选;脚本/动作引用的平台 API 集合(字符串数组);工作流分析可省略。 |
HTTP 200
{
"valid": true,
"errors": [],
"warnings": [],
"input_schema": {
"type": "object",
"properties": {
"n": {
"type": "number"
}
},
"required": [
"n"
]
},
"output_schema": {
"type": "object",
"properties": {
"answer": {
"type": "number"
}
},
"required": [
"answer"
]
},
"references": [],
"outline": null,
"platform_apis": []
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
将 ns/name@tag、精确版本或版本范围解析为可运行的精确版本;省略 @ 时使用 latest,归档目标拒绝解析,无匹配返回 NO_MATCHING_VERSION。
GET /automation/v1/resolve
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| query: target | string | 必填;ns/name@tag、ns/name@version 或 ns/name@range;省略 @ 时使用 latest。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| TARGET | 已发布的 docs-samples/name@1.0.0 |
: "${TARGET:?Set TARGET}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/resolve" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
--get \
--data-urlencode "target=${TARGET}"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.resolve.retrieve({
"query": {
"target": env("TARGET")
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| namespace | string | 必填 / 必有;编排命名空间。 |
| name | string | 必填 / 必有;编排名字。 |
| version | string | 必填 / 必有;target 解析到的精确版本号。 |
| version_id | string | 必填 / 必有;该版本的 ID(scv_ 或 wfv_ 前缀)。 |
| deprecated | null / string | 必填 / 必有;解析到的版本被弃用时的弃用说明;未弃用为 null。 |
HTTP 200
{
"kind": "script",
"namespace": "docs-samples",
"name": "sample-scripts-1791867412840-b05e8a",
"version": "1.0.0",
"version_id": "scv_00mv67lza679fc5498438040079f0c5684208c4915",
"deprecated": null
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 |
| 409 | TARGET_ARCHIVED:目标已归档,不能用于本操作;动作执行错误的 detail 包含 ns/name。 |
| 422 | NO_MATCHING_VERSION:没有满足标签、版本或范围的已发布版本。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
按名称搜索可见目标,按名称升序分页;默认排除归档目标,可筛选已发布的脚本和工作流。
GET /automation/v1/targets
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| query: q | string | 可选;不区分大小写,按 ns/name 或说明的字面子串匹配。 |
| query: kind | "action" / "script" / "workflow"[] | 可选;action、script 或 workflow;省略返回全部。 多个值以逗号分隔,匹配任一值。 minItems: 1 |
| query: limit | integer | 可选;每页条数,整数 1–100,默认 25。 minimum: 1;maximum: 100 |
| query: labels | object | 可选;按标签过滤,使用 labels[k]=v;同键逗号多值取任一,不同键同时满足。 |
| query: created_at[gte] | string | 可选;创建时间下界,包含边界;使用带时区的 ISO 8601 时间。 format: "date-time" |
| query: created_at[lte] | string | 可选;创建时间上界,包含边界;使用带时区的 ISO 8601 时间。 format: "date-time" |
| query: cursor | string | 可选;上一页的 next_cursor;翻页时保留原筛选条件。 |
| query: archived | boolean | 可选;默认 false,仅返回未归档目标;true 仅返回已归档目标。 default: false |
| query: published | boolean | 可选;true 仅返回有已发布版本的编排;动作始终可用。 |
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/targets" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
--get \
--data-urlencode "q=sample-" \
--data-urlencode "limit=1"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.targets.list({
"query": {
"q": "sample-",
"limit": 1
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| data | object[] | 必填 / 必有;本页的目标搜索结果(动作、脚本、工作流),按相关度和创建时间排列。 |
| data[].kind | "action" / "script" / "workflow" | 必填 / 必有;目标类型。action 为动作;script 为脚本;workflow 为工作流。 |
| data[].namespace | string | 必填 / 必有;目标命名空间。 |
| data[].name | string | 必填 / 必有;目标名字。 |
| data[].description | string | 必填 / 必有;目标的说明文字。 |
| data[].latest_version | null / string | 必填 / 必有;latest 标签指向的版本号;动作或尚未发布时为 null。 |
| data[].archived | boolean | 必填 / 必有;true 表示目标已归档,不能再被运行。 |
| next_cursor | string / null | 必填 / 必有;下一页游标,原样传给 cursor 参数并保持原查询条件;没有更多页为 null。接口不返回总数。 |
HTTP 200
{
"data": [
{
"kind": "action",
"namespace": "docs-samples",
"name": "sample-action-1791867412840-b05e8a",
"description": "",
"latest_version": null,
"archived": false
}
],
"next_cursor": "WyJbXCJ0YXJnZXRzXCIsXCJ0bnRfM2E5NzU5ODY0Y2NiNGUwMFwiLHtcInFcIjpcInNhbXBsZS1cIn1dIiwiZG9jcy1zYW1wbGVzL3NhbXBsZS1hY3Rpb24tMTc5MTg2NzQxMjg0MC1iMDVlOGEiLCJmdW5jdGlvbjphY3RfMDBtdjY3bG96NGZlNGYyN2JkZjg5MzQ2Yzg4NWIzYTI4YjIwMzhjMDkxIl0="
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
target 与 source 二选一;source 还须提供 language,输入与源码先校验再创建运行。wait 为 0–60 秒(默认 0),返回时已到终态为 200,否则 202;Idempotency-Key 在租户、方法、路径内保留 24 小时,请求指纹不含 wait。重放返回当前运行并带 Idempotent-Replayed: true,同键不同内容返回 422,处理中返回 409。新建非确定性运行 ID 为 run_ + 10 位 base36 毫秒时间前缀 + 64 位十六进制 DO ID,共 78 字符;旧随机 ID 为 46 字符,历史与确定性 ID 仍有效。同毫秒内不保证顺序。
POST /automation/v1/runs
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| header: Idempotency-Key | string | 可选;1–256 字符;租户、方法、路径内去重 24 小时,请求指纹不含 wait。 |
| 字段 | 类型 | 说明 |
|---|---|---|
| (分支1).target | string | 必填 / 必有;脚本或工作流引用 ns/name@tag、ns/name@version 或 ns/name@range,省略 @ 时使用 latest;与 source 互斥。 |
| (分支1).input | null / string / number / boolean / object / null / string / number / boolean / object / JSON[][] | 可选;传给运行的 JSON 输入,缺省为 {};必须符合目标输入契约,最多 1 MiB。 |
| (分支1).input(分支5).*(分支5) | object | 递归 JSON 值。 |
| (分支1).input(分支5).*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| (分支1).input(分支6)[](分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| (分支1).input(分支6)[](分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| (分支1).wait | number | 可选;等待终态的秒数,0–60,默认 0;不计入幂等请求指纹。 minimum: 0;maximum: 60 |
| (分支1).labels | object | 可选;最多 50 个标签;键为 1–40 个字符,值最多 500 个字符。 |
| (分支1).deadline_seconds | integer | 可选;正整数秒,最多 604800;脚本默认且最多 300 秒,工作流默认 86400 秒、最多 7 天。 minimum: 1 |
| (分支2).source | string | 必填 / 必有;源码;创建临时运行时与 target 互斥,且必须同时提供 language,最多 1 MiB。 |
| (分支2).language | "ts" / "yaml" | 必填 / 必有;源码语言:ts 表示脚本,yaml 表示工作流。 |
| (分支2).input | null / string / number / boolean / object / null / string / number / boolean / object / JSON[][] | 可选;传给运行的 JSON 输入,缺省为 {};必须符合目标输入契约,最多 1 MiB。 |
| (分支2).input(分支5).*(分支5) | object | 递归 JSON 值。 |
| (分支2).input(分支5).*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| (分支2).input(分支6)[](分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| (分支2).input(分支6)[](分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| (分支2).wait | number | 可选;等待终态的秒数,0–60,默认 0;不计入幂等请求指纹。 minimum: 0;maximum: 60 |
| (分支2).labels | object | 可选;最多 50 个标签;键为 1–40 个字符,值最多 500 个字符。 |
| (分支2).deadline_seconds | integer | 可选;正整数秒,最多 604800;脚本默认且最多 300 秒,工作流默认 86400 秒、最多 7 天。 minimum: 1 |
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/runs" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"source": "export default async (input: { n: number }) => ({ answer: input.n + 1 });",
"language": "ts",
"input": {
"n": 41
},
"wait": 60,
"labels": {
"namespace": "docs-samples",
"name": "sample-run"
}
}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.runs.create({
"body": {
"source": "export default async (input: { n: number }) => ({ answer: input.n + 1 });",
"language": "ts",
"input": {
"n": 41
},
"wait": 60,
"labels": {
"namespace": "docs-samples",
"name": "sample-run"
}
}
});
console.log(result);Success
| 响应头 | 类型 | 说明 |
|---|---|---|
| Idempotent-Replayed | boolean | true when returning a replayed run. |
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;不透明运行 ID。新建非确定性 ID 为 run_ + 10 位 base36 毫秒时间前缀 + 64 位 hex DO ID,共 78 字符;旧随机 ID 为 46 字符,历史及确定性 ID 仍有效。同毫秒内不保证创建顺序。 |
| kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| number | null / number | 必填 / 必有;运行在其脚本或工作流内的递增序号;临时运行为 null。 |
| definition | null / object | 必填 / 必有;运行所属的脚本或工作流 {namespace, name};临时运行(直接传 source)为 null。 |
| definition(分支2).namespace | string | 必填 / 必有;脚本或工作流的命名空间。 |
| definition(分支2).name | string | 必填 / 必有;脚本或工作流的名字。 |
| target | null / string | 必填 / 必有;创建时 target 参数的原文(如 acme/report@latest);临时运行为 null。 |
| resolved_version | null / string | 必填 / 必有;target 解析到的精确版本号;临时运行为 null。 |
| source_digest | null / string | 必填 / 必有;临时运行的源码摘要,可用于读取源码;由已发布定义启动的运行为 null。 |
| language | "ts" / "yaml" | 必填 / 必有;源码语言。ts 表示 TypeScript 脚本;yaml 表示工作流 YAML。 |
| status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;运行状态。pending 已创建尚未开始;running 执行中;waiting 工作流在等待事件、定时器或子运行;suspended 工作流被暂停;cancelled 已取消;faulted 失败,error 给出原因;completed 成功完成,output 为结果。后三种是终态。 |
| progress | null / object | 必填 / 必有;运行报告的最新进度 {label, current, total, updated_at};未报告为 null。 |
| progress(分支2).label | string | 必填 / 必有;进度说明文字,例如当前阶段。 |
| progress(分支2).current | null / number | 必填 / 必有;已完成的数量;未报告为 null。 |
| progress(分支2).total | null / number | 必填 / 必有;总量;未知为 null。 |
| progress(分支2).updated_at | string | 必填 / 必有;进度最近一次更新的时间(RFC 3339 UTC)。 |
| current_wait | null / object | 必填 / 必有;运行当前未完成的等待点;不在等待为 null。 |
| current_wait(分支2).id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| current_wait(分支2).run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| current_wait(分支2).kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| current_wait(分支2).state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| current_wait(分支2).task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| current_wait(分支2).task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| current_wait(分支2).task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| current_wait(分支2).resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| current_wait(分支2).event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| current_wait(分支2).child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| current_wait(分支2).created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| current_wait(分支2).expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| current_wait(分支2).resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| counters | object | 必填 / 必有;运行的累计计数。 不接受额外字段。 |
| counters.calls | number | 必填 / 必有;脚本发出的调用总数。 |
| counters.action_calls | number | 必填 / 必有;其中调用动作的次数。 |
| counters.child_runs | number | 必填 / 必有;启动的子运行数。 |
| counters.tasks_completed | number | 必填 / 必有;工作流已完成的步骤数。 |
| counters.tasks_total | null / number | 必填 / 必有;工作流顶层步骤总数;脚本运行为 null。 |
| input | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| input(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| input(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| output(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| error | null / object | 必填 / 必有;运行失败(faulted)时的错误详情;未失败为 null。 |
| error(分支2).type | string | 必填 / 必有;平台错误类别,或工作流 raise 定义的完整 URI,原样保留。 |
| error(分支2).code | null / string | 必填 / 必有;稳定错误码,可按码分支处理;没有为 null。 |
| error(分支2).title | string | 必填 / 必有;错误的简短标题。 |
| error(分支2).detail | null / string | 必填 / 必有;错误的详细说明;没有为 null。 |
| error(分支2).source | null / object | 必填 / 必有;错误发生的位置:工作流步骤或脚本调用;未知为 null。 |
| error(分支2).source(分支2).kind | "call" / "task" | 必填 / 必有;位置类型。task 表示工作流步骤;call 表示脚本中的调用。 |
| error(分支2).source(分支2).reference | string | 可选;task 类型时:出错步骤的 JSON Pointer。 |
| error(分支2).source(分支2).seq | number | 可选;call 类型时:出错调用的序号(与 Call.seq 对应)。 |
| error(分支2).source(分支2).action | object | 可选;出错的动作 {name, revision};错误来自动作时才有。 不接受额外字段。 |
| error(分支2).source(分支2).action.name | string | 必填 / 必有;动作全名 ns/name。 |
| error(分支2).source(分支2).action.revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| error(分支2).request_id | string / null | 可选;导致失败的下游响应 X-Request-Id;没有下游响应标识时为 null 或省略。 |
| error(分支2).errors | object[] | 可选;逐字段校验错误;pointer 使用 RFC 6901 指向字段,detail 为中文修正说明。 |
| error(分支2).errors[].pointer | string | 必填 / 必有;RFC 6901 字段指针。TypeScript 源码诊断为 /source(脚本)或 /implementation/source(动作);行列另见 line/column,不拼在指针后。 |
| error(分支2).errors[].detail | string | 必填 / 必有;中文修正说明,指出该位置出了什么问题以及怎样改。 |
| error(分支2).errors[].hint | string | 可选;可选的补充提示,给出下一步可执行的动作(例如改用另一个接口)。 |
| error(分支2).errors[].line | integer | 可选;行号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| error(分支2).errors[].column | integer | 可选;列号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| error(分支2).status | number | 可选;工作流 raise 声明的 HTTP 风格状态;可省略,平台错误可能不提供。 |
| initiator | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| initiator.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| initiator.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| channel | "run" / "console" / "api" / "internal" / "trigger" | 必填 / 必有;请求进入平台的渠道。console 为控制台(经 BFF);api 为公开 API 调用;internal 为平台内部服务调用;run 为由另一个运行创建的子运行;trigger 为触发器启动。 |
| owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| parent | null / object | 必填 / 必有;派生本运行的父运行 {id, number, definition};根运行为 null。 |
| parent(分支2).id | string | 必填 / 必有;父运行 ID(run_ 前缀)。 |
| parent(分支2).number | null / number | 必填 / 必有;父运行在其定义内的序号;父运行是临时运行时为 null。 |
| parent(分支2).definition | null / object | 必填 / 必有;父运行所属的脚本或工作流 {namespace, name};临时运行为 null。 |
| parent(分支2).definition(分支2).namespace | string | 必填 / 必有;父运行所属定义的命名空间。 |
| parent(分支2).definition(分支2).name | string | 必填 / 必有;父运行所属定义的名字。 |
| parent_run_id | string / null | 必填 / 必有;派生出本运行的父运行 id;根运行为 null |
| root_run_id | string | 必填 / 必有;运行树根运行的 ID;根运行自身指向自己。 |
| depth | number | 必填 / 必有;运行树中的深度:根运行为 0,每一层子运行加 1,最大 10。 |
| attach | null / "wait" / "detach" | 必填 / 必有;子运行与父运行的关系。wait 表示父运行等待子运行结束,且子运行的截止时间不晚于父运行;detach 表示父运行不等待,也不会因父运行取消而被取消;根运行为 null。 |
| deadline_at | string | 必填 / 必有;运行的截止时间(RFC 3339 UTC):创建时间加 deadline_seconds(脚本默认且最多 300 秒,工作流默认 86400 秒、最多 604800 秒),等待型子运行不晚于父运行截止前 1 秒。 |
| created_at | string | 必填 / 必有;运行创建时间(RFC 3339 UTC)。 |
| started_at | null / string | 必填 / 必有;开始执行的时间(RFC 3339 UTC);仍在排队为 null。 |
| ended_at | null / string | 必填 / 必有;进入终态的时间(RFC 3339 UTC);尚未结束为 null。 |
| updated_at | string | 必填 / 必有;运行记录最近一次更新的时间(RFC 3339 UTC)。 |
| heartbeat_at | null / string | 必填 / 必有;执行器最近一次存活信号的时间(RFC 3339 UTC);尚未开始为 null。 |
| cancel_requested_at | null / string | 必填 / 必有;收到取消请求的时间(RFC 3339 UTC);未取消为 null。 |
| cancelled_by | null / object | 必填 / 必有;请求取消的主体;未取消或非人为取消为 null。 |
| cancelled_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| cancelled_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| cancel_reason | null / "user" / "parent_cancelled" / "deadline" / "executor_lost" | 必填 / 必有;取消原因。user 为用户取消;parent_cancelled 为父运行被取消而级联取消;deadline 为超过截止时间;executor_lost 为执行器丢失;未取消为 null。 |
| suspend_requested_at | null / string | 必填 / 必有;请求暂停工作流的时间(RFC 3339 UTC);未暂停为 null。 |
| suspended_by | null / object | 必填 / 必有;请求暂停的主体;未暂停为 null。 |
| suspended_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| suspended_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| queued_ms | null / number | 必填 / 必有;从创建到开始执行的排队毫秒数;尚未开始为 null。 |
| run_ms | null / number | 必填 / 必有;实际执行毫秒数,不含等待点上的等待时间;结束后固定。 |
| wait_ms | null / number | 必填 / 必有;在等待点上累计等待的毫秒数;尚无等待为 null。 |
| usage | object / null | 必填 / 必有;仅单个运行详情(含 expand)返回;列表为 null。运行本身不收费;这里是运行中调用模型、搜索等能力产生的实扣,按调用归因;未评级的用量稍后计入。汇总超时(1.5 秒)或失败时为 null,详情仍返回 200。 |
| usage(分支1).currency | "USD" | 必填 / 必有;金额币种,固定为 USD。 |
| usage(分支1).cost | string | 必填 / 必有;仅本运行自身的已评级实扣(不含子运行),美元十进制字符串,精确到 6 位小数;没有用量时为 0.000000。 pattern: "^[0-9]+\.[0-9]{6}$" |
| usage(分支1).pending_events | integer | 必填 / 必有;本运行自身尚未评级的用量事件数,金额稍后才计入。 minimum: 0 |
| usage(分支1).by_service | object[] | 必填 / 必有;本运行按服务拆分的实扣,每项为 service 与 cost(6 位小数美元字符串);没有用量时为空数组。 |
| usage(分支1).by_service[].service | string | 必填 / 必有;产生用量的服务名,例如 router 或 search。 |
| usage(分支1).by_service[].cost | string | 必填 / 必有;该服务已评级实扣的美元十进制字符串,精确到 6 位小数。 pattern: "^[0-9]+\.[0-9]{6}$" |
| usage(分支1).tree_cost | string / null | 必填 / 必有;仅根运行返回整棵运行树的已评级实扣(含自身),6 位小数美元字符串;子运行为 null。 |
| rerun_of | null / string | 必填 / 必有;重跑来源:本运行是对哪个运行(run_ ID)的重跑;否则为 null。 |
| labels | object | 必填 / 必有;用户标签与系统标签;触发器运行支持 64 个用户标签,系统标签不占用名额。 |
| trigger | object / null | 必填 / 必有;启动本运行的触发器 {id, name};不是触发器启动时为 null。 |
| trigger(分支1).id | string | 必填 / 必有;启动本运行的触发器 ID(trg_ 前缀)。 |
| trigger(分支1).name | string | 必填 / 必有;启动本运行的触发器名称。 |
| cancel_message | string / null | 必填 / 必有;用户提供的取消备注(1–500 字符);未提供时为 null,cancel_reason 枚举不变。 |
| input_truncated | boolean | 可选;列表省略外置 input 时为 true,此时 input 为 null;内联值不变,运行详情返回完整值。 |
| output_truncated | boolean | 可选;列表省略外置 output 时为 true,此时 output 为 null;内联值不变,运行详情返回完整值。 |
Run accepted; still pending or executing when wait expires.
| 响应头 | 类型 | 说明 |
|---|---|---|
| Idempotent-Replayed | boolean | true when returning a replayed run. |
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;不透明运行 ID。新建非确定性 ID 为 run_ + 10 位 base36 毫秒时间前缀 + 64 位 hex DO ID,共 78 字符;旧随机 ID 为 46 字符,历史及确定性 ID 仍有效。同毫秒内不保证创建顺序。 |
| kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| number | null / number | 必填 / 必有;运行在其脚本或工作流内的递增序号;临时运行为 null。 |
| definition | null / object | 必填 / 必有;运行所属的脚本或工作流 {namespace, name};临时运行(直接传 source)为 null。 |
| definition(分支2).namespace | string | 必填 / 必有;脚本或工作流的命名空间。 |
| definition(分支2).name | string | 必填 / 必有;脚本或工作流的名字。 |
| target | null / string | 必填 / 必有;创建时 target 参数的原文(如 acme/report@latest);临时运行为 null。 |
| resolved_version | null / string | 必填 / 必有;target 解析到的精确版本号;临时运行为 null。 |
| source_digest | null / string | 必填 / 必有;临时运行的源码摘要,可用于读取源码;由已发布定义启动的运行为 null。 |
| language | "ts" / "yaml" | 必填 / 必有;源码语言。ts 表示 TypeScript 脚本;yaml 表示工作流 YAML。 |
| status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;运行状态。pending 已创建尚未开始;running 执行中;waiting 工作流在等待事件、定时器或子运行;suspended 工作流被暂停;cancelled 已取消;faulted 失败,error 给出原因;completed 成功完成,output 为结果。后三种是终态。 |
| progress | null / object | 必填 / 必有;运行报告的最新进度 {label, current, total, updated_at};未报告为 null。 |
| progress(分支2).label | string | 必填 / 必有;进度说明文字,例如当前阶段。 |
| progress(分支2).current | null / number | 必填 / 必有;已完成的数量;未报告为 null。 |
| progress(分支2).total | null / number | 必填 / 必有;总量;未知为 null。 |
| progress(分支2).updated_at | string | 必填 / 必有;进度最近一次更新的时间(RFC 3339 UTC)。 |
| current_wait | null / object | 必填 / 必有;运行当前未完成的等待点;不在等待为 null。 |
| current_wait(分支2).id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| current_wait(分支2).run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| current_wait(分支2).kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| current_wait(分支2).state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| current_wait(分支2).task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| current_wait(分支2).task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| current_wait(分支2).task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| current_wait(分支2).resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| current_wait(分支2).event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| current_wait(分支2).child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| current_wait(分支2).created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| current_wait(分支2).expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| current_wait(分支2).resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| counters | object | 必填 / 必有;运行的累计计数。 不接受额外字段。 |
| counters.calls | number | 必填 / 必有;脚本发出的调用总数。 |
| counters.action_calls | number | 必填 / 必有;其中调用动作的次数。 |
| counters.child_runs | number | 必填 / 必有;启动的子运行数。 |
| counters.tasks_completed | number | 必填 / 必有;工作流已完成的步骤数。 |
| counters.tasks_total | null / number | 必填 / 必有;工作流顶层步骤总数;脚本运行为 null。 |
| input | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| input(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| input(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| output(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| error | null / object | 必填 / 必有;运行失败(faulted)时的错误详情;未失败为 null。 |
| error(分支2).type | string | 必填 / 必有;平台错误类别,或工作流 raise 定义的完整 URI,原样保留。 |
| error(分支2).code | null / string | 必填 / 必有;稳定错误码,可按码分支处理;没有为 null。 |
| error(分支2).title | string | 必填 / 必有;错误的简短标题。 |
| error(分支2).detail | null / string | 必填 / 必有;错误的详细说明;没有为 null。 |
| error(分支2).source | null / object | 必填 / 必有;错误发生的位置:工作流步骤或脚本调用;未知为 null。 |
| error(分支2).source(分支2).kind | "call" / "task" | 必填 / 必有;位置类型。task 表示工作流步骤;call 表示脚本中的调用。 |
| error(分支2).source(分支2).reference | string | 可选;task 类型时:出错步骤的 JSON Pointer。 |
| error(分支2).source(分支2).seq | number | 可选;call 类型时:出错调用的序号(与 Call.seq 对应)。 |
| error(分支2).source(分支2).action | object | 可选;出错的动作 {name, revision};错误来自动作时才有。 不接受额外字段。 |
| error(分支2).source(分支2).action.name | string | 必填 / 必有;动作全名 ns/name。 |
| error(分支2).source(分支2).action.revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| error(分支2).request_id | string / null | 可选;导致失败的下游响应 X-Request-Id;没有下游响应标识时为 null 或省略。 |
| error(分支2).errors | object[] | 可选;逐字段校验错误;pointer 使用 RFC 6901 指向字段,detail 为中文修正说明。 |
| error(分支2).errors[].pointer | string | 必填 / 必有;RFC 6901 字段指针。TypeScript 源码诊断为 /source(脚本)或 /implementation/source(动作);行列另见 line/column,不拼在指针后。 |
| error(分支2).errors[].detail | string | 必填 / 必有;中文修正说明,指出该位置出了什么问题以及怎样改。 |
| error(分支2).errors[].hint | string | 可选;可选的补充提示,给出下一步可执行的动作(例如改用另一个接口)。 |
| error(分支2).errors[].line | integer | 可选;行号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| error(分支2).errors[].column | integer | 可选;列号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| error(分支2).status | number | 可选;工作流 raise 声明的 HTTP 风格状态;可省略,平台错误可能不提供。 |
| initiator | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| initiator.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| initiator.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| channel | "run" / "console" / "api" / "internal" / "trigger" | 必填 / 必有;请求进入平台的渠道。console 为控制台(经 BFF);api 为公开 API 调用;internal 为平台内部服务调用;run 为由另一个运行创建的子运行;trigger 为触发器启动。 |
| owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| parent | null / object | 必填 / 必有;派生本运行的父运行 {id, number, definition};根运行为 null。 |
| parent(分支2).id | string | 必填 / 必有;父运行 ID(run_ 前缀)。 |
| parent(分支2).number | null / number | 必填 / 必有;父运行在其定义内的序号;父运行是临时运行时为 null。 |
| parent(分支2).definition | null / object | 必填 / 必有;父运行所属的脚本或工作流 {namespace, name};临时运行为 null。 |
| parent(分支2).definition(分支2).namespace | string | 必填 / 必有;父运行所属定义的命名空间。 |
| parent(分支2).definition(分支2).name | string | 必填 / 必有;父运行所属定义的名字。 |
| parent_run_id | string / null | 必填 / 必有;派生出本运行的父运行 id;根运行为 null |
| root_run_id | string | 必填 / 必有;运行树根运行的 ID;根运行自身指向自己。 |
| depth | number | 必填 / 必有;运行树中的深度:根运行为 0,每一层子运行加 1,最大 10。 |
| attach | null / "wait" / "detach" | 必填 / 必有;子运行与父运行的关系。wait 表示父运行等待子运行结束,且子运行的截止时间不晚于父运行;detach 表示父运行不等待,也不会因父运行取消而被取消;根运行为 null。 |
| deadline_at | string | 必填 / 必有;运行的截止时间(RFC 3339 UTC):创建时间加 deadline_seconds(脚本默认且最多 300 秒,工作流默认 86400 秒、最多 604800 秒),等待型子运行不晚于父运行截止前 1 秒。 |
| created_at | string | 必填 / 必有;运行创建时间(RFC 3339 UTC)。 |
| started_at | null / string | 必填 / 必有;开始执行的时间(RFC 3339 UTC);仍在排队为 null。 |
| ended_at | null / string | 必填 / 必有;进入终态的时间(RFC 3339 UTC);尚未结束为 null。 |
| updated_at | string | 必填 / 必有;运行记录最近一次更新的时间(RFC 3339 UTC)。 |
| heartbeat_at | null / string | 必填 / 必有;执行器最近一次存活信号的时间(RFC 3339 UTC);尚未开始为 null。 |
| cancel_requested_at | null / string | 必填 / 必有;收到取消请求的时间(RFC 3339 UTC);未取消为 null。 |
| cancelled_by | null / object | 必填 / 必有;请求取消的主体;未取消或非人为取消为 null。 |
| cancelled_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| cancelled_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| cancel_reason | null / "user" / "parent_cancelled" / "deadline" / "executor_lost" | 必填 / 必有;取消原因。user 为用户取消;parent_cancelled 为父运行被取消而级联取消;deadline 为超过截止时间;executor_lost 为执行器丢失;未取消为 null。 |
| suspend_requested_at | null / string | 必填 / 必有;请求暂停工作流的时间(RFC 3339 UTC);未暂停为 null。 |
| suspended_by | null / object | 必填 / 必有;请求暂停的主体;未暂停为 null。 |
| suspended_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| suspended_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| queued_ms | null / number | 必填 / 必有;从创建到开始执行的排队毫秒数;尚未开始为 null。 |
| run_ms | null / number | 必填 / 必有;实际执行毫秒数,不含等待点上的等待时间;结束后固定。 |
| wait_ms | null / number | 必填 / 必有;在等待点上累计等待的毫秒数;尚无等待为 null。 |
| usage | object / null | 必填 / 必有;仅单个运行详情(含 expand)返回;列表为 null。运行本身不收费;这里是运行中调用模型、搜索等能力产生的实扣,按调用归因;未评级的用量稍后计入。汇总超时(1.5 秒)或失败时为 null,详情仍返回 200。 |
| usage(分支1).currency | "USD" | 必填 / 必有;金额币种,固定为 USD。 |
| usage(分支1).cost | string | 必填 / 必有;仅本运行自身的已评级实扣(不含子运行),美元十进制字符串,精确到 6 位小数;没有用量时为 0.000000。 pattern: "^[0-9]+\.[0-9]{6}$" |
| usage(分支1).pending_events | integer | 必填 / 必有;本运行自身尚未评级的用量事件数,金额稍后才计入。 minimum: 0 |
| usage(分支1).by_service | object[] | 必填 / 必有;本运行按服务拆分的实扣,每项为 service 与 cost(6 位小数美元字符串);没有用量时为空数组。 |
| usage(分支1).by_service[].service | string | 必填 / 必有;产生用量的服务名,例如 router 或 search。 |
| usage(分支1).by_service[].cost | string | 必填 / 必有;该服务已评级实扣的美元十进制字符串,精确到 6 位小数。 pattern: "^[0-9]+\.[0-9]{6}$" |
| usage(分支1).tree_cost | string / null | 必填 / 必有;仅根运行返回整棵运行树的已评级实扣(含自身),6 位小数美元字符串;子运行为 null。 |
| rerun_of | null / string | 必填 / 必有;重跑来源:本运行是对哪个运行(run_ ID)的重跑;否则为 null。 |
| labels | object | 必填 / 必有;用户标签与系统标签;触发器运行支持 64 个用户标签,系统标签不占用名额。 |
| trigger | object / null | 必填 / 必有;启动本运行的触发器 {id, name};不是触发器启动时为 null。 |
| trigger(分支1).id | string | 必填 / 必有;启动本运行的触发器 ID(trg_ 前缀)。 |
| trigger(分支1).name | string | 必填 / 必有;启动本运行的触发器名称。 |
| cancel_message | string / null | 必填 / 必有;用户提供的取消备注(1–500 字符);未提供时为 null,cancel_reason 枚举不变。 |
| input_truncated | boolean | 可选;列表省略外置 input 时为 true,此时 input 为 null;内联值不变,运行详情返回完整值。 |
| output_truncated | boolean | 可选;列表省略外置 output 时为 true,此时 output 为 null;内联值不变,运行详情返回完整值。 |
HTTP 200
{
"id": "run_00mv67mdlm5d5d707cd031744e8437f67f6acf02afaabd18e76bf8db9d674333de6f1fb2f1",
"kind": "script",
"number": null,
"definition": null,
"target": null,
"resolved_version": null,
"source_digest": "7ae6678882a4ef2ea96e401c105d5c6ef512917cd72a9235289d2a3bf1f1b49d",
"language": "ts",
"status": "completed",
"progress": null,
"current_wait": null,
"counters": {
"calls": 0,
"action_calls": 0,
"child_runs": 0,
"tasks_completed": 0,
"tasks_total": null
},
"input": {
"n": 41
},
"output": {
"answer": 42
},
"error": null,
"initiator": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"channel": "api",
"owner": "tnt_3a9759864ccb4e00",
"trigger": null,
"parent": null,
"parent_run_id": null,
"root_run_id": "run_00mv67mdlm5d5d707cd031744e8437f67f6acf02afaabd18e76bf8db9d674333de6f1fb2f1",
"depth": 0,
"attach": null,
"deadline_at": "2026-10-13T05:02:40.954Z",
"created_at": "2026-10-13T04:57:40.954Z",
"started_at": "2026-10-13T04:57:42.283Z",
"ended_at": "2026-10-13T04:57:42.367Z",
"updated_at": "2026-10-13T04:57:42.367Z",
"heartbeat_at": "2026-10-13T04:57:42.283Z",
"cancel_requested_at": null,
"cancelled_by": null,
"cancel_reason": null,
"cancel_message": null,
"suspend_requested_at": null,
"suspended_by": null,
"queued_ms": 1329,
"run_ms": 84,
"wait_ms": null,
"usage": null,
"rerun_of": null,
"labels": {
"namespace": "docs-samples",
"name": "sample-run-1791867412840-b05e8a"
}
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 DEFINITION_INVALID:源码未通过定义校验。 INPUT_INVALID:输入不满足目标契约或业务校验。 |
| 403 | NAMESPACE_FORBIDDEN:命名空间只读或运行令牌不允许此调用。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 VERSION_NOT_FOUND:指定版本或修订不存在。 RUN_NOT_FOUND:运行不存在或当前租户不可见。 |
| 409 | TARGET_ARCHIVED:目标已归档,不能用于本操作;动作执行错误的 detail 包含 ns/name。 IDEMPOTENCY_IN_FLIGHT:同一幂等键的请求仍在处理中。 |
| 413 | PAYLOAD_TOO_LARGE:请求内容超过本操作允许的大小。 |
| 422 | NO_MATCHING_VERSION:没有满足标签、版本或范围的已发布版本。 IDEMPOTENCY_KEY_MISMATCH:同一幂等键已用于不同请求内容。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
按创建时间倒序筛选租户内运行。支持状态多选、目标、来源、labels[k] 和创建时间下界筛选。q 以 run_ 开头时精确匹配运行 ID,否则按编排名称前缀匹配。大 input/output 在列表中为 null,对应 input_truncated/output_truncated 为 true;详情返回全文。
GET /automation/v1/runs
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| query: limit | integer | 可选;每页条数,整数 1–100,默认 50。 minimum: 1;maximum: 100 |
| query: cursor | string | 可选;上一页返回的 next_cursor,不透明字符串;保持原查询条件继续翻页。 |
| query: kind | "script" / "workflow"[] | 可选;script 或 workflow;省略返回两者。 多个值以逗号分隔,匹配任一值。 minItems: 1 |
| query: definition | string[] | 可选;精确编排名,格式 ns/name。 多个值以逗号分隔,匹配任一值。 minItems: 1 |
| query: version | string[] | 可选;规范的精确语义版本,例如 1.2.0 或 1.3.0-beta.1;不能是范围。 多个值以逗号分隔,匹配任一值。 minItems: 1 |
| query: status | "pending" / "running" / "waiting" / "suspended" / "cancelled" / "faulted" / "completed"[] | 可选;逗号分隔的状态,可选 pending、running、waiting、suspended、cancelled、faulted、completed;省略不过滤。 多个值以逗号分隔,匹配任一值。 |
| query: channel | "console" / "api" / "internal" / "run" / "trigger"[] | 可选;来源渠道:run 仅子运行;console、api、internal、trigger 为根运行。多个值以逗号分隔,匹配任一值。 minItems: 1 |
| query: initiator_type | "user" / "api_key" / "agent" / "trigger"[] | 可选;根发起方类型:user、api_key、agent 或 trigger,子运行继承根发起方。run 返回 INPUT_INVALID;按来源筛选用 channel=run 或 parent_run_id。多个值以逗号分隔,匹配任一值。 minItems: 1 |
| query: initiator | "me" | 可选;仅支持 me,匹配当前凭证的主体类型和 ID,包含由我的运行派生出的子运行;省略不限制。 |
| query: adhoc | boolean | 可选;true 仅临时运行,false 仅已发布定义的运行;省略返回两者。 |
| query: language | "ts" / "yaml"[] | 可选;源码语言:ts 或 yaml。 多个值以逗号分隔,匹配任一值。 minItems: 1 |
| query: parent_run_id | string[] | 可选;按直接父运行 ID 精确匹配;用它列出某个运行的子运行(由工作流 run 步骤或脚本 invoke() 启动),每项含 ID、目标、状态与耗时。 多个值以逗号分隔,匹配任一值。 minItems: 1 |
| query: root_run_id | string[] | 可选;按根运行 ID 精确匹配,读取同一运行树。 多个值以逗号分隔,匹配任一值。 minItems: 1 |
| query: q | string | 可选;run_ 开头时精确匹配运行 ID,否则按编排名称前缀匹配;% 与 _ 作为普通字符。 |
| query: labels | object | 可选;按标签过滤,使用 labels[k]=v;同键逗号多值取任一,不同键同时满足。 |
| query: created_at[gte] | string | 可选;创建时间下界,包含边界;使用带时区的 ISO 8601 时间。 format: "date-time" |
| query: created_at[lte] | string | 可选;创建时间上界,包含边界;使用带时区的 ISO 8601 时间。 format: "date-time" |
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/runs" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
--get \
--data-urlencode "labels[name]=sample-run-1791867412840-b05e8a" \
--data-urlencode "limit=1"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.runs.list({
"query": {
"labels": {
"name": "sample-run-1791867412840-b05e8a"
},
"limit": 1
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| data | object[] | 必填 / 必有;本页的运行摘要,按 created_at 倒序、id 倒序排列。 |
| data[].id | string | 必填 / 必有;不透明运行 ID。新建非确定性 ID 为 run_ + 10 位 base36 毫秒时间前缀 + 64 位 hex DO ID,共 78 字符;旧随机 ID 为 46 字符,历史及确定性 ID 仍有效。同毫秒内不保证创建顺序。 |
| data[].kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| data[].number | null / number | 必填 / 必有;运行在其脚本或工作流内的递增序号;临时运行为 null。 |
| data[].definition | null / object | 必填 / 必有;运行所属的脚本或工作流 {namespace, name};临时运行(直接传 source)为 null。 |
| data[].definition(分支2).namespace | string | 必填 / 必有;脚本或工作流的命名空间。 |
| data[].definition(分支2).name | string | 必填 / 必有;脚本或工作流的名字。 |
| data[].target | null / string | 必填 / 必有;创建时 target 参数的原文(如 acme/report@latest);临时运行为 null。 |
| data[].resolved_version | null / string | 必填 / 必有;target 解析到的精确版本号;临时运行为 null。 |
| data[].source_digest | null / string | 必填 / 必有;临时运行的源码摘要,可用于读取源码;由已发布定义启动的运行为 null。 |
| data[].language | "ts" / "yaml" | 必填 / 必有;源码语言。ts 表示 TypeScript 脚本;yaml 表示工作流 YAML。 |
| data[].status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;运行状态。pending 已创建尚未开始;running 执行中;waiting 工作流在等待事件、定时器或子运行;suspended 工作流被暂停;cancelled 已取消;faulted 失败,error 给出原因;completed 成功完成,output 为结果。后三种是终态。 |
| data[].progress | null / object | 必填 / 必有;运行报告的最新进度 {label, current, total, updated_at};未报告为 null。 |
| data[].progress(分支2).label | string | 必填 / 必有;进度说明文字,例如当前阶段。 |
| data[].progress(分支2).current | null / number | 必填 / 必有;已完成的数量;未报告为 null。 |
| data[].progress(分支2).total | null / number | 必填 / 必有;总量;未知为 null。 |
| data[].progress(分支2).updated_at | string | 必填 / 必有;进度最近一次更新的时间(RFC 3339 UTC)。 |
| data[].current_wait | null / object | 必填 / 必有;运行当前未完成的等待点;不在等待为 null。 |
| data[].current_wait(分支2).id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| data[].current_wait(分支2).run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| data[].current_wait(分支2).kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| data[].current_wait(分支2).state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| data[].current_wait(分支2).task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| data[].current_wait(分支2).task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| data[].current_wait(分支2).task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| data[].current_wait(分支2).resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| data[].current_wait(分支2).event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| data[].current_wait(分支2).child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| data[].current_wait(分支2).created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| data[].current_wait(分支2).expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| data[].current_wait(分支2).resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| data[].counters | object | 必填 / 必有;运行的累计计数。 不接受额外字段。 |
| data[].counters.calls | number | 必填 / 必有;脚本发出的调用总数。 |
| data[].counters.action_calls | number | 必填 / 必有;其中调用动作的次数。 |
| data[].counters.child_runs | number | 必填 / 必有;启动的子运行数。 |
| data[].counters.tasks_completed | number | 必填 / 必有;工作流已完成的步骤数。 |
| data[].counters.tasks_total | null / number | 必填 / 必有;工作流顶层步骤总数;脚本运行为 null。 |
| data[].input | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| data[].input(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[].input(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[].output | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| data[].output(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[].output(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[].error | null / object | 必填 / 必有;运行失败(faulted)时的错误详情;未失败为 null。 |
| data[].error(分支2).type | string | 必填 / 必有;平台错误类别,或工作流 raise 定义的完整 URI,原样保留。 |
| data[].error(分支2).code | null / string | 必填 / 必有;稳定错误码,可按码分支处理;没有为 null。 |
| data[].error(分支2).title | string | 必填 / 必有;错误的简短标题。 |
| data[].error(分支2).detail | null / string | 必填 / 必有;错误的详细说明;没有为 null。 |
| data[].error(分支2).source | null / object | 必填 / 必有;错误发生的位置:工作流步骤或脚本调用;未知为 null。 |
| data[].error(分支2).source(分支2).kind | "call" / "task" | 必填 / 必有;位置类型。task 表示工作流步骤;call 表示脚本中的调用。 |
| data[].error(分支2).source(分支2).reference | string | 可选;task 类型时:出错步骤的 JSON Pointer。 |
| data[].error(分支2).source(分支2).seq | number | 可选;call 类型时:出错调用的序号(与 Call.seq 对应)。 |
| data[].error(分支2).source(分支2).action | object | 可选;出错的动作 {name, revision};错误来自动作时才有。 不接受额外字段。 |
| data[].error(分支2).source(分支2).action.name | string | 必填 / 必有;动作全名 ns/name。 |
| data[].error(分支2).source(分支2).action.revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| data[].error(分支2).request_id | string / null | 可选;导致失败的下游响应 X-Request-Id;没有下游响应标识时为 null 或省略。 |
| data[].error(分支2).errors | object[] | 可选;逐字段校验错误;pointer 使用 RFC 6901 指向字段,detail 为中文修正说明。 |
| data[].error(分支2).errors[].pointer | string | 必填 / 必有;RFC 6901 字段指针。TypeScript 源码诊断为 /source(脚本)或 /implementation/source(动作);行列另见 line/column,不拼在指针后。 |
| data[].error(分支2).errors[].detail | string | 必填 / 必有;中文修正说明,指出该位置出了什么问题以及怎样改。 |
| data[].error(分支2).errors[].hint | string | 可选;可选的补充提示,给出下一步可执行的动作(例如改用另一个接口)。 |
| data[].error(分支2).errors[].line | integer | 可选;行号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| data[].error(分支2).errors[].column | integer | 可选;列号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| data[].error(分支2).status | number | 可选;工作流 raise 声明的 HTTP 风格状态;可省略,平台错误可能不提供。 |
| data[].initiator | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| data[].initiator.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| data[].initiator.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| data[].channel | "run" / "console" / "api" / "internal" / "trigger" | 必填 / 必有;请求进入平台的渠道。console 为控制台(经 BFF);api 为公开 API 调用;internal 为平台内部服务调用;run 为由另一个运行创建的子运行;trigger 为触发器启动。 |
| data[].owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| data[].parent | null / object | 必填 / 必有;派生本运行的父运行 {id, number, definition};根运行为 null。 |
| data[].parent(分支2).id | string | 必填 / 必有;父运行 ID(run_ 前缀)。 |
| data[].parent(分支2).number | null / number | 必填 / 必有;父运行在其定义内的序号;父运行是临时运行时为 null。 |
| data[].parent(分支2).definition | null / object | 必填 / 必有;父运行所属的脚本或工作流 {namespace, name};临时运行为 null。 |
| data[].parent(分支2).definition(分支2).namespace | string | 必填 / 必有;父运行所属定义的命名空间。 |
| data[].parent(分支2).definition(分支2).name | string | 必填 / 必有;父运行所属定义的名字。 |
| data[].parent_run_id | string / null | 必填 / 必有;派生出本运行的父运行 id;根运行为 null |
| data[].root_run_id | string | 必填 / 必有;运行树根运行的 ID;根运行自身指向自己。 |
| data[].depth | number | 必填 / 必有;运行树中的深度:根运行为 0,每一层子运行加 1,最大 10。 |
| data[].attach | null / "wait" / "detach" | 必填 / 必有;子运行与父运行的关系。wait 表示父运行等待子运行结束,且子运行的截止时间不晚于父运行;detach 表示父运行不等待,也不会因父运行取消而被取消;根运行为 null。 |
| data[].deadline_at | string | 必填 / 必有;运行的截止时间(RFC 3339 UTC):创建时间加 deadline_seconds(脚本默认且最多 300 秒,工作流默认 86400 秒、最多 604800 秒),等待型子运行不晚于父运行截止前 1 秒。 |
| data[].created_at | string | 必填 / 必有;运行创建时间(RFC 3339 UTC)。 |
| data[].started_at | null / string | 必填 / 必有;开始执行的时间(RFC 3339 UTC);仍在排队为 null。 |
| data[].ended_at | null / string | 必填 / 必有;进入终态的时间(RFC 3339 UTC);尚未结束为 null。 |
| data[].updated_at | string | 必填 / 必有;运行记录最近一次更新的时间(RFC 3339 UTC)。 |
| data[].heartbeat_at | null / string | 必填 / 必有;执行器最近一次存活信号的时间(RFC 3339 UTC);尚未开始为 null。 |
| data[].cancel_requested_at | null / string | 必填 / 必有;收到取消请求的时间(RFC 3339 UTC);未取消为 null。 |
| data[].cancelled_by | null / object | 必填 / 必有;请求取消的主体;未取消或非人为取消为 null。 |
| data[].cancelled_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| data[].cancelled_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| data[].cancel_reason | null / "user" / "parent_cancelled" / "deadline" / "executor_lost" | 必填 / 必有;取消原因。user 为用户取消;parent_cancelled 为父运行被取消而级联取消;deadline 为超过截止时间;executor_lost 为执行器丢失;未取消为 null。 |
| data[].suspend_requested_at | null / string | 必填 / 必有;请求暂停工作流的时间(RFC 3339 UTC);未暂停为 null。 |
| data[].suspended_by | null / object | 必填 / 必有;请求暂停的主体;未暂停为 null。 |
| data[].suspended_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| data[].suspended_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| data[].queued_ms | null / number | 必填 / 必有;从创建到开始执行的排队毫秒数;尚未开始为 null。 |
| data[].run_ms | null / number | 必填 / 必有;实际执行毫秒数,不含等待点上的等待时间;结束后固定。 |
| data[].wait_ms | null / number | 必填 / 必有;在等待点上累计等待的毫秒数;尚无等待为 null。 |
| data[].usage | object / null | 必填 / 必有;仅单个运行详情(含 expand)返回;列表为 null。运行本身不收费;这里是运行中调用模型、搜索等能力产生的实扣,按调用归因;未评级的用量稍后计入。汇总超时(1.5 秒)或失败时为 null,详情仍返回 200。 |
| data[].usage(分支1).currency | "USD" | 必填 / 必有;金额币种,固定为 USD。 |
| data[].usage(分支1).cost | string | 必填 / 必有;仅本运行自身的已评级实扣(不含子运行),美元十进制字符串,精确到 6 位小数;没有用量时为 0.000000。 pattern: "^[0-9]+\.[0-9]{6}$" |
| data[].usage(分支1).pending_events | integer | 必填 / 必有;本运行自身尚未评级的用量事件数,金额稍后才计入。 minimum: 0 |
| data[].usage(分支1).by_service | object[] | 必填 / 必有;本运行按服务拆分的实扣,每项为 service 与 cost(6 位小数美元字符串);没有用量时为空数组。 |
| data[].usage(分支1).by_service[].service | string | 必填 / 必有;产生用量的服务名,例如 router 或 search。 |
| data[].usage(分支1).by_service[].cost | string | 必填 / 必有;该服务已评级实扣的美元十进制字符串,精确到 6 位小数。 pattern: "^[0-9]+\.[0-9]{6}$" |
| data[].usage(分支1).tree_cost | string / null | 必填 / 必有;仅根运行返回整棵运行树的已评级实扣(含自身),6 位小数美元字符串;子运行为 null。 |
| data[].rerun_of | null / string | 必填 / 必有;重跑来源:本运行是对哪个运行(run_ ID)的重跑;否则为 null。 |
| data[].labels | object | 必填 / 必有;用户标签与系统标签;触发器运行支持 64 个用户标签,系统标签不占用名额。 |
| data[].trigger | object / null | 必填 / 必有;启动本运行的触发器 {id, name};不是触发器启动时为 null。 |
| data[].trigger(分支1).id | string | 必填 / 必有;启动本运行的触发器 ID(trg_ 前缀)。 |
| data[].trigger(分支1).name | string | 必填 / 必有;启动本运行的触发器名称。 |
| data[].cancel_message | string / null | 必填 / 必有;用户提供的取消备注(1–500 字符);未提供时为 null,cancel_reason 枚举不变。 |
| data[].input_truncated | boolean | 可选;列表省略外置 input 时为 true,此时 input 为 null;内联值不变,运行详情返回完整值。 |
| data[].output_truncated | boolean | 可选;列表省略外置 output 时为 true,此时 output 为 null;内联值不变,运行详情返回完整值。 |
| next_cursor | null / string | 必填 / 必有;下一页游标,原样传给 cursor 参数并保持原查询条件;没有更多页为 null。接口不返回总数。 |
HTTP 200
{
"data": [
{
"id": "run_00mv67mdlm5d5d707cd031744e8437f67f6acf02afaabd18e76bf8db9d674333de6f1fb2f1",
"kind": "script",
"number": null,
"definition": null,
"target": null,
"resolved_version": null,
"source_digest": "7ae6678882a4ef2ea96e401c105d5c6ef512917cd72a9235289d2a3bf1f1b49d",
"language": "ts",
"status": "completed",
"progress": null,
"current_wait": null,
"counters": {
"calls": 0,
"action_calls": 0,
"child_runs": 0,
"tasks_completed": 0,
"tasks_total": null
},
"input": {
"n": 41
},
"output": {
"answer": 42
},
"error": null,
"initiator": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"channel": "api",
"owner": "tnt_3a9759864ccb4e00",
"trigger": null,
"parent": null,
"parent_run_id": null,
"root_run_id": "run_00mv67mdlm5d5d707cd031744e8437f67f6acf02afaabd18e76bf8db9d674333de6f1fb2f1",
"depth": 0,
"attach": null,
"deadline_at": "2026-10-13T05:02:40.954Z",
"created_at": "2026-10-13T04:57:40.954Z",
"started_at": "2026-10-13T04:57:42.283Z",
"ended_at": "2026-10-13T04:57:42.367Z",
"updated_at": "2026-10-13T04:57:42.367Z",
"heartbeat_at": "2026-10-13T04:57:42.283Z",
"cancel_requested_at": null,
"cancelled_by": null,
"cancel_reason": null,
"cancel_message": null,
"suspend_requested_at": null,
"suspended_by": null,
"queued_ms": 1329,
"run_ms": 84,
"wait_ms": null,
"usage": null,
"rerun_of": null,
"labels": {
"namespace": "docs-samples",
"name": "sample-run-1791867412840-b05e8a"
}
}
],
"next_cursor": null
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 INPUT_INVALID:输入不满足目标契约或业务校验。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
读取运行详情,可用 expand 一次带回调用、步骤、步骤聚合、日志或源码;传 wait(秒,0–60)可挂起请求直到运行到达终态或超时,不必轮询;展开页最多 200 条,后续通过各账本端点的游标读取。 工作流 raise 错误保留完整 type URI、status、title、detail;只有平台内部异常归为 runtime。
GET /automation/v1/runs/{id}
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: id | string | 必填;运行 ID(run_)。 |
| query: expand | "calls" / "tasks" / "task_groups" / "logs" / "source"[] | 可选;逗号分隔且不能重复:calls、tasks、task_groups、logs、source,这是全部合法取值(output 不是展开项,运行输出在 output 字段里);省略不展开,展开页最多 200 条。无效取值返回 INVALID_PARAMS 并列出合法取值。 minItems: 1 |
| query: wait | integer | 可选;等待运行到达终态的秒数,0–60 的整数,默认 0(立即返回)。超时后运行仍未结束则返回当前运行(状态码仍为 200),请检查 status;超过 60 或不是整数返回 INVALID_PARAMS。含义与 runs.create 的 wait 相同。 minimum: 0;maximum: 60 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| RUN_ID | 运行 id;暂停和恢复仅工作流;取消需非终态运行 |
: "${RUN_ID:?Set RUN_ID}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/runs/${RUN_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.runs.retrieve({
"path": {
"id": env("RUN_ID")
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;不透明运行 ID。新建非确定性 ID 为 run_ + 10 位 base36 毫秒时间前缀 + 64 位 hex DO ID,共 78 字符;旧随机 ID 为 46 字符,历史及确定性 ID 仍有效。同毫秒内不保证创建顺序。 |
| kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| number | null / number | 必填 / 必有;运行在其脚本或工作流内的递增序号;临时运行为 null。 |
| definition | null / object | 必填 / 必有;运行所属的脚本或工作流 {namespace, name};临时运行(直接传 source)为 null。 |
| definition(分支2).namespace | string | 必填 / 必有;脚本或工作流的命名空间。 |
| definition(分支2).name | string | 必填 / 必有;脚本或工作流的名字。 |
| target | null / string | 必填 / 必有;创建时 target 参数的原文(如 acme/report@latest);临时运行为 null。 |
| resolved_version | null / string | 必填 / 必有;target 解析到的精确版本号;临时运行为 null。 |
| source_digest | null / string | 必填 / 必有;临时运行的源码摘要,可用于读取源码;由已发布定义启动的运行为 null。 |
| language | "ts" / "yaml" | 必填 / 必有;源码语言。ts 表示 TypeScript 脚本;yaml 表示工作流 YAML。 |
| status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;运行状态。pending 已创建尚未开始;running 执行中;waiting 工作流在等待事件、定时器或子运行;suspended 工作流被暂停;cancelled 已取消;faulted 失败,error 给出原因;completed 成功完成,output 为结果。后三种是终态。 |
| progress | null / object | 必填 / 必有;运行报告的最新进度 {label, current, total, updated_at};未报告为 null。 |
| progress(分支2).label | string | 必填 / 必有;进度说明文字,例如当前阶段。 |
| progress(分支2).current | null / number | 必填 / 必有;已完成的数量;未报告为 null。 |
| progress(分支2).total | null / number | 必填 / 必有;总量;未知为 null。 |
| progress(分支2).updated_at | string | 必填 / 必有;进度最近一次更新的时间(RFC 3339 UTC)。 |
| current_wait | null / object | 必填 / 必有;运行当前未完成的等待点;不在等待为 null。 |
| current_wait(分支2).id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| current_wait(分支2).run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| current_wait(分支2).kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| current_wait(分支2).state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| current_wait(分支2).task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| current_wait(分支2).task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| current_wait(分支2).task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| current_wait(分支2).resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| current_wait(分支2).event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| current_wait(分支2).child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| current_wait(分支2).created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| current_wait(分支2).expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| current_wait(分支2).resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| counters | object | 必填 / 必有;运行的累计计数。 不接受额外字段。 |
| counters.calls | number | 必填 / 必有;脚本发出的调用总数。 |
| counters.action_calls | number | 必填 / 必有;其中调用动作的次数。 |
| counters.child_runs | number | 必填 / 必有;启动的子运行数。 |
| counters.tasks_completed | number | 必填 / 必有;工作流已完成的步骤数。 |
| counters.tasks_total | null / number | 必填 / 必有;工作流顶层步骤总数;脚本运行为 null。 |
| input | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| input(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| input(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| output(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| error | null / object | 必填 / 必有;运行失败(faulted)时的错误详情;未失败为 null。 |
| error(分支2).type | string | 必填 / 必有;平台错误类别,或工作流 raise 定义的完整 URI,原样保留。 |
| error(分支2).code | null / string | 必填 / 必有;稳定错误码,可按码分支处理;没有为 null。 |
| error(分支2).title | string | 必填 / 必有;错误的简短标题。 |
| error(分支2).detail | null / string | 必填 / 必有;错误的详细说明;没有为 null。 |
| error(分支2).source | null / object | 必填 / 必有;错误发生的位置:工作流步骤或脚本调用;未知为 null。 |
| error(分支2).source(分支2).kind | "call" / "task" | 必填 / 必有;位置类型。task 表示工作流步骤;call 表示脚本中的调用。 |
| error(分支2).source(分支2).reference | string | 可选;task 类型时:出错步骤的 JSON Pointer。 |
| error(分支2).source(分支2).seq | number | 可选;call 类型时:出错调用的序号(与 Call.seq 对应)。 |
| error(分支2).source(分支2).action | object | 可选;出错的动作 {name, revision};错误来自动作时才有。 不接受额外字段。 |
| error(分支2).source(分支2).action.name | string | 必填 / 必有;动作全名 ns/name。 |
| error(分支2).source(分支2).action.revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| error(分支2).request_id | string / null | 可选;导致失败的下游响应 X-Request-Id;没有下游响应标识时为 null 或省略。 |
| error(分支2).errors | object[] | 可选;逐字段校验错误;pointer 使用 RFC 6901 指向字段,detail 为中文修正说明。 |
| error(分支2).errors[].pointer | string | 必填 / 必有;RFC 6901 字段指针。TypeScript 源码诊断为 /source(脚本)或 /implementation/source(动作);行列另见 line/column,不拼在指针后。 |
| error(分支2).errors[].detail | string | 必填 / 必有;中文修正说明,指出该位置出了什么问题以及怎样改。 |
| error(分支2).errors[].hint | string | 可选;可选的补充提示,给出下一步可执行的动作(例如改用另一个接口)。 |
| error(分支2).errors[].line | integer | 可选;行号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| error(分支2).errors[].column | integer | 可选;列号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| error(分支2).status | number | 可选;工作流 raise 声明的 HTTP 风格状态;可省略,平台错误可能不提供。 |
| initiator | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| initiator.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| initiator.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| channel | "run" / "console" / "api" / "internal" / "trigger" | 必填 / 必有;请求进入平台的渠道。console 为控制台(经 BFF);api 为公开 API 调用;internal 为平台内部服务调用;run 为由另一个运行创建的子运行;trigger 为触发器启动。 |
| owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| parent | null / object | 必填 / 必有;派生本运行的父运行 {id, number, definition};根运行为 null。 |
| parent(分支2).id | string | 必填 / 必有;父运行 ID(run_ 前缀)。 |
| parent(分支2).number | null / number | 必填 / 必有;父运行在其定义内的序号;父运行是临时运行时为 null。 |
| parent(分支2).definition | null / object | 必填 / 必有;父运行所属的脚本或工作流 {namespace, name};临时运行为 null。 |
| parent(分支2).definition(分支2).namespace | string | 必填 / 必有;父运行所属定义的命名空间。 |
| parent(分支2).definition(分支2).name | string | 必填 / 必有;父运行所属定义的名字。 |
| parent_run_id | string / null | 必填 / 必有;派生出本运行的父运行 id;根运行为 null |
| root_run_id | string | 必填 / 必有;运行树根运行的 ID;根运行自身指向自己。 |
| depth | number | 必填 / 必有;运行树中的深度:根运行为 0,每一层子运行加 1,最大 10。 |
| attach | null / "wait" / "detach" | 必填 / 必有;子运行与父运行的关系。wait 表示父运行等待子运行结束,且子运行的截止时间不晚于父运行;detach 表示父运行不等待,也不会因父运行取消而被取消;根运行为 null。 |
| deadline_at | string | 必填 / 必有;运行的截止时间(RFC 3339 UTC):创建时间加 deadline_seconds(脚本默认且最多 300 秒,工作流默认 86400 秒、最多 604800 秒),等待型子运行不晚于父运行截止前 1 秒。 |
| created_at | string | 必填 / 必有;运行创建时间(RFC 3339 UTC)。 |
| started_at | null / string | 必填 / 必有;开始执行的时间(RFC 3339 UTC);仍在排队为 null。 |
| ended_at | null / string | 必填 / 必有;进入终态的时间(RFC 3339 UTC);尚未结束为 null。 |
| updated_at | string | 必填 / 必有;运行记录最近一次更新的时间(RFC 3339 UTC)。 |
| heartbeat_at | null / string | 必填 / 必有;执行器最近一次存活信号的时间(RFC 3339 UTC);尚未开始为 null。 |
| cancel_requested_at | null / string | 必填 / 必有;收到取消请求的时间(RFC 3339 UTC);未取消为 null。 |
| cancelled_by | null / object | 必填 / 必有;请求取消的主体;未取消或非人为取消为 null。 |
| cancelled_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| cancelled_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| cancel_reason | null / "user" / "parent_cancelled" / "deadline" / "executor_lost" | 必填 / 必有;取消原因。user 为用户取消;parent_cancelled 为父运行被取消而级联取消;deadline 为超过截止时间;executor_lost 为执行器丢失;未取消为 null。 |
| suspend_requested_at | null / string | 必填 / 必有;请求暂停工作流的时间(RFC 3339 UTC);未暂停为 null。 |
| suspended_by | null / object | 必填 / 必有;请求暂停的主体;未暂停为 null。 |
| suspended_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| suspended_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| queued_ms | null / number | 必填 / 必有;从创建到开始执行的排队毫秒数;尚未开始为 null。 |
| run_ms | null / number | 必填 / 必有;实际执行毫秒数,不含等待点上的等待时间;结束后固定。 |
| wait_ms | null / number | 必填 / 必有;在等待点上累计等待的毫秒数;尚无等待为 null。 |
| usage | object / null | 必填 / 必有;仅单个运行详情(含 expand)返回;列表为 null。运行本身不收费;这里是运行中调用模型、搜索等能力产生的实扣,按调用归因;未评级的用量稍后计入。汇总超时(1.5 秒)或失败时为 null,详情仍返回 200。 |
| usage(分支1).currency | "USD" | 必填 / 必有;金额币种,固定为 USD。 |
| usage(分支1).cost | string | 必填 / 必有;仅本运行自身的已评级实扣(不含子运行),美元十进制字符串,精确到 6 位小数;没有用量时为 0.000000。 pattern: "^[0-9]+\.[0-9]{6}$" |
| usage(分支1).pending_events | integer | 必填 / 必有;本运行自身尚未评级的用量事件数,金额稍后才计入。 minimum: 0 |
| usage(分支1).by_service | object[] | 必填 / 必有;本运行按服务拆分的实扣,每项为 service 与 cost(6 位小数美元字符串);没有用量时为空数组。 |
| usage(分支1).by_service[].service | string | 必填 / 必有;产生用量的服务名,例如 router 或 search。 |
| usage(分支1).by_service[].cost | string | 必填 / 必有;该服务已评级实扣的美元十进制字符串,精确到 6 位小数。 pattern: "^[0-9]+\.[0-9]{6}$" |
| usage(分支1).tree_cost | string / null | 必填 / 必有;仅根运行返回整棵运行树的已评级实扣(含自身),6 位小数美元字符串;子运行为 null。 |
| rerun_of | null / string | 必填 / 必有;重跑来源:本运行是对哪个运行(run_ ID)的重跑;否则为 null。 |
| labels | object | 必填 / 必有;用户标签与系统标签;触发器运行支持 64 个用户标签,系统标签不占用名额。 |
| trigger | object / null | 必填 / 必有;启动本运行的触发器 {id, name};不是触发器启动时为 null。 |
| trigger(分支1).id | string | 必填 / 必有;启动本运行的触发器 ID(trg_ 前缀)。 |
| trigger(分支1).name | string | 必填 / 必有;启动本运行的触发器名称。 |
| calls | object | 可选;expand=calls 时返回的调用记录分页:{data, next_cursor}。 不接受额外字段。 |
| calls.data | object[] | 必填 / 必有;本页的调用记录(Call)。 maxItems: 200 |
| calls.data[].id | string | 必填 / 必有;调用 ID,前缀 call_。 |
| calls.data[].run_id | string | 必填 / 必有;发出该调用的脚本运行 ID(run_ 前缀)。 |
| calls.data[].seq | number | 必填 / 必有;调用在该运行中的序号,随调用顺序递增;与 run_id 一起定位这次调用。 |
| calls.data[].target | object | 必填 / 必有;被调用的目标 {kind, name, revision?, version?}。 不接受额外字段。 |
| calls.data[].target.kind | "action" / "script" / "workflow" / "platform_api" | 必填 / 必有;目标类型。action 为动作;platform_api 为平台 API 操作;script 为脚本;workflow 为工作流。 |
| calls.data[].target.name | string | 必填 / 必有;目标名称:动作为 ns/name,平台 API 为操作名,脚本与工作流为 ns/name。 |
| calls.data[].target.revision | string | 可选;实际执行的动作修订 ID(actr_ 前缀);仅动作调用有。 |
| calls.data[].target.version | string | 可选;实际运行的精确版本号;仅脚本与工作流调用有。 |
| calls.data[].args_preview | string | 必填 / 必有;调用参数的单行预览,由服务端截断;超过 32 KB 的原文存放在对象存储而不内联。 |
| calls.data[].result_preview | null / string | 必填 / 必有;返回值的单行预览,由服务端截断;调用结束前为 null。 |
| calls.data[].status | "running" / "completed" / "faulted" / "cancelled" | 必填 / 必有;调用状态。running 执行中;completed 已正常返回;faulted 失败,error 给出原因;cancelled 因运行被取消而中止。 |
| calls.data[].started_at | string | 必填 / 必有;调用开始的时间(RFC 3339 UTC)。 |
| calls.data[].ended_at | null / string | 必填 / 必有;调用结束的时间(RFC 3339 UTC);仍在执行为 null。 |
| calls.data[].duration_ms | null / number | 必填 / 必有;从开始到结束的毫秒数;未结束为 null。 |
| calls.data[].error | null / object | 必填 / 必有;调用失败时的错误详情;成功或仍在执行为 null。 |
| calls.data[].error(分支2).type | string | 必填 / 必有;平台错误类别,或工作流 raise 定义的完整 URI,原样保留。 |
| calls.data[].error(分支2).code | null / string | 必填 / 必有;稳定错误码,可按码分支处理;没有为 null。 |
| calls.data[].error(分支2).title | string | 必填 / 必有;错误的简短标题。 |
| calls.data[].error(分支2).detail | null / string | 必填 / 必有;错误的详细说明;没有为 null。 |
| calls.data[].error(分支2).source | null / object | 必填 / 必有;错误发生的位置:工作流步骤或脚本调用;未知为 null。 |
| calls.data[].error(分支2).source(分支2).kind | "call" / "task" | 必填 / 必有;位置类型。task 表示工作流步骤;call 表示脚本中的调用。 |
| calls.data[].error(分支2).source(分支2).reference | string | 可选;task 类型时:出错步骤的 JSON Pointer。 |
| calls.data[].error(分支2).source(分支2).seq | number | 可选;call 类型时:出错调用的序号(与 Call.seq 对应)。 |
| calls.data[].error(分支2).source(分支2).action | object | 可选;出错的动作 {name, revision};错误来自动作时才有。 不接受额外字段。 |
| calls.data[].error(分支2).source(分支2).action.name | string | 必填 / 必有;动作全名 ns/name。 |
| calls.data[].error(分支2).source(分支2).action.revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| calls.data[].error(分支2).request_id | string / null | 可选;导致失败的下游响应 X-Request-Id;没有下游响应标识时为 null 或省略。 |
| calls.data[].error(分支2).errors | object[] | 可选;逐字段校验错误;pointer 使用 RFC 6901 指向字段,detail 为中文修正说明。 |
| calls.data[].error(分支2).errors[].pointer | string | 必填 / 必有;RFC 6901 字段指针。TypeScript 源码诊断为 /source(脚本)或 /implementation/source(动作);行列另见 line/column,不拼在指针后。 |
| calls.data[].error(分支2).errors[].detail | string | 必填 / 必有;中文修正说明,指出该位置出了什么问题以及怎样改。 |
| calls.data[].error(分支2).errors[].hint | string | 可选;可选的补充提示,给出下一步可执行的动作(例如改用另一个接口)。 |
| calls.data[].error(分支2).errors[].line | integer | 可选;行号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| calls.data[].error(分支2).errors[].column | integer | 可选;列号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| calls.data[].error(分支2).status | number | 可选;工作流 raise 声明的 HTTP 风格状态;可省略,平台错误可能不提供。 |
| calls.data[].child_run_id | null / string | 必填 / 必有;目标是脚本或工作流时,由本次调用启动的子运行 ID;动作与平台 API 调用为 null。 |
| calls.data[].invocation_key | string | 必填 / 必有;标识这一次逻辑调用的键,随调用发往下游,使至少一次语义下的重试可被去重。 |
| calls.data[].request_id | string / null | 必填 / 必有;下游响应的 X-Request-Id;尚未收到响应或响应未提供该头时为 null。 |
| calls.next_cursor | null / string | 必填 / 必有;下一页游标;没有更多为 null。 |
| tasks | object | 可选;expand=tasks 时返回的工作流步骤分页:{data, next_cursor}。 不接受额外字段。 |
| tasks.data | object[] | 必填 / 必有;本页的步骤(Task)。 maxItems: 200 |
| tasks.data[].id | string | 必填 / 必有;步骤执行记录的标识,按不透明字符串处理。 |
| tasks.data[].run_id | string | 必填 / 必有;所属运行 ID。 |
| tasks.data[].reference | string | 必填 / 必有;该步骤在工作流文档中的 JSON Pointer,例如 /do/0/start。 |
| tasks.data[].name | string | 必填 / 必有;步骤名,即工作流 YAML 中该步骤的键。 |
| tasks.data[].kind | "run" / "call" / "wait" / "set" / "for" / "fork" / "try" / "switch" / "emit" / "raise" / "listen" / "do" | 必填 / 必有;工作流步骤类型。call 调用动作;run 运行子脚本或子工作流;wait 等待时长;set 设置变量;for 循环;fork 并行分支;try 带捕获的块;switch 条件分支;emit 发出事件;raise 抛出错误;listen 等待事件;do 顺序执行的步骤块。 |
| tasks.data[].iteration | number[] | 必填 / 必有;外层 for 循环的当前迭代下标,由外到内;不在循环中为空数组。 |
| tasks.data[].attempt | number | 必填 / 必有;第几次尝试;步骤因重试而重新执行时递增。 |
| tasks.data[].status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;步骤状态,取值与运行状态相同。pending 尚未开始;running 执行中;waiting 在等待事件、定时器或子运行;suspended 因运行被暂停;cancelled 已取消;faulted 失败;completed 成功完成。 |
| tasks.data[].skipped | boolean | 必填 / 必有;true 表示该步骤被跳过而没有实际执行。 |
| tasks.data[].started_at | null / string | 必填 / 必有;步骤开始的时间(RFC 3339 UTC);未开始为 null。 |
| tasks.data[].ended_at | null / string | 必填 / 必有;步骤结束的时间(RFC 3339 UTC);未结束为 null。 |
| tasks.data[].duration_ms | null / number | 必填 / 必有;执行耗时毫秒数;未结束为 null。 |
| tasks.data[].input | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| tasks.data[].input(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| tasks.data[].input(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| tasks.data[].input_truncated | boolean | 必填 / 必有;true 表示 input 超过 32 KB 已被截断。 |
| tasks.data[].output | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| tasks.data[].output(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| tasks.data[].output(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| tasks.data[].output_truncated | boolean | 必填 / 必有;输出超过内联限制而被省略时为 true。 |
| tasks.data[].error | null / object | 必填 / 必有;步骤失败时的错误详情;未失败为 null。 |
| tasks.data[].error(分支2).type | string | 必填 / 必有;平台错误类别,或工作流 raise 定义的完整 URI,原样保留。 |
| tasks.data[].error(分支2).code | null / string | 必填 / 必有;稳定错误码,可按码分支处理;没有为 null。 |
| tasks.data[].error(分支2).title | string | 必填 / 必有;错误的简短标题。 |
| tasks.data[].error(分支2).detail | null / string | 必填 / 必有;错误的详细说明;没有为 null。 |
| tasks.data[].error(分支2).source | null / object | 必填 / 必有;错误发生的位置:工作流步骤或脚本调用;未知为 null。 |
| tasks.data[].error(分支2).source(分支2).kind | "call" / "task" | 必填 / 必有;位置类型。task 表示工作流步骤;call 表示脚本中的调用。 |
| tasks.data[].error(分支2).source(分支2).reference | string | 可选;task 类型时:出错步骤的 JSON Pointer。 |
| tasks.data[].error(分支2).source(分支2).seq | number | 可选;call 类型时:出错调用的序号(与 Call.seq 对应)。 |
| tasks.data[].error(分支2).source(分支2).action | object | 可选;出错的动作 {name, revision};错误来自动作时才有。 不接受额外字段。 |
| tasks.data[].error(分支2).source(分支2).action.name | string | 必填 / 必有;动作全名 ns/name。 |
| tasks.data[].error(分支2).source(分支2).action.revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| tasks.data[].error(分支2).request_id | string / null | 可选;导致失败的下游响应 X-Request-Id;没有下游响应标识时为 null 或省略。 |
| tasks.data[].error(分支2).errors | object[] | 可选;逐字段校验错误;pointer 使用 RFC 6901 指向字段,detail 为中文修正说明。 |
| tasks.data[].error(分支2).errors[].pointer | string | 必填 / 必有;RFC 6901 字段指针。TypeScript 源码诊断为 /source(脚本)或 /implementation/source(动作);行列另见 line/column,不拼在指针后。 |
| tasks.data[].error(分支2).errors[].detail | string | 必填 / 必有;中文修正说明,指出该位置出了什么问题以及怎样改。 |
| tasks.data[].error(分支2).errors[].hint | string | 可选;可选的补充提示,给出下一步可执行的动作(例如改用另一个接口)。 |
| tasks.data[].error(分支2).errors[].line | integer | 可选;行号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| tasks.data[].error(分支2).errors[].column | integer | 可选;列号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| tasks.data[].error(分支2).status | number | 可选;工作流 raise 声明的 HTTP 风格状态;可省略,平台错误可能不提供。 |
| tasks.data[].action | null / object | 必填 / 必有;call 步骤执行的动作 {name, revision};其它步骤为 null。 |
| tasks.data[].action(分支2).name | string | 必填 / 必有;动作全名 ns/name。 |
| tasks.data[].action(分支2).revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| tasks.data[].child_run | null / object | 必填 / 必有;run 步骤启动的子运行摘要 {id, number, status, resolved_version};其它步骤为 null。 |
| tasks.data[].child_run(分支2).id | string | 必填 / 必有;子运行 ID(run_ 前缀),创建后即可读取。 |
| tasks.data[].child_run(分支2).number | null / number | 必填 / 必有;子运行在其定义内的序号;临时运行为 null。 |
| tasks.data[].child_run(分支2).status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;子运行的状态。pending 尚未开始;running 执行中;waiting 在等待;suspended 已暂停;cancelled 已取消;faulted 失败;completed 成功完成。等待型子运行在结束时补全终态,detach 的子运行只记录启动时的状态。 |
| tasks.data[].child_run(分支2).resolved_version | null / string | 必填 / 必有;子运行解析到的精确版本号;临时运行为 null。 |
| tasks.next_cursor | null / string | 必填 / 必有;下一页游标;没有更多为 null。 |
| task_groups | object | 可选;expand=task_groups 时返回、按 reference 聚合的步骤分页 {data, next_cursor}(循环的多次迭代合并为一行);脚本运行为空页。 不接受额外字段。 |
| task_groups.data | object[] | 必填 / 必有;本页的聚合行(TaskGroup)。 maxItems: 200 |
| task_groups.data[].reference | string | 必填 / 必有;该步骤在工作流文档中的 JSON Pointer,例如 /do/0/start。 |
| task_groups.data[].name | string | 必填 / 必有;步骤名,即工作流 YAML 中该步骤的键。 |
| task_groups.data[].count | number | 必填 / 必有;该 reference 下合并的执行记录条数(循环的迭代数)。 |
| task_groups.data[].status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;步骤状态,取值与运行状态相同。pending 尚未开始;running 执行中;waiting 在等待事件、定时器或子运行;suspended 因运行被暂停;cancelled 已取消;faulted 失败;completed 成功完成。 |
| task_groups.data[].duration_ms | null / number | 必填 / 必有;执行耗时毫秒数;未结束为 null。 |
| task_groups.next_cursor | null / string | 必填 / 必有;下一页游标;没有更多为 null。 |
| logs | object | 可选;expand=logs 时返回的日志分页:{data, next_cursor}。 不接受额外字段。 |
| logs.data | object[] | 必填 / 必有;本页的日志行(LogLine)。 maxItems: 200 |
| logs.data[].cursor | string | 必填 / 必有;该行的游标;用作 cursor 翻页,或在 SSE 中作为 Last-Event-ID 续传。 |
| logs.data[].ts | string | 必填 / 必有;日志产生的时间(RFC 3339 UTC)。 |
| logs.data[].level | "debug" / "info" / "warn" / "error" | 必填 / 必有;日志级别。debug 调试信息;info 一般信息;warn 警告;error 错误。 |
| logs.data[].message | string | 必填 / 必有;日志文本。 |
| logs.next_cursor | null / string | 必填 / 必有;下一页游标;没有更多为 null。 |
| source | object | 可选;临时运行的源码快照 {language, source, sha256}。 不接受额外字段。 |
| source.language | "ts" / "yaml" | 必填 / 必有;源码语言。ts 表示 TypeScript 脚本;yaml 表示工作流 YAML。 |
| source.source | string | 必填 / 必有;运行时使用的完整源码(ts 或 yaml)。 |
| source.sha256 | string | 必填 / 必有;源码的 SHA-256 摘要,可作为发布时的 expected_source_sha256。 |
| cancel_message | string / null | 必填 / 必有;用户提供的取消备注(1–500 字符);未提供时为 null,cancel_reason 枚举不变。 |
| input_truncated | boolean | 可选;列表省略外置 input 时为 true,此时 input 为 null;内联值不变,运行详情返回完整值。 |
| output_truncated | boolean | 可选;列表省略外置 output 时为 true,此时 output 为 null;内联值不变,运行详情返回完整值。 |
HTTP 200
{
"id": "run_00mv67mdlm5d5d707cd031744e8437f67f6acf02afaabd18e76bf8db9d674333de6f1fb2f1",
"kind": "script",
"number": null,
"definition": null,
"target": null,
"resolved_version": null,
"source_digest": "7ae6678882a4ef2ea96e401c105d5c6ef512917cd72a9235289d2a3bf1f1b49d",
"language": "ts",
"status": "completed",
"progress": null,
"current_wait": null,
"counters": {
"calls": 0,
"action_calls": 0,
"child_runs": 0,
"tasks_completed": 0,
"tasks_total": null
},
"input": {
"n": 41
},
"output": {
"answer": 42
},
"error": null,
"initiator": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"channel": "api",
"owner": "tnt_3a9759864ccb4e00",
"trigger": null,
"parent": null,
"parent_run_id": null,
"root_run_id": "run_00mv67mdlm5d5d707cd031744e8437f67f6acf02afaabd18e76bf8db9d674333de6f1fb2f1",
"depth": 0,
"attach": null,
"deadline_at": "2026-10-13T05:02:40.954Z",
"created_at": "2026-10-13T04:57:40.954Z",
"started_at": "2026-10-13T04:57:42.283Z",
"ended_at": "2026-10-13T04:57:42.367Z",
"updated_at": "2026-10-13T04:57:42.367Z",
"heartbeat_at": "2026-10-13T04:57:42.283Z",
"cancel_requested_at": null,
"cancelled_by": null,
"cancel_reason": null,
"cancel_message": null,
"suspend_requested_at": null,
"suspended_by": null,
"queued_ms": 1329,
"run_ms": 84,
"wait_ms": null,
"usage": {
"currency": "USD",
"cost": "0.000000",
"pending_events": 0,
"by_service": [],
"tree_cost": "0.000000"
},
"rerun_of": null,
"labels": {
"namespace": "docs-samples",
"name": "sample-run-1791867412840-b05e8a"
}
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | RUN_NOT_FOUND:运行不存在或当前租户不可见。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
请求取消运行。返回 202:工作流直接终止,脚本先请求中止并在宽限期后强制结束;已终态运行返回 409 RUN_INVALID_STATE。取消传播到附着子运行,不影响 detach 子运行;可选 reason 为 1–500 字符,保存为 Run.cancel_message;用户取消的 cancel_reason 仍为 user。
POST /automation/v1/runs/{id}/cancel
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: id | string | 必填;运行 ID(run_)。 |
不接受额外字段。
| 字段 | 类型 | 说明 |
|---|---|---|
| reason | string | 可选;可选取消备注,1–500 字符;保存为 Run.cancel_message,cancel_reason 仍为 user。 minLength: 1;maxLength: 500 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| RUN_ID | 运行 id;暂停和恢复仅工作流;取消需非终态运行 |
: "${RUN_ID:?Set RUN_ID}"
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/runs/${RUN_ID}/cancel" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"reason": "Sample completed"
}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.runs.cancel({
"path": {
"id": env("RUN_ID")
},
"body": {
"reason": "Sample completed"
}
});
console.log(result);Cancellation accepted; updated Run.
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;不透明运行 ID。新建非确定性 ID 为 run_ + 10 位 base36 毫秒时间前缀 + 64 位 hex DO ID,共 78 字符;旧随机 ID 为 46 字符,历史及确定性 ID 仍有效。同毫秒内不保证创建顺序。 |
| kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| number | null / number | 必填 / 必有;运行在其脚本或工作流内的递增序号;临时运行为 null。 |
| definition | null / object | 必填 / 必有;运行所属的脚本或工作流 {namespace, name};临时运行(直接传 source)为 null。 |
| definition(分支2).namespace | string | 必填 / 必有;脚本或工作流的命名空间。 |
| definition(分支2).name | string | 必填 / 必有;脚本或工作流的名字。 |
| target | null / string | 必填 / 必有;创建时 target 参数的原文(如 acme/report@latest);临时运行为 null。 |
| resolved_version | null / string | 必填 / 必有;target 解析到的精确版本号;临时运行为 null。 |
| source_digest | null / string | 必填 / 必有;临时运行的源码摘要,可用于读取源码;由已发布定义启动的运行为 null。 |
| language | "ts" / "yaml" | 必填 / 必有;源码语言。ts 表示 TypeScript 脚本;yaml 表示工作流 YAML。 |
| status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;运行状态。pending 已创建尚未开始;running 执行中;waiting 工作流在等待事件、定时器或子运行;suspended 工作流被暂停;cancelled 已取消;faulted 失败,error 给出原因;completed 成功完成,output 为结果。后三种是终态。 |
| progress | null / object | 必填 / 必有;运行报告的最新进度 {label, current, total, updated_at};未报告为 null。 |
| progress(分支2).label | string | 必填 / 必有;进度说明文字,例如当前阶段。 |
| progress(分支2).current | null / number | 必填 / 必有;已完成的数量;未报告为 null。 |
| progress(分支2).total | null / number | 必填 / 必有;总量;未知为 null。 |
| progress(分支2).updated_at | string | 必填 / 必有;进度最近一次更新的时间(RFC 3339 UTC)。 |
| current_wait | null / object | 必填 / 必有;运行当前未完成的等待点;不在等待为 null。 |
| current_wait(分支2).id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| current_wait(分支2).run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| current_wait(分支2).kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| current_wait(分支2).state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| current_wait(分支2).task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| current_wait(分支2).task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| current_wait(分支2).task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| current_wait(分支2).resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| current_wait(分支2).event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| current_wait(分支2).child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| current_wait(分支2).created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| current_wait(分支2).expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| current_wait(分支2).resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| counters | object | 必填 / 必有;运行的累计计数。 不接受额外字段。 |
| counters.calls | number | 必填 / 必有;脚本发出的调用总数。 |
| counters.action_calls | number | 必填 / 必有;其中调用动作的次数。 |
| counters.child_runs | number | 必填 / 必有;启动的子运行数。 |
| counters.tasks_completed | number | 必填 / 必有;工作流已完成的步骤数。 |
| counters.tasks_total | null / number | 必填 / 必有;工作流顶层步骤总数;脚本运行为 null。 |
| input | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| input(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| input(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| output(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| error | null / object | 必填 / 必有;运行失败(faulted)时的错误详情;未失败为 null。 |
| error(分支2).type | string | 必填 / 必有;平台错误类别,或工作流 raise 定义的完整 URI,原样保留。 |
| error(分支2).code | null / string | 必填 / 必有;稳定错误码,可按码分支处理;没有为 null。 |
| error(分支2).title | string | 必填 / 必有;错误的简短标题。 |
| error(分支2).detail | null / string | 必填 / 必有;错误的详细说明;没有为 null。 |
| error(分支2).source | null / object | 必填 / 必有;错误发生的位置:工作流步骤或脚本调用;未知为 null。 |
| error(分支2).source(分支2).kind | "call" / "task" | 必填 / 必有;位置类型。task 表示工作流步骤;call 表示脚本中的调用。 |
| error(分支2).source(分支2).reference | string | 可选;task 类型时:出错步骤的 JSON Pointer。 |
| error(分支2).source(分支2).seq | number | 可选;call 类型时:出错调用的序号(与 Call.seq 对应)。 |
| error(分支2).source(分支2).action | object | 可选;出错的动作 {name, revision};错误来自动作时才有。 不接受额外字段。 |
| error(分支2).source(分支2).action.name | string | 必填 / 必有;动作全名 ns/name。 |
| error(分支2).source(分支2).action.revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| error(分支2).request_id | string / null | 可选;导致失败的下游响应 X-Request-Id;没有下游响应标识时为 null 或省略。 |
| error(分支2).errors | object[] | 可选;逐字段校验错误;pointer 使用 RFC 6901 指向字段,detail 为中文修正说明。 |
| error(分支2).errors[].pointer | string | 必填 / 必有;RFC 6901 字段指针。TypeScript 源码诊断为 /source(脚本)或 /implementation/source(动作);行列另见 line/column,不拼在指针后。 |
| error(分支2).errors[].detail | string | 必填 / 必有;中文修正说明,指出该位置出了什么问题以及怎样改。 |
| error(分支2).errors[].hint | string | 可选;可选的补充提示,给出下一步可执行的动作(例如改用另一个接口)。 |
| error(分支2).errors[].line | integer | 可选;行号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| error(分支2).errors[].column | integer | 可选;列号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| error(分支2).status | number | 可选;工作流 raise 声明的 HTTP 风格状态;可省略,平台错误可能不提供。 |
| initiator | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| initiator.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| initiator.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| channel | "run" / "console" / "api" / "internal" / "trigger" | 必填 / 必有;请求进入平台的渠道。console 为控制台(经 BFF);api 为公开 API 调用;internal 为平台内部服务调用;run 为由另一个运行创建的子运行;trigger 为触发器启动。 |
| owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| parent | null / object | 必填 / 必有;派生本运行的父运行 {id, number, definition};根运行为 null。 |
| parent(分支2).id | string | 必填 / 必有;父运行 ID(run_ 前缀)。 |
| parent(分支2).number | null / number | 必填 / 必有;父运行在其定义内的序号;父运行是临时运行时为 null。 |
| parent(分支2).definition | null / object | 必填 / 必有;父运行所属的脚本或工作流 {namespace, name};临时运行为 null。 |
| parent(分支2).definition(分支2).namespace | string | 必填 / 必有;父运行所属定义的命名空间。 |
| parent(分支2).definition(分支2).name | string | 必填 / 必有;父运行所属定义的名字。 |
| parent_run_id | string / null | 必填 / 必有;派生出本运行的父运行 id;根运行为 null |
| root_run_id | string | 必填 / 必有;运行树根运行的 ID;根运行自身指向自己。 |
| depth | number | 必填 / 必有;运行树中的深度:根运行为 0,每一层子运行加 1,最大 10。 |
| attach | null / "wait" / "detach" | 必填 / 必有;子运行与父运行的关系。wait 表示父运行等待子运行结束,且子运行的截止时间不晚于父运行;detach 表示父运行不等待,也不会因父运行取消而被取消;根运行为 null。 |
| deadline_at | string | 必填 / 必有;运行的截止时间(RFC 3339 UTC):创建时间加 deadline_seconds(脚本默认且最多 300 秒,工作流默认 86400 秒、最多 604800 秒),等待型子运行不晚于父运行截止前 1 秒。 |
| created_at | string | 必填 / 必有;运行创建时间(RFC 3339 UTC)。 |
| started_at | null / string | 必填 / 必有;开始执行的时间(RFC 3339 UTC);仍在排队为 null。 |
| ended_at | null / string | 必填 / 必有;进入终态的时间(RFC 3339 UTC);尚未结束为 null。 |
| updated_at | string | 必填 / 必有;运行记录最近一次更新的时间(RFC 3339 UTC)。 |
| heartbeat_at | null / string | 必填 / 必有;执行器最近一次存活信号的时间(RFC 3339 UTC);尚未开始为 null。 |
| cancel_requested_at | null / string | 必填 / 必有;收到取消请求的时间(RFC 3339 UTC);未取消为 null。 |
| cancelled_by | null / object | 必填 / 必有;请求取消的主体;未取消或非人为取消为 null。 |
| cancelled_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| cancelled_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| cancel_reason | null / "user" / "parent_cancelled" / "deadline" / "executor_lost" | 必填 / 必有;取消原因。user 为用户取消;parent_cancelled 为父运行被取消而级联取消;deadline 为超过截止时间;executor_lost 为执行器丢失;未取消为 null。 |
| suspend_requested_at | null / string | 必填 / 必有;请求暂停工作流的时间(RFC 3339 UTC);未暂停为 null。 |
| suspended_by | null / object | 必填 / 必有;请求暂停的主体;未暂停为 null。 |
| suspended_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| suspended_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| queued_ms | null / number | 必填 / 必有;从创建到开始执行的排队毫秒数;尚未开始为 null。 |
| run_ms | null / number | 必填 / 必有;实际执行毫秒数,不含等待点上的等待时间;结束后固定。 |
| wait_ms | null / number | 必填 / 必有;在等待点上累计等待的毫秒数;尚无等待为 null。 |
| usage | object / null | 必填 / 必有;仅单个运行详情(含 expand)返回;列表为 null。运行本身不收费;这里是运行中调用模型、搜索等能力产生的实扣,按调用归因;未评级的用量稍后计入。汇总超时(1.5 秒)或失败时为 null,详情仍返回 200。 |
| usage(分支1).currency | "USD" | 必填 / 必有;金额币种,固定为 USD。 |
| usage(分支1).cost | string | 必填 / 必有;仅本运行自身的已评级实扣(不含子运行),美元十进制字符串,精确到 6 位小数;没有用量时为 0.000000。 pattern: "^[0-9]+\.[0-9]{6}$" |
| usage(分支1).pending_events | integer | 必填 / 必有;本运行自身尚未评级的用量事件数,金额稍后才计入。 minimum: 0 |
| usage(分支1).by_service | object[] | 必填 / 必有;本运行按服务拆分的实扣,每项为 service 与 cost(6 位小数美元字符串);没有用量时为空数组。 |
| usage(分支1).by_service[].service | string | 必填 / 必有;产生用量的服务名,例如 router 或 search。 |
| usage(分支1).by_service[].cost | string | 必填 / 必有;该服务已评级实扣的美元十进制字符串,精确到 6 位小数。 pattern: "^[0-9]+\.[0-9]{6}$" |
| usage(分支1).tree_cost | string / null | 必填 / 必有;仅根运行返回整棵运行树的已评级实扣(含自身),6 位小数美元字符串;子运行为 null。 |
| rerun_of | null / string | 必填 / 必有;重跑来源:本运行是对哪个运行(run_ ID)的重跑;否则为 null。 |
| labels | object | 必填 / 必有;用户标签与系统标签;触发器运行支持 64 个用户标签,系统标签不占用名额。 |
| trigger | object / null | 必填 / 必有;启动本运行的触发器 {id, name};不是触发器启动时为 null。 |
| trigger(分支1).id | string | 必填 / 必有;启动本运行的触发器 ID(trg_ 前缀)。 |
| trigger(分支1).name | string | 必填 / 必有;启动本运行的触发器名称。 |
| cancel_message | string / null | 必填 / 必有;用户提供的取消备注(1–500 字符);未提供时为 null,cancel_reason 枚举不变。 |
| input_truncated | boolean | 可选;列表省略外置 input 时为 true,此时 input 为 null;内联值不变,运行详情返回完整值。 |
| output_truncated | boolean | 可选;列表省略外置 output 时为 true,此时 output 为 null;内联值不变,运行详情返回完整值。 |
HTTP 202
{
"id": "run_00mv67mwcj0f099fa839644b384742cdfbbbff67226e46f1eed8a36c5226f15a3cf730a221",
"kind": "workflow",
"number": null,
"definition": null,
"target": null,
"resolved_version": null,
"source_digest": "fa40016c6458f18ae4e5b418247cdccccfc4d5dfabe2bdec76f3103842ea15ad",
"language": "yaml",
"status": "cancelled",
"progress": null,
"current_wait": null,
"counters": {
"calls": 0,
"action_calls": 0,
"child_runs": 0,
"tasks_completed": 0,
"tasks_total": 1
},
"input": {},
"output": null,
"error": null,
"initiator": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"channel": "api",
"owner": "tnt_3a9759864ccb4e00",
"trigger": null,
"parent": null,
"parent_run_id": null,
"root_run_id": "run_00mv67mwcj0f099fa839644b384742cdfbbbff67226e46f1eed8a36c5226f15a3cf730a221",
"depth": 0,
"attach": null,
"deadline_at": "2026-10-14T04:58:05.251Z",
"created_at": "2026-10-13T04:58:05.251Z",
"started_at": null,
"ended_at": "2026-10-13T04:58:07.803Z",
"updated_at": "2026-10-13T04:58:07.803Z",
"heartbeat_at": null,
"cancel_requested_at": "2026-10-13T04:58:07.754Z",
"cancelled_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"cancel_reason": "user",
"cancel_message": "Sample completed",
"suspend_requested_at": null,
"suspended_by": null,
"queued_ms": 2552,
"run_ms": 0,
"wait_ms": null,
"usage": null,
"rerun_of": null,
"labels": {
"namespace": "docs-samples",
"name": "sample-run-1791867412840-b05e8a"
}
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | RUN_NOT_FOUND:运行不存在或当前租户不可见。 |
| 409 | RUN_INVALID_STATE:当前状态不允许执行该动作。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
用原精确版本或原临时源码创建新的根运行,保留标签并记录 rerun_of;可覆盖 input,未提供则沿用原输入。原目标已归档会拒绝重新运行,运行令牌不能使用此入口。
POST /automation/v1/runs/{id}/rerun
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: id | string | 必填;运行 ID(run_)。 |
| header: Idempotency-Key | string | 可选;可选;1–256 字符。24 小时内同一 key 重放首个响应并带 Idempotent-Replayed: true;同 key 不同请求体返回 422;处理中返回 409。 minLength: 1;maxLength: 256 |
不接受额外字段。
| 字段 | 类型 | 说明 |
|---|---|---|
| input | null / string / number / boolean / object / null / string / number / boolean / object / JSON[][] | 可选;可选的新输入;省略沿用原运行输入,必须符合目标契约。 |
| input(分支5).*(分支5) | object | 递归 JSON 值。 |
| input(分支5).*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| input(分支6)[](分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| input(分支6)[](分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| RUN_ID | 运行 id;暂停和恢复仅工作流;取消需非终态运行 |
: "${RUN_ID:?Set RUN_ID}"
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/runs/${RUN_ID}/rerun" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"input": {
"n": 42
}
}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.runs.rerun({
"path": {
"id": env("RUN_ID")
},
"body": {
"input": {
"n": 42
}
}
});
console.log(result);Success
| 响应头 | 类型 | 说明 |
|---|---|---|
| Idempotent-Replayed | boolean | Present and true when replaying the first response for this key. |
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;不透明运行 ID。新建非确定性 ID 为 run_ + 10 位 base36 毫秒时间前缀 + 64 位 hex DO ID,共 78 字符;旧随机 ID 为 46 字符,历史及确定性 ID 仍有效。同毫秒内不保证创建顺序。 |
| kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| number | null / number | 必填 / 必有;运行在其脚本或工作流内的递增序号;临时运行为 null。 |
| definition | null / object | 必填 / 必有;运行所属的脚本或工作流 {namespace, name};临时运行(直接传 source)为 null。 |
| definition(分支2).namespace | string | 必填 / 必有;脚本或工作流的命名空间。 |
| definition(分支2).name | string | 必填 / 必有;脚本或工作流的名字。 |
| target | null / string | 必填 / 必有;创建时 target 参数的原文(如 acme/report@latest);临时运行为 null。 |
| resolved_version | null / string | 必填 / 必有;target 解析到的精确版本号;临时运行为 null。 |
| source_digest | null / string | 必填 / 必有;临时运行的源码摘要,可用于读取源码;由已发布定义启动的运行为 null。 |
| language | "ts" / "yaml" | 必填 / 必有;源码语言。ts 表示 TypeScript 脚本;yaml 表示工作流 YAML。 |
| status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;运行状态。pending 已创建尚未开始;running 执行中;waiting 工作流在等待事件、定时器或子运行;suspended 工作流被暂停;cancelled 已取消;faulted 失败,error 给出原因;completed 成功完成,output 为结果。后三种是终态。 |
| progress | null / object | 必填 / 必有;运行报告的最新进度 {label, current, total, updated_at};未报告为 null。 |
| progress(分支2).label | string | 必填 / 必有;进度说明文字,例如当前阶段。 |
| progress(分支2).current | null / number | 必填 / 必有;已完成的数量;未报告为 null。 |
| progress(分支2).total | null / number | 必填 / 必有;总量;未知为 null。 |
| progress(分支2).updated_at | string | 必填 / 必有;进度最近一次更新的时间(RFC 3339 UTC)。 |
| current_wait | null / object | 必填 / 必有;运行当前未完成的等待点;不在等待为 null。 |
| current_wait(分支2).id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| current_wait(分支2).run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| current_wait(分支2).kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| current_wait(分支2).state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| current_wait(分支2).task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| current_wait(分支2).task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| current_wait(分支2).task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| current_wait(分支2).resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| current_wait(分支2).event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| current_wait(分支2).child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| current_wait(分支2).created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| current_wait(分支2).expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| current_wait(分支2).resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| counters | object | 必填 / 必有;运行的累计计数。 不接受额外字段。 |
| counters.calls | number | 必填 / 必有;脚本发出的调用总数。 |
| counters.action_calls | number | 必填 / 必有;其中调用动作的次数。 |
| counters.child_runs | number | 必填 / 必有;启动的子运行数。 |
| counters.tasks_completed | number | 必填 / 必有;工作流已完成的步骤数。 |
| counters.tasks_total | null / number | 必填 / 必有;工作流顶层步骤总数;脚本运行为 null。 |
| input | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| input(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| input(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| output(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| error | null / object | 必填 / 必有;运行失败(faulted)时的错误详情;未失败为 null。 |
| error(分支2).type | string | 必填 / 必有;平台错误类别,或工作流 raise 定义的完整 URI,原样保留。 |
| error(分支2).code | null / string | 必填 / 必有;稳定错误码,可按码分支处理;没有为 null。 |
| error(分支2).title | string | 必填 / 必有;错误的简短标题。 |
| error(分支2).detail | null / string | 必填 / 必有;错误的详细说明;没有为 null。 |
| error(分支2).source | null / object | 必填 / 必有;错误发生的位置:工作流步骤或脚本调用;未知为 null。 |
| error(分支2).source(分支2).kind | "call" / "task" | 必填 / 必有;位置类型。task 表示工作流步骤;call 表示脚本中的调用。 |
| error(分支2).source(分支2).reference | string | 可选;task 类型时:出错步骤的 JSON Pointer。 |
| error(分支2).source(分支2).seq | number | 可选;call 类型时:出错调用的序号(与 Call.seq 对应)。 |
| error(分支2).source(分支2).action | object | 可选;出错的动作 {name, revision};错误来自动作时才有。 不接受额外字段。 |
| error(分支2).source(分支2).action.name | string | 必填 / 必有;动作全名 ns/name。 |
| error(分支2).source(分支2).action.revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| error(分支2).request_id | string / null | 可选;导致失败的下游响应 X-Request-Id;没有下游响应标识时为 null 或省略。 |
| error(分支2).errors | object[] | 可选;逐字段校验错误;pointer 使用 RFC 6901 指向字段,detail 为中文修正说明。 |
| error(分支2).errors[].pointer | string | 必填 / 必有;RFC 6901 字段指针。TypeScript 源码诊断为 /source(脚本)或 /implementation/source(动作);行列另见 line/column,不拼在指针后。 |
| error(分支2).errors[].detail | string | 必填 / 必有;中文修正说明,指出该位置出了什么问题以及怎样改。 |
| error(分支2).errors[].hint | string | 可选;可选的补充提示,给出下一步可执行的动作(例如改用另一个接口)。 |
| error(分支2).errors[].line | integer | 可选;行号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| error(分支2).errors[].column | integer | 可选;列号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| error(分支2).status | number | 可选;工作流 raise 声明的 HTTP 风格状态;可省略,平台错误可能不提供。 |
| initiator | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| initiator.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| initiator.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| channel | "run" / "console" / "api" / "internal" / "trigger" | 必填 / 必有;请求进入平台的渠道。console 为控制台(经 BFF);api 为公开 API 调用;internal 为平台内部服务调用;run 为由另一个运行创建的子运行;trigger 为触发器启动。 |
| owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| parent | null / object | 必填 / 必有;派生本运行的父运行 {id, number, definition};根运行为 null。 |
| parent(分支2).id | string | 必填 / 必有;父运行 ID(run_ 前缀)。 |
| parent(分支2).number | null / number | 必填 / 必有;父运行在其定义内的序号;父运行是临时运行时为 null。 |
| parent(分支2).definition | null / object | 必填 / 必有;父运行所属的脚本或工作流 {namespace, name};临时运行为 null。 |
| parent(分支2).definition(分支2).namespace | string | 必填 / 必有;父运行所属定义的命名空间。 |
| parent(分支2).definition(分支2).name | string | 必填 / 必有;父运行所属定义的名字。 |
| parent_run_id | string / null | 必填 / 必有;派生出本运行的父运行 id;根运行为 null |
| root_run_id | string | 必填 / 必有;运行树根运行的 ID;根运行自身指向自己。 |
| depth | number | 必填 / 必有;运行树中的深度:根运行为 0,每一层子运行加 1,最大 10。 |
| attach | null / "wait" / "detach" | 必填 / 必有;子运行与父运行的关系。wait 表示父运行等待子运行结束,且子运行的截止时间不晚于父运行;detach 表示父运行不等待,也不会因父运行取消而被取消;根运行为 null。 |
| deadline_at | string | 必填 / 必有;运行的截止时间(RFC 3339 UTC):创建时间加 deadline_seconds(脚本默认且最多 300 秒,工作流默认 86400 秒、最多 604800 秒),等待型子运行不晚于父运行截止前 1 秒。 |
| created_at | string | 必填 / 必有;运行创建时间(RFC 3339 UTC)。 |
| started_at | null / string | 必填 / 必有;开始执行的时间(RFC 3339 UTC);仍在排队为 null。 |
| ended_at | null / string | 必填 / 必有;进入终态的时间(RFC 3339 UTC);尚未结束为 null。 |
| updated_at | string | 必填 / 必有;运行记录最近一次更新的时间(RFC 3339 UTC)。 |
| heartbeat_at | null / string | 必填 / 必有;执行器最近一次存活信号的时间(RFC 3339 UTC);尚未开始为 null。 |
| cancel_requested_at | null / string | 必填 / 必有;收到取消请求的时间(RFC 3339 UTC);未取消为 null。 |
| cancelled_by | null / object | 必填 / 必有;请求取消的主体;未取消或非人为取消为 null。 |
| cancelled_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| cancelled_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| cancel_reason | null / "user" / "parent_cancelled" / "deadline" / "executor_lost" | 必填 / 必有;取消原因。user 为用户取消;parent_cancelled 为父运行被取消而级联取消;deadline 为超过截止时间;executor_lost 为执行器丢失;未取消为 null。 |
| suspend_requested_at | null / string | 必填 / 必有;请求暂停工作流的时间(RFC 3339 UTC);未暂停为 null。 |
| suspended_by | null / object | 必填 / 必有;请求暂停的主体;未暂停为 null。 |
| suspended_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| suspended_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| queued_ms | null / number | 必填 / 必有;从创建到开始执行的排队毫秒数;尚未开始为 null。 |
| run_ms | null / number | 必填 / 必有;实际执行毫秒数,不含等待点上的等待时间;结束后固定。 |
| wait_ms | null / number | 必填 / 必有;在等待点上累计等待的毫秒数;尚无等待为 null。 |
| usage | object / null | 必填 / 必有;仅单个运行详情(含 expand)返回;列表为 null。运行本身不收费;这里是运行中调用模型、搜索等能力产生的实扣,按调用归因;未评级的用量稍后计入。汇总超时(1.5 秒)或失败时为 null,详情仍返回 200。 |
| usage(分支1).currency | "USD" | 必填 / 必有;金额币种,固定为 USD。 |
| usage(分支1).cost | string | 必填 / 必有;仅本运行自身的已评级实扣(不含子运行),美元十进制字符串,精确到 6 位小数;没有用量时为 0.000000。 pattern: "^[0-9]+\.[0-9]{6}$" |
| usage(分支1).pending_events | integer | 必填 / 必有;本运行自身尚未评级的用量事件数,金额稍后才计入。 minimum: 0 |
| usage(分支1).by_service | object[] | 必填 / 必有;本运行按服务拆分的实扣,每项为 service 与 cost(6 位小数美元字符串);没有用量时为空数组。 |
| usage(分支1).by_service[].service | string | 必填 / 必有;产生用量的服务名,例如 router 或 search。 |
| usage(分支1).by_service[].cost | string | 必填 / 必有;该服务已评级实扣的美元十进制字符串,精确到 6 位小数。 pattern: "^[0-9]+\.[0-9]{6}$" |
| usage(分支1).tree_cost | string / null | 必填 / 必有;仅根运行返回整棵运行树的已评级实扣(含自身),6 位小数美元字符串;子运行为 null。 |
| rerun_of | null / string | 必填 / 必有;重跑来源:本运行是对哪个运行(run_ ID)的重跑;否则为 null。 |
| labels | object | 必填 / 必有;用户标签与系统标签;触发器运行支持 64 个用户标签,系统标签不占用名额。 |
| trigger | object / null | 必填 / 必有;启动本运行的触发器 {id, name};不是触发器启动时为 null。 |
| trigger(分支1).id | string | 必填 / 必有;启动本运行的触发器 ID(trg_ 前缀)。 |
| trigger(分支1).name | string | 必填 / 必有;启动本运行的触发器名称。 |
| cancel_message | string / null | 必填 / 必有;用户提供的取消备注(1–500 字符);未提供时为 null,cancel_reason 枚举不变。 |
| input_truncated | boolean | 可选;列表省略外置 input 时为 true,此时 input 为 null;内联值不变,运行详情返回完整值。 |
| output_truncated | boolean | 可选;列表省略外置 output 时为 true,此时 output 为 null;内联值不变,运行详情返回完整值。 |
HTTP 200
{
"id": "run_00mv67mj3s5141d7514d6e0c18cd71ba7e821b89faadad8897cc6bedb103209efe6de40b4d",
"kind": "script",
"number": null,
"definition": null,
"target": null,
"resolved_version": null,
"source_digest": "7ae6678882a4ef2ea96e401c105d5c6ef512917cd72a9235289d2a3bf1f1b49d",
"language": "ts",
"status": "running",
"progress": null,
"current_wait": null,
"counters": {
"calls": 0,
"action_calls": 0,
"child_runs": 0,
"tasks_completed": 0,
"tasks_total": null
},
"input": {
"n": 42
},
"output": null,
"error": null,
"initiator": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"channel": "api",
"owner": "tnt_3a9759864ccb4e00",
"trigger": null,
"parent": null,
"parent_run_id": null,
"root_run_id": "run_00mv67mj3s5141d7514d6e0c18cd71ba7e821b89faadad8897cc6bedb103209efe6de40b4d",
"depth": 0,
"attach": null,
"deadline_at": "2026-10-13T05:02:48.088Z",
"created_at": "2026-10-13T04:57:48.088Z",
"started_at": "2026-10-13T04:57:49.075Z",
"ended_at": null,
"updated_at": "2026-10-13T04:57:49.075Z",
"heartbeat_at": "2026-10-13T04:57:49.075Z",
"cancel_requested_at": null,
"cancelled_by": null,
"cancel_reason": null,
"cancel_message": null,
"suspend_requested_at": null,
"suspended_by": null,
"queued_ms": 987,
"run_ms": null,
"wait_ms": null,
"usage": null,
"rerun_of": "run_00mv67mdlm5d5d707cd031744e8437f67f6acf02afaabd18e76bf8db9d674333de6f1fb2f1",
"labels": {
"namespace": "docs-samples",
"name": "sample-run-1791867412840-b05e8a"
}
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 DEFINITION_INVALID:源码未通过定义校验。 INPUT_INVALID:输入不满足目标契约或业务校验。 |
| 403 | NAMESPACE_FORBIDDEN:命名空间只读或运行令牌不允许此调用。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 VERSION_NOT_FOUND:指定版本或修订不存在。 RUN_NOT_FOUND:运行不存在或当前租户不可见。 |
| 409 | IDEMPOTENCY_IN_FLIGHT:同一幂等键的请求仍在处理中。 TARGET_ARCHIVED:目标已归档,不能用于本操作;动作执行错误的 detail 包含 ns/name。 |
| 413 | PAYLOAD_TOO_LARGE:请求内容超过本操作允许的大小。 |
| 422 | IDEMPOTENCY_KEY_MISMATCH:同一幂等键已用于不同请求内容。 NO_MATCHING_VERSION:没有满足标签、版本或范围的已发布版本。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
仅可暂停正在运行或等待中的工作流;脚本返回 OPERATION_NOT_SUPPORTED,其他状态返回 RUN_INVALID_STATE。
POST /automation/v1/runs/{id}/suspend
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: id | string | 必填;运行 ID(run_)。 |
不接受额外字段。 object
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| RUN_ID | 运行 id;暂停和恢复仅工作流;取消需非终态运行 |
: "${RUN_ID:?Set RUN_ID}"
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/runs/${RUN_ID}/suspend" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.runs.suspend({
"path": {
"id": env("RUN_ID")
},
"body": {}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;不透明运行 ID。新建非确定性 ID 为 run_ + 10 位 base36 毫秒时间前缀 + 64 位 hex DO ID,共 78 字符;旧随机 ID 为 46 字符,历史及确定性 ID 仍有效。同毫秒内不保证创建顺序。 |
| kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| number | null / number | 必填 / 必有;运行在其脚本或工作流内的递增序号;临时运行为 null。 |
| definition | null / object | 必填 / 必有;运行所属的脚本或工作流 {namespace, name};临时运行(直接传 source)为 null。 |
| definition(分支2).namespace | string | 必填 / 必有;脚本或工作流的命名空间。 |
| definition(分支2).name | string | 必填 / 必有;脚本或工作流的名字。 |
| target | null / string | 必填 / 必有;创建时 target 参数的原文(如 acme/report@latest);临时运行为 null。 |
| resolved_version | null / string | 必填 / 必有;target 解析到的精确版本号;临时运行为 null。 |
| source_digest | null / string | 必填 / 必有;临时运行的源码摘要,可用于读取源码;由已发布定义启动的运行为 null。 |
| language | "ts" / "yaml" | 必填 / 必有;源码语言。ts 表示 TypeScript 脚本;yaml 表示工作流 YAML。 |
| status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;运行状态。pending 已创建尚未开始;running 执行中;waiting 工作流在等待事件、定时器或子运行;suspended 工作流被暂停;cancelled 已取消;faulted 失败,error 给出原因;completed 成功完成,output 为结果。后三种是终态。 |
| progress | null / object | 必填 / 必有;运行报告的最新进度 {label, current, total, updated_at};未报告为 null。 |
| progress(分支2).label | string | 必填 / 必有;进度说明文字,例如当前阶段。 |
| progress(分支2).current | null / number | 必填 / 必有;已完成的数量;未报告为 null。 |
| progress(分支2).total | null / number | 必填 / 必有;总量;未知为 null。 |
| progress(分支2).updated_at | string | 必填 / 必有;进度最近一次更新的时间(RFC 3339 UTC)。 |
| current_wait | null / object | 必填 / 必有;运行当前未完成的等待点;不在等待为 null。 |
| current_wait(分支2).id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| current_wait(分支2).run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| current_wait(分支2).kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| current_wait(分支2).state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| current_wait(分支2).task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| current_wait(分支2).task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| current_wait(分支2).task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| current_wait(分支2).resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| current_wait(分支2).event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| current_wait(分支2).child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| current_wait(分支2).created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| current_wait(分支2).expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| current_wait(分支2).resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| counters | object | 必填 / 必有;运行的累计计数。 不接受额外字段。 |
| counters.calls | number | 必填 / 必有;脚本发出的调用总数。 |
| counters.action_calls | number | 必填 / 必有;其中调用动作的次数。 |
| counters.child_runs | number | 必填 / 必有;启动的子运行数。 |
| counters.tasks_completed | number | 必填 / 必有;工作流已完成的步骤数。 |
| counters.tasks_total | null / number | 必填 / 必有;工作流顶层步骤总数;脚本运行为 null。 |
| input | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| input(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| input(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| output(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| error | null / object | 必填 / 必有;运行失败(faulted)时的错误详情;未失败为 null。 |
| error(分支2).type | string | 必填 / 必有;平台错误类别,或工作流 raise 定义的完整 URI,原样保留。 |
| error(分支2).code | null / string | 必填 / 必有;稳定错误码,可按码分支处理;没有为 null。 |
| error(分支2).title | string | 必填 / 必有;错误的简短标题。 |
| error(分支2).detail | null / string | 必填 / 必有;错误的详细说明;没有为 null。 |
| error(分支2).source | null / object | 必填 / 必有;错误发生的位置:工作流步骤或脚本调用;未知为 null。 |
| error(分支2).source(分支2).kind | "call" / "task" | 必填 / 必有;位置类型。task 表示工作流步骤;call 表示脚本中的调用。 |
| error(分支2).source(分支2).reference | string | 可选;task 类型时:出错步骤的 JSON Pointer。 |
| error(分支2).source(分支2).seq | number | 可选;call 类型时:出错调用的序号(与 Call.seq 对应)。 |
| error(分支2).source(分支2).action | object | 可选;出错的动作 {name, revision};错误来自动作时才有。 不接受额外字段。 |
| error(分支2).source(分支2).action.name | string | 必填 / 必有;动作全名 ns/name。 |
| error(分支2).source(分支2).action.revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| error(分支2).request_id | string / null | 可选;导致失败的下游响应 X-Request-Id;没有下游响应标识时为 null 或省略。 |
| error(分支2).errors | object[] | 可选;逐字段校验错误;pointer 使用 RFC 6901 指向字段,detail 为中文修正说明。 |
| error(分支2).errors[].pointer | string | 必填 / 必有;RFC 6901 字段指针。TypeScript 源码诊断为 /source(脚本)或 /implementation/source(动作);行列另见 line/column,不拼在指针后。 |
| error(分支2).errors[].detail | string | 必填 / 必有;中文修正说明,指出该位置出了什么问题以及怎样改。 |
| error(分支2).errors[].hint | string | 可选;可选的补充提示,给出下一步可执行的动作(例如改用另一个接口)。 |
| error(分支2).errors[].line | integer | 可选;行号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| error(分支2).errors[].column | integer | 可选;列号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| error(分支2).status | number | 可选;工作流 raise 声明的 HTTP 风格状态;可省略,平台错误可能不提供。 |
| initiator | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| initiator.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| initiator.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| channel | "run" / "console" / "api" / "internal" / "trigger" | 必填 / 必有;请求进入平台的渠道。console 为控制台(经 BFF);api 为公开 API 调用;internal 为平台内部服务调用;run 为由另一个运行创建的子运行;trigger 为触发器启动。 |
| owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| parent | null / object | 必填 / 必有;派生本运行的父运行 {id, number, definition};根运行为 null。 |
| parent(分支2).id | string | 必填 / 必有;父运行 ID(run_ 前缀)。 |
| parent(分支2).number | null / number | 必填 / 必有;父运行在其定义内的序号;父运行是临时运行时为 null。 |
| parent(分支2).definition | null / object | 必填 / 必有;父运行所属的脚本或工作流 {namespace, name};临时运行为 null。 |
| parent(分支2).definition(分支2).namespace | string | 必填 / 必有;父运行所属定义的命名空间。 |
| parent(分支2).definition(分支2).name | string | 必填 / 必有;父运行所属定义的名字。 |
| parent_run_id | string / null | 必填 / 必有;派生出本运行的父运行 id;根运行为 null |
| root_run_id | string | 必填 / 必有;运行树根运行的 ID;根运行自身指向自己。 |
| depth | number | 必填 / 必有;运行树中的深度:根运行为 0,每一层子运行加 1,最大 10。 |
| attach | null / "wait" / "detach" | 必填 / 必有;子运行与父运行的关系。wait 表示父运行等待子运行结束,且子运行的截止时间不晚于父运行;detach 表示父运行不等待,也不会因父运行取消而被取消;根运行为 null。 |
| deadline_at | string | 必填 / 必有;运行的截止时间(RFC 3339 UTC):创建时间加 deadline_seconds(脚本默认且最多 300 秒,工作流默认 86400 秒、最多 604800 秒),等待型子运行不晚于父运行截止前 1 秒。 |
| created_at | string | 必填 / 必有;运行创建时间(RFC 3339 UTC)。 |
| started_at | null / string | 必填 / 必有;开始执行的时间(RFC 3339 UTC);仍在排队为 null。 |
| ended_at | null / string | 必填 / 必有;进入终态的时间(RFC 3339 UTC);尚未结束为 null。 |
| updated_at | string | 必填 / 必有;运行记录最近一次更新的时间(RFC 3339 UTC)。 |
| heartbeat_at | null / string | 必填 / 必有;执行器最近一次存活信号的时间(RFC 3339 UTC);尚未开始为 null。 |
| cancel_requested_at | null / string | 必填 / 必有;收到取消请求的时间(RFC 3339 UTC);未取消为 null。 |
| cancelled_by | null / object | 必填 / 必有;请求取消的主体;未取消或非人为取消为 null。 |
| cancelled_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| cancelled_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| cancel_reason | null / "user" / "parent_cancelled" / "deadline" / "executor_lost" | 必填 / 必有;取消原因。user 为用户取消;parent_cancelled 为父运行被取消而级联取消;deadline 为超过截止时间;executor_lost 为执行器丢失;未取消为 null。 |
| suspend_requested_at | null / string | 必填 / 必有;请求暂停工作流的时间(RFC 3339 UTC);未暂停为 null。 |
| suspended_by | null / object | 必填 / 必有;请求暂停的主体;未暂停为 null。 |
| suspended_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| suspended_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| queued_ms | null / number | 必填 / 必有;从创建到开始执行的排队毫秒数;尚未开始为 null。 |
| run_ms | null / number | 必填 / 必有;实际执行毫秒数,不含等待点上的等待时间;结束后固定。 |
| wait_ms | null / number | 必填 / 必有;在等待点上累计等待的毫秒数;尚无等待为 null。 |
| usage | object / null | 必填 / 必有;仅单个运行详情(含 expand)返回;列表为 null。运行本身不收费;这里是运行中调用模型、搜索等能力产生的实扣,按调用归因;未评级的用量稍后计入。汇总超时(1.5 秒)或失败时为 null,详情仍返回 200。 |
| usage(分支1).currency | "USD" | 必填 / 必有;金额币种,固定为 USD。 |
| usage(分支1).cost | string | 必填 / 必有;仅本运行自身的已评级实扣(不含子运行),美元十进制字符串,精确到 6 位小数;没有用量时为 0.000000。 pattern: "^[0-9]+\.[0-9]{6}$" |
| usage(分支1).pending_events | integer | 必填 / 必有;本运行自身尚未评级的用量事件数,金额稍后才计入。 minimum: 0 |
| usage(分支1).by_service | object[] | 必填 / 必有;本运行按服务拆分的实扣,每项为 service 与 cost(6 位小数美元字符串);没有用量时为空数组。 |
| usage(分支1).by_service[].service | string | 必填 / 必有;产生用量的服务名,例如 router 或 search。 |
| usage(分支1).by_service[].cost | string | 必填 / 必有;该服务已评级实扣的美元十进制字符串,精确到 6 位小数。 pattern: "^[0-9]+\.[0-9]{6}$" |
| usage(分支1).tree_cost | string / null | 必填 / 必有;仅根运行返回整棵运行树的已评级实扣(含自身),6 位小数美元字符串;子运行为 null。 |
| rerun_of | null / string | 必填 / 必有;重跑来源:本运行是对哪个运行(run_ ID)的重跑;否则为 null。 |
| labels | object | 必填 / 必有;用户标签与系统标签;触发器运行支持 64 个用户标签,系统标签不占用名额。 |
| trigger | object / null | 必填 / 必有;启动本运行的触发器 {id, name};不是触发器启动时为 null。 |
| trigger(分支1).id | string | 必填 / 必有;启动本运行的触发器 ID(trg_ 前缀)。 |
| trigger(分支1).name | string | 必填 / 必有;启动本运行的触发器名称。 |
| cancel_message | string / null | 必填 / 必有;用户提供的取消备注(1–500 字符);未提供时为 null,cancel_reason 枚举不变。 |
| input_truncated | boolean | 可选;列表省略外置 input 时为 true,此时 input 为 null;内联值不变,运行详情返回完整值。 |
| output_truncated | boolean | 可选;列表省略外置 output 时为 true,此时 output 为 null;内联值不变,运行详情返回完整值。 |
HTTP 200
{
"id": "run_00mv67mkw52c7fa90cc9649b1053e66fd836b071f289acb667ff8ca853e65bc4608e9a45bd",
"kind": "workflow",
"number": null,
"definition": null,
"target": null,
"resolved_version": null,
"source_digest": "1f559f7323adda4865d889639a4d878eab97e1ce3e542c68ea4022af4cd0f7fa",
"language": "yaml",
"status": "suspended",
"progress": null,
"current_wait": {
"id": "wait_wf-eebc9ef34869206fa1bcc1e2ae6375990a7ab34c5ad485ac98a4f189c4b37346",
"run_id": "run_00mv67mkw52c7fa90cc9649b1053e66fd836b071f289acb667ff8ca853e65bc4608e9a45bd",
"kind": "event",
"state": "open",
"task": {
"reference": "/do/0/ready",
"name": "ready"
},
"resume_at": null,
"event_type": "ready",
"child_run_id": null,
"created_at": "2026-10-13T04:57:56.982Z",
"expires_at": "2026-10-14T04:57:50.405Z",
"resolved_at": null
},
"counters": {
"calls": 0,
"action_calls": 0,
"child_runs": 0,
"tasks_completed": 0,
"tasks_total": 1
},
"input": {},
"output": null,
"error": null,
"initiator": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"channel": "api",
"owner": "tnt_3a9759864ccb4e00",
"trigger": null,
"parent": null,
"parent_run_id": null,
"root_run_id": "run_00mv67mkw52c7fa90cc9649b1053e66fd836b071f289acb667ff8ca853e65bc4608e9a45bd",
"depth": 0,
"attach": null,
"deadline_at": "2026-10-14T04:57:50.405Z",
"created_at": "2026-10-13T04:57:50.405Z",
"started_at": "2026-10-13T04:57:56.933Z",
"ended_at": null,
"updated_at": "2026-10-13T04:57:58.173Z",
"heartbeat_at": null,
"cancel_requested_at": null,
"cancelled_by": null,
"cancel_reason": null,
"cancel_message": null,
"suspend_requested_at": "2026-10-13T04:57:58.173Z",
"suspended_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"queued_ms": 6528,
"run_ms": null,
"wait_ms": null,
"usage": null,
"rerun_of": null,
"labels": {
"namespace": "docs-samples",
"name": "sample-run-1791867412840-b05e8a"
}
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | RUN_NOT_FOUND:运行不存在或当前租户不可见。 |
| 409 | OPERATION_NOT_SUPPORTED:该资源类型不支持此操作。 RUN_INVALID_STATE:当前状态不允许执行该动作。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
仅恢复 suspended 状态的工作流,回到暂停前的运行或等待状态;并发名额不足时仍保持暂停,脚本不支持此操作。
POST /automation/v1/runs/{id}/resume
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: id | string | 必填;运行 ID(run_)。 |
不接受额外字段。 object
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| RUN_ID | 运行 id;暂停和恢复仅工作流;取消需非终态运行 |
: "${RUN_ID:?Set RUN_ID}"
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/runs/${RUN_ID}/resume" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.runs.resume({
"path": {
"id": env("RUN_ID")
},
"body": {}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;不透明运行 ID。新建非确定性 ID 为 run_ + 10 位 base36 毫秒时间前缀 + 64 位 hex DO ID,共 78 字符;旧随机 ID 为 46 字符,历史及确定性 ID 仍有效。同毫秒内不保证创建顺序。 |
| kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| number | null / number | 必填 / 必有;运行在其脚本或工作流内的递增序号;临时运行为 null。 |
| definition | null / object | 必填 / 必有;运行所属的脚本或工作流 {namespace, name};临时运行(直接传 source)为 null。 |
| definition(分支2).namespace | string | 必填 / 必有;脚本或工作流的命名空间。 |
| definition(分支2).name | string | 必填 / 必有;脚本或工作流的名字。 |
| target | null / string | 必填 / 必有;创建时 target 参数的原文(如 acme/report@latest);临时运行为 null。 |
| resolved_version | null / string | 必填 / 必有;target 解析到的精确版本号;临时运行为 null。 |
| source_digest | null / string | 必填 / 必有;临时运行的源码摘要,可用于读取源码;由已发布定义启动的运行为 null。 |
| language | "ts" / "yaml" | 必填 / 必有;源码语言。ts 表示 TypeScript 脚本;yaml 表示工作流 YAML。 |
| status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;运行状态。pending 已创建尚未开始;running 执行中;waiting 工作流在等待事件、定时器或子运行;suspended 工作流被暂停;cancelled 已取消;faulted 失败,error 给出原因;completed 成功完成,output 为结果。后三种是终态。 |
| progress | null / object | 必填 / 必有;运行报告的最新进度 {label, current, total, updated_at};未报告为 null。 |
| progress(分支2).label | string | 必填 / 必有;进度说明文字,例如当前阶段。 |
| progress(分支2).current | null / number | 必填 / 必有;已完成的数量;未报告为 null。 |
| progress(分支2).total | null / number | 必填 / 必有;总量;未知为 null。 |
| progress(分支2).updated_at | string | 必填 / 必有;进度最近一次更新的时间(RFC 3339 UTC)。 |
| current_wait | null / object | 必填 / 必有;运行当前未完成的等待点;不在等待为 null。 |
| current_wait(分支2).id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| current_wait(分支2).run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| current_wait(分支2).kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| current_wait(分支2).state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| current_wait(分支2).task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| current_wait(分支2).task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| current_wait(分支2).task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| current_wait(分支2).resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| current_wait(分支2).event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| current_wait(分支2).child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| current_wait(分支2).created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| current_wait(分支2).expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| current_wait(分支2).resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| counters | object | 必填 / 必有;运行的累计计数。 不接受额外字段。 |
| counters.calls | number | 必填 / 必有;脚本发出的调用总数。 |
| counters.action_calls | number | 必填 / 必有;其中调用动作的次数。 |
| counters.child_runs | number | 必填 / 必有;启动的子运行数。 |
| counters.tasks_completed | number | 必填 / 必有;工作流已完成的步骤数。 |
| counters.tasks_total | null / number | 必填 / 必有;工作流顶层步骤总数;脚本运行为 null。 |
| input | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| input(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| input(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| output(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| output(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| error | null / object | 必填 / 必有;运行失败(faulted)时的错误详情;未失败为 null。 |
| error(分支2).type | string | 必填 / 必有;平台错误类别,或工作流 raise 定义的完整 URI,原样保留。 |
| error(分支2).code | null / string | 必填 / 必有;稳定错误码,可按码分支处理;没有为 null。 |
| error(分支2).title | string | 必填 / 必有;错误的简短标题。 |
| error(分支2).detail | null / string | 必填 / 必有;错误的详细说明;没有为 null。 |
| error(分支2).source | null / object | 必填 / 必有;错误发生的位置:工作流步骤或脚本调用;未知为 null。 |
| error(分支2).source(分支2).kind | "call" / "task" | 必填 / 必有;位置类型。task 表示工作流步骤;call 表示脚本中的调用。 |
| error(分支2).source(分支2).reference | string | 可选;task 类型时:出错步骤的 JSON Pointer。 |
| error(分支2).source(分支2).seq | number | 可选;call 类型时:出错调用的序号(与 Call.seq 对应)。 |
| error(分支2).source(分支2).action | object | 可选;出错的动作 {name, revision};错误来自动作时才有。 不接受额外字段。 |
| error(分支2).source(分支2).action.name | string | 必填 / 必有;动作全名 ns/name。 |
| error(分支2).source(分支2).action.revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| error(分支2).request_id | string / null | 可选;导致失败的下游响应 X-Request-Id;没有下游响应标识时为 null 或省略。 |
| error(分支2).errors | object[] | 可选;逐字段校验错误;pointer 使用 RFC 6901 指向字段,detail 为中文修正说明。 |
| error(分支2).errors[].pointer | string | 必填 / 必有;RFC 6901 字段指针。TypeScript 源码诊断为 /source(脚本)或 /implementation/source(动作);行列另见 line/column,不拼在指针后。 |
| error(分支2).errors[].detail | string | 必填 / 必有;中文修正说明,指出该位置出了什么问题以及怎样改。 |
| error(分支2).errors[].hint | string | 可选;可选的补充提示,给出下一步可执行的动作(例如改用另一个接口)。 |
| error(分支2).errors[].line | integer | 可选;行号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| error(分支2).errors[].column | integer | 可选;列号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| error(分支2).status | number | 可选;工作流 raise 声明的 HTTP 风格状态;可省略,平台错误可能不提供。 |
| initiator | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| initiator.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| initiator.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| channel | "run" / "console" / "api" / "internal" / "trigger" | 必填 / 必有;请求进入平台的渠道。console 为控制台(经 BFF);api 为公开 API 调用;internal 为平台内部服务调用;run 为由另一个运行创建的子运行;trigger 为触发器启动。 |
| owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| parent | null / object | 必填 / 必有;派生本运行的父运行 {id, number, definition};根运行为 null。 |
| parent(分支2).id | string | 必填 / 必有;父运行 ID(run_ 前缀)。 |
| parent(分支2).number | null / number | 必填 / 必有;父运行在其定义内的序号;父运行是临时运行时为 null。 |
| parent(分支2).definition | null / object | 必填 / 必有;父运行所属的脚本或工作流 {namespace, name};临时运行为 null。 |
| parent(分支2).definition(分支2).namespace | string | 必填 / 必有;父运行所属定义的命名空间。 |
| parent(分支2).definition(分支2).name | string | 必填 / 必有;父运行所属定义的名字。 |
| parent_run_id | string / null | 必填 / 必有;派生出本运行的父运行 id;根运行为 null |
| root_run_id | string | 必填 / 必有;运行树根运行的 ID;根运行自身指向自己。 |
| depth | number | 必填 / 必有;运行树中的深度:根运行为 0,每一层子运行加 1,最大 10。 |
| attach | null / "wait" / "detach" | 必填 / 必有;子运行与父运行的关系。wait 表示父运行等待子运行结束,且子运行的截止时间不晚于父运行;detach 表示父运行不等待,也不会因父运行取消而被取消;根运行为 null。 |
| deadline_at | string | 必填 / 必有;运行的截止时间(RFC 3339 UTC):创建时间加 deadline_seconds(脚本默认且最多 300 秒,工作流默认 86400 秒、最多 604800 秒),等待型子运行不晚于父运行截止前 1 秒。 |
| created_at | string | 必填 / 必有;运行创建时间(RFC 3339 UTC)。 |
| started_at | null / string | 必填 / 必有;开始执行的时间(RFC 3339 UTC);仍在排队为 null。 |
| ended_at | null / string | 必填 / 必有;进入终态的时间(RFC 3339 UTC);尚未结束为 null。 |
| updated_at | string | 必填 / 必有;运行记录最近一次更新的时间(RFC 3339 UTC)。 |
| heartbeat_at | null / string | 必填 / 必有;执行器最近一次存活信号的时间(RFC 3339 UTC);尚未开始为 null。 |
| cancel_requested_at | null / string | 必填 / 必有;收到取消请求的时间(RFC 3339 UTC);未取消为 null。 |
| cancelled_by | null / object | 必填 / 必有;请求取消的主体;未取消或非人为取消为 null。 |
| cancelled_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| cancelled_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| cancel_reason | null / "user" / "parent_cancelled" / "deadline" / "executor_lost" | 必填 / 必有;取消原因。user 为用户取消;parent_cancelled 为父运行被取消而级联取消;deadline 为超过截止时间;executor_lost 为执行器丢失;未取消为 null。 |
| suspend_requested_at | null / string | 必填 / 必有;请求暂停工作流的时间(RFC 3339 UTC);未暂停为 null。 |
| suspended_by | null / object | 必填 / 必有;请求暂停的主体;未暂停为 null。 |
| suspended_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| suspended_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| queued_ms | null / number | 必填 / 必有;从创建到开始执行的排队毫秒数;尚未开始为 null。 |
| run_ms | null / number | 必填 / 必有;实际执行毫秒数,不含等待点上的等待时间;结束后固定。 |
| wait_ms | null / number | 必填 / 必有;在等待点上累计等待的毫秒数;尚无等待为 null。 |
| usage | object / null | 必填 / 必有;仅单个运行详情(含 expand)返回;列表为 null。运行本身不收费;这里是运行中调用模型、搜索等能力产生的实扣,按调用归因;未评级的用量稍后计入。汇总超时(1.5 秒)或失败时为 null,详情仍返回 200。 |
| usage(分支1).currency | "USD" | 必填 / 必有;金额币种,固定为 USD。 |
| usage(分支1).cost | string | 必填 / 必有;仅本运行自身的已评级实扣(不含子运行),美元十进制字符串,精确到 6 位小数;没有用量时为 0.000000。 pattern: "^[0-9]+\.[0-9]{6}$" |
| usage(分支1).pending_events | integer | 必填 / 必有;本运行自身尚未评级的用量事件数,金额稍后才计入。 minimum: 0 |
| usage(分支1).by_service | object[] | 必填 / 必有;本运行按服务拆分的实扣,每项为 service 与 cost(6 位小数美元字符串);没有用量时为空数组。 |
| usage(分支1).by_service[].service | string | 必填 / 必有;产生用量的服务名,例如 router 或 search。 |
| usage(分支1).by_service[].cost | string | 必填 / 必有;该服务已评级实扣的美元十进制字符串,精确到 6 位小数。 pattern: "^[0-9]+\.[0-9]{6}$" |
| usage(分支1).tree_cost | string / null | 必填 / 必有;仅根运行返回整棵运行树的已评级实扣(含自身),6 位小数美元字符串;子运行为 null。 |
| rerun_of | null / string | 必填 / 必有;重跑来源:本运行是对哪个运行(run_ ID)的重跑;否则为 null。 |
| labels | object | 必填 / 必有;用户标签与系统标签;触发器运行支持 64 个用户标签,系统标签不占用名额。 |
| trigger | object / null | 必填 / 必有;启动本运行的触发器 {id, name};不是触发器启动时为 null。 |
| trigger(分支1).id | string | 必填 / 必有;启动本运行的触发器 ID(trg_ 前缀)。 |
| trigger(分支1).name | string | 必填 / 必有;启动本运行的触发器名称。 |
| cancel_message | string / null | 必填 / 必有;用户提供的取消备注(1–500 字符);未提供时为 null,cancel_reason 枚举不变。 |
| input_truncated | boolean | 可选;列表省略外置 input 时为 true,此时 input 为 null;内联值不变,运行详情返回完整值。 |
| output_truncated | boolean | 可选;列表省略外置 output 时为 true,此时 output 为 null;内联值不变,运行详情返回完整值。 |
HTTP 200
{
"id": "run_00mv67mkw52c7fa90cc9649b1053e66fd836b071f289acb667ff8ca853e65bc4608e9a45bd",
"kind": "workflow",
"number": null,
"definition": null,
"target": null,
"resolved_version": null,
"source_digest": "1f559f7323adda4865d889639a4d878eab97e1ce3e542c68ea4022af4cd0f7fa",
"language": "yaml",
"status": "waiting",
"progress": null,
"current_wait": {
"id": "wait_wf-eebc9ef34869206fa1bcc1e2ae6375990a7ab34c5ad485ac98a4f189c4b37346",
"run_id": "run_00mv67mkw52c7fa90cc9649b1053e66fd836b071f289acb667ff8ca853e65bc4608e9a45bd",
"kind": "event",
"state": "open",
"task": {
"reference": "/do/0/ready",
"name": "ready"
},
"resume_at": null,
"event_type": "ready",
"child_run_id": null,
"created_at": "2026-10-13T04:57:56.982Z",
"expires_at": "2026-10-14T04:57:50.405Z",
"resolved_at": null
},
"counters": {
"calls": 0,
"action_calls": 0,
"child_runs": 0,
"tasks_completed": 0,
"tasks_total": 1
},
"input": {},
"output": null,
"error": null,
"initiator": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"channel": "api",
"owner": "tnt_3a9759864ccb4e00",
"trigger": null,
"parent": null,
"parent_run_id": null,
"root_run_id": "run_00mv67mkw52c7fa90cc9649b1053e66fd836b071f289acb667ff8ca853e65bc4608e9a45bd",
"depth": 0,
"attach": null,
"deadline_at": "2026-10-14T04:57:50.405Z",
"created_at": "2026-10-13T04:57:50.405Z",
"started_at": "2026-10-13T04:57:56.933Z",
"ended_at": null,
"updated_at": "2026-10-13T04:58:02.193Z",
"heartbeat_at": null,
"cancel_requested_at": null,
"cancelled_by": null,
"cancel_reason": null,
"cancel_message": null,
"suspend_requested_at": null,
"suspended_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"queued_ms": 6528,
"run_ms": null,
"wait_ms": null,
"usage": null,
"rerun_of": null,
"labels": {
"namespace": "docs-samples",
"name": "sample-run-1791867412840-b05e8a"
}
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | RUN_NOT_FOUND:运行不存在或当前租户不可见。 |
| 409 | OPERATION_NOT_SUPPORTED:该资源类型不支持此操作。 RUN_INVALID_STATE:当前状态不允许执行该动作。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
按账本顺序列出运行的等待点。包括当前及历史的 event、timer 与 child 等待点。
GET /automation/v1/runs/{id}/waits
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: id | string | 必填;运行 ID(run_)。 |
| query: limit | integer | 可选;每页条数,整数 1–100,默认 50。 minimum: 1;maximum: 100 |
| query: cursor | string | 可选;上一页返回的 next_cursor,不透明字符串;保持原查询条件继续翻页。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| RUN_ID | 运行 id;暂停和恢复仅工作流;取消需非终态运行 |
: "${RUN_ID:?Set RUN_ID}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/runs/${RUN_ID}/waits" \
-H "Authorization: Bearer $PRAXIS_API_KEY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.runs.waits.list({
"path": {
"id": env("RUN_ID")
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| data | object[] | 必填 / 必有;本页的等待点(当前与历史),按 created_at 倒序、id 倒序排列。 |
| data[].id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| data[].run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| data[].kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| data[].state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| data[].task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| data[].task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| data[].task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| data[].resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| data[].event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| data[].child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| data[].created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| data[].expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| data[].resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| next_cursor | null / string | 必填 / 必有;下一页游标,原样传给 cursor 参数并保持原查询条件;没有更多页为 null。接口不返回总数。 |
HTTP 200
{
"data": [
{
"id": "wait_wf-eebc9ef34869206fa1bcc1e2ae6375990a7ab34c5ad485ac98a4f189c4b37346",
"run_id": "run_00mv67mkw52c7fa90cc9649b1053e66fd836b071f289acb667ff8ca853e65bc4608e9a45bd",
"kind": "event",
"state": "open",
"task": {
"reference": "/do/0/ready",
"name": "ready"
},
"resume_at": null,
"event_type": "ready",
"child_run_id": null,
"created_at": "2026-10-13T04:57:56.982Z",
"expires_at": "2026-10-14T04:57:50.405Z",
"resolved_at": null
}
],
"next_cursor": null
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | RUN_NOT_FOUND:运行不存在或当前租户不可见。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
分页读取调用账本及执行结果。结果按账本顺序列出目标、参数与结果预览、状态和耗时。脚本运行读调用账本;工作流运行的动作调用记在步骤上,这里列出带动作的步骤(不含被跳过的),与 counters.action_calls 一致。
GET /automation/v1/runs/{id}/calls
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: id | string | 必填;运行 ID(run_)。 |
| query: limit | integer | 可选;运行台账每页条数,整数 1–200,默认 50;其它集合上限为 100。 minimum: 1;maximum: 200 |
| query: cursor | string | 可选;上一页返回的 next_cursor,不透明字符串;保持原查询条件继续翻页。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| RUN_ID | 运行 id;暂停和恢复仅工作流;取消需非终态运行 |
: "${RUN_ID:?Set RUN_ID}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/runs/${RUN_ID}/calls" \
-H "Authorization: Bearer $PRAXIS_API_KEY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.runs.calls.list({
"path": {
"id": env("RUN_ID")
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| data | object[] | 必填 / 必有;本页的脚本调用记录,按 seq 顺序排列。 |
| data[].id | string | 必填 / 必有;调用 ID,前缀 call_。 |
| data[].run_id | string | 必填 / 必有;发出该调用的脚本运行 ID(run_ 前缀)。 |
| data[].seq | number | 必填 / 必有;调用在该运行中的序号,随调用顺序递增;与 run_id 一起定位这次调用。 |
| data[].target | object | 必填 / 必有;被调用的目标 {kind, name, revision?, version?}。 不接受额外字段。 |
| data[].target.kind | "action" / "script" / "workflow" / "platform_api" | 必填 / 必有;目标类型。action 为动作;platform_api 为平台 API 操作;script 为脚本;workflow 为工作流。 |
| data[].target.name | string | 必填 / 必有;目标名称:动作为 ns/name,平台 API 为操作名,脚本与工作流为 ns/name。 |
| data[].target.revision | string | 可选;实际执行的动作修订 ID(actr_ 前缀);仅动作调用有。 |
| data[].target.version | string | 可选;实际运行的精确版本号;仅脚本与工作流调用有。 |
| data[].args_preview | string | 必填 / 必有;调用参数的单行预览,由服务端截断;超过 32 KB 的原文存放在对象存储而不内联。 |
| data[].result_preview | null / string | 必填 / 必有;返回值的单行预览,由服务端截断;调用结束前为 null。 |
| data[].status | "running" / "completed" / "faulted" / "cancelled" | 必填 / 必有;调用状态。running 执行中;completed 已正常返回;faulted 失败,error 给出原因;cancelled 因运行被取消而中止。 |
| data[].started_at | string | 必填 / 必有;调用开始的时间(RFC 3339 UTC)。 |
| data[].ended_at | null / string | 必填 / 必有;调用结束的时间(RFC 3339 UTC);仍在执行为 null。 |
| data[].duration_ms | null / number | 必填 / 必有;从开始到结束的毫秒数;未结束为 null。 |
| data[].error | null / object | 必填 / 必有;调用失败时的错误详情;成功或仍在执行为 null。 |
| data[].error(分支2).type | string | 必填 / 必有;平台错误类别,或工作流 raise 定义的完整 URI,原样保留。 |
| data[].error(分支2).code | null / string | 必填 / 必有;稳定错误码,可按码分支处理;没有为 null。 |
| data[].error(分支2).title | string | 必填 / 必有;错误的简短标题。 |
| data[].error(分支2).detail | null / string | 必填 / 必有;错误的详细说明;没有为 null。 |
| data[].error(分支2).source | null / object | 必填 / 必有;错误发生的位置:工作流步骤或脚本调用;未知为 null。 |
| data[].error(分支2).source(分支2).kind | "call" / "task" | 必填 / 必有;位置类型。task 表示工作流步骤;call 表示脚本中的调用。 |
| data[].error(分支2).source(分支2).reference | string | 可选;task 类型时:出错步骤的 JSON Pointer。 |
| data[].error(分支2).source(分支2).seq | number | 可选;call 类型时:出错调用的序号(与 Call.seq 对应)。 |
| data[].error(分支2).source(分支2).action | object | 可选;出错的动作 {name, revision};错误来自动作时才有。 不接受额外字段。 |
| data[].error(分支2).source(分支2).action.name | string | 必填 / 必有;动作全名 ns/name。 |
| data[].error(分支2).source(分支2).action.revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| data[].error(分支2).request_id | string / null | 可选;导致失败的下游响应 X-Request-Id;没有下游响应标识时为 null 或省略。 |
| data[].error(分支2).errors | object[] | 可选;逐字段校验错误;pointer 使用 RFC 6901 指向字段,detail 为中文修正说明。 |
| data[].error(分支2).errors[].pointer | string | 必填 / 必有;RFC 6901 字段指针。TypeScript 源码诊断为 /source(脚本)或 /implementation/source(动作);行列另见 line/column,不拼在指针后。 |
| data[].error(分支2).errors[].detail | string | 必填 / 必有;中文修正说明,指出该位置出了什么问题以及怎样改。 |
| data[].error(分支2).errors[].hint | string | 可选;可选的补充提示,给出下一步可执行的动作(例如改用另一个接口)。 |
| data[].error(分支2).errors[].line | integer | 可选;行号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| data[].error(分支2).errors[].column | integer | 可选;列号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| data[].error(分支2).status | number | 可选;工作流 raise 声明的 HTTP 风格状态;可省略,平台错误可能不提供。 |
| data[].child_run_id | null / string | 必填 / 必有;目标是脚本或工作流时,由本次调用启动的子运行 ID;动作与平台 API 调用为 null。 |
| data[].invocation_key | string | 必填 / 必有;标识这一次逻辑调用的键,随调用发往下游,使至少一次语义下的重试可被去重。 |
| data[].request_id | string / null | 必填 / 必有;下游响应的 X-Request-Id;尚未收到响应或响应未提供该头时为 null。 |
| next_cursor | null / string | 必填 / 必有;下一页游标,原样传给 cursor 参数并保持原查询条件;没有更多页为 null。接口不返回总数。 |
HTTP 200
{
"data": [],
"next_cursor": null
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | RUN_NOT_FOUND:运行不存在或当前租户不可见。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
读取运行产物及其文件引用。按账本顺序返回类型、大小及所属步骤。
GET /automation/v1/runs/{id}/artifacts
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: id | string | 必填;运行 ID(run_)。 |
| query: limit | integer | 可选;每页条数,整数 1–100,默认 50。 minimum: 1;maximum: 100 |
| query: cursor | string | 可选;上一页返回的 next_cursor,不透明字符串;保持原查询条件继续翻页。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| RUN_ID | 运行 id;暂停和恢复仅工作流;取消需非终态运行 |
: "${RUN_ID:?Set RUN_ID}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/runs/${RUN_ID}/artifacts" \
-H "Authorization: Bearer $PRAXIS_API_KEY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.runs.artifacts.list({
"path": {
"id": env("RUN_ID")
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| data | object[] | 必填 / 必有;本页的运行产物,按 created_at 倒序、id 倒序排列。 |
| data[].id | string | 必填 / 必有;产物 ID,按不透明字符串处理。 |
| data[].file_id | string | 必填 / 必有;产物在文件服务中的文件 ID,用文件接口下载内容。 |
| data[].name | string | 必填 / 必有;产物文件名。 |
| data[].content_type | string | 必填 / 必有;产物的 MIME 类型。 |
| data[].size_in_bytes | number | 必填 / 必有;产物大小,单位字节。 |
| data[].task | null / string | 必填 / 必有;产生该产物的工作流步骤的 JSON Pointer;不属于某个步骤为 null。 |
| data[].created_at | string | 必填 / 必有;产物创建时间(RFC 3339 UTC)。 |
| next_cursor | null / string | 必填 / 必有;下一页游标,原样传给 cursor 参数并保持原查询条件;没有更多页为 null。接口不返回总数。 |
HTTP 200
{
"data": [],
"next_cursor": null
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | RUN_NOT_FOUND:运行不存在或当前租户不可见。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
仅完成 event 等待点,payload 上限 32 KiB 且须满足等待条件;timer 与 child 不支持手动完成。相同 id 与相同 payload 重放返回 replayed=true,其他重复提交返回 WAIT_ALREADY_RESOLVED,超时返回 WAIT_EXPIRED。
POST /automation/v1/runs/{id}/waits/{wait_id}/complete
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: id | string | 必填;运行 ID(run_)。 |
| path: wait_id | string | 必填;该运行下的等待点 ID(wait_)。 |
不接受额外字段。
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 可选;可选事件去重 ID;同一等待点重复提交相同 ID 和 payload 返回 replayed=true。 |
| payload | null / string / number / boolean / object / null / string / number / boolean / object / JSON[][] | 必填 / 必有;事件数据,JSON 编码最多 32 KiB;必须满足等待点的过滤条件。 |
| payload(分支5).*(分支5) | object | 递归 JSON 值。 |
| payload(分支5).*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| payload(分支6)[](分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| payload(分支6)[](分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| RUN_ID | 运行 id;暂停和恢复仅工作流;取消需非终态运行 |
| WAIT_ID | 同一运行中 kind=event、state=open 的等待点 id |
: "${RUN_ID:?Set RUN_ID}"
: "${WAIT_ID:?Set WAIT_ID}"
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/runs/${RUN_ID}/waits/${WAIT_ID}/complete" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"payload": {
"answer": 42
}
}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.runs.waits.complete({
"path": {
"id": env("RUN_ID"),
"wait_id": env("WAIT_ID")
},
"body": {
"payload": {
"answer": 42
}
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;等待点 ID,前缀 wait_。 |
| run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件;timer 等待到点;child 等待子运行;本接口只对 event 有效。 |
| state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;完成后的等待点状态。open 仍在等待;resolved 已被满足;expired 已到期;cancelled 已取消。成功提交的事件使其变为 resolved。 |
| task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer。 |
| task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC)。 |
| replayed | boolean | 必填 / 必有;true 表示这是对同一 id 且相同 payload 的重复提交,返回的是原结果而不是再次处理。 |
HTTP 200
{
"id": "wait_wf-eebc9ef34869206fa1bcc1e2ae6375990a7ab34c5ad485ac98a4f189c4b37346",
"run_id": "run_00mv67mkw52c7fa90cc9649b1053e66fd836b071f289acb667ff8ca853e65bc4608e9a45bd",
"kind": "event",
"state": "resolved",
"task": {
"reference": "/do/0/ready",
"name": "ready"
},
"resume_at": null,
"event_type": "ready",
"child_run_id": null,
"created_at": "2026-10-13T04:57:56.982Z",
"expires_at": "2026-10-14T04:57:50.405Z",
"resolved_at": "2026-10-13T04:58:03.972Z",
"replayed": false
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 INPUT_INVALID:输入不满足目标契约或业务校验。 |
| 404 | RUN_NOT_FOUND:运行不存在或当前租户不可见。 WAIT_NOT_FOUND:运行中不存在该等待点。 |
| 409 | OPERATION_NOT_SUPPORTED:该资源类型不支持此操作。 WAIT_ALREADY_RESOLVED:等待点已关闭,或重复事件与原提交不同。 |
| 410 | WAIT_EXPIRED:等待点已超过到期时间。 |
| 413 | PAYLOAD_TOO_LARGE:请求内容超过本操作允许的大小。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
分页读取步骤账本;include=planned 附带尚未执行的顶层步骤,group_by=reference 按步骤引用聚合次数、状态和耗时。
GET /automation/v1/runs/{id}/tasks
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: id | string | 必填;运行 ID(run_)。 |
| query: limit | integer | 可选;运行台账每页条数,整数 1–200,默认 50;其它集合上限为 100。 minimum: 1;maximum: 200 |
| query: cursor | string | 可选;上一页返回的 next_cursor,不透明字符串;保持原查询条件继续翻页。 |
| query: include | "planned" | 可选;仅支持 planned,附带尚未执行的顶层步骤;省略只读已有步骤。 |
| query: group_by | "reference" | 可选;仅支持 reference,按步骤引用聚合循环执行;省略返回逐次步骤。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| RUN_ID | 运行 id;暂停和恢复仅工作流;取消需非终态运行 |
: "${RUN_ID:?Set RUN_ID}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/runs/${RUN_ID}/tasks" \
-H "Authorization: Bearer $PRAXIS_API_KEY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.runs.tasks.list({
"path": {
"id": env("RUN_ID")
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| data | object / object[] | 必填 / 必有;本页的工作流步骤记录;group_by=reference 时为按 reference 聚合的 TaskGroup 行,按执行顺序排列。 |
| data[](分支1).id | string | 必填 / 必有;步骤执行记录的标识,按不透明字符串处理。 |
| data[](分支1).run_id | string | 必填 / 必有;所属运行 ID。 |
| data[](分支1).reference | string | 必填 / 必有;该步骤在工作流文档中的 JSON Pointer,例如 /do/0/start。 |
| data[](分支1).name | string | 必填 / 必有;步骤名,即工作流 YAML 中该步骤的键。 |
| data[](分支1).kind | "run" / "call" / "wait" / "set" / "for" / "fork" / "try" / "switch" / "emit" / "raise" / "listen" / "do" | 必填 / 必有;工作流步骤类型。call 调用动作;run 运行子脚本或子工作流;wait 等待时长;set 设置变量;for 循环;fork 并行分支;try 带捕获的块;switch 条件分支;emit 发出事件;raise 抛出错误;listen 等待事件;do 顺序执行的步骤块。 |
| data[](分支1).iteration | number[] | 必填 / 必有;外层 for 循环的当前迭代下标,由外到内;不在循环中为空数组。 |
| data[](分支1).attempt | number | 必填 / 必有;第几次尝试;步骤因重试而重新执行时递增。 |
| data[](分支1).status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;步骤状态,取值与运行状态相同。pending 尚未开始;running 执行中;waiting 在等待事件、定时器或子运行;suspended 因运行被暂停;cancelled 已取消;faulted 失败;completed 成功完成。 |
| data[](分支1).skipped | boolean | 必填 / 必有;true 表示该步骤被跳过而没有实际执行。 |
| data[](分支1).started_at | null / string | 必填 / 必有;步骤开始的时间(RFC 3339 UTC);未开始为 null。 |
| data[](分支1).ended_at | null / string | 必填 / 必有;步骤结束的时间(RFC 3339 UTC);未结束为 null。 |
| data[](分支1).duration_ms | null / number | 必填 / 必有;执行耗时毫秒数;未结束为 null。 |
| data[](分支1).input | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| data[](分支1).input(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[](分支1).input(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[](分支1).input_truncated | boolean | 必填 / 必有;true 表示 input 超过 32 KB 已被截断。 |
| data[](分支1).output | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| data[](分支1).output(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[](分支1).output(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[](分支1).output_truncated | boolean | 必填 / 必有;输出超过内联限制而被省略时为 true。 |
| data[](分支1).error | null / object | 必填 / 必有;步骤失败时的错误详情;未失败为 null。 |
| data[](分支1).error(分支2).type | string | 必填 / 必有;平台错误类别,或工作流 raise 定义的完整 URI,原样保留。 |
| data[](分支1).error(分支2).code | null / string | 必填 / 必有;稳定错误码,可按码分支处理;没有为 null。 |
| data[](分支1).error(分支2).title | string | 必填 / 必有;错误的简短标题。 |
| data[](分支1).error(分支2).detail | null / string | 必填 / 必有;错误的详细说明;没有为 null。 |
| data[](分支1).error(分支2).source | null / object | 必填 / 必有;错误发生的位置:工作流步骤或脚本调用;未知为 null。 |
| data[](分支1).error(分支2).source(分支2).kind | "call" / "task" | 必填 / 必有;位置类型。task 表示工作流步骤;call 表示脚本中的调用。 |
| data[](分支1).error(分支2).source(分支2).reference | string | 可选;task 类型时:出错步骤的 JSON Pointer。 |
| data[](分支1).error(分支2).source(分支2).seq | number | 可选;call 类型时:出错调用的序号(与 Call.seq 对应)。 |
| data[](分支1).error(分支2).source(分支2).action | object | 可选;出错的动作 {name, revision};错误来自动作时才有。 不接受额外字段。 |
| data[](分支1).error(分支2).source(分支2).action.name | string | 必填 / 必有;动作全名 ns/name。 |
| data[](分支1).error(分支2).source(分支2).action.revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| data[](分支1).error(分支2).request_id | string / null | 可选;导致失败的下游响应 X-Request-Id;没有下游响应标识时为 null 或省略。 |
| data[](分支1).error(分支2).errors | object[] | 可选;逐字段校验错误;pointer 使用 RFC 6901 指向字段,detail 为中文修正说明。 |
| data[](分支1).error(分支2).errors[].pointer | string | 必填 / 必有;RFC 6901 字段指针。TypeScript 源码诊断为 /source(脚本)或 /implementation/source(动作);行列另见 line/column,不拼在指针后。 |
| data[](分支1).error(分支2).errors[].detail | string | 必填 / 必有;中文修正说明,指出该位置出了什么问题以及怎样改。 |
| data[](分支1).error(分支2).errors[].hint | string | 可选;可选的补充提示,给出下一步可执行的动作(例如改用另一个接口)。 |
| data[](分支1).error(分支2).errors[].line | integer | 可选;行号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| data[](分支1).error(分支2).errors[].column | integer | 可选;列号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| data[](分支1).error(分支2).status | number | 可选;工作流 raise 声明的 HTTP 风格状态;可省略,平台错误可能不提供。 |
| data[](分支1).action | null / object | 必填 / 必有;call 步骤执行的动作 {name, revision};其它步骤为 null。 |
| data[](分支1).action(分支2).name | string | 必填 / 必有;动作全名 ns/name。 |
| data[](分支1).action(分支2).revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| data[](分支1).child_run | null / object | 必填 / 必有;run 步骤启动的子运行摘要 {id, number, status, resolved_version};其它步骤为 null。 |
| data[](分支1).child_run(分支2).id | string | 必填 / 必有;子运行 ID(run_ 前缀),创建后即可读取。 |
| data[](分支1).child_run(分支2).number | null / number | 必填 / 必有;子运行在其定义内的序号;临时运行为 null。 |
| data[](分支1).child_run(分支2).status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;子运行的状态。pending 尚未开始;running 执行中;waiting 在等待;suspended 已暂停;cancelled 已取消;faulted 失败;completed 成功完成。等待型子运行在结束时补全终态,detach 的子运行只记录启动时的状态。 |
| data[](分支1).child_run(分支2).resolved_version | null / string | 必填 / 必有;子运行解析到的精确版本号;临时运行为 null。 |
| data[](分支2).reference | string | 必填 / 必有;该步骤在工作流文档中的 JSON Pointer,例如 /do/0/start。 |
| data[](分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中该步骤的键。 |
| data[](分支2).count | number | 必填 / 必有;该 reference 下合并的执行记录条数(循环的迭代数)。 |
| data[](分支2).status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;步骤状态,取值与运行状态相同。pending 尚未开始;running 执行中;waiting 在等待事件、定时器或子运行;suspended 因运行被暂停;cancelled 已取消;faulted 失败;completed 成功完成。 |
| data[](分支2).duration_ms | null / number | 必填 / 必有;执行耗时毫秒数;未结束为 null。 |
| next_cursor | null / string | 必填 / 必有;下一页游标,原样传给 cursor 参数并保持原查询条件;没有更多页为 null。接口不返回总数。 |
HTTP 200
{
"data": [],
"next_cursor": null
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | RUN_NOT_FOUND:运行不存在或当前租户不可见。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
读取 CloudEvents 账本或订阅实时事件流。默认返回 CloudEvents 账本页,Accept: text/event-stream 开启实时流,事件名为 ai.praxis.automation.run.status、ai.praxis.automation.run.progress、ai.praxis.automation.call.started、ai.praxis.automation.call.completed、ai.praxis.automation.task.started、ai.praxis.automation.task.completed、ai.praxis.automation.wait.created、ai.praxis.automation.wait.resolved。id 为续传游标,Last-Event-ID 优先于 cursor;每 20 秒发送 : ping,运行终态后以 event: end 收尾。
GET /automation/v1/runs/{id}/events
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: id | string | 必填;运行 ID(run_)。 |
| query: limit | integer | 可选;每页条数,整数 1–100,默认 50。 minimum: 1;maximum: 100 |
| query: cursor | string | 可选;上一页返回的 next_cursor,不透明字符串;保持原查询条件继续翻页。 |
| header: Accept | "application/json" / "text/event-stream" | 可选;application/json(默认)读取账本页;text/event-stream 订阅实时流。 |
| header: Last-Event-ID | string | 可选;SSE 续传游标,读取该事件之后的记录;优先于 cursor,仅用于实时流。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| RUN_ID | 运行 id;暂停和恢复仅工作流;取消需非终态运行 |
: "${RUN_ID:?Set RUN_ID}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/runs/${RUN_ID}/events" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Accept: text/event-stream"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
for await (const event of automation.runs.events({
"path": {
"id": env("RUN_ID")
}
})) {
console.log(event);
}Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| data | object / object / object / object / object[] | 必填 / 必有;本页的账本事件(RunEvent),按事件顺序排列。 |
| data[](分支1).type | "ai.praxis.automation.run.status" | 必填 / 必有;事件类型:固定为 ai.praxis.automation.run.status,运行状态发生变化,data 为完整的运行。 |
| data[](分支1).data | object | 必填 / 必有;一次运行的完整状态:目标、状态、输入输出、错误、发起方、运行树位置和各类时间。 不接受额外字段。 |
| data[](分支1).data.id | string | 必填 / 必有;不透明运行 ID。新建非确定性 ID 为 run_ + 10 位 base36 毫秒时间前缀 + 64 位 hex DO ID,共 78 字符;旧随机 ID 为 46 字符,历史及确定性 ID 仍有效。同毫秒内不保证创建顺序。 |
| data[](分支1).data.kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| data[](分支1).data.number | null / number | 必填 / 必有;运行在其脚本或工作流内的递增序号;临时运行为 null。 |
| data[](分支1).data.definition | null / object | 必填 / 必有;运行所属的脚本或工作流 {namespace, name};临时运行(直接传 source)为 null。 |
| data[](分支1).data.definition(分支2).namespace | string | 必填 / 必有;脚本或工作流的命名空间。 |
| data[](分支1).data.definition(分支2).name | string | 必填 / 必有;脚本或工作流的名字。 |
| data[](分支1).data.target | null / string | 必填 / 必有;创建时 target 参数的原文(如 acme/report@latest);临时运行为 null。 |
| data[](分支1).data.resolved_version | null / string | 必填 / 必有;target 解析到的精确版本号;临时运行为 null。 |
| data[](分支1).data.source_digest | null / string | 必填 / 必有;临时运行的源码摘要,可用于读取源码;由已发布定义启动的运行为 null。 |
| data[](分支1).data.language | "ts" / "yaml" | 必填 / 必有;源码语言。ts 表示 TypeScript 脚本;yaml 表示工作流 YAML。 |
| data[](分支1).data.status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;运行状态。pending 已创建尚未开始;running 执行中;waiting 工作流在等待事件、定时器或子运行;suspended 工作流被暂停;cancelled 已取消;faulted 失败,error 给出原因;completed 成功完成,output 为结果。后三种是终态。 |
| data[](分支1).data.progress | null / object | 必填 / 必有;运行报告的最新进度 {label, current, total, updated_at};未报告为 null。 |
| data[](分支1).data.progress(分支2).label | string | 必填 / 必有;进度说明文字,例如当前阶段。 |
| data[](分支1).data.progress(分支2).current | null / number | 必填 / 必有;已完成的数量;未报告为 null。 |
| data[](分支1).data.progress(分支2).total | null / number | 必填 / 必有;总量;未知为 null。 |
| data[](分支1).data.progress(分支2).updated_at | string | 必填 / 必有;进度最近一次更新的时间(RFC 3339 UTC)。 |
| data[](分支1).data.current_wait | null / object | 必填 / 必有;运行当前未完成的等待点;不在等待为 null。 |
| data[](分支1).data.current_wait(分支2).id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| data[](分支1).data.current_wait(分支2).run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| data[](分支1).data.current_wait(分支2).kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| data[](分支1).data.current_wait(分支2).state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| data[](分支1).data.current_wait(分支2).task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| data[](分支1).data.current_wait(分支2).task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| data[](分支1).data.current_wait(分支2).task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| data[](分支1).data.current_wait(分支2).resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| data[](分支1).data.current_wait(分支2).event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| data[](分支1).data.current_wait(分支2).child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| data[](分支1).data.current_wait(分支2).created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| data[](分支1).data.current_wait(分支2).expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| data[](分支1).data.current_wait(分支2).resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| data[](分支1).data.counters | object | 必填 / 必有;运行的累计计数。 不接受额外字段。 |
| data[](分支1).data.counters.calls | number | 必填 / 必有;脚本发出的调用总数。 |
| data[](分支1).data.counters.action_calls | number | 必填 / 必有;其中调用动作的次数。 |
| data[](分支1).data.counters.child_runs | number | 必填 / 必有;启动的子运行数。 |
| data[](分支1).data.counters.tasks_completed | number | 必填 / 必有;工作流已完成的步骤数。 |
| data[](分支1).data.counters.tasks_total | null / number | 必填 / 必有;工作流顶层步骤总数;脚本运行为 null。 |
| data[](分支1).data.input | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| data[](分支1).data.input(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[](分支1).data.input(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[](分支1).data.output | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| data[](分支1).data.output(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[](分支1).data.output(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[](分支1).data.error | null / object | 必填 / 必有;运行失败(faulted)时的错误详情;未失败为 null。 |
| data[](分支1).data.error(分支2).type | string | 必填 / 必有;平台错误类别,或工作流 raise 定义的完整 URI,原样保留。 |
| data[](分支1).data.error(分支2).code | null / string | 必填 / 必有;稳定错误码,可按码分支处理;没有为 null。 |
| data[](分支1).data.error(分支2).title | string | 必填 / 必有;错误的简短标题。 |
| data[](分支1).data.error(分支2).detail | null / string | 必填 / 必有;错误的详细说明;没有为 null。 |
| data[](分支1).data.error(分支2).source | null / object | 必填 / 必有;错误发生的位置:工作流步骤或脚本调用;未知为 null。 |
| data[](分支1).data.error(分支2).source(分支2).kind | "call" / "task" | 必填 / 必有;位置类型。task 表示工作流步骤;call 表示脚本中的调用。 |
| data[](分支1).data.error(分支2).source(分支2).reference | string | 可选;task 类型时:出错步骤的 JSON Pointer。 |
| data[](分支1).data.error(分支2).source(分支2).seq | number | 可选;call 类型时:出错调用的序号(与 Call.seq 对应)。 |
| data[](分支1).data.error(分支2).source(分支2).action | object | 可选;出错的动作 {name, revision};错误来自动作时才有。 不接受额外字段。 |
| data[](分支1).data.error(分支2).source(分支2).action.name | string | 必填 / 必有;动作全名 ns/name。 |
| data[](分支1).data.error(分支2).source(分支2).action.revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| data[](分支1).data.error(分支2).request_id | string / null | 可选;导致失败的下游响应 X-Request-Id;没有下游响应标识时为 null 或省略。 |
| data[](分支1).data.error(分支2).errors | object[] | 可选;逐字段校验错误;pointer 使用 RFC 6901 指向字段,detail 为中文修正说明。 |
| data[](分支1).data.error(分支2).errors[].pointer | string | 必填 / 必有;RFC 6901 字段指针。TypeScript 源码诊断为 /source(脚本)或 /implementation/source(动作);行列另见 line/column,不拼在指针后。 |
| data[](分支1).data.error(分支2).errors[].detail | string | 必填 / 必有;中文修正说明,指出该位置出了什么问题以及怎样改。 |
| data[](分支1).data.error(分支2).errors[].hint | string | 可选;可选的补充提示,给出下一步可执行的动作(例如改用另一个接口)。 |
| data[](分支1).data.error(分支2).errors[].line | integer | 可选;行号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| data[](分支1).data.error(分支2).errors[].column | integer | 可选;列号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| data[](分支1).data.error(分支2).status | number | 可选;工作流 raise 声明的 HTTP 风格状态;可省略,平台错误可能不提供。 |
| data[](分支1).data.initiator | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| data[](分支1).data.initiator.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| data[](分支1).data.initiator.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| data[](分支1).data.channel | "run" / "console" / "api" / "internal" / "trigger" | 必填 / 必有;请求进入平台的渠道。console 为控制台(经 BFF);api 为公开 API 调用;internal 为平台内部服务调用;run 为由另一个运行创建的子运行;trigger 为触发器启动。 |
| data[](分支1).data.owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| data[](分支1).data.parent | null / object | 必填 / 必有;派生本运行的父运行 {id, number, definition};根运行为 null。 |
| data[](分支1).data.parent(分支2).id | string | 必填 / 必有;父运行 ID(run_ 前缀)。 |
| data[](分支1).data.parent(分支2).number | null / number | 必填 / 必有;父运行在其定义内的序号;父运行是临时运行时为 null。 |
| data[](分支1).data.parent(分支2).definition | null / object | 必填 / 必有;父运行所属的脚本或工作流 {namespace, name};临时运行为 null。 |
| data[](分支1).data.parent(分支2).definition(分支2).namespace | string | 必填 / 必有;父运行所属定义的命名空间。 |
| data[](分支1).data.parent(分支2).definition(分支2).name | string | 必填 / 必有;父运行所属定义的名字。 |
| data[](分支1).data.parent_run_id | string / null | 必填 / 必有;派生出本运行的父运行 id;根运行为 null |
| data[](分支1).data.root_run_id | string | 必填 / 必有;运行树根运行的 ID;根运行自身指向自己。 |
| data[](分支1).data.depth | number | 必填 / 必有;运行树中的深度:根运行为 0,每一层子运行加 1,最大 10。 |
| data[](分支1).data.attach | null / "wait" / "detach" | 必填 / 必有;子运行与父运行的关系。wait 表示父运行等待子运行结束,且子运行的截止时间不晚于父运行;detach 表示父运行不等待,也不会因父运行取消而被取消;根运行为 null。 |
| data[](分支1).data.deadline_at | string | 必填 / 必有;运行的截止时间(RFC 3339 UTC):创建时间加 deadline_seconds(脚本默认且最多 300 秒,工作流默认 86400 秒、最多 604800 秒),等待型子运行不晚于父运行截止前 1 秒。 |
| data[](分支1).data.created_at | string | 必填 / 必有;运行创建时间(RFC 3339 UTC)。 |
| data[](分支1).data.started_at | null / string | 必填 / 必有;开始执行的时间(RFC 3339 UTC);仍在排队为 null。 |
| data[](分支1).data.ended_at | null / string | 必填 / 必有;进入终态的时间(RFC 3339 UTC);尚未结束为 null。 |
| data[](分支1).data.updated_at | string | 必填 / 必有;运行记录最近一次更新的时间(RFC 3339 UTC)。 |
| data[](分支1).data.heartbeat_at | null / string | 必填 / 必有;执行器最近一次存活信号的时间(RFC 3339 UTC);尚未开始为 null。 |
| data[](分支1).data.cancel_requested_at | null / string | 必填 / 必有;收到取消请求的时间(RFC 3339 UTC);未取消为 null。 |
| data[](分支1).data.cancelled_by | null / object | 必填 / 必有;请求取消的主体;未取消或非人为取消为 null。 |
| data[](分支1).data.cancelled_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| data[](分支1).data.cancelled_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| data[](分支1).data.cancel_reason | null / "user" / "parent_cancelled" / "deadline" / "executor_lost" | 必填 / 必有;取消原因。user 为用户取消;parent_cancelled 为父运行被取消而级联取消;deadline 为超过截止时间;executor_lost 为执行器丢失;未取消为 null。 |
| data[](分支1).data.suspend_requested_at | null / string | 必填 / 必有;请求暂停工作流的时间(RFC 3339 UTC);未暂停为 null。 |
| data[](分支1).data.suspended_by | null / object | 必填 / 必有;请求暂停的主体;未暂停为 null。 |
| data[](分支1).data.suspended_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| data[](分支1).data.suspended_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| data[](分支1).data.queued_ms | null / number | 必填 / 必有;从创建到开始执行的排队毫秒数;尚未开始为 null。 |
| data[](分支1).data.run_ms | null / number | 必填 / 必有;实际执行毫秒数,不含等待点上的等待时间;结束后固定。 |
| data[](分支1).data.wait_ms | null / number | 必填 / 必有;在等待点上累计等待的毫秒数;尚无等待为 null。 |
| data[](分支1).data.usage | object / null | 必填 / 必有;仅单个运行详情(含 expand)返回;列表为 null。运行本身不收费;这里是运行中调用模型、搜索等能力产生的实扣,按调用归因;未评级的用量稍后计入。汇总超时(1.5 秒)或失败时为 null,详情仍返回 200。 |
| data[](分支1).data.usage(分支1).currency | "USD" | 必填 / 必有;金额币种,固定为 USD。 |
| data[](分支1).data.usage(分支1).cost | string | 必填 / 必有;仅本运行自身的已评级实扣(不含子运行),美元十进制字符串,精确到 6 位小数;没有用量时为 0.000000。 pattern: "^[0-9]+\.[0-9]{6}$" |
| data[](分支1).data.usage(分支1).pending_events | integer | 必填 / 必有;本运行自身尚未评级的用量事件数,金额稍后才计入。 minimum: 0 |
| data[](分支1).data.usage(分支1).by_service | object[] | 必填 / 必有;本运行按服务拆分的实扣,每项为 service 与 cost(6 位小数美元字符串);没有用量时为空数组。 |
| data[](分支1).data.usage(分支1).by_service[].service | string | 必填 / 必有;产生用量的服务名,例如 router 或 search。 |
| data[](分支1).data.usage(分支1).by_service[].cost | string | 必填 / 必有;该服务已评级实扣的美元十进制字符串,精确到 6 位小数。 pattern: "^[0-9]+\.[0-9]{6}$" |
| data[](分支1).data.usage(分支1).tree_cost | string / null | 必填 / 必有;仅根运行返回整棵运行树的已评级实扣(含自身),6 位小数美元字符串;子运行为 null。 |
| data[](分支1).data.rerun_of | null / string | 必填 / 必有;重跑来源:本运行是对哪个运行(run_ ID)的重跑;否则为 null。 |
| data[](分支1).data.labels | object | 必填 / 必有;用户标签与系统标签;触发器运行支持 64 个用户标签,系统标签不占用名额。 |
| data[](分支1).data.trigger | object / null | 必填 / 必有;启动本运行的触发器 {id, name};不是触发器启动时为 null。 |
| data[](分支1).data.trigger(分支1).id | string | 必填 / 必有;启动本运行的触发器 ID(trg_ 前缀)。 |
| data[](分支1).data.trigger(分支1).name | string | 必填 / 必有;启动本运行的触发器名称。 |
| data[](分支1).data.cancel_message | string / null | 必填 / 必有;用户提供的取消备注(1–500 字符);未提供时为 null,cancel_reason 枚举不变。 |
| data[](分支1).data.input_truncated | boolean | 可选;列表省略外置 input 时为 true,此时 input 为 null;内联值不变,运行详情返回完整值。 |
| data[](分支1).data.output_truncated | boolean | 可选;列表省略外置 output 时为 true,此时 output 为 null;内联值不变,运行详情返回完整值。 |
| data[](分支1).specversion | "1.0" | 必填 / 必有;CloudEvents 规范版本,固定为 1.0。 |
| data[](分支1).id | string | 必填 / 必有;事件 ID,在该运行的账本内唯一。 |
| data[](分支1).source | string | 必填 / 必有;事件来源,形如 /automation/v1/runs/{id}。 |
| data[](分支1).time | string | 必填 / 必有;事件发生的时间(RFC 3339 UTC)。 |
| data[](分支1).cursor | string | 必填 / 必有;事件游标;用作 cursor 翻页,或在 SSE 中作为 Last-Event-ID 续传。 |
| data[](分支1).seq | number | 必填 / 必有;事件在运行账本中的序号,严格递增。 |
| data[](分支2).type | "ai.praxis.automation.run.progress" | 必填 / 必有;事件类型:固定为 ai.praxis.automation.run.progress,运行上报了新进度,data 为进度。 |
| data[](分支2).data | object | 必填 / 必有;运行报告的进度,包含说明、已完成量与总量。 不接受额外字段。 |
| data[](分支2).data.label | string | 必填 / 必有;进度说明文字,例如当前阶段。 |
| data[](分支2).data.current | null / number | 必填 / 必有;已完成的数量;未报告为 null。 |
| data[](分支2).data.total | null / number | 必填 / 必有;总量;未知为 null。 |
| data[](分支2).data.updated_at | string | 必填 / 必有;进度最近一次更新的时间(RFC 3339 UTC)。 |
| data[](分支2).specversion | "1.0" | 必填 / 必有;CloudEvents 规范版本,固定为 1.0。 |
| data[](分支2).id | string | 必填 / 必有;事件 ID,在该运行的账本内唯一。 |
| data[](分支2).source | string | 必填 / 必有;事件来源,形如 /automation/v1/runs/{id}。 |
| data[](分支2).time | string | 必填 / 必有;事件发生的时间(RFC 3339 UTC)。 |
| data[](分支2).cursor | string | 必填 / 必有;事件游标;用作 cursor 翻页,或在 SSE 中作为 Last-Event-ID 续传。 |
| data[](分支2).seq | number | 必填 / 必有;事件在运行账本中的序号,严格递增。 |
| data[](分支3).type | "ai.praxis.automation.call.started" / "ai.praxis.automation.call.completed" | 必填 / 必有;事件类型。ai.praxis.automation.call.started 调用开始;ai.praxis.automation.call.completed 调用结束(成功或失败);data 为调用记录。 |
| data[](分支3).data | object | 必填 / 必有;脚本运行中的一次调用记录(动作、平台 API、脚本或工作流),按 seq 顺序排列。 不接受额外字段。 |
| data[](分支3).data.id | string | 必填 / 必有;调用 ID,前缀 call_。 |
| data[](分支3).data.run_id | string | 必填 / 必有;发出该调用的脚本运行 ID(run_ 前缀)。 |
| data[](分支3).data.seq | number | 必填 / 必有;调用在该运行中的序号,随调用顺序递增;与 run_id 一起定位这次调用。 |
| data[](分支3).data.target | object | 必填 / 必有;被调用的目标 {kind, name, revision?, version?}。 不接受额外字段。 |
| data[](分支3).data.target.kind | "action" / "script" / "workflow" / "platform_api" | 必填 / 必有;目标类型。action 为动作;platform_api 为平台 API 操作;script 为脚本;workflow 为工作流。 |
| data[](分支3).data.target.name | string | 必填 / 必有;目标名称:动作为 ns/name,平台 API 为操作名,脚本与工作流为 ns/name。 |
| data[](分支3).data.target.revision | string | 可选;实际执行的动作修订 ID(actr_ 前缀);仅动作调用有。 |
| data[](分支3).data.target.version | string | 可选;实际运行的精确版本号;仅脚本与工作流调用有。 |
| data[](分支3).data.args_preview | string | 必填 / 必有;调用参数的单行预览,由服务端截断;超过 32 KB 的原文存放在对象存储而不内联。 |
| data[](分支3).data.result_preview | null / string | 必填 / 必有;返回值的单行预览,由服务端截断;调用结束前为 null。 |
| data[](分支3).data.status | "running" / "completed" / "faulted" / "cancelled" | 必填 / 必有;调用状态。running 执行中;completed 已正常返回;faulted 失败,error 给出原因;cancelled 因运行被取消而中止。 |
| data[](分支3).data.started_at | string | 必填 / 必有;调用开始的时间(RFC 3339 UTC)。 |
| data[](分支3).data.ended_at | null / string | 必填 / 必有;调用结束的时间(RFC 3339 UTC);仍在执行为 null。 |
| data[](分支3).data.duration_ms | null / number | 必填 / 必有;从开始到结束的毫秒数;未结束为 null。 |
| data[](分支3).data.error | null / object | 必填 / 必有;调用失败时的错误详情;成功或仍在执行为 null。 |
| data[](分支3).data.error(分支2).type | string | 必填 / 必有;平台错误类别,或工作流 raise 定义的完整 URI,原样保留。 |
| data[](分支3).data.error(分支2).code | null / string | 必填 / 必有;稳定错误码,可按码分支处理;没有为 null。 |
| data[](分支3).data.error(分支2).title | string | 必填 / 必有;错误的简短标题。 |
| data[](分支3).data.error(分支2).detail | null / string | 必填 / 必有;错误的详细说明;没有为 null。 |
| data[](分支3).data.error(分支2).source | null / object | 必填 / 必有;错误发生的位置:工作流步骤或脚本调用;未知为 null。 |
| data[](分支3).data.error(分支2).source(分支2).kind | "call" / "task" | 必填 / 必有;位置类型。task 表示工作流步骤;call 表示脚本中的调用。 |
| data[](分支3).data.error(分支2).source(分支2).reference | string | 可选;task 类型时:出错步骤的 JSON Pointer。 |
| data[](分支3).data.error(分支2).source(分支2).seq | number | 可选;call 类型时:出错调用的序号(与 Call.seq 对应)。 |
| data[](分支3).data.error(分支2).source(分支2).action | object | 可选;出错的动作 {name, revision};错误来自动作时才有。 不接受额外字段。 |
| data[](分支3).data.error(分支2).source(分支2).action.name | string | 必填 / 必有;动作全名 ns/name。 |
| data[](分支3).data.error(分支2).source(分支2).action.revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| data[](分支3).data.error(分支2).request_id | string / null | 可选;导致失败的下游响应 X-Request-Id;没有下游响应标识时为 null 或省略。 |
| data[](分支3).data.error(分支2).errors | object[] | 可选;逐字段校验错误;pointer 使用 RFC 6901 指向字段,detail 为中文修正说明。 |
| data[](分支3).data.error(分支2).errors[].pointer | string | 必填 / 必有;RFC 6901 字段指针。TypeScript 源码诊断为 /source(脚本)或 /implementation/source(动作);行列另见 line/column,不拼在指针后。 |
| data[](分支3).data.error(分支2).errors[].detail | string | 必填 / 必有;中文修正说明,指出该位置出了什么问题以及怎样改。 |
| data[](分支3).data.error(分支2).errors[].hint | string | 可选;可选的补充提示,给出下一步可执行的动作(例如改用另一个接口)。 |
| data[](分支3).data.error(分支2).errors[].line | integer | 可选;行号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| data[](分支3).data.error(分支2).errors[].column | integer | 可选;列号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| data[](分支3).data.error(分支2).status | number | 可选;工作流 raise 声明的 HTTP 风格状态;可省略,平台错误可能不提供。 |
| data[](分支3).data.child_run_id | null / string | 必填 / 必有;目标是脚本或工作流时,由本次调用启动的子运行 ID;动作与平台 API 调用为 null。 |
| data[](分支3).data.invocation_key | string | 必填 / 必有;标识这一次逻辑调用的键,随调用发往下游,使至少一次语义下的重试可被去重。 |
| data[](分支3).data.request_id | string / null | 必填 / 必有;下游响应的 X-Request-Id;尚未收到响应或响应未提供该头时为 null。 |
| data[](分支3).specversion | "1.0" | 必填 / 必有;CloudEvents 规范版本,固定为 1.0。 |
| data[](分支3).id | string | 必填 / 必有;事件 ID,在该运行的账本内唯一。 |
| data[](分支3).source | string | 必填 / 必有;事件来源,形如 /automation/v1/runs/{id}。 |
| data[](分支3).time | string | 必填 / 必有;事件发生的时间(RFC 3339 UTC)。 |
| data[](分支3).cursor | string | 必填 / 必有;事件游标;用作 cursor 翻页,或在 SSE 中作为 Last-Event-ID 续传。 |
| data[](分支3).seq | number | 必填 / 必有;事件在运行账本中的序号,严格递增。 |
| data[](分支4).type | "ai.praxis.automation.task.started" / "ai.praxis.automation.task.completed" | 必填 / 必有;事件类型。ai.praxis.automation.task.started 步骤开始;ai.praxis.automation.task.completed 步骤结束;data 为步骤记录。 |
| data[](分支4).data | object | 必填 / 必有;工作流中一个步骤的一次执行记录。循环会让同一步骤产生多条记录(iteration 不同),重试会让 attempt 递增。 不接受额外字段。 |
| data[](分支4).data.id | string | 必填 / 必有;步骤执行记录的标识,按不透明字符串处理。 |
| data[](分支4).data.run_id | string | 必填 / 必有;所属运行 ID。 |
| data[](分支4).data.reference | string | 必填 / 必有;该步骤在工作流文档中的 JSON Pointer,例如 /do/0/start。 |
| data[](分支4).data.name | string | 必填 / 必有;步骤名,即工作流 YAML 中该步骤的键。 |
| data[](分支4).data.kind | "run" / "call" / "wait" / "set" / "for" / "fork" / "try" / "switch" / "emit" / "raise" / "listen" / "do" | 必填 / 必有;工作流步骤类型。call 调用动作;run 运行子脚本或子工作流;wait 等待时长;set 设置变量;for 循环;fork 并行分支;try 带捕获的块;switch 条件分支;emit 发出事件;raise 抛出错误;listen 等待事件;do 顺序执行的步骤块。 |
| data[](分支4).data.iteration | number[] | 必填 / 必有;外层 for 循环的当前迭代下标,由外到内;不在循环中为空数组。 |
| data[](分支4).data.attempt | number | 必填 / 必有;第几次尝试;步骤因重试而重新执行时递增。 |
| data[](分支4).data.status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;步骤状态,取值与运行状态相同。pending 尚未开始;running 执行中;waiting 在等待事件、定时器或子运行;suspended 因运行被暂停;cancelled 已取消;faulted 失败;completed 成功完成。 |
| data[](分支4).data.skipped | boolean | 必填 / 必有;true 表示该步骤被跳过而没有实际执行。 |
| data[](分支4).data.started_at | null / string | 必填 / 必有;步骤开始的时间(RFC 3339 UTC);未开始为 null。 |
| data[](分支4).data.ended_at | null / string | 必填 / 必有;步骤结束的时间(RFC 3339 UTC);未结束为 null。 |
| data[](分支4).data.duration_ms | null / number | 必填 / 必有;执行耗时毫秒数;未结束为 null。 |
| data[](分支4).data.input | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| data[](分支4).data.input(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[](分支4).data.input(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[](分支4).data.input_truncated | boolean | 必填 / 必有;true 表示 input 超过 32 KB 已被截断。 |
| data[](分支4).data.output | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| data[](分支4).data.output(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[](分支4).data.output(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[](分支4).data.output_truncated | boolean | 必填 / 必有;输出超过内联限制而被省略时为 true。 |
| data[](分支4).data.error | null / object | 必填 / 必有;步骤失败时的错误详情;未失败为 null。 |
| data[](分支4).data.error(分支2).type | string | 必填 / 必有;平台错误类别,或工作流 raise 定义的完整 URI,原样保留。 |
| data[](分支4).data.error(分支2).code | null / string | 必填 / 必有;稳定错误码,可按码分支处理;没有为 null。 |
| data[](分支4).data.error(分支2).title | string | 必填 / 必有;错误的简短标题。 |
| data[](分支4).data.error(分支2).detail | null / string | 必填 / 必有;错误的详细说明;没有为 null。 |
| data[](分支4).data.error(分支2).source | null / object | 必填 / 必有;错误发生的位置:工作流步骤或脚本调用;未知为 null。 |
| data[](分支4).data.error(分支2).source(分支2).kind | "call" / "task" | 必填 / 必有;位置类型。task 表示工作流步骤;call 表示脚本中的调用。 |
| data[](分支4).data.error(分支2).source(分支2).reference | string | 可选;task 类型时:出错步骤的 JSON Pointer。 |
| data[](分支4).data.error(分支2).source(分支2).seq | number | 可选;call 类型时:出错调用的序号(与 Call.seq 对应)。 |
| data[](分支4).data.error(分支2).source(分支2).action | object | 可选;出错的动作 {name, revision};错误来自动作时才有。 不接受额外字段。 |
| data[](分支4).data.error(分支2).source(分支2).action.name | string | 必填 / 必有;动作全名 ns/name。 |
| data[](分支4).data.error(分支2).source(分支2).action.revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| data[](分支4).data.error(分支2).request_id | string / null | 可选;导致失败的下游响应 X-Request-Id;没有下游响应标识时为 null 或省略。 |
| data[](分支4).data.error(分支2).errors | object[] | 可选;逐字段校验错误;pointer 使用 RFC 6901 指向字段,detail 为中文修正说明。 |
| data[](分支4).data.error(分支2).errors[].pointer | string | 必填 / 必有;RFC 6901 字段指针。TypeScript 源码诊断为 /source(脚本)或 /implementation/source(动作);行列另见 line/column,不拼在指针后。 |
| data[](分支4).data.error(分支2).errors[].detail | string | 必填 / 必有;中文修正说明,指出该位置出了什么问题以及怎样改。 |
| data[](分支4).data.error(分支2).errors[].hint | string | 可选;可选的补充提示,给出下一步可执行的动作(例如改用另一个接口)。 |
| data[](分支4).data.error(分支2).errors[].line | integer | 可选;行号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| data[](分支4).data.error(分支2).errors[].column | integer | 可选;列号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| data[](分支4).data.error(分支2).status | number | 可选;工作流 raise 声明的 HTTP 风格状态;可省略,平台错误可能不提供。 |
| data[](分支4).data.action | null / object | 必填 / 必有;call 步骤执行的动作 {name, revision};其它步骤为 null。 |
| data[](分支4).data.action(分支2).name | string | 必填 / 必有;动作全名 ns/name。 |
| data[](分支4).data.action(分支2).revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| data[](分支4).data.child_run | null / object | 必填 / 必有;run 步骤启动的子运行摘要 {id, number, status, resolved_version};其它步骤为 null。 |
| data[](分支4).data.child_run(分支2).id | string | 必填 / 必有;子运行 ID(run_ 前缀),创建后即可读取。 |
| data[](分支4).data.child_run(分支2).number | null / number | 必填 / 必有;子运行在其定义内的序号;临时运行为 null。 |
| data[](分支4).data.child_run(分支2).status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;子运行的状态。pending 尚未开始;running 执行中;waiting 在等待;suspended 已暂停;cancelled 已取消;faulted 失败;completed 成功完成。等待型子运行在结束时补全终态,detach 的子运行只记录启动时的状态。 |
| data[](分支4).data.child_run(分支2).resolved_version | null / string | 必填 / 必有;子运行解析到的精确版本号;临时运行为 null。 |
| data[](分支4).specversion | "1.0" | 必填 / 必有;CloudEvents 规范版本,固定为 1.0。 |
| data[](分支4).id | string | 必填 / 必有;事件 ID,在该运行的账本内唯一。 |
| data[](分支4).source | string | 必填 / 必有;事件来源,形如 /automation/v1/runs/{id}。 |
| data[](分支4).time | string | 必填 / 必有;事件发生的时间(RFC 3339 UTC)。 |
| data[](分支4).cursor | string | 必填 / 必有;事件游标;用作 cursor 翻页,或在 SSE 中作为 Last-Event-ID 续传。 |
| data[](分支4).seq | number | 必填 / 必有;事件在运行账本中的序号,严格递增。 |
| data[](分支5).type | "ai.praxis.automation.wait.created" / "ai.praxis.automation.wait.resolved" | 必填 / 必有;事件类型。ai.praxis.automation.wait.created 等待点创建;ai.praxis.automation.wait.resolved 等待点被满足、到期或取消;data 为等待点。 |
| data[](分支5).data | object | 必填 / 必有;运行上的一个等待点,工作流在它被满足、到期或取消之前不会继续。 不接受额外字段。 |
| data[](分支5).data.id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| data[](分支5).data.run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| data[](分支5).data.kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| data[](分支5).data.state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| data[](分支5).data.task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| data[](分支5).data.task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| data[](分支5).data.task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| data[](分支5).data.resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| data[](分支5).data.event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| data[](分支5).data.child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| data[](分支5).data.created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| data[](分支5).data.expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| data[](分支5).data.resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| data[](分支5).specversion | "1.0" | 必填 / 必有;CloudEvents 规范版本,固定为 1.0。 |
| data[](分支5).id | string | 必填 / 必有;事件 ID,在该运行的账本内唯一。 |
| data[](分支5).source | string | 必填 / 必有;事件来源,形如 /automation/v1/runs/{id}。 |
| data[](分支5).time | string | 必填 / 必有;事件发生的时间(RFC 3339 UTC)。 |
| data[](分支5).cursor | string | 必填 / 必有;事件游标;用作 cursor 翻页,或在 SSE 中作为 Last-Event-ID 续传。 |
| data[](分支5).seq | number | 必填 / 必有;事件在运行账本中的序号,严格递增。 |
| next_cursor | null / string | 必填 / 必有;下一页游标,原样传给 cursor 参数并保持原查询条件;没有更多页为 null。接口不返回总数。 |
text/event-stream
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 可选;Resume cursor of this entry; send it back as Last-Event-ID, or as cursor on the JSON form, to continue after it. Absent on the end event. |
| event | "ai.praxis.automation.run.status" / "ai.praxis.automation.run.progress" / "ai.praxis.automation.call.started" / "ai.praxis.automation.call.completed" / "ai.praxis.automation.task.started" / "ai.praxis.automation.task.completed" / "ai.praxis.automation.wait.created" / "ai.praxis.automation.wait.resolved" / "end" | 必填 / 必有;SSE event name: one of ai.praxis.automation.run.status, ai.praxis.automation.run.progress, ai.praxis.automation.call.started, ai.praxis.automation.call.completed, ai.praxis.automation.task.started, ai.praxis.automation.task.completed, ai.praxis.automation.wait.created, ai.praxis.automation.wait.resolved, naming the RunEvent type carried in data; end is sent once when the run has reached a terminal status and closes the stream. |
| data | object / object / object / object / object / object | 必填 / 必有;Decoded JSON of one run event, whose shape is selected by its type; for the end event, an empty object. |
| data(分支1)(分支1).type | "ai.praxis.automation.run.status" | 必填 / 必有;事件类型:固定为 ai.praxis.automation.run.status,运行状态发生变化,data 为完整的运行。 |
| data(分支1)(分支1).data | object | 必填 / 必有;一次运行的完整状态:目标、状态、输入输出、错误、发起方、运行树位置和各类时间。 不接受额外字段。 |
| data(分支1)(分支1).data.id | string | 必填 / 必有;不透明运行 ID。新建非确定性 ID 为 run_ + 10 位 base36 毫秒时间前缀 + 64 位 hex DO ID,共 78 字符;旧随机 ID 为 46 字符,历史及确定性 ID 仍有效。同毫秒内不保证创建顺序。 |
| data(分支1)(分支1).data.kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| data(分支1)(分支1).data.number | null / number | 必填 / 必有;运行在其脚本或工作流内的递增序号;临时运行为 null。 |
| data(分支1)(分支1).data.definition | null / object | 必填 / 必有;运行所属的脚本或工作流 {namespace, name};临时运行(直接传 source)为 null。 |
| data(分支1)(分支1).data.definition(分支2).namespace | string | 必填 / 必有;脚本或工作流的命名空间。 |
| data(分支1)(分支1).data.definition(分支2).name | string | 必填 / 必有;脚本或工作流的名字。 |
| data(分支1)(分支1).data.target | null / string | 必填 / 必有;创建时 target 参数的原文(如 acme/report@latest);临时运行为 null。 |
| data(分支1)(分支1).data.resolved_version | null / string | 必填 / 必有;target 解析到的精确版本号;临时运行为 null。 |
| data(分支1)(分支1).data.source_digest | null / string | 必填 / 必有;临时运行的源码摘要,可用于读取源码;由已发布定义启动的运行为 null。 |
| data(分支1)(分支1).data.language | "ts" / "yaml" | 必填 / 必有;源码语言。ts 表示 TypeScript 脚本;yaml 表示工作流 YAML。 |
| data(分支1)(分支1).data.status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;运行状态。pending 已创建尚未开始;running 执行中;waiting 工作流在等待事件、定时器或子运行;suspended 工作流被暂停;cancelled 已取消;faulted 失败,error 给出原因;completed 成功完成,output 为结果。后三种是终态。 |
| data(分支1)(分支1).data.progress | null / object | 必填 / 必有;运行报告的最新进度 {label, current, total, updated_at};未报告为 null。 |
| data(分支1)(分支1).data.progress(分支2).label | string | 必填 / 必有;进度说明文字,例如当前阶段。 |
| data(分支1)(分支1).data.progress(分支2).current | null / number | 必填 / 必有;已完成的数量;未报告为 null。 |
| data(分支1)(分支1).data.progress(分支2).total | null / number | 必填 / 必有;总量;未知为 null。 |
| data(分支1)(分支1).data.progress(分支2).updated_at | string | 必填 / 必有;进度最近一次更新的时间(RFC 3339 UTC)。 |
| data(分支1)(分支1).data.current_wait | null / object | 必填 / 必有;运行当前未完成的等待点;不在等待为 null。 |
| data(分支1)(分支1).data.current_wait(分支2).id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| data(分支1)(分支1).data.current_wait(分支2).run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| data(分支1)(分支1).data.current_wait(分支2).kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| data(分支1)(分支1).data.current_wait(分支2).state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| data(分支1)(分支1).data.current_wait(分支2).task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| data(分支1)(分支1).data.current_wait(分支2).task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| data(分支1)(分支1).data.current_wait(分支2).task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| data(分支1)(分支1).data.current_wait(分支2).resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| data(分支1)(分支1).data.current_wait(分支2).event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| data(分支1)(分支1).data.current_wait(分支2).child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| data(分支1)(分支1).data.current_wait(分支2).created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| data(分支1)(分支1).data.current_wait(分支2).expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| data(分支1)(分支1).data.current_wait(分支2).resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| data(分支1)(分支1).data.counters | object | 必填 / 必有;运行的累计计数。 不接受额外字段。 |
| data(分支1)(分支1).data.counters.calls | number | 必填 / 必有;脚本发出的调用总数。 |
| data(分支1)(分支1).data.counters.action_calls | number | 必填 / 必有;其中调用动作的次数。 |
| data(分支1)(分支1).data.counters.child_runs | number | 必填 / 必有;启动的子运行数。 |
| data(分支1)(分支1).data.counters.tasks_completed | number | 必填 / 必有;工作流已完成的步骤数。 |
| data(分支1)(分支1).data.counters.tasks_total | null / number | 必填 / 必有;工作流顶层步骤总数;脚本运行为 null。 |
| data(分支1)(分支1).data.input | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| data(分支1)(分支1).data.input(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data(分支1)(分支1).data.input(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data(分支1)(分支1).data.output | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| data(分支1)(分支1).data.output(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data(分支1)(分支1).data.output(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data(分支1)(分支1).data.error | null / object | 必填 / 必有;运行失败(faulted)时的错误详情;未失败为 null。 |
| data(分支1)(分支1).data.error(分支2).type | string | 必填 / 必有;平台错误类别,或工作流 raise 定义的完整 URI,原样保留。 |
| data(分支1)(分支1).data.error(分支2).code | null / string | 必填 / 必有;稳定错误码,可按码分支处理;没有为 null。 |
| data(分支1)(分支1).data.error(分支2).title | string | 必填 / 必有;错误的简短标题。 |
| data(分支1)(分支1).data.error(分支2).detail | null / string | 必填 / 必有;错误的详细说明;没有为 null。 |
| data(分支1)(分支1).data.error(分支2).source | null / object | 必填 / 必有;错误发生的位置:工作流步骤或脚本调用;未知为 null。 |
| data(分支1)(分支1).data.error(分支2).source(分支2).kind | "call" / "task" | 必填 / 必有;位置类型。task 表示工作流步骤;call 表示脚本中的调用。 |
| data(分支1)(分支1).data.error(分支2).source(分支2).reference | string | 可选;task 类型时:出错步骤的 JSON Pointer。 |
| data(分支1)(分支1).data.error(分支2).source(分支2).seq | number | 可选;call 类型时:出错调用的序号(与 Call.seq 对应)。 |
| data(分支1)(分支1).data.error(分支2).source(分支2).action | object | 可选;出错的动作 {name, revision};错误来自动作时才有。 不接受额外字段。 |
| data(分支1)(分支1).data.error(分支2).source(分支2).action.name | string | 必填 / 必有;动作全名 ns/name。 |
| data(分支1)(分支1).data.error(分支2).source(分支2).action.revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| data(分支1)(分支1).data.error(分支2).request_id | string / null | 可选;导致失败的下游响应 X-Request-Id;没有下游响应标识时为 null 或省略。 |
| data(分支1)(分支1).data.error(分支2).errors | object[] | 可选;逐字段校验错误;pointer 使用 RFC 6901 指向字段,detail 为中文修正说明。 |
| data(分支1)(分支1).data.error(分支2).errors[].pointer | string | 必填 / 必有;RFC 6901 字段指针。TypeScript 源码诊断为 /source(脚本)或 /implementation/source(动作);行列另见 line/column,不拼在指针后。 |
| data(分支1)(分支1).data.error(分支2).errors[].detail | string | 必填 / 必有;中文修正说明,指出该位置出了什么问题以及怎样改。 |
| data(分支1)(分支1).data.error(分支2).errors[].hint | string | 可选;可选的补充提示,给出下一步可执行的动作(例如改用另一个接口)。 |
| data(分支1)(分支1).data.error(分支2).errors[].line | integer | 可选;行号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| data(分支1)(分支1).data.error(分支2).errors[].column | integer | 可选;列号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| data(分支1)(分支1).data.error(分支2).status | number | 可选;工作流 raise 声明的 HTTP 风格状态;可省略,平台错误可能不提供。 |
| data(分支1)(分支1).data.initiator | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| data(分支1)(分支1).data.initiator.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| data(分支1)(分支1).data.initiator.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| data(分支1)(分支1).data.channel | "run" / "console" / "api" / "internal" / "trigger" | 必填 / 必有;请求进入平台的渠道。console 为控制台(经 BFF);api 为公开 API 调用;internal 为平台内部服务调用;run 为由另一个运行创建的子运行;trigger 为触发器启动。 |
| data(分支1)(分支1).data.owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| data(分支1)(分支1).data.parent | null / object | 必填 / 必有;派生本运行的父运行 {id, number, definition};根运行为 null。 |
| data(分支1)(分支1).data.parent(分支2).id | string | 必填 / 必有;父运行 ID(run_ 前缀)。 |
| data(分支1)(分支1).data.parent(分支2).number | null / number | 必填 / 必有;父运行在其定义内的序号;父运行是临时运行时为 null。 |
| data(分支1)(分支1).data.parent(分支2).definition | null / object | 必填 / 必有;父运行所属的脚本或工作流 {namespace, name};临时运行为 null。 |
| data(分支1)(分支1).data.parent(分支2).definition(分支2).namespace | string | 必填 / 必有;父运行所属定义的命名空间。 |
| data(分支1)(分支1).data.parent(分支2).definition(分支2).name | string | 必填 / 必有;父运行所属定义的名字。 |
| data(分支1)(分支1).data.parent_run_id | string / null | 必填 / 必有;派生出本运行的父运行 id;根运行为 null |
| data(分支1)(分支1).data.root_run_id | string | 必填 / 必有;运行树根运行的 ID;根运行自身指向自己。 |
| data(分支1)(分支1).data.depth | number | 必填 / 必有;运行树中的深度:根运行为 0,每一层子运行加 1,最大 10。 |
| data(分支1)(分支1).data.attach | null / "wait" / "detach" | 必填 / 必有;子运行与父运行的关系。wait 表示父运行等待子运行结束,且子运行的截止时间不晚于父运行;detach 表示父运行不等待,也不会因父运行取消而被取消;根运行为 null。 |
| data(分支1)(分支1).data.deadline_at | string | 必填 / 必有;运行的截止时间(RFC 3339 UTC):创建时间加 deadline_seconds(脚本默认且最多 300 秒,工作流默认 86400 秒、最多 604800 秒),等待型子运行不晚于父运行截止前 1 秒。 |
| data(分支1)(分支1).data.created_at | string | 必填 / 必有;运行创建时间(RFC 3339 UTC)。 |
| data(分支1)(分支1).data.started_at | null / string | 必填 / 必有;开始执行的时间(RFC 3339 UTC);仍在排队为 null。 |
| data(分支1)(分支1).data.ended_at | null / string | 必填 / 必有;进入终态的时间(RFC 3339 UTC);尚未结束为 null。 |
| data(分支1)(分支1).data.updated_at | string | 必填 / 必有;运行记录最近一次更新的时间(RFC 3339 UTC)。 |
| data(分支1)(分支1).data.heartbeat_at | null / string | 必填 / 必有;执行器最近一次存活信号的时间(RFC 3339 UTC);尚未开始为 null。 |
| data(分支1)(分支1).data.cancel_requested_at | null / string | 必填 / 必有;收到取消请求的时间(RFC 3339 UTC);未取消为 null。 |
| data(分支1)(分支1).data.cancelled_by | null / object | 必填 / 必有;请求取消的主体;未取消或非人为取消为 null。 |
| data(分支1)(分支1).data.cancelled_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| data(分支1)(分支1).data.cancelled_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| data(分支1)(分支1).data.cancel_reason | null / "user" / "parent_cancelled" / "deadline" / "executor_lost" | 必填 / 必有;取消原因。user 为用户取消;parent_cancelled 为父运行被取消而级联取消;deadline 为超过截止时间;executor_lost 为执行器丢失;未取消为 null。 |
| data(分支1)(分支1).data.suspend_requested_at | null / string | 必填 / 必有;请求暂停工作流的时间(RFC 3339 UTC);未暂停为 null。 |
| data(分支1)(分支1).data.suspended_by | null / object | 必填 / 必有;请求暂停的主体;未暂停为 null。 |
| data(分支1)(分支1).data.suspended_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| data(分支1)(分支1).data.suspended_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| data(分支1)(分支1).data.queued_ms | null / number | 必填 / 必有;从创建到开始执行的排队毫秒数;尚未开始为 null。 |
| data(分支1)(分支1).data.run_ms | null / number | 必填 / 必有;实际执行毫秒数,不含等待点上的等待时间;结束后固定。 |
| data(分支1)(分支1).data.wait_ms | null / number | 必填 / 必有;在等待点上累计等待的毫秒数;尚无等待为 null。 |
| data(分支1)(分支1).data.usage | object / null | 必填 / 必有;仅单个运行详情(含 expand)返回;列表为 null。运行本身不收费;这里是运行中调用模型、搜索等能力产生的实扣,按调用归因;未评级的用量稍后计入。汇总超时(1.5 秒)或失败时为 null,详情仍返回 200。 |
| data(分支1)(分支1).data.usage(分支1).currency | "USD" | 必填 / 必有;金额币种,固定为 USD。 |
| data(分支1)(分支1).data.usage(分支1).cost | string | 必填 / 必有;仅本运行自身的已评级实扣(不含子运行),美元十进制字符串,精确到 6 位小数;没有用量时为 0.000000。 pattern: "^[0-9]+\.[0-9]{6}$" |
| data(分支1)(分支1).data.usage(分支1).pending_events | integer | 必填 / 必有;本运行自身尚未评级的用量事件数,金额稍后才计入。 minimum: 0 |
| data(分支1)(分支1).data.usage(分支1).by_service | object[] | 必填 / 必有;本运行按服务拆分的实扣,每项为 service 与 cost(6 位小数美元字符串);没有用量时为空数组。 |
| data(分支1)(分支1).data.usage(分支1).by_service[].service | string | 必填 / 必有;产生用量的服务名,例如 router 或 search。 |
| data(分支1)(分支1).data.usage(分支1).by_service[].cost | string | 必填 / 必有;该服务已评级实扣的美元十进制字符串,精确到 6 位小数。 pattern: "^[0-9]+\.[0-9]{6}$" |
| data(分支1)(分支1).data.usage(分支1).tree_cost | string / null | 必填 / 必有;仅根运行返回整棵运行树的已评级实扣(含自身),6 位小数美元字符串;子运行为 null。 |
| data(分支1)(分支1).data.rerun_of | null / string | 必填 / 必有;重跑来源:本运行是对哪个运行(run_ ID)的重跑;否则为 null。 |
| data(分支1)(分支1).data.labels | object | 必填 / 必有;用户标签与系统标签;触发器运行支持 64 个用户标签,系统标签不占用名额。 |
| data(分支1)(分支1).data.trigger | object / null | 必填 / 必有;启动本运行的触发器 {id, name};不是触发器启动时为 null。 |
| data(分支1)(分支1).data.trigger(分支1).id | string | 必填 / 必有;启动本运行的触发器 ID(trg_ 前缀)。 |
| data(分支1)(分支1).data.trigger(分支1).name | string | 必填 / 必有;启动本运行的触发器名称。 |
| data(分支1)(分支1).data.cancel_message | string / null | 必填 / 必有;用户提供的取消备注(1–500 字符);未提供时为 null,cancel_reason 枚举不变。 |
| data(分支1)(分支1).data.input_truncated | boolean | 可选;列表省略外置 input 时为 true,此时 input 为 null;内联值不变,运行详情返回完整值。 |
| data(分支1)(分支1).data.output_truncated | boolean | 可选;列表省略外置 output 时为 true,此时 output 为 null;内联值不变,运行详情返回完整值。 |
| data(分支1)(分支1).specversion | "1.0" | 必填 / 必有;CloudEvents 规范版本,固定为 1.0。 |
| data(分支1)(分支1).id | string | 必填 / 必有;事件 ID,在该运行的账本内唯一。 |
| data(分支1)(分支1).source | string | 必填 / 必有;事件来源,形如 /automation/v1/runs/{id}。 |
| data(分支1)(分支1).time | string | 必填 / 必有;事件发生的时间(RFC 3339 UTC)。 |
| data(分支1)(分支1).cursor | string | 必填 / 必有;事件游标;用作 cursor 翻页,或在 SSE 中作为 Last-Event-ID 续传。 |
| data(分支1)(分支1).seq | number | 必填 / 必有;事件在运行账本中的序号,严格递增。 |
| data(分支1)(分支2).type | "ai.praxis.automation.run.progress" | 必填 / 必有;事件类型:固定为 ai.praxis.automation.run.progress,运行上报了新进度,data 为进度。 |
| data(分支1)(分支2).data | object | 必填 / 必有;运行报告的进度,包含说明、已完成量与总量。 不接受额外字段。 |
| data(分支1)(分支2).data.label | string | 必填 / 必有;进度说明文字,例如当前阶段。 |
| data(分支1)(分支2).data.current | null / number | 必填 / 必有;已完成的数量;未报告为 null。 |
| data(分支1)(分支2).data.total | null / number | 必填 / 必有;总量;未知为 null。 |
| data(分支1)(分支2).data.updated_at | string | 必填 / 必有;进度最近一次更新的时间(RFC 3339 UTC)。 |
| data(分支1)(分支2).specversion | "1.0" | 必填 / 必有;CloudEvents 规范版本,固定为 1.0。 |
| data(分支1)(分支2).id | string | 必填 / 必有;事件 ID,在该运行的账本内唯一。 |
| data(分支1)(分支2).source | string | 必填 / 必有;事件来源,形如 /automation/v1/runs/{id}。 |
| data(分支1)(分支2).time | string | 必填 / 必有;事件发生的时间(RFC 3339 UTC)。 |
| data(分支1)(分支2).cursor | string | 必填 / 必有;事件游标;用作 cursor 翻页,或在 SSE 中作为 Last-Event-ID 续传。 |
| data(分支1)(分支2).seq | number | 必填 / 必有;事件在运行账本中的序号,严格递增。 |
| data(分支1)(分支3).type | "ai.praxis.automation.call.started" / "ai.praxis.automation.call.completed" | 必填 / 必有;事件类型。ai.praxis.automation.call.started 调用开始;ai.praxis.automation.call.completed 调用结束(成功或失败);data 为调用记录。 |
| data(分支1)(分支3).data | object | 必填 / 必有;脚本运行中的一次调用记录(动作、平台 API、脚本或工作流),按 seq 顺序排列。 不接受额外字段。 |
| data(分支1)(分支3).data.id | string | 必填 / 必有;调用 ID,前缀 call_。 |
| data(分支1)(分支3).data.run_id | string | 必填 / 必有;发出该调用的脚本运行 ID(run_ 前缀)。 |
| data(分支1)(分支3).data.seq | number | 必填 / 必有;调用在该运行中的序号,随调用顺序递增;与 run_id 一起定位这次调用。 |
| data(分支1)(分支3).data.target | object | 必填 / 必有;被调用的目标 {kind, name, revision?, version?}。 不接受额外字段。 |
| data(分支1)(分支3).data.target.kind | "action" / "script" / "workflow" / "platform_api" | 必填 / 必有;目标类型。action 为动作;platform_api 为平台 API 操作;script 为脚本;workflow 为工作流。 |
| data(分支1)(分支3).data.target.name | string | 必填 / 必有;目标名称:动作为 ns/name,平台 API 为操作名,脚本与工作流为 ns/name。 |
| data(分支1)(分支3).data.target.revision | string | 可选;实际执行的动作修订 ID(actr_ 前缀);仅动作调用有。 |
| data(分支1)(分支3).data.target.version | string | 可选;实际运行的精确版本号;仅脚本与工作流调用有。 |
| data(分支1)(分支3).data.args_preview | string | 必填 / 必有;调用参数的单行预览,由服务端截断;超过 32 KB 的原文存放在对象存储而不内联。 |
| data(分支1)(分支3).data.result_preview | null / string | 必填 / 必有;返回值的单行预览,由服务端截断;调用结束前为 null。 |
| data(分支1)(分支3).data.status | "running" / "completed" / "faulted" / "cancelled" | 必填 / 必有;调用状态。running 执行中;completed 已正常返回;faulted 失败,error 给出原因;cancelled 因运行被取消而中止。 |
| data(分支1)(分支3).data.started_at | string | 必填 / 必有;调用开始的时间(RFC 3339 UTC)。 |
| data(分支1)(分支3).data.ended_at | null / string | 必填 / 必有;调用结束的时间(RFC 3339 UTC);仍在执行为 null。 |
| data(分支1)(分支3).data.duration_ms | null / number | 必填 / 必有;从开始到结束的毫秒数;未结束为 null。 |
| data(分支1)(分支3).data.error | null / object | 必填 / 必有;调用失败时的错误详情;成功或仍在执行为 null。 |
| data(分支1)(分支3).data.error(分支2).type | string | 必填 / 必有;平台错误类别,或工作流 raise 定义的完整 URI,原样保留。 |
| data(分支1)(分支3).data.error(分支2).code | null / string | 必填 / 必有;稳定错误码,可按码分支处理;没有为 null。 |
| data(分支1)(分支3).data.error(分支2).title | string | 必填 / 必有;错误的简短标题。 |
| data(分支1)(分支3).data.error(分支2).detail | null / string | 必填 / 必有;错误的详细说明;没有为 null。 |
| data(分支1)(分支3).data.error(分支2).source | null / object | 必填 / 必有;错误发生的位置:工作流步骤或脚本调用;未知为 null。 |
| data(分支1)(分支3).data.error(分支2).source(分支2).kind | "call" / "task" | 必填 / 必有;位置类型。task 表示工作流步骤;call 表示脚本中的调用。 |
| data(分支1)(分支3).data.error(分支2).source(分支2).reference | string | 可选;task 类型时:出错步骤的 JSON Pointer。 |
| data(分支1)(分支3).data.error(分支2).source(分支2).seq | number | 可选;call 类型时:出错调用的序号(与 Call.seq 对应)。 |
| data(分支1)(分支3).data.error(分支2).source(分支2).action | object | 可选;出错的动作 {name, revision};错误来自动作时才有。 不接受额外字段。 |
| data(分支1)(分支3).data.error(分支2).source(分支2).action.name | string | 必填 / 必有;动作全名 ns/name。 |
| data(分支1)(分支3).data.error(分支2).source(分支2).action.revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| data(分支1)(分支3).data.error(分支2).request_id | string / null | 可选;导致失败的下游响应 X-Request-Id;没有下游响应标识时为 null 或省略。 |
| data(分支1)(分支3).data.error(分支2).errors | object[] | 可选;逐字段校验错误;pointer 使用 RFC 6901 指向字段,detail 为中文修正说明。 |
| data(分支1)(分支3).data.error(分支2).errors[].pointer | string | 必填 / 必有;RFC 6901 字段指针。TypeScript 源码诊断为 /source(脚本)或 /implementation/source(动作);行列另见 line/column,不拼在指针后。 |
| data(分支1)(分支3).data.error(分支2).errors[].detail | string | 必填 / 必有;中文修正说明,指出该位置出了什么问题以及怎样改。 |
| data(分支1)(分支3).data.error(分支2).errors[].hint | string | 可选;可选的补充提示,给出下一步可执行的动作(例如改用另一个接口)。 |
| data(分支1)(分支3).data.error(分支2).errors[].line | integer | 可选;行号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| data(分支1)(分支3).data.error(分支2).errors[].column | integer | 可选;列号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| data(分支1)(分支3).data.error(分支2).status | number | 可选;工作流 raise 声明的 HTTP 风格状态;可省略,平台错误可能不提供。 |
| data(分支1)(分支3).data.child_run_id | null / string | 必填 / 必有;目标是脚本或工作流时,由本次调用启动的子运行 ID;动作与平台 API 调用为 null。 |
| data(分支1)(分支3).data.invocation_key | string | 必填 / 必有;标识这一次逻辑调用的键,随调用发往下游,使至少一次语义下的重试可被去重。 |
| data(分支1)(分支3).data.request_id | string / null | 必填 / 必有;下游响应的 X-Request-Id;尚未收到响应或响应未提供该头时为 null。 |
| data(分支1)(分支3).specversion | "1.0" | 必填 / 必有;CloudEvents 规范版本,固定为 1.0。 |
| data(分支1)(分支3).id | string | 必填 / 必有;事件 ID,在该运行的账本内唯一。 |
| data(分支1)(分支3).source | string | 必填 / 必有;事件来源,形如 /automation/v1/runs/{id}。 |
| data(分支1)(分支3).time | string | 必填 / 必有;事件发生的时间(RFC 3339 UTC)。 |
| data(分支1)(分支3).cursor | string | 必填 / 必有;事件游标;用作 cursor 翻页,或在 SSE 中作为 Last-Event-ID 续传。 |
| data(分支1)(分支3).seq | number | 必填 / 必有;事件在运行账本中的序号,严格递增。 |
| data(分支1)(分支4).type | "ai.praxis.automation.task.started" / "ai.praxis.automation.task.completed" | 必填 / 必有;事件类型。ai.praxis.automation.task.started 步骤开始;ai.praxis.automation.task.completed 步骤结束;data 为步骤记录。 |
| data(分支1)(分支4).data | object | 必填 / 必有;工作流中一个步骤的一次执行记录。循环会让同一步骤产生多条记录(iteration 不同),重试会让 attempt 递增。 不接受额外字段。 |
| data(分支1)(分支4).data.id | string | 必填 / 必有;步骤执行记录的标识,按不透明字符串处理。 |
| data(分支1)(分支4).data.run_id | string | 必填 / 必有;所属运行 ID。 |
| data(分支1)(分支4).data.reference | string | 必填 / 必有;该步骤在工作流文档中的 JSON Pointer,例如 /do/0/start。 |
| data(分支1)(分支4).data.name | string | 必填 / 必有;步骤名,即工作流 YAML 中该步骤的键。 |
| data(分支1)(分支4).data.kind | "run" / "call" / "wait" / "set" / "for" / "fork" / "try" / "switch" / "emit" / "raise" / "listen" / "do" | 必填 / 必有;工作流步骤类型。call 调用动作;run 运行子脚本或子工作流;wait 等待时长;set 设置变量;for 循环;fork 并行分支;try 带捕获的块;switch 条件分支;emit 发出事件;raise 抛出错误;listen 等待事件;do 顺序执行的步骤块。 |
| data(分支1)(分支4).data.iteration | number[] | 必填 / 必有;外层 for 循环的当前迭代下标,由外到内;不在循环中为空数组。 |
| data(分支1)(分支4).data.attempt | number | 必填 / 必有;第几次尝试;步骤因重试而重新执行时递增。 |
| data(分支1)(分支4).data.status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;步骤状态,取值与运行状态相同。pending 尚未开始;running 执行中;waiting 在等待事件、定时器或子运行;suspended 因运行被暂停;cancelled 已取消;faulted 失败;completed 成功完成。 |
| data(分支1)(分支4).data.skipped | boolean | 必填 / 必有;true 表示该步骤被跳过而没有实际执行。 |
| data(分支1)(分支4).data.started_at | null / string | 必填 / 必有;步骤开始的时间(RFC 3339 UTC);未开始为 null。 |
| data(分支1)(分支4).data.ended_at | null / string | 必填 / 必有;步骤结束的时间(RFC 3339 UTC);未结束为 null。 |
| data(分支1)(分支4).data.duration_ms | null / number | 必填 / 必有;执行耗时毫秒数;未结束为 null。 |
| data(分支1)(分支4).data.input | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| data(分支1)(分支4).data.input(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data(分支1)(分支4).data.input(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data(分支1)(分支4).data.input_truncated | boolean | 必填 / 必有;true 表示 input 超过 32 KB 已被截断。 |
| data(分支1)(分支4).data.output | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| data(分支1)(分支4).data.output(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data(分支1)(分支4).data.output(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data(分支1)(分支4).data.output_truncated | boolean | 必填 / 必有;输出超过内联限制而被省略时为 true。 |
| data(分支1)(分支4).data.error | null / object | 必填 / 必有;步骤失败时的错误详情;未失败为 null。 |
| data(分支1)(分支4).data.error(分支2).type | string | 必填 / 必有;平台错误类别,或工作流 raise 定义的完整 URI,原样保留。 |
| data(分支1)(分支4).data.error(分支2).code | null / string | 必填 / 必有;稳定错误码,可按码分支处理;没有为 null。 |
| data(分支1)(分支4).data.error(分支2).title | string | 必填 / 必有;错误的简短标题。 |
| data(分支1)(分支4).data.error(分支2).detail | null / string | 必填 / 必有;错误的详细说明;没有为 null。 |
| data(分支1)(分支4).data.error(分支2).source | null / object | 必填 / 必有;错误发生的位置:工作流步骤或脚本调用;未知为 null。 |
| data(分支1)(分支4).data.error(分支2).source(分支2).kind | "call" / "task" | 必填 / 必有;位置类型。task 表示工作流步骤;call 表示脚本中的调用。 |
| data(分支1)(分支4).data.error(分支2).source(分支2).reference | string | 可选;task 类型时:出错步骤的 JSON Pointer。 |
| data(分支1)(分支4).data.error(分支2).source(分支2).seq | number | 可选;call 类型时:出错调用的序号(与 Call.seq 对应)。 |
| data(分支1)(分支4).data.error(分支2).source(分支2).action | object | 可选;出错的动作 {name, revision};错误来自动作时才有。 不接受额外字段。 |
| data(分支1)(分支4).data.error(分支2).source(分支2).action.name | string | 必填 / 必有;动作全名 ns/name。 |
| data(分支1)(分支4).data.error(分支2).source(分支2).action.revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| data(分支1)(分支4).data.error(分支2).request_id | string / null | 可选;导致失败的下游响应 X-Request-Id;没有下游响应标识时为 null 或省略。 |
| data(分支1)(分支4).data.error(分支2).errors | object[] | 可选;逐字段校验错误;pointer 使用 RFC 6901 指向字段,detail 为中文修正说明。 |
| data(分支1)(分支4).data.error(分支2).errors[].pointer | string | 必填 / 必有;RFC 6901 字段指针。TypeScript 源码诊断为 /source(脚本)或 /implementation/source(动作);行列另见 line/column,不拼在指针后。 |
| data(分支1)(分支4).data.error(分支2).errors[].detail | string | 必填 / 必有;中文修正说明,指出该位置出了什么问题以及怎样改。 |
| data(分支1)(分支4).data.error(分支2).errors[].hint | string | 可选;可选的补充提示,给出下一步可执行的动作(例如改用另一个接口)。 |
| data(分支1)(分支4).data.error(分支2).errors[].line | integer | 可选;行号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| data(分支1)(分支4).data.error(分支2).errors[].column | integer | 可选;列号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| data(分支1)(分支4).data.error(分支2).status | number | 可选;工作流 raise 声明的 HTTP 风格状态;可省略,平台错误可能不提供。 |
| data(分支1)(分支4).data.action | null / object | 必填 / 必有;call 步骤执行的动作 {name, revision};其它步骤为 null。 |
| data(分支1)(分支4).data.action(分支2).name | string | 必填 / 必有;动作全名 ns/name。 |
| data(分支1)(分支4).data.action(分支2).revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| data(分支1)(分支4).data.child_run | null / object | 必填 / 必有;run 步骤启动的子运行摘要 {id, number, status, resolved_version};其它步骤为 null。 |
| data(分支1)(分支4).data.child_run(分支2).id | string | 必填 / 必有;子运行 ID(run_ 前缀),创建后即可读取。 |
| data(分支1)(分支4).data.child_run(分支2).number | null / number | 必填 / 必有;子运行在其定义内的序号;临时运行为 null。 |
| data(分支1)(分支4).data.child_run(分支2).status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;子运行的状态。pending 尚未开始;running 执行中;waiting 在等待;suspended 已暂停;cancelled 已取消;faulted 失败;completed 成功完成。等待型子运行在结束时补全终态,detach 的子运行只记录启动时的状态。 |
| data(分支1)(分支4).data.child_run(分支2).resolved_version | null / string | 必填 / 必有;子运行解析到的精确版本号;临时运行为 null。 |
| data(分支1)(分支4).specversion | "1.0" | 必填 / 必有;CloudEvents 规范版本,固定为 1.0。 |
| data(分支1)(分支4).id | string | 必填 / 必有;事件 ID,在该运行的账本内唯一。 |
| data(分支1)(分支4).source | string | 必填 / 必有;事件来源,形如 /automation/v1/runs/{id}。 |
| data(分支1)(分支4).time | string | 必填 / 必有;事件发生的时间(RFC 3339 UTC)。 |
| data(分支1)(分支4).cursor | string | 必填 / 必有;事件游标;用作 cursor 翻页,或在 SSE 中作为 Last-Event-ID 续传。 |
| data(分支1)(分支4).seq | number | 必填 / 必有;事件在运行账本中的序号,严格递增。 |
| data(分支1)(分支5).type | "ai.praxis.automation.wait.created" / "ai.praxis.automation.wait.resolved" | 必填 / 必有;事件类型。ai.praxis.automation.wait.created 等待点创建;ai.praxis.automation.wait.resolved 等待点被满足、到期或取消;data 为等待点。 |
| data(分支1)(分支5).data | object | 必填 / 必有;运行上的一个等待点,工作流在它被满足、到期或取消之前不会继续。 不接受额外字段。 |
| data(分支1)(分支5).data.id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| data(分支1)(分支5).data.run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| data(分支1)(分支5).data.kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| data(分支1)(分支5).data.state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| data(分支1)(分支5).data.task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| data(分支1)(分支5).data.task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| data(分支1)(分支5).data.task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| data(分支1)(分支5).data.resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| data(分支1)(分支5).data.event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| data(分支1)(分支5).data.child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| data(分支1)(分支5).data.created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| data(分支1)(分支5).data.expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| data(分支1)(分支5).data.resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| data(分支1)(分支5).specversion | "1.0" | 必填 / 必有;CloudEvents 规范版本,固定为 1.0。 |
| data(分支1)(分支5).id | string | 必填 / 必有;事件 ID,在该运行的账本内唯一。 |
| data(分支1)(分支5).source | string | 必填 / 必有;事件来源,形如 /automation/v1/runs/{id}。 |
| data(分支1)(分支5).time | string | 必填 / 必有;事件发生的时间(RFC 3339 UTC)。 |
| data(分支1)(分支5).cursor | string | 必填 / 必有;事件游标;用作 cursor 翻页,或在 SSE 中作为 Last-Event-ID 续传。 |
| data(分支1)(分支5).seq | number | 必填 / 必有;事件在运行账本中的序号,严格递增。 |
| (分支1).event | "ai.praxis.automation.run.status" / "ai.praxis.automation.run.progress" / "ai.praxis.automation.call.started" / "ai.praxis.automation.call.completed" / "ai.praxis.automation.task.started" / "ai.praxis.automation.task.completed" / "ai.praxis.automation.wait.created" / "ai.praxis.automation.wait.resolved" | 可选;SSE event name: one of ai.praxis.automation.run.status, ai.praxis.automation.run.progress, ai.praxis.automation.call.started, ai.praxis.automation.call.completed, ai.praxis.automation.task.started, ai.praxis.automation.task.completed, ai.praxis.automation.wait.created, ai.praxis.automation.wait.resolved, naming the RunEvent type carried in data. |
| (分支1).data | object / object / object / object / object | 可选;运行账本中的一条 CloudEvents 事件,载荷带完整投影,收到后不必回拉。type 决定 data 的类型:run.status 为运行,run.progress 为进度,call.* 为调用,task.* 为步骤,wait.* 为等待点。 |
| (分支1).data(分支1).type | "ai.praxis.automation.run.status" | 必填 / 必有;事件类型:固定为 ai.praxis.automation.run.status,运行状态发生变化,data 为完整的运行。 |
| (分支1).data(分支1).data | object | 必填 / 必有;一次运行的完整状态:目标、状态、输入输出、错误、发起方、运行树位置和各类时间。 不接受额外字段。 |
| (分支1).data(分支1).data.id | string | 必填 / 必有;不透明运行 ID。新建非确定性 ID 为 run_ + 10 位 base36 毫秒时间前缀 + 64 位 hex DO ID,共 78 字符;旧随机 ID 为 46 字符,历史及确定性 ID 仍有效。同毫秒内不保证创建顺序。 |
| (分支1).data(分支1).data.kind | "script" / "workflow" | 必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。 |
| (分支1).data(分支1).data.number | null / number | 必填 / 必有;运行在其脚本或工作流内的递增序号;临时运行为 null。 |
| (分支1).data(分支1).data.definition | null / object | 必填 / 必有;运行所属的脚本或工作流 {namespace, name};临时运行(直接传 source)为 null。 |
| (分支1).data(分支1).data.definition(分支2).namespace | string | 必填 / 必有;脚本或工作流的命名空间。 |
| (分支1).data(分支1).data.definition(分支2).name | string | 必填 / 必有;脚本或工作流的名字。 |
| (分支1).data(分支1).data.target | null / string | 必填 / 必有;创建时 target 参数的原文(如 acme/report@latest);临时运行为 null。 |
| (分支1).data(分支1).data.resolved_version | null / string | 必填 / 必有;target 解析到的精确版本号;临时运行为 null。 |
| (分支1).data(分支1).data.source_digest | null / string | 必填 / 必有;临时运行的源码摘要,可用于读取源码;由已发布定义启动的运行为 null。 |
| (分支1).data(分支1).data.language | "ts" / "yaml" | 必填 / 必有;源码语言。ts 表示 TypeScript 脚本;yaml 表示工作流 YAML。 |
| (分支1).data(分支1).data.status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;运行状态。pending 已创建尚未开始;running 执行中;waiting 工作流在等待事件、定时器或子运行;suspended 工作流被暂停;cancelled 已取消;faulted 失败,error 给出原因;completed 成功完成,output 为结果。后三种是终态。 |
| (分支1).data(分支1).data.progress | null / object | 必填 / 必有;运行报告的最新进度 {label, current, total, updated_at};未报告为 null。 |
| (分支1).data(分支1).data.progress(分支2).label | string | 必填 / 必有;进度说明文字,例如当前阶段。 |
| (分支1).data(分支1).data.progress(分支2).current | null / number | 必填 / 必有;已完成的数量;未报告为 null。 |
| (分支1).data(分支1).data.progress(分支2).total | null / number | 必填 / 必有;总量;未知为 null。 |
| (分支1).data(分支1).data.progress(分支2).updated_at | string | 必填 / 必有;进度最近一次更新的时间(RFC 3339 UTC)。 |
| (分支1).data(分支1).data.current_wait | null / object | 必填 / 必有;运行当前未完成的等待点;不在等待为 null。 |
| (分支1).data(分支1).data.current_wait(分支2).id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| (分支1).data(分支1).data.current_wait(分支2).run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| (分支1).data(分支1).data.current_wait(分支2).kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| (分支1).data(分支1).data.current_wait(分支2).state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| (分支1).data(分支1).data.current_wait(分支2).task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| (分支1).data(分支1).data.current_wait(分支2).task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| (分支1).data(分支1).data.current_wait(分支2).task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| (分支1).data(分支1).data.current_wait(分支2).resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| (分支1).data(分支1).data.current_wait(分支2).event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| (分支1).data(分支1).data.current_wait(分支2).child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| (分支1).data(分支1).data.current_wait(分支2).created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| (分支1).data(分支1).data.current_wait(分支2).expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| (分支1).data(分支1).data.current_wait(分支2).resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| (分支1).data(分支1).data.counters | object | 必填 / 必有;运行的累计计数。 不接受额外字段。 |
| (分支1).data(分支1).data.counters.calls | number | 必填 / 必有;脚本发出的调用总数。 |
| (分支1).data(分支1).data.counters.action_calls | number | 必填 / 必有;其中调用动作的次数。 |
| (分支1).data(分支1).data.counters.child_runs | number | 必填 / 必有;启动的子运行数。 |
| (分支1).data(分支1).data.counters.tasks_completed | number | 必填 / 必有;工作流已完成的步骤数。 |
| (分支1).data(分支1).data.counters.tasks_total | null / number | 必填 / 必有;工作流顶层步骤总数;脚本运行为 null。 |
| (分支1).data(分支1).data.input | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| (分支1).data(分支1).data.input(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| (分支1).data(分支1).data.input(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| (分支1).data(分支1).data.output | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| (分支1).data(分支1).data.output(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| (分支1).data(分支1).data.output(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| (分支1).data(分支1).data.error | null / object | 必填 / 必有;运行失败(faulted)时的错误详情;未失败为 null。 |
| (分支1).data(分支1).data.error(分支2).type | string | 必填 / 必有;平台错误类别,或工作流 raise 定义的完整 URI,原样保留。 |
| (分支1).data(分支1).data.error(分支2).code | null / string | 必填 / 必有;稳定错误码,可按码分支处理;没有为 null。 |
| (分支1).data(分支1).data.error(分支2).title | string | 必填 / 必有;错误的简短标题。 |
| (分支1).data(分支1).data.error(分支2).detail | null / string | 必填 / 必有;错误的详细说明;没有为 null。 |
| (分支1).data(分支1).data.error(分支2).source | null / object | 必填 / 必有;错误发生的位置:工作流步骤或脚本调用;未知为 null。 |
| (分支1).data(分支1).data.error(分支2).source(分支2).kind | "call" / "task" | 必填 / 必有;位置类型。task 表示工作流步骤;call 表示脚本中的调用。 |
| (分支1).data(分支1).data.error(分支2).source(分支2).reference | string | 可选;task 类型时:出错步骤的 JSON Pointer。 |
| (分支1).data(分支1).data.error(分支2).source(分支2).seq | number | 可选;call 类型时:出错调用的序号(与 Call.seq 对应)。 |
| (分支1).data(分支1).data.error(分支2).source(分支2).action | object | 可选;出错的动作 {name, revision};错误来自动作时才有。 不接受额外字段。 |
| (分支1).data(分支1).data.error(分支2).source(分支2).action.name | string | 必填 / 必有;动作全名 ns/name。 |
| (分支1).data(分支1).data.error(分支2).source(分支2).action.revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| (分支1).data(分支1).data.error(分支2).request_id | string / null | 可选;导致失败的下游响应 X-Request-Id;没有下游响应标识时为 null 或省略。 |
| (分支1).data(分支1).data.error(分支2).errors | object[] | 可选;逐字段校验错误;pointer 使用 RFC 6901 指向字段,detail 为中文修正说明。 |
| (分支1).data(分支1).data.error(分支2).errors[].pointer | string | 必填 / 必有;RFC 6901 字段指针。TypeScript 源码诊断为 /source(脚本)或 /implementation/source(动作);行列另见 line/column,不拼在指针后。 |
| (分支1).data(分支1).data.error(分支2).errors[].detail | string | 必填 / 必有;中文修正说明,指出该位置出了什么问题以及怎样改。 |
| (分支1).data(分支1).data.error(分支2).errors[].hint | string | 可选;可选的补充提示,给出下一步可执行的动作(例如改用另一个接口)。 |
| (分支1).data(分支1).data.error(分支2).errors[].line | integer | 可选;行号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| (分支1).data(分支1).data.error(分支2).errors[].column | integer | 可选;列号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| (分支1).data(分支1).data.error(分支2).status | number | 可选;工作流 raise 声明的 HTTP 风格状态;可省略,平台错误可能不提供。 |
| (分支1).data(分支1).data.initiator | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| (分支1).data(分支1).data.initiator.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| (分支1).data(分支1).data.initiator.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| (分支1).data(分支1).data.channel | "run" / "console" / "api" / "internal" / "trigger" | 必填 / 必有;请求进入平台的渠道。console 为控制台(经 BFF);api 为公开 API 调用;internal 为平台内部服务调用;run 为由另一个运行创建的子运行;trigger 为触发器启动。 |
| (分支1).data(分支1).data.owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| (分支1).data(分支1).data.parent | null / object | 必填 / 必有;派生本运行的父运行 {id, number, definition};根运行为 null。 |
| (分支1).data(分支1).data.parent(分支2).id | string | 必填 / 必有;父运行 ID(run_ 前缀)。 |
| (分支1).data(分支1).data.parent(分支2).number | null / number | 必填 / 必有;父运行在其定义内的序号;父运行是临时运行时为 null。 |
| (分支1).data(分支1).data.parent(分支2).definition | null / object | 必填 / 必有;父运行所属的脚本或工作流 {namespace, name};临时运行为 null。 |
| (分支1).data(分支1).data.parent(分支2).definition(分支2).namespace | string | 必填 / 必有;父运行所属定义的命名空间。 |
| (分支1).data(分支1).data.parent(分支2).definition(分支2).name | string | 必填 / 必有;父运行所属定义的名字。 |
| (分支1).data(分支1).data.parent_run_id | string / null | 必填 / 必有;派生出本运行的父运行 id;根运行为 null |
| (分支1).data(分支1).data.root_run_id | string | 必填 / 必有;运行树根运行的 ID;根运行自身指向自己。 |
| (分支1).data(分支1).data.depth | number | 必填 / 必有;运行树中的深度:根运行为 0,每一层子运行加 1,最大 10。 |
| (分支1).data(分支1).data.attach | null / "wait" / "detach" | 必填 / 必有;子运行与父运行的关系。wait 表示父运行等待子运行结束,且子运行的截止时间不晚于父运行;detach 表示父运行不等待,也不会因父运行取消而被取消;根运行为 null。 |
| (分支1).data(分支1).data.deadline_at | string | 必填 / 必有;运行的截止时间(RFC 3339 UTC):创建时间加 deadline_seconds(脚本默认且最多 300 秒,工作流默认 86400 秒、最多 604800 秒),等待型子运行不晚于父运行截止前 1 秒。 |
| (分支1).data(分支1).data.created_at | string | 必填 / 必有;运行创建时间(RFC 3339 UTC)。 |
| (分支1).data(分支1).data.started_at | null / string | 必填 / 必有;开始执行的时间(RFC 3339 UTC);仍在排队为 null。 |
| (分支1).data(分支1).data.ended_at | null / string | 必填 / 必有;进入终态的时间(RFC 3339 UTC);尚未结束为 null。 |
| (分支1).data(分支1).data.updated_at | string | 必填 / 必有;运行记录最近一次更新的时间(RFC 3339 UTC)。 |
| (分支1).data(分支1).data.heartbeat_at | null / string | 必填 / 必有;执行器最近一次存活信号的时间(RFC 3339 UTC);尚未开始为 null。 |
| (分支1).data(分支1).data.cancel_requested_at | null / string | 必填 / 必有;收到取消请求的时间(RFC 3339 UTC);未取消为 null。 |
| (分支1).data(分支1).data.cancelled_by | null / object | 必填 / 必有;请求取消的主体;未取消或非人为取消为 null。 |
| (分支1).data(分支1).data.cancelled_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| (分支1).data(分支1).data.cancelled_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| (分支1).data(分支1).data.cancel_reason | null / "user" / "parent_cancelled" / "deadline" / "executor_lost" | 必填 / 必有;取消原因。user 为用户取消;parent_cancelled 为父运行被取消而级联取消;deadline 为超过截止时间;executor_lost 为执行器丢失;未取消为 null。 |
| (分支1).data(分支1).data.suspend_requested_at | null / string | 必填 / 必有;请求暂停工作流的时间(RFC 3339 UTC);未暂停为 null。 |
| (分支1).data(分支1).data.suspended_by | null / object | 必填 / 必有;请求暂停的主体;未暂停为 null。 |
| (分支1).data(分支1).data.suspended_by(分支2).type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| (分支1).data(分支1).data.suspended_by(分支2).id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| (分支1).data(分支1).data.queued_ms | null / number | 必填 / 必有;从创建到开始执行的排队毫秒数;尚未开始为 null。 |
| (分支1).data(分支1).data.run_ms | null / number | 必填 / 必有;实际执行毫秒数,不含等待点上的等待时间;结束后固定。 |
| (分支1).data(分支1).data.wait_ms | null / number | 必填 / 必有;在等待点上累计等待的毫秒数;尚无等待为 null。 |
| (分支1).data(分支1).data.usage | object / null | 必填 / 必有;仅单个运行详情(含 expand)返回;列表为 null。运行本身不收费;这里是运行中调用模型、搜索等能力产生的实扣,按调用归因;未评级的用量稍后计入。汇总超时(1.5 秒)或失败时为 null,详情仍返回 200。 |
| (分支1).data(分支1).data.usage(分支1).currency | "USD" | 必填 / 必有;金额币种,固定为 USD。 |
| (分支1).data(分支1).data.usage(分支1).cost | string | 必填 / 必有;仅本运行自身的已评级实扣(不含子运行),美元十进制字符串,精确到 6 位小数;没有用量时为 0.000000。 pattern: "^[0-9]+\.[0-9]{6}$" |
| (分支1).data(分支1).data.usage(分支1).pending_events | integer | 必填 / 必有;本运行自身尚未评级的用量事件数,金额稍后才计入。 minimum: 0 |
| (分支1).data(分支1).data.usage(分支1).by_service | object[] | 必填 / 必有;本运行按服务拆分的实扣,每项为 service 与 cost(6 位小数美元字符串);没有用量时为空数组。 |
| (分支1).data(分支1).data.usage(分支1).by_service[].service | string | 必填 / 必有;产生用量的服务名,例如 router 或 search。 |
| (分支1).data(分支1).data.usage(分支1).by_service[].cost | string | 必填 / 必有;该服务已评级实扣的美元十进制字符串,精确到 6 位小数。 pattern: "^[0-9]+\.[0-9]{6}$" |
| (分支1).data(分支1).data.usage(分支1).tree_cost | string / null | 必填 / 必有;仅根运行返回整棵运行树的已评级实扣(含自身),6 位小数美元字符串;子运行为 null。 |
| (分支1).data(分支1).data.rerun_of | null / string | 必填 / 必有;重跑来源:本运行是对哪个运行(run_ ID)的重跑;否则为 null。 |
| (分支1).data(分支1).data.labels | object | 必填 / 必有;用户标签与系统标签;触发器运行支持 64 个用户标签,系统标签不占用名额。 |
| (分支1).data(分支1).data.trigger | object / null | 必填 / 必有;启动本运行的触发器 {id, name};不是触发器启动时为 null。 |
| (分支1).data(分支1).data.trigger(分支1).id | string | 必填 / 必有;启动本运行的触发器 ID(trg_ 前缀)。 |
| (分支1).data(分支1).data.trigger(分支1).name | string | 必填 / 必有;启动本运行的触发器名称。 |
| (分支1).data(分支1).data.cancel_message | string / null | 必填 / 必有;用户提供的取消备注(1–500 字符);未提供时为 null,cancel_reason 枚举不变。 |
| (分支1).data(分支1).data.input_truncated | boolean | 可选;列表省略外置 input 时为 true,此时 input 为 null;内联值不变,运行详情返回完整值。 |
| (分支1).data(分支1).data.output_truncated | boolean | 可选;列表省略外置 output 时为 true,此时 output 为 null;内联值不变,运行详情返回完整值。 |
| (分支1).data(分支1).specversion | "1.0" | 必填 / 必有;CloudEvents 规范版本,固定为 1.0。 |
| (分支1).data(分支1).id | string | 必填 / 必有;事件 ID,在该运行的账本内唯一。 |
| (分支1).data(分支1).source | string | 必填 / 必有;事件来源,形如 /automation/v1/runs/{id}。 |
| (分支1).data(分支1).time | string | 必填 / 必有;事件发生的时间(RFC 3339 UTC)。 |
| (分支1).data(分支1).cursor | string | 必填 / 必有;事件游标;用作 cursor 翻页,或在 SSE 中作为 Last-Event-ID 续传。 |
| (分支1).data(分支1).seq | number | 必填 / 必有;事件在运行账本中的序号,严格递增。 |
| (分支1).data(分支2).type | "ai.praxis.automation.run.progress" | 必填 / 必有;事件类型:固定为 ai.praxis.automation.run.progress,运行上报了新进度,data 为进度。 |
| (分支1).data(分支2).data | object | 必填 / 必有;运行报告的进度,包含说明、已完成量与总量。 不接受额外字段。 |
| (分支1).data(分支2).data.label | string | 必填 / 必有;进度说明文字,例如当前阶段。 |
| (分支1).data(分支2).data.current | null / number | 必填 / 必有;已完成的数量;未报告为 null。 |
| (分支1).data(分支2).data.total | null / number | 必填 / 必有;总量;未知为 null。 |
| (分支1).data(分支2).data.updated_at | string | 必填 / 必有;进度最近一次更新的时间(RFC 3339 UTC)。 |
| (分支1).data(分支2).specversion | "1.0" | 必填 / 必有;CloudEvents 规范版本,固定为 1.0。 |
| (分支1).data(分支2).id | string | 必填 / 必有;事件 ID,在该运行的账本内唯一。 |
| (分支1).data(分支2).source | string | 必填 / 必有;事件来源,形如 /automation/v1/runs/{id}。 |
| (分支1).data(分支2).time | string | 必填 / 必有;事件发生的时间(RFC 3339 UTC)。 |
| (分支1).data(分支2).cursor | string | 必填 / 必有;事件游标;用作 cursor 翻页,或在 SSE 中作为 Last-Event-ID 续传。 |
| (分支1).data(分支2).seq | number | 必填 / 必有;事件在运行账本中的序号,严格递增。 |
| (分支1).data(分支3).type | "ai.praxis.automation.call.started" / "ai.praxis.automation.call.completed" | 必填 / 必有;事件类型。ai.praxis.automation.call.started 调用开始;ai.praxis.automation.call.completed 调用结束(成功或失败);data 为调用记录。 |
| (分支1).data(分支3).data | object | 必填 / 必有;脚本运行中的一次调用记录(动作、平台 API、脚本或工作流),按 seq 顺序排列。 不接受额外字段。 |
| (分支1).data(分支3).data.id | string | 必填 / 必有;调用 ID,前缀 call_。 |
| (分支1).data(分支3).data.run_id | string | 必填 / 必有;发出该调用的脚本运行 ID(run_ 前缀)。 |
| (分支1).data(分支3).data.seq | number | 必填 / 必有;调用在该运行中的序号,随调用顺序递增;与 run_id 一起定位这次调用。 |
| (分支1).data(分支3).data.target | object | 必填 / 必有;被调用的目标 {kind, name, revision?, version?}。 不接受额外字段。 |
| (分支1).data(分支3).data.target.kind | "action" / "script" / "workflow" / "platform_api" | 必填 / 必有;目标类型。action 为动作;platform_api 为平台 API 操作;script 为脚本;workflow 为工作流。 |
| (分支1).data(分支3).data.target.name | string | 必填 / 必有;目标名称:动作为 ns/name,平台 API 为操作名,脚本与工作流为 ns/name。 |
| (分支1).data(分支3).data.target.revision | string | 可选;实际执行的动作修订 ID(actr_ 前缀);仅动作调用有。 |
| (分支1).data(分支3).data.target.version | string | 可选;实际运行的精确版本号;仅脚本与工作流调用有。 |
| (分支1).data(分支3).data.args_preview | string | 必填 / 必有;调用参数的单行预览,由服务端截断;超过 32 KB 的原文存放在对象存储而不内联。 |
| (分支1).data(分支3).data.result_preview | null / string | 必填 / 必有;返回值的单行预览,由服务端截断;调用结束前为 null。 |
| (分支1).data(分支3).data.status | "running" / "completed" / "faulted" / "cancelled" | 必填 / 必有;调用状态。running 执行中;completed 已正常返回;faulted 失败,error 给出原因;cancelled 因运行被取消而中止。 |
| (分支1).data(分支3).data.started_at | string | 必填 / 必有;调用开始的时间(RFC 3339 UTC)。 |
| (分支1).data(分支3).data.ended_at | null / string | 必填 / 必有;调用结束的时间(RFC 3339 UTC);仍在执行为 null。 |
| (分支1).data(分支3).data.duration_ms | null / number | 必填 / 必有;从开始到结束的毫秒数;未结束为 null。 |
| (分支1).data(分支3).data.error | null / object | 必填 / 必有;调用失败时的错误详情;成功或仍在执行为 null。 |
| (分支1).data(分支3).data.error(分支2).type | string | 必填 / 必有;平台错误类别,或工作流 raise 定义的完整 URI,原样保留。 |
| (分支1).data(分支3).data.error(分支2).code | null / string | 必填 / 必有;稳定错误码,可按码分支处理;没有为 null。 |
| (分支1).data(分支3).data.error(分支2).title | string | 必填 / 必有;错误的简短标题。 |
| (分支1).data(分支3).data.error(分支2).detail | null / string | 必填 / 必有;错误的详细说明;没有为 null。 |
| (分支1).data(分支3).data.error(分支2).source | null / object | 必填 / 必有;错误发生的位置:工作流步骤或脚本调用;未知为 null。 |
| (分支1).data(分支3).data.error(分支2).source(分支2).kind | "call" / "task" | 必填 / 必有;位置类型。task 表示工作流步骤;call 表示脚本中的调用。 |
| (分支1).data(分支3).data.error(分支2).source(分支2).reference | string | 可选;task 类型时:出错步骤的 JSON Pointer。 |
| (分支1).data(分支3).data.error(分支2).source(分支2).seq | number | 可选;call 类型时:出错调用的序号(与 Call.seq 对应)。 |
| (分支1).data(分支3).data.error(分支2).source(分支2).action | object | 可选;出错的动作 {name, revision};错误来自动作时才有。 不接受额外字段。 |
| (分支1).data(分支3).data.error(分支2).source(分支2).action.name | string | 必填 / 必有;动作全名 ns/name。 |
| (分支1).data(分支3).data.error(分支2).source(分支2).action.revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| (分支1).data(分支3).data.error(分支2).request_id | string / null | 可选;导致失败的下游响应 X-Request-Id;没有下游响应标识时为 null 或省略。 |
| (分支1).data(分支3).data.error(分支2).errors | object[] | 可选;逐字段校验错误;pointer 使用 RFC 6901 指向字段,detail 为中文修正说明。 |
| (分支1).data(分支3).data.error(分支2).errors[].pointer | string | 必填 / 必有;RFC 6901 字段指针。TypeScript 源码诊断为 /source(脚本)或 /implementation/source(动作);行列另见 line/column,不拼在指针后。 |
| (分支1).data(分支3).data.error(分支2).errors[].detail | string | 必填 / 必有;中文修正说明,指出该位置出了什么问题以及怎样改。 |
| (分支1).data(分支3).data.error(分支2).errors[].hint | string | 可选;可选的补充提示,给出下一步可执行的动作(例如改用另一个接口)。 |
| (分支1).data(分支3).data.error(分支2).errors[].line | integer | 可选;行号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| (分支1).data(分支3).data.error(分支2).errors[].column | integer | 可选;列号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| (分支1).data(分支3).data.error(分支2).status | number | 可选;工作流 raise 声明的 HTTP 风格状态;可省略,平台错误可能不提供。 |
| (分支1).data(分支3).data.child_run_id | null / string | 必填 / 必有;目标是脚本或工作流时,由本次调用启动的子运行 ID;动作与平台 API 调用为 null。 |
| (分支1).data(分支3).data.invocation_key | string | 必填 / 必有;标识这一次逻辑调用的键,随调用发往下游,使至少一次语义下的重试可被去重。 |
| (分支1).data(分支3).data.request_id | string / null | 必填 / 必有;下游响应的 X-Request-Id;尚未收到响应或响应未提供该头时为 null。 |
| (分支1).data(分支3).specversion | "1.0" | 必填 / 必有;CloudEvents 规范版本,固定为 1.0。 |
| (分支1).data(分支3).id | string | 必填 / 必有;事件 ID,在该运行的账本内唯一。 |
| (分支1).data(分支3).source | string | 必填 / 必有;事件来源,形如 /automation/v1/runs/{id}。 |
| (分支1).data(分支3).time | string | 必填 / 必有;事件发生的时间(RFC 3339 UTC)。 |
| (分支1).data(分支3).cursor | string | 必填 / 必有;事件游标;用作 cursor 翻页,或在 SSE 中作为 Last-Event-ID 续传。 |
| (分支1).data(分支3).seq | number | 必填 / 必有;事件在运行账本中的序号,严格递增。 |
| (分支1).data(分支4).type | "ai.praxis.automation.task.started" / "ai.praxis.automation.task.completed" | 必填 / 必有;事件类型。ai.praxis.automation.task.started 步骤开始;ai.praxis.automation.task.completed 步骤结束;data 为步骤记录。 |
| (分支1).data(分支4).data | object | 必填 / 必有;工作流中一个步骤的一次执行记录。循环会让同一步骤产生多条记录(iteration 不同),重试会让 attempt 递增。 不接受额外字段。 |
| (分支1).data(分支4).data.id | string | 必填 / 必有;步骤执行记录的标识,按不透明字符串处理。 |
| (分支1).data(分支4).data.run_id | string | 必填 / 必有;所属运行 ID。 |
| (分支1).data(分支4).data.reference | string | 必填 / 必有;该步骤在工作流文档中的 JSON Pointer,例如 /do/0/start。 |
| (分支1).data(分支4).data.name | string | 必填 / 必有;步骤名,即工作流 YAML 中该步骤的键。 |
| (分支1).data(分支4).data.kind | "run" / "call" / "wait" / "set" / "for" / "fork" / "try" / "switch" / "emit" / "raise" / "listen" / "do" | 必填 / 必有;工作流步骤类型。call 调用动作;run 运行子脚本或子工作流;wait 等待时长;set 设置变量;for 循环;fork 并行分支;try 带捕获的块;switch 条件分支;emit 发出事件;raise 抛出错误;listen 等待事件;do 顺序执行的步骤块。 |
| (分支1).data(分支4).data.iteration | number[] | 必填 / 必有;外层 for 循环的当前迭代下标,由外到内;不在循环中为空数组。 |
| (分支1).data(分支4).data.attempt | number | 必填 / 必有;第几次尝试;步骤因重试而重新执行时递增。 |
| (分支1).data(分支4).data.status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;步骤状态,取值与运行状态相同。pending 尚未开始;running 执行中;waiting 在等待事件、定时器或子运行;suspended 因运行被暂停;cancelled 已取消;faulted 失败;completed 成功完成。 |
| (分支1).data(分支4).data.skipped | boolean | 必填 / 必有;true 表示该步骤被跳过而没有实际执行。 |
| (分支1).data(分支4).data.started_at | null / string | 必填 / 必有;步骤开始的时间(RFC 3339 UTC);未开始为 null。 |
| (分支1).data(分支4).data.ended_at | null / string | 必填 / 必有;步骤结束的时间(RFC 3339 UTC);未结束为 null。 |
| (分支1).data(分支4).data.duration_ms | null / number | 必填 / 必有;执行耗时毫秒数;未结束为 null。 |
| (分支1).data(分支4).data.input | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| (分支1).data(分支4).data.input(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| (分支1).data(分支4).data.input(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| (分支1).data(分支4).data.input_truncated | boolean | 必填 / 必有;true 表示 input 超过 32 KB 已被截断。 |
| (分支1).data(分支4).data.output | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| (分支1).data(分支4).data.output(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| (分支1).data(分支4).data.output(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| (分支1).data(分支4).data.output_truncated | boolean | 必填 / 必有;输出超过内联限制而被省略时为 true。 |
| (分支1).data(分支4).data.error | null / object | 必填 / 必有;步骤失败时的错误详情;未失败为 null。 |
| (分支1).data(分支4).data.error(分支2).type | string | 必填 / 必有;平台错误类别,或工作流 raise 定义的完整 URI,原样保留。 |
| (分支1).data(分支4).data.error(分支2).code | null / string | 必填 / 必有;稳定错误码,可按码分支处理;没有为 null。 |
| (分支1).data(分支4).data.error(分支2).title | string | 必填 / 必有;错误的简短标题。 |
| (分支1).data(分支4).data.error(分支2).detail | null / string | 必填 / 必有;错误的详细说明;没有为 null。 |
| (分支1).data(分支4).data.error(分支2).source | null / object | 必填 / 必有;错误发生的位置:工作流步骤或脚本调用;未知为 null。 |
| (分支1).data(分支4).data.error(分支2).source(分支2).kind | "call" / "task" | 必填 / 必有;位置类型。task 表示工作流步骤;call 表示脚本中的调用。 |
| (分支1).data(分支4).data.error(分支2).source(分支2).reference | string | 可选;task 类型时:出错步骤的 JSON Pointer。 |
| (分支1).data(分支4).data.error(分支2).source(分支2).seq | number | 可选;call 类型时:出错调用的序号(与 Call.seq 对应)。 |
| (分支1).data(分支4).data.error(分支2).source(分支2).action | object | 可选;出错的动作 {name, revision};错误来自动作时才有。 不接受额外字段。 |
| (分支1).data(分支4).data.error(分支2).source(分支2).action.name | string | 必填 / 必有;动作全名 ns/name。 |
| (分支1).data(分支4).data.error(分支2).source(分支2).action.revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| (分支1).data(分支4).data.error(分支2).request_id | string / null | 可选;导致失败的下游响应 X-Request-Id;没有下游响应标识时为 null 或省略。 |
| (分支1).data(分支4).data.error(分支2).errors | object[] | 可选;逐字段校验错误;pointer 使用 RFC 6901 指向字段,detail 为中文修正说明。 |
| (分支1).data(分支4).data.error(分支2).errors[].pointer | string | 必填 / 必有;RFC 6901 字段指针。TypeScript 源码诊断为 /source(脚本)或 /implementation/source(动作);行列另见 line/column,不拼在指针后。 |
| (分支1).data(分支4).data.error(分支2).errors[].detail | string | 必填 / 必有;中文修正说明,指出该位置出了什么问题以及怎样改。 |
| (分支1).data(分支4).data.error(分支2).errors[].hint | string | 可选;可选的补充提示,给出下一步可执行的动作(例如改用另一个接口)。 |
| (分支1).data(分支4).data.error(分支2).errors[].line | integer | 可选;行号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| (分支1).data(分支4).data.error(分支2).errors[].column | integer | 可选;列号,从 1 起;仅有源码位置时返回。 minimum: 1 |
| (分支1).data(分支4).data.error(分支2).status | number | 可选;工作流 raise 声明的 HTTP 风格状态;可省略,平台错误可能不提供。 |
| (分支1).data(分支4).data.action | null / object | 必填 / 必有;call 步骤执行的动作 {name, revision};其它步骤为 null。 |
| (分支1).data(分支4).data.action(分支2).name | string | 必填 / 必有;动作全名 ns/name。 |
| (分支1).data(分支4).data.action(分支2).revision | string | 必填 / 必有;执行的动作修订 ID(actr_ 前缀)。 |
| (分支1).data(分支4).data.child_run | null / object | 必填 / 必有;run 步骤启动的子运行摘要 {id, number, status, resolved_version};其它步骤为 null。 |
| (分支1).data(分支4).data.child_run(分支2).id | string | 必填 / 必有;子运行 ID(run_ 前缀),创建后即可读取。 |
| (分支1).data(分支4).data.child_run(分支2).number | null / number | 必填 / 必有;子运行在其定义内的序号;临时运行为 null。 |
| (分支1).data(分支4).data.child_run(分支2).status | "running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended" | 必填 / 必有;子运行的状态。pending 尚未开始;running 执行中;waiting 在等待;suspended 已暂停;cancelled 已取消;faulted 失败;completed 成功完成。等待型子运行在结束时补全终态,detach 的子运行只记录启动时的状态。 |
| (分支1).data(分支4).data.child_run(分支2).resolved_version | null / string | 必填 / 必有;子运行解析到的精确版本号;临时运行为 null。 |
| (分支1).data(分支4).specversion | "1.0" | 必填 / 必有;CloudEvents 规范版本,固定为 1.0。 |
| (分支1).data(分支4).id | string | 必填 / 必有;事件 ID,在该运行的账本内唯一。 |
| (分支1).data(分支4).source | string | 必填 / 必有;事件来源,形如 /automation/v1/runs/{id}。 |
| (分支1).data(分支4).time | string | 必填 / 必有;事件发生的时间(RFC 3339 UTC)。 |
| (分支1).data(分支4).cursor | string | 必填 / 必有;事件游标;用作 cursor 翻页,或在 SSE 中作为 Last-Event-ID 续传。 |
| (分支1).data(分支4).seq | number | 必填 / 必有;事件在运行账本中的序号,严格递增。 |
| (分支1).data(分支5).type | "ai.praxis.automation.wait.created" / "ai.praxis.automation.wait.resolved" | 必填 / 必有;事件类型。ai.praxis.automation.wait.created 等待点创建;ai.praxis.automation.wait.resolved 等待点被满足、到期或取消;data 为等待点。 |
| (分支1).data(分支5).data | object | 必填 / 必有;运行上的一个等待点,工作流在它被满足、到期或取消之前不会继续。 不接受额外字段。 |
| (分支1).data(分支5).data.id | string | 必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。 |
| (分支1).data(分支5).data.run_id | string | 必填 / 必有;所属运行 ID(run_ 前缀)。 |
| (分支1).data(分支5).data.kind | "event" / "timer" / "child" | 必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。 |
| (分支1).data(分支5).data.state | "cancelled" / "open" / "resolved" / "expired" | 必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。 |
| (分支1).data(分支5).data.task | null / object | 必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。 |
| (分支1).data(分支5).data.task(分支2).reference | string | 必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。 |
| (分支1).data(分支5).data.task(分支2).name | string | 必填 / 必有;步骤名,即工作流 YAML 中的键。 |
| (分支1).data(分支5).data.resume_at | null / string | 必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。 |
| (分支1).data(分支5).data.event_type | null / string | 必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。 |
| (分支1).data(分支5).data.child_run_id | null / string | 必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。 |
| (分支1).data(分支5).data.created_at | string | 必填 / 必有;等待点创建时间(RFC 3339 UTC)。 |
| (分支1).data(分支5).data.expires_at | null / string | 必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。 |
| (分支1).data(分支5).data.resolved_at | null / string | 必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。 |
| (分支1).data(分支5).specversion | "1.0" | 必填 / 必有;CloudEvents 规范版本,固定为 1.0。 |
| (分支1).data(分支5).id | string | 必填 / 必有;事件 ID,在该运行的账本内唯一。 |
| (分支1).data(分支5).source | string | 必填 / 必有;事件来源,形如 /automation/v1/runs/{id}。 |
| (分支1).data(分支5).time | string | 必填 / 必有;事件发生的时间(RFC 3339 UTC)。 |
| (分支1).data(分支5).cursor | string | 必填 / 必有;事件游标;用作 cursor 翻页,或在 SSE 中作为 Last-Event-ID 续传。 |
| (分支1).data(分支5).seq | number | 必填 / 必有;事件在运行账本中的序号,严格递增。 |
| (分支2).event | "end" | 可选;SSE event name end: sent once when the run has reached a terminal status, and the stream then closes. |
| (分支2).data | object | 可选;Always an empty object for the end event. |
HTTP 200
id: WyJydW5fMDBtdjY3bWRsbTVkNWQ3MDdjZDAzMTc0NGU4NDM3ZjY3ZjZhY2YwMmFmYWFiZDE4ZTc2YmY4ZGI5ZDY3NDMzM2RlNmYxZmIyZjE6ZXZlbnRzIiwxXQ==
event: ai.praxis.automation.run.status
data: {"type":"ai.praxis.automation.run.status","data":{"id":"run_00mv67mdlm5d5d707cd031744e8437f67f6acf02afaabd18e76bf8db9d674333de6f1fb2f1","kind":"script","number":null,"definition":null,"target":null,"resolved_version":null,"source_digest":"7ae6678882a4ef2ea96e401c105d5c6ef512917cd72a9235289d2a3bf1f1b49d","language":"ts","status":"pending","progress":null,"current_wait":null,"counters":{"calls":0,"action_calls":0,"child_runs":0,"tasks_completed":0,"tasks_total":null},"input":{"n":41},"output":null,"error":null,"initiator":{"type":"api_key","id":"key_3e00b8984967"},"channel":"api","owner":"tnt_3a9759864ccb4e00","trigger":null,"parent":null,"parent_run_id":null,"root_run_id":"run_00mv67mdlm5d5d707cd031744e8437f67f6acf02afaabd18e76bf8db9d674333de6f1fb2f1","depth":0,"attach":null,"deadline_at":"2026-10-13T05:02:40.954Z","created_at":"2026-10-13T04:57:40.954Z","started_at":null,"ended_at":null,"updated_at":"2026-10-13T04:57:40.954Z","heartbeat_at":null,"cancel_requested_at":null,"cancelled_by":null,"cancel_reason":null,"cancel_message":null,"suspend_requested_at":null,"suspended_by":null,"queued_ms":null,"run_ms":null,"wait_ms":null,"usage":null,"rerun_of":null,"labels":{"namespace":"docs-samples","name":"sample-run-1791867412840-b05e8a"}},"specversion":"1.0","id":"WyJydW5fMDBtdjY3bWRsbTVkNWQ3MDdjZDAzMTc0NGU4NDM3ZjY3ZjZhY2YwMmFmYWFiZDE4ZTc2YmY4ZGI5ZDY3NDMzM2RlNmYxZmIyZjE6ZXZlbnRzIiwxXQ==","cursor":"WyJydW5fMDBtdjY3bWRsbTVkNWQ3MDdjZDAzMTc0NGU4NDM3ZjY3ZjZhY2YwMmFmYWFiZDE4ZTc2YmY4ZGI5ZDY3NDMzM2RlNmYxZmIyZjE6ZXZlbnRzIiwxXQ==","seq":1,"source":"/automation/v1/runs/run_00mv67mdlm5d5d707cd031744e8437f67f6acf02afaabd18e76bf8db9d674333de6f1fb2f1","time":"2026-10-13T04:57:40.954Z"}
id: WyJydW5fMDBtdjY3bWRsbTVkNWQ3MDdjZDAzMTc0NGU4NDM3ZjY3ZjZhY2YwMmFmYWFiZDE4ZTc2YmY4ZGI5ZDY3NDMzM2RlNmYxZmIyZjE6ZXZlbnRzIiwyXQ==
event: ai.praxis.automation.run.status
data: {"type":"ai.praxis.automation.run.status","data":{"id":"run_00mv67mdlm5d5d707cd031744e8437f67f6acf02afaabd18e76bf8db9d674333de6f1fb2f1","kind":"script","number":null,"definition":null,"target":null,"resolved_version":null,"source_digest":"7ae6678882a4ef2ea96e401c105d5c6ef512917cd72a9235289d2a3bf1f1b49d","language":"ts","status":"running","progress":null,"current_wait":null,"counters":{"calls":0,"action_calls":0,"child_runs":0,"tasks_completed":0,"tasks_total":null},"input":{"n":41},"output":null,"error":null,"initiator":{"type":"api_key","id":"key_3e00b8984967"},"channel":"api","owner":"tnt_3a9759864ccb4e00","trigger":null,"parent":null,"parent_run_id":null,"root_run_id":"run_00mv67mdlm5d5d707cd031744e8437f67f6acf02afaabd18e76bf8db9d674333de6f1fb2f1","depth":0,"attach":null,"deadline_at":"2026-10-13T05:02:40.954Z","created_at":"2026-10-13T04:57:40.954Z","started_at":"2026-10-13T04:57:42.283Z","ended_at":null,"updated_at":"2026-10-13T04:57:42.283Z","heartbeat_at":"2026-10-13T04:57:42.283Z","cancel_requested_at":null,"cancelled_by":null,"cancel_reason":null,"cancel_message":null,"suspend_requested_at":null,"suspended_by":null,"queued_ms":1329,"run_ms":null,"wait_ms":null,"usage":null,"rerun_of":null,"labels":{"namespace":"docs-samples","name":"sample-run-1791867412840-b05e8a"}},"specversion":"1.0","id":"WyJydW5fMDBtdjY3bWRsbTVkNWQ3MDdjZDAzMTc0NGU4NDM3ZjY3ZjZhY2YwMmFmYWFiZDE4ZTc2YmY4ZGI5ZDY3NDMzM2RlNmYxZmIyZjE6ZXZlbnRzIiwyXQ==","cursor":"WyJydW5fMDBtdjY3bWRsbTVkNWQ3MDdjZDAzMTc0NGU4NDM3ZjY3ZjZhY2YwMmFmYWFiZDE4ZTc2YmY4ZGI5ZDY3NDMzM2RlNmYxZmIyZjE6ZXZlbnRzIiwyXQ==","seq":2,"source":"/automation/v1/runs/run_00mv67mdlm5d5d707cd031744e8437f67f6acf02afaabd18e76bf8db9d674333de6f1fb2f1","time":"2026-10-13T04:57:42.283Z"}
id: WyJydW5fMDBtdjY3bWRsbTVkNWQ3MDdjZDAzMTc0NGU4NDM3ZjY3ZjZhY2YwMmFmYWFiZDE4ZTc2YmY4ZGI5ZDY3NDMzM2RlNmYxZmIyZjE6ZXZlbnRzIiwzXQ==
event: ai.praxis.automation.run.status
data: {"type":"ai.praxis.automation.run.status","data":{"id":"run_00mv67mdlm5d5d707cd031744e8437f67f6acf02afaabd18e76bf8db9d674333de6f1fb2f1","kind":"script","number":null,"definition":null,"target":null,"resolved_version":null,"source_digest":"7ae6678882a4ef2ea96e401c105d5c6ef512917cd72a9235289d2a3bf1f1b49d","language":"ts","status":"completed","progress":null,"current_wait":null,"counters":{"calls":0,"action_calls":0,"child_runs":0,"tasks_completed":0,"tasks_total":null},"input":{"n":41},"output":{"answer":42},"error":null,"initiator":{"type":"api_key","id":"key_3e00b8984967"},"channel":"api","owner":"tnt_3a9759864ccb4e00","trigger":null,"parent":null,"parent_run_id":null,"root_run_id":"run_00mv67mdlm5d5d707cd031744e8437f67f6acf02afaabd18e76bf8db9d674333de6f1fb2f1","depth":0,"attach":null,"deadline_at":"2026-10-13T05:02:40.954Z","created_at":"2026-10-13T04:57:40.954Z","started_at":"2026-10-13T04:57:42.283Z","ended_at":"2026-10-13T04:57:42.367Z","updated_at":"2026-10-13T04:57:42.367Z","heartbeat_at":"2026-10-13T04:57:42.283Z","cancel_requested_at":null,"cancelled_by":null,"cancel_reason":null,"cancel_message":null,"suspend_requested_at":null,"suspended_by":null,"queued_ms":1329,"run_ms":84,"wait_ms":null,"usage":null,"rerun_of":null,"labels":{"namespace":"docs-samples","name":"sample-run-1791867412840-b05e8a"}},"specversion":"1.0","id":"WyJydW5fMDBtdjY3bWRsbTVkNWQ3MDdjZDAzMTc0NGU4NDM3ZjY3ZjZhY2YwMmFmYWFiZDE4ZTc2YmY4ZGI5ZDY3NDMzM2RlNmYxZmIyZjE6ZXZlbnRzIiwzXQ==","cursor":"WyJydW5fMDBtdjY3bWRsbTVkNWQ3MDdjZDAzMTc0NGU4NDM3ZjY3ZjZhY2YwMmFmYWFiZDE4ZTc2YmY4ZGI5ZDY3NDMzM2RlNmYxZmIyZjE6ZXZlbnRzIiwzXQ==","seq":3,"source":"/automation/v1/runs/run_00mv67mdlm5d5d707cd031744e8437f67f6acf02afaabd18e76bf8db9d674333de6f1fb2f1","time":"2026-10-13T04:57:42.367Z"}
event: end
data: {}
| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | RUN_NOT_FOUND:运行不存在或当前租户不可见。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
默认返回保留期内的日志页,保留期为 30 天;Accept: text/event-stream 开启实时流,日志帧为 event: log。id 为续传游标,Last-Event-ID 优先于 cursor;每 20 秒发送 : ping,运行终态后以 event: end 收尾。
GET /automation/v1/runs/{id}/logs
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: id | string | 必填;运行 ID(run_)。 |
| query: limit | integer | 可选;运行台账每页条数,整数 1–200,默认 50;其它集合上限为 100。 minimum: 1;maximum: 200 |
| query: cursor | string | 可选;上一页返回的 next_cursor,不透明字符串;保持原查询条件继续翻页。 |
| header: Accept | "application/json" / "text/event-stream" | 可选;application/json(默认)读取账本页;text/event-stream 订阅实时流。 |
| header: Last-Event-ID | string | 可选;SSE 续传游标,读取该事件之后的记录;优先于 cursor,仅用于实时流。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| RUN_ID | 运行 id;暂停和恢复仅工作流;取消需非终态运行 |
: "${RUN_ID:?Set RUN_ID}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/runs/${RUN_ID}/logs" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Accept: text/event-stream"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
for await (const event of automation.runs.logs({
"path": {
"id": env("RUN_ID")
}
})) {
console.log(event);
}Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| data | object[] | 必填 / 必有;本页的日志行(LogLine),按时间顺序排列。 |
| data[].cursor | string | 必填 / 必有;该行的游标;用作 cursor 翻页,或在 SSE 中作为 Last-Event-ID 续传。 |
| data[].ts | string | 必填 / 必有;日志产生的时间(RFC 3339 UTC)。 |
| data[].level | "debug" / "info" / "warn" / "error" | 必填 / 必有;日志级别。debug 调试信息;info 一般信息;warn 警告;error 错误。 |
| data[].message | string | 必填 / 必有;日志文本。 |
| next_cursor | null / string | 必填 / 必有;下一页游标,原样传给 cursor 参数并保持原查询条件;没有更多页为 null。接口不返回总数。 |
text/event-stream
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 可选;Resume cursor of this entry; send it back as Last-Event-ID, or as cursor on the JSON form, to continue after it. Absent on the end event. |
| event | "log" / "end" | 必填 / 必有;SSE event name: log carries one log line in data; end is sent once when the run has reached a terminal status and closes the stream. |
| data | object / object | 必填 / 必有;Decoded JSON of one log line; for the end event, an empty object. |
| data(分支1).cursor | string | 必填 / 必有;该行的游标;用作 cursor 翻页,或在 SSE 中作为 Last-Event-ID 续传。 |
| data(分支1).ts | string | 必填 / 必有;日志产生的时间(RFC 3339 UTC)。 |
| data(分支1).level | "debug" / "info" / "warn" / "error" | 必填 / 必有;日志级别。debug 调试信息;info 一般信息;warn 警告;error 错误。 |
| data(分支1).message | string | 必填 / 必有;日志文本。 |
| (分支1).event | "log" | 可选;SSE event name: log, one log line is carried in data. |
| (分支1).data | object | 可选;运行产生的一行日志,保留 30 天。 不接受额外字段。 |
| (分支1).data.cursor | string | 必填 / 必有;该行的游标;用作 cursor 翻页,或在 SSE 中作为 Last-Event-ID 续传。 |
| (分支1).data.ts | string | 必填 / 必有;日志产生的时间(RFC 3339 UTC)。 |
| (分支1).data.level | "debug" / "info" / "warn" / "error" | 必填 / 必有;日志级别。debug 调试信息;info 一般信息;warn 警告;error 错误。 |
| (分支1).data.message | string | 必填 / 必有;日志文本。 |
| (分支2).event | "end" | 可选;SSE event name end: sent once when the run has reached a terminal status, and the stream then closes. |
| (分支2).data | object | 可选;Always an empty object for the end event. |
HTTP 200
event: end
data: {}
| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | RUN_NOT_FOUND:运行不存在或当前租户不可见。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
读取运行实际使用的源码及摘要。结果包括语言与 SHA-256 摘要,适用于临时运行及已发布定义的运行。
GET /automation/v1/runs/{id}/source
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: id | string | 必填;运行 ID(run_)。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| RUN_ID | 运行 id;暂停和恢复仅工作流;取消需非终态运行 |
: "${RUN_ID:?Set RUN_ID}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/runs/${RUN_ID}/source" \
-H "Authorization: Bearer $PRAXIS_API_KEY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.runs.retrieveSource({
"path": {
"id": env("RUN_ID")
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| language | "ts" / "yaml" | 必填 / 必有;源码语言。ts 表示 TypeScript 脚本;yaml 表示工作流 YAML。 |
| source | string | 必填 / 必有;运行时使用的完整源码(ts 或 yaml)。 |
| sha256 | string | 必填 / 必有;源码的 SHA-256 摘要,可作为发布时的 expected_source_sha256。 |
HTTP 200
{
"language": "ts",
"source": "export default async (input: { n: number }) => ({ answer: input.n + 1 });",
"sha256": "7ae6678882a4ef2ea96e401c105d5c6ef512917cd72a9235289d2a3bf1f1b49d"
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | RUN_NOT_FOUND:运行不存在或当前租户不可见。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
分页列出租户触发器,可按目标、类型和状态筛选;ns/name 匹配该目标的所有标签或版本,ns/name@spec 精确匹配。
GET /automation/v1/triggers
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| query: limit | integer | 可选;每页条数,整数 1–100,默认 25。 minimum: 1;maximum: 100 |
| query: cursor | string | 可选;上一页返回的 next_cursor,不透明字符串;保持原查询条件继续翻页。 |
| query: target | string[] | 可选;ns/name 匹配该目标的所有版本或标签;ns/name@spec 精确匹配已存的引用。 多个值以逗号分隔,匹配任一值。 minItems: 1 |
| query: kind | "schedule" / "webhook"[] | 可选;schedule 或 webhook;省略返回两者。 多个值以逗号分隔,匹配任一值。 minItems: 1 |
| query: state | "enabled" / "paused" / "expired"[] | 可选;触发器状态:enabled、paused 或 expired;省略不过滤。 多个值以逗号分隔,匹配任一值。 minItems: 1 |
| query: labels | object | 可选;按标签过滤,使用 labels[k]=v;同键逗号多值取任一,不同键同时满足。 |
| query: created_at[gte] | string | 可选;创建时间下界,包含边界;使用带时区的 ISO 8601 时间。 format: "date-time" |
| query: created_at[lte] | string | 可选;创建时间上界,包含边界;使用带时区的 ISO 8601 时间。 format: "date-time" |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| TARGET | 已发布的 docs-samples/name@1.0.0 |
: "${TARGET:?Set TARGET}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/triggers" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
--get \
--data-urlencode "target=${TARGET}"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.triggers.list({
"query": {
"target": [
env("TARGET")
]
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| data | object[] | 必填 / 必有;本页的触发器,按 created_at 倒序、id 倒序排列。 |
| data[].name | string | 必填 / 必有;触发器名称,1–100 字符。 minLength: 1;maxLength: 100 |
| data[].description | string | 必填 / 必有;触发器说明,最多 1000 字符。 maxLength: 1000 |
| data[].labels | object | 必填 / 必有;触发器标签:字符串键值对,最多 64 个;键不能以保留前缀 praxis. 开头,违反返回 400 INPUT_INVALID。 |
| data[].target | string | 必填 / 必有;要运行的脚本或工作流引用,形如 ns/name@标签或版本;默认跟随 latest,写成 @1.2.0 则钉死版本。 |
| data[].input | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| data[].input(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[].input(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| data[].kind | "schedule" / "webhook" | 必填 / 必有;触发器类型。schedule 按计划(cron、every 或 at)触发;webhook 由入站 HTTP 请求触发。 |
| data[].schedule | object / object / object / null | 必填 / 必有;定时规则,kind=schedule 时有值(cron、every 或 at 三选一);webhook 为 null。 |
| data[].schedule(分支1)(分支1).cron | string | 必填 / 必有;Five fields; supports L, W, #. DST gaps skip the day and overlaps run once. |
| data[].schedule(分支1)(分支2).every | string / object | 必填 / 必有;时长:ISO 8601 字符串(如 PT5M),或 {days, hours, minutes, seconds, milliseconds} 对象;折算后必须是 60000 至 31622400000 毫秒(1 分钟至 366 天)的整数毫秒。 |
| data[].schedule(分支1)(分支2).every(分支2).days | integer | 可选;天数,非负整数。 minimum: 0 |
| data[].schedule(分支1)(分支2).every(分支2).hours | integer | 可选;小时数,非负整数。 minimum: 0 |
| data[].schedule(分支1)(分支2).every(分支2).minutes | integer | 可选;分钟数,非负整数。 minimum: 0 |
| data[].schedule(分支1)(分支2).every(分支2).seconds | integer | 可选;秒数,非负整数。 minimum: 0 |
| data[].schedule(分支1)(分支2).every(分支2).milliseconds | integer | 可选;毫秒数,非负整数。 minimum: 0 |
| data[].schedule(分支1)(分支3).at | string | 必填 / 必有;一次性触发的时刻(RFC 3339 UTC);不能早于当前时间,也不能晚于一年后。执行后触发器进入 expired。 format: "date-time" |
| data[].timezone | string | 必填 / 必有;IANA 时区名,定时规则按它解释;API 缺省为 UTC。 default: "UTC" |
| data[].start_at | string / null | 必填 / 必有;定时触发器的开始时间(RFC 3339 UTC);此前不触发。没有限制为 null。 |
| data[].end_at | string / null | 必填 / 必有;定时触发器的结束时间(RFC 3339 UTC);超过后进入 expired。没有期限为 null。 |
| data[].overlap | "skip" / "allow" | 必填 / 必有;重叠策略:上一次运行未结束时又到点,skip(默认)跳过,allow 照常启动。 default: "skip" |
| data[].catchup_window_seconds | integer | 必填 / 必有;补跑窗口(秒),默认 300,仅定时触发器适用:到点时若已延迟超过该值(宕机、暂停期间),记为 missed 且不补跑。 default: 300;minimum: 0 |
| data[].webhook | object / null | 必填 / 必有;webhook 设置,kind=webhook 时有值;schedule 触发器为 null。 |
| data[].webhook(分支1).input_mode | "body" / "envelope" | 必填 / 必有;webhook 触发时传给目标的输入形态。body(默认)只传请求体;envelope 传含 body、raw_body、raw_body_encoding、headers、webhook_id、received_at 的信封对象。 |
| data[].webhook(分支1).url_hint | string | 必填 / 必有;webhook 地址的掩码提示,省略号代替私密 token,不能用于调用。新建触发器为公开完整 URL;历史记录可能为 /automation/v1/hooks/{id}/… 相对路径。 |
| data[].id | string | 必填 / 必有;触发器 ID,前缀 trg_;用于 webhook 地址以及触发器的所有接口。 |
| data[].owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| data[].state | "enabled" / "paused" / "expired" | 必填 / 必有;触发器状态。enabled 启用,会按计划或请求触发;paused 已暂停,不触发;expired 已到期,一次性触发器执行完或超过 end_at 后进入,不再触发。 |
| data[].source | "api" / "definition" | 必填 / 必有;触发器来源。api 为通过 API 创建,可修改和删除;definition 为由工作流 YAML 的 schedule 生成,只能暂停或恢复,修改返回 409 TRIGGER_MANAGED。 |
| data[].created_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| data[].created_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| data[].created_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| data[].created_by_user_id | string | 必填 / 必有;创建者的真实用户 ID,由网关转发;触发器启动的运行以该用户身份取令牌,用于审计与用量归属。 |
| data[].next_fire_times | string[] | 必填 / 必有;接下来最多 5 次的触发时间(RFC 3339 UTC);webhook、已暂停或已到期的触发器为空数组。 maxItems: 5 |
| data[].last_firing | object / null | 必填 / 必有;最近一次触发记录;从未触发为 null。 |
| data[].last_firing(分支1).id | string | 必填 / 必有;触发记录 ID;记录保留 30 天。 |
| data[].last_firing(分支1).trigger_id | string | 必填 / 必有;所属触发器 ID(trg_ 前缀)。 |
| data[].last_firing(分支1).scheduled_at | string | 必填 / 必有;计划触发的时间(RFC 3339 UTC);webhook 取请求到达时间。 format: "date-time" |
| data[].last_firing(分支1).fired_at | string | 必填 / 必有;实际触发的时间(RFC 3339 UTC)。 format: "date-time" |
| data[].last_firing(分支1).outcome | "accepted" / "started" / "skipped_overlap" / "missed" / "failed" / "deduped" | 必填 / 必有;触发结果。accepted 已持久化等待处理;started 已创建运行;skipped_overlap 因上一次运行未结束而跳过;missed 到点时延迟超过补跑窗口,不补跑;failed 创建运行失败;deduped 与 24 小时内相同 webhook-id 的请求重复,已去重。 |
| data[].last_firing(分支1).run_id | string / null | 必填 / 必有;本次触发创建的运行 ID(run_ 前缀);未创建运行为 null。 |
| data[].last_firing(分支1).resolved_version | string / null | 必填 / 必有;本次触发实际解析到的精确版本号;尚未解析或失败时为 null。 |
| data[].last_firing(分支1).error | object / null | 必填 / 必有;触发失败时的原因 {code, message};没有失败为 null。 |
| data[].last_firing(分支1).error(分支1).code | string | 必填 / 必有;失败的错误码。 |
| data[].last_firing(分支1).error(分支1).message | string | 必填 / 必有;失败的说明文字。 |
| data[].counts | object | 必填 / 必有;触发结果累计次数 {started, skipped, missed, failed}。 不接受额外字段。 |
| data[].counts.started | integer | 必填 / 必有;成功启动运行的次数。 minimum: 0 |
| data[].counts.skipped | integer | 必填 / 必有;因重叠策略为 skip 且上一次运行未结束而跳过的次数。 minimum: 0 |
| data[].counts.missed | integer | 必填 / 必有;因延迟超过补跑窗口而错过的次数。 minimum: 0 |
| data[].counts.failed | integer | 必填 / 必有;创建运行失败的次数。 minimum: 0 |
| data[].created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 format: "date-time" |
| data[].updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 format: "date-time" |
| data[].etag | string | 必填 / 必有;触发器当前修订标识,更新时作为 If-Match;不匹配返回 412。 |
| data[].usage_30d | object / null | 可选;仅 GET /triggers/{id} 返回,列表省略。最近 30 天由此触发器启动的运行及子运行的归因实扣。运行本身不收费;这里是运行中调用模型、搜索等能力产生的实扣,按调用归因;未评级的用量稍后计入。汇总超时(1.5 秒)或失败时为 null,详情仍返回 200。 |
| data[].usage_30d(分支1).currency | "USD" | 必填 / 必有;金额币种,固定为 USD。 |
| data[].usage_30d(分支1).cost | string | 必填 / 必有;已评级实扣的美元十进制字符串,精确到 6 位小数;没有用量时为 0.000000。 pattern: "^[0-9]+\.[0-9]{6}$" |
| data[].usage_30d(分支1).pending_events | integer | 必填 / 必有;尚未评级的用量事件数,金额稍后才计入。 minimum: 0 |
| next_cursor | string / null | 必填 / 必有;下一页游标,原样传给 cursor 参数并保持原查询条件;没有更多页为 null。接口不返回总数。 |
HTTP 200
{
"data": [
{
"id": "trg_00mv67mzzqa0d63b98d72446dd9d1331051a3e100e",
"owner": "tnt_3a9759864ccb4e00",
"name": "sample-webhook-1791867412840-b05e8a",
"description": "",
"labels": {
"namespace": "docs-samples"
},
"target": "docs-samples/sample-scripts-1791867412840-b05e8a@1.0.0",
"input": {},
"kind": "webhook",
"schedule": null,
"timezone": "UTC",
"start_at": null,
"end_at": null,
"overlap": "skip",
"catchup_window_seconds": 300,
"webhook": {
"input_mode": "body",
"url_hint": "https://api-develop.deepraxis.ai/automation/v1/hooks/trg_00mv67mzzqa0d63b98d72446dd9d1331051a3e100e/…"
},
"state": "paused",
"source": "api",
"created_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"created_by_user_id": "usr_49d4fcb99517",
"next_fire_times": [],
"last_firing": null,
"counts": {
"started": 0,
"skipped": 0,
"missed": 0,
"failed": 0
},
"created_at": "2026-10-13T04:58:09.974Z",
"updated_at": "2026-10-13T04:58:12.519Z",
"etag": "etag_00mv67n1yf40e7b8d39ce5459d9ce835bfb1083701"
}
],
"next_cursor": null
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
为已发布脚本或工作流创建定时或 webhook 触发器,每租户最多 100 个启用中的触发器。目标只接受精确版本或标签,webhook_url 仅在创建 webhook 或轮换时返回,须妥善保存。
POST /automation/v1/triggers
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| header: Idempotency-Key | string | 可选;可选;1–256 字符。24 小时内同一 key 重放首个响应并带 Idempotent-Replayed: true;同 key 不同请求体返回 422;处理中返回 409。 minLength: 1;maxLength: 256 |
不接受额外字段。
| 字段 | 类型 | 说明 |
|---|---|---|
| name | string | 必填 / 必有;触发器显示名,1–100 字符且不能全为空白;不要求唯一。 minLength: 1;maxLength: 100 |
| description | string | 可选;说明,最多 1000 个字符。 maxLength: 1000 |
| labels | object | 可选;最多 64 个用户标签,禁止 praxis. 前缀;内部标签不占用名额。键 1–40 字符、值最多 500 字符。 |
| target | string | 必填 / 必有;ns/name@tag 或 ns/name@version,省略 @ 时用 latest;触发器不接受版本范围。 |
| input | null / string / number / boolean / object / null / string / number / boolean / object / JSON[][] | 可选;定时触发的静态 JSON 输入,默认 {};创建与修改时校验目标契约。webhook 未显式提供时不在创建阶段校验回调输入。 |
| input(分支5).*(分支5) | object | 递归 JSON 值。 |
| input(分支5).*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| input(分支6)[](分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| input(分支6)[](分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| kind | "schedule" / "webhook" | 必填 / 必有;schedule 按计划触发,webhook 由 HTTP 回调触发;创建后不可更改。 |
| schedule | object / object / object | 可选;三选一:cron 为五段表达式(支持 L/W/#);every 为 ISO 8601 时长或时长对象,须为正整数毫秒且在 1 分钟至 366 天之间;at 为未来一年内的一次性 RFC 3339 时间。 |
| schedule(分支1).cron | string | 必填 / 必有;Five fields; supports L, W, #. DST gaps skip the day and overlaps run once. |
| schedule(分支2).every | string / object | 必填 / 必有;时长:ISO 8601 字符串(如 PT5M),或 {days, hours, minutes, seconds, milliseconds} 对象;折算后必须是 60000 至 31622400000 毫秒(1 分钟至 366 天)的整数毫秒。 |
| schedule(分支2).every(分支2).days | integer | 可选;天数,非负整数。 minimum: 0 |
| schedule(分支2).every(分支2).hours | integer | 可选;小时数,非负整数。 minimum: 0 |
| schedule(分支2).every(分支2).minutes | integer | 可选;分钟数,非负整数。 minimum: 0 |
| schedule(分支2).every(分支2).seconds | integer | 可选;秒数,非负整数。 minimum: 0 |
| schedule(分支2).every(分支2).milliseconds | integer | 可选;毫秒数,非负整数。 minimum: 0 |
| schedule(分支3).at | string | 必填 / 必有;一次性触发时刻,需带 Z 或 ±HH:MM 时区;必须在请求时刻至一年后之间。调用时将示例替换为该范围内的未来时间。 pattern: "(Z|[+-]\d\d:\d\d)$";format: "date-time" |
| timezone | string | 可选;IANA 时区,默认 UTC;夏令时跳过不存在的时刻,重复时刻只触发一次。 default: "UTC" |
| start_at | string / null | 可选;可选开始时间,RFC 3339 且带时区;null 表示不设下界。 |
| end_at | string / null | 可选;可选结束时间,RFC 3339 且带时区;不能早于 start_at,null 表示不设上界。 |
| overlap | "skip" / "allow" | 可选;skip(默认)在前次运行未结束时跳过,allow 允许并行触发。 default: "skip" |
| catchup_window_seconds | integer | 可选;非负整数秒,默认 300;仅对定时触发器生效;延迟超过窗口时记为 missed,不补跑,webhook 不受此窗口影响。 default: 300;minimum: 0 |
| webhook | object | 可选;input_mode 为 body(默认)或 envelope;后者包含 body、raw_body、raw_body_encoding、白名单 headers、webhook_id、received_at,完整 URL 仅创建或轮换时返回。 不接受额外字段。 |
| webhook.input_mode | "body" / "envelope" | 必填 / 必有;webhook 触发时传给目标的输入形态。body(默认)只传请求体;envelope 传含 body、raw_body、raw_body_encoding、headers、webhook_id、received_at 的信封对象。 default: "body" |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| TARGET | 已发布的 docs-samples/name@1.0.0 |
: "${TARGET:?Set TARGET}"
BODY=$(jq -n --arg TARGET "$TARGET" '{
"name": "sample-webhook",
"target": $TARGET,
"kind": "webhook",
"labels": {
"namespace": "docs-samples"
},
"webhook": {
"input_mode": "body"
}
}')
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/triggers" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data "$BODY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.triggers.create({
"body": {
"name": "sample-webhook",
"target": env("TARGET"),
"kind": "webhook",
"labels": {
"namespace": "docs-samples"
},
"webhook": {
"input_mode": "body"
}
}
});
console.log(result);Success
| 响应头 | 类型 | 说明 |
|---|---|---|
| ETag | string | Current resource revision for conditional updates. |
| Idempotent-Replayed | boolean | Present and true when replaying the first response for this key. |
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| name | string | 必填 / 必有;触发器名称,1–100 字符。 minLength: 1;maxLength: 100 |
| description | string | 必填 / 必有;触发器说明,最多 1000 字符。 maxLength: 1000 |
| labels | object | 必填 / 必有;触发器标签:字符串键值对,最多 64 个;键不能以保留前缀 praxis. 开头,违反返回 400 INPUT_INVALID。 |
| target | string | 必填 / 必有;要运行的脚本或工作流引用,形如 ns/name@标签或版本;默认跟随 latest,写成 @1.2.0 则钉死版本。 |
| input | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| input(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| input(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| kind | "schedule" / "webhook" | 必填 / 必有;触发器类型。schedule 按计划(cron、every 或 at)触发;webhook 由入站 HTTP 请求触发。 |
| schedule | object / object / object / null | 必填 / 必有;定时规则,kind=schedule 时有值(cron、every 或 at 三选一);webhook 为 null。 |
| schedule(分支1)(分支1).cron | string | 必填 / 必有;Five fields; supports L, W, #. DST gaps skip the day and overlaps run once. |
| schedule(分支1)(分支2).every | string / object | 必填 / 必有;时长:ISO 8601 字符串(如 PT5M),或 {days, hours, minutes, seconds, milliseconds} 对象;折算后必须是 60000 至 31622400000 毫秒(1 分钟至 366 天)的整数毫秒。 |
| schedule(分支1)(分支2).every(分支2).days | integer | 可选;天数,非负整数。 minimum: 0 |
| schedule(分支1)(分支2).every(分支2).hours | integer | 可选;小时数,非负整数。 minimum: 0 |
| schedule(分支1)(分支2).every(分支2).minutes | integer | 可选;分钟数,非负整数。 minimum: 0 |
| schedule(分支1)(分支2).every(分支2).seconds | integer | 可选;秒数,非负整数。 minimum: 0 |
| schedule(分支1)(分支2).every(分支2).milliseconds | integer | 可选;毫秒数,非负整数。 minimum: 0 |
| schedule(分支1)(分支3).at | string | 必填 / 必有;一次性触发的时刻(RFC 3339 UTC);不能早于当前时间,也不能晚于一年后。执行后触发器进入 expired。 format: "date-time" |
| timezone | string | 必填 / 必有;IANA 时区名,定时规则按它解释;API 缺省为 UTC。 default: "UTC" |
| start_at | string / null | 必填 / 必有;定时触发器的开始时间(RFC 3339 UTC);此前不触发。没有限制为 null。 |
| end_at | string / null | 必填 / 必有;定时触发器的结束时间(RFC 3339 UTC);超过后进入 expired。没有期限为 null。 |
| overlap | "skip" / "allow" | 必填 / 必有;重叠策略:上一次运行未结束时又到点,skip(默认)跳过,allow 照常启动。 default: "skip" |
| catchup_window_seconds | integer | 必填 / 必有;补跑窗口(秒),默认 300,仅定时触发器适用:到点时若已延迟超过该值(宕机、暂停期间),记为 missed 且不补跑。 default: 300;minimum: 0 |
| webhook | object / null | 必填 / 必有;webhook 设置,kind=webhook 时有值;schedule 触发器为 null。 |
| webhook(分支1).input_mode | "body" / "envelope" | 必填 / 必有;webhook 触发时传给目标的输入形态。body(默认)只传请求体;envelope 传含 body、raw_body、raw_body_encoding、headers、webhook_id、received_at 的信封对象。 |
| webhook(分支1).url_hint | string | 必填 / 必有;webhook 地址的掩码提示,省略号代替私密 token,不能用于调用。新建触发器为公开完整 URL;历史记录可能为 /automation/v1/hooks/{id}/… 相对路径。 |
| id | string | 必填 / 必有;触发器 ID,前缀 trg_;用于 webhook 地址以及触发器的所有接口。 |
| owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| state | "enabled" / "paused" / "expired" | 必填 / 必有;触发器状态。enabled 启用,会按计划或请求触发;paused 已暂停,不触发;expired 已到期,一次性触发器执行完或超过 end_at 后进入,不再触发。 |
| source | "api" / "definition" | 必填 / 必有;触发器来源。api 为通过 API 创建,可修改和删除;definition 为由工作流 YAML 的 schedule 生成,只能暂停或恢复,修改返回 409 TRIGGER_MANAGED。 |
| created_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| created_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| created_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| created_by_user_id | string | 必填 / 必有;创建者的真实用户 ID,由网关转发;触发器启动的运行以该用户身份取令牌,用于审计与用量归属。 |
| next_fire_times | string[] | 必填 / 必有;接下来最多 5 次的触发时间(RFC 3339 UTC);webhook、已暂停或已到期的触发器为空数组。 maxItems: 5 |
| last_firing | object / null | 必填 / 必有;最近一次触发记录;从未触发为 null。 |
| last_firing(分支1).id | string | 必填 / 必有;触发记录 ID;记录保留 30 天。 |
| last_firing(分支1).trigger_id | string | 必填 / 必有;所属触发器 ID(trg_ 前缀)。 |
| last_firing(分支1).scheduled_at | string | 必填 / 必有;计划触发的时间(RFC 3339 UTC);webhook 取请求到达时间。 format: "date-time" |
| last_firing(分支1).fired_at | string | 必填 / 必有;实际触发的时间(RFC 3339 UTC)。 format: "date-time" |
| last_firing(分支1).outcome | "accepted" / "started" / "skipped_overlap" / "missed" / "failed" / "deduped" | 必填 / 必有;触发结果。accepted 已持久化等待处理;started 已创建运行;skipped_overlap 因上一次运行未结束而跳过;missed 到点时延迟超过补跑窗口,不补跑;failed 创建运行失败;deduped 与 24 小时内相同 webhook-id 的请求重复,已去重。 |
| last_firing(分支1).run_id | string / null | 必填 / 必有;本次触发创建的运行 ID(run_ 前缀);未创建运行为 null。 |
| last_firing(分支1).resolved_version | string / null | 必填 / 必有;本次触发实际解析到的精确版本号;尚未解析或失败时为 null。 |
| last_firing(分支1).error | object / null | 必填 / 必有;触发失败时的原因 {code, message};没有失败为 null。 |
| last_firing(分支1).error(分支1).code | string | 必填 / 必有;失败的错误码。 |
| last_firing(分支1).error(分支1).message | string | 必填 / 必有;失败的说明文字。 |
| counts | object | 必填 / 必有;触发结果累计次数 {started, skipped, missed, failed}。 不接受额外字段。 |
| counts.started | integer | 必填 / 必有;成功启动运行的次数。 minimum: 0 |
| counts.skipped | integer | 必填 / 必有;因重叠策略为 skip 且上一次运行未结束而跳过的次数。 minimum: 0 |
| counts.missed | integer | 必填 / 必有;因延迟超过补跑窗口而错过的次数。 minimum: 0 |
| counts.failed | integer | 必填 / 必有;创建运行失败的次数。 minimum: 0 |
| created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 format: "date-time" |
| updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 format: "date-time" |
| etag | string | 必填 / 必有;触发器当前修订标识,更新时作为 If-Match;不匹配返回 412。 |
| usage_30d | object / null | 可选;创建响应中恒为 null;近 30 天用量只在 GET /triggers/{id} 返回。 |
| usage_30d(分支1).currency | "USD" | 必填 / 必有;金额币种,固定为 USD。 |
| usage_30d(分支1).cost | string | 必填 / 必有;已评级实扣的美元十进制字符串,精确到 6 位小数;没有用量时为 0.000000。 pattern: "^[0-9]+\.[0-9]{6}$" |
| usage_30d(分支1).pending_events | integer | 必填 / 必有;尚未评级的用量事件数,金额稍后才计入。 minimum: 0 |
| webhook_url | string | 可选;Returned only on webhook creation or rotation. format: "uri" |
HTTP 200
{
"id": "trg_00mv67mzzqa0d63b98d72446dd9d1331051a3e100e",
"owner": "tnt_3a9759864ccb4e00",
"name": "sample-webhook-1791867412840-b05e8a",
"description": "",
"labels": {
"namespace": "docs-samples"
},
"target": "docs-samples/sample-scripts-1791867412840-b05e8a@1.0.0",
"input": {},
"kind": "webhook",
"schedule": null,
"timezone": "UTC",
"start_at": null,
"end_at": null,
"overlap": "skip",
"catchup_window_seconds": 300,
"webhook": {
"input_mode": "body",
"url_hint": "https://api-develop.deepraxis.ai/automation/v1/hooks/trg_00mv67mzzqa0d63b98d72446dd9d1331051a3e100e/…"
},
"state": "enabled",
"source": "api",
"created_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"created_by_user_id": "usr_49d4fcb99517",
"next_fire_times": [],
"last_firing": null,
"counts": {
"started": 0,
"skipped": 0,
"missed": 0,
"failed": 0
},
"created_at": "2026-10-13T04:58:09.974Z",
"updated_at": "2026-10-13T04:58:09.974Z",
"etag": "etag_00mv67mzzqc6ef5487c69f4857b65b91dab497104c",
"webhook_url": "https://api-develop.deepraxis.ai/automation/v1/hooks/trg_00mv67mzzqa0d63b98d72446dd9d1331051a3e100e/${WEBHOOK_TOKEN}"
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 SCHEDULE_INVALID:定时规则或时间边界无效。 TIMEZONE_INVALID:时区不是有效的 IANA 时区。 INTERVAL_TOO_SHORT:定时间隔短于一分钟。 INPUT_INVALID:输入不满足目标契约或业务校验。 |
| 404 | TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 VERSION_NOT_FOUND:指定版本或修订不存在。 |
| 409 | IDEMPOTENCY_IN_FLIGHT:同一幂等键的请求仍在处理中。 TARGET_ARCHIVED:目标已归档,不能用于本操作;动作执行错误的 detail 包含 ns/name。 |
| 412 | PRECONDITION_FAILED:修订、源码摘要或并发写入条件不匹配。 |
| 422 | IDEMPOTENCY_KEY_MISMATCH:同一幂等键已用于不同请求内容。 NO_MATCHING_VERSION:没有满足标签、版本或范围的已发布版本。 |
| 429 | TRIGGER_LIMIT:租户已达到 100 个启用触发器的上限。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
读取规则、状态、未来触发时间与最近触发结果;ETag 可用于修改,完整 webhook URL 不会再次返回。
GET /automation/v1/triggers/{id}
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: id | string | 必填;触发器 ID(trg_)。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| TRIGGER_ID | 触发器 id;webhook 调用前需恢复启用 |
: "${TRIGGER_ID:?Set TRIGGER_ID}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/triggers/${TRIGGER_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.triggers.retrieve({
"path": {
"id": env("TRIGGER_ID")
}
});
console.log(result);Success
| 响应头 | 类型 | 说明 |
|---|---|---|
| ETag | string | Current resource revision for conditional updates. |
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| name | string | 必填 / 必有;触发器名称,1–100 字符。 minLength: 1;maxLength: 100 |
| description | string | 必填 / 必有;触发器说明,最多 1000 字符。 maxLength: 1000 |
| labels | object | 必填 / 必有;触发器标签:字符串键值对,最多 64 个;键不能以保留前缀 praxis. 开头,违反返回 400 INPUT_INVALID。 |
| target | string | 必填 / 必有;要运行的脚本或工作流引用,形如 ns/name@标签或版本;默认跟随 latest,写成 @1.2.0 则钉死版本。 |
| input | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| input(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| input(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| kind | "schedule" / "webhook" | 必填 / 必有;触发器类型。schedule 按计划(cron、every 或 at)触发;webhook 由入站 HTTP 请求触发。 |
| schedule | object / object / object / null | 必填 / 必有;定时规则,kind=schedule 时有值(cron、every 或 at 三选一);webhook 为 null。 |
| schedule(分支1)(分支1).cron | string | 必填 / 必有;Five fields; supports L, W, #. DST gaps skip the day and overlaps run once. |
| schedule(分支1)(分支2).every | string / object | 必填 / 必有;时长:ISO 8601 字符串(如 PT5M),或 {days, hours, minutes, seconds, milliseconds} 对象;折算后必须是 60000 至 31622400000 毫秒(1 分钟至 366 天)的整数毫秒。 |
| schedule(分支1)(分支2).every(分支2).days | integer | 可选;天数,非负整数。 minimum: 0 |
| schedule(分支1)(分支2).every(分支2).hours | integer | 可选;小时数,非负整数。 minimum: 0 |
| schedule(分支1)(分支2).every(分支2).minutes | integer | 可选;分钟数,非负整数。 minimum: 0 |
| schedule(分支1)(分支2).every(分支2).seconds | integer | 可选;秒数,非负整数。 minimum: 0 |
| schedule(分支1)(分支2).every(分支2).milliseconds | integer | 可选;毫秒数,非负整数。 minimum: 0 |
| schedule(分支1)(分支3).at | string | 必填 / 必有;一次性触发的时刻(RFC 3339 UTC);不能早于当前时间,也不能晚于一年后。执行后触发器进入 expired。 format: "date-time" |
| timezone | string | 必填 / 必有;IANA 时区名,定时规则按它解释;API 缺省为 UTC。 default: "UTC" |
| start_at | string / null | 必填 / 必有;定时触发器的开始时间(RFC 3339 UTC);此前不触发。没有限制为 null。 |
| end_at | string / null | 必填 / 必有;定时触发器的结束时间(RFC 3339 UTC);超过后进入 expired。没有期限为 null。 |
| overlap | "skip" / "allow" | 必填 / 必有;重叠策略:上一次运行未结束时又到点,skip(默认)跳过,allow 照常启动。 default: "skip" |
| catchup_window_seconds | integer | 必填 / 必有;补跑窗口(秒),默认 300,仅定时触发器适用:到点时若已延迟超过该值(宕机、暂停期间),记为 missed 且不补跑。 default: 300;minimum: 0 |
| webhook | object / null | 必填 / 必有;webhook 设置,kind=webhook 时有值;schedule 触发器为 null。 |
| webhook(分支1).input_mode | "body" / "envelope" | 必填 / 必有;webhook 触发时传给目标的输入形态。body(默认)只传请求体;envelope 传含 body、raw_body、raw_body_encoding、headers、webhook_id、received_at 的信封对象。 |
| webhook(分支1).url_hint | string | 必填 / 必有;webhook 地址的掩码提示,省略号代替私密 token,不能用于调用。新建触发器为公开完整 URL;历史记录可能为 /automation/v1/hooks/{id}/… 相对路径。 |
| id | string | 必填 / 必有;触发器 ID,前缀 trg_;用于 webhook 地址以及触发器的所有接口。 |
| owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| state | "enabled" / "paused" / "expired" | 必填 / 必有;触发器状态。enabled 启用,会按计划或请求触发;paused 已暂停,不触发;expired 已到期,一次性触发器执行完或超过 end_at 后进入,不再触发。 |
| source | "api" / "definition" | 必填 / 必有;触发器来源。api 为通过 API 创建,可修改和删除;definition 为由工作流 YAML 的 schedule 生成,只能暂停或恢复,修改返回 409 TRIGGER_MANAGED。 |
| created_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| created_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| created_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| created_by_user_id | string | 必填 / 必有;创建者的真实用户 ID,由网关转发;触发器启动的运行以该用户身份取令牌,用于审计与用量归属。 |
| next_fire_times | string[] | 必填 / 必有;接下来最多 5 次的触发时间(RFC 3339 UTC);webhook、已暂停或已到期的触发器为空数组。 maxItems: 5 |
| last_firing | object / null | 必填 / 必有;最近一次触发记录;从未触发为 null。 |
| last_firing(分支1).id | string | 必填 / 必有;触发记录 ID;记录保留 30 天。 |
| last_firing(分支1).trigger_id | string | 必填 / 必有;所属触发器 ID(trg_ 前缀)。 |
| last_firing(分支1).scheduled_at | string | 必填 / 必有;计划触发的时间(RFC 3339 UTC);webhook 取请求到达时间。 format: "date-time" |
| last_firing(分支1).fired_at | string | 必填 / 必有;实际触发的时间(RFC 3339 UTC)。 format: "date-time" |
| last_firing(分支1).outcome | "accepted" / "started" / "skipped_overlap" / "missed" / "failed" / "deduped" | 必填 / 必有;触发结果。accepted 已持久化等待处理;started 已创建运行;skipped_overlap 因上一次运行未结束而跳过;missed 到点时延迟超过补跑窗口,不补跑;failed 创建运行失败;deduped 与 24 小时内相同 webhook-id 的请求重复,已去重。 |
| last_firing(分支1).run_id | string / null | 必填 / 必有;本次触发创建的运行 ID(run_ 前缀);未创建运行为 null。 |
| last_firing(分支1).resolved_version | string / null | 必填 / 必有;本次触发实际解析到的精确版本号;尚未解析或失败时为 null。 |
| last_firing(分支1).error | object / null | 必填 / 必有;触发失败时的原因 {code, message};没有失败为 null。 |
| last_firing(分支1).error(分支1).code | string | 必填 / 必有;失败的错误码。 |
| last_firing(分支1).error(分支1).message | string | 必填 / 必有;失败的说明文字。 |
| counts | object | 必填 / 必有;触发结果累计次数 {started, skipped, missed, failed}。 不接受额外字段。 |
| counts.started | integer | 必填 / 必有;成功启动运行的次数。 minimum: 0 |
| counts.skipped | integer | 必填 / 必有;因重叠策略为 skip 且上一次运行未结束而跳过的次数。 minimum: 0 |
| counts.missed | integer | 必填 / 必有;因延迟超过补跑窗口而错过的次数。 minimum: 0 |
| counts.failed | integer | 必填 / 必有;创建运行失败的次数。 minimum: 0 |
| created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 format: "date-time" |
| updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 format: "date-time" |
| etag | string | 必填 / 必有;触发器当前修订标识,更新时作为 If-Match;不匹配返回 412。 |
| usage_30d | object / null | 可选;仅 GET /triggers/{id} 返回,列表省略。最近 30 天由此触发器启动的运行及子运行的归因实扣。运行本身不收费;这里是运行中调用模型、搜索等能力产生的实扣,按调用归因;未评级的用量稍后计入。汇总超时(1.5 秒)或失败时为 null,详情仍返回 200。 |
| usage_30d(分支1).currency | "USD" | 必填 / 必有;金额币种,固定为 USD。 |
| usage_30d(分支1).cost | string | 必填 / 必有;已评级实扣的美元十进制字符串,精确到 6 位小数;没有用量时为 0.000000。 pattern: "^[0-9]+\.[0-9]{6}$" |
| usage_30d(分支1).pending_events | integer | 必填 / 必有;尚未评级的用量事件数,金额稍后才计入。 minimum: 0 |
HTTP 200
{
"id": "trg_00mv67mzzqa0d63b98d72446dd9d1331051a3e100e",
"owner": "tnt_3a9759864ccb4e00",
"name": "sample-webhook-1791867412840-b05e8a",
"description": "",
"labels": {
"namespace": "docs-samples"
},
"target": "docs-samples/sample-scripts-1791867412840-b05e8a@1.0.0",
"input": {},
"kind": "webhook",
"schedule": null,
"timezone": "UTC",
"start_at": null,
"end_at": null,
"overlap": "skip",
"catchup_window_seconds": 300,
"webhook": {
"input_mode": "body",
"url_hint": "https://api-develop.deepraxis.ai/automation/v1/hooks/trg_00mv67mzzqa0d63b98d72446dd9d1331051a3e100e/…"
},
"state": "paused",
"source": "api",
"created_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"created_by_user_id": "usr_49d4fcb99517",
"next_fire_times": [],
"last_firing": null,
"counts": {
"started": 0,
"skipped": 0,
"missed": 0,
"failed": 0
},
"created_at": "2026-10-13T04:58:09.974Z",
"updated_at": "2026-10-13T04:58:12.519Z",
"etag": "etag_00mv67n1yf40e7b8d39ce5459d9ce835bfb1083701",
"usage_30d": null
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | TRIGGER_NOT_FOUND:触发器不存在或不可访问,回调鉴权失败也使用此错误。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
使用匹配当前 ETag 的 If-Match 修改配置,并重新校验目标输入与规则;kind 不可更改,由定义管理的触发器拒绝修改并返回 TRIGGER_MANAGED。
PATCH /automation/v1/triggers/{id}
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: id | string | 必填;触发器 ID(trg_)。 |
| header: If-Match | string | 必填;当前资源的 ETag,可直接使用对象里的 draft.revision 或 etag 字段值:裸值、带双引号或弱校验写法 W/"…" 均接受(RFC 7232 弱比较);缺失返回 400,修订不匹配返回 412。 |
不接受额外字段。
| 字段 | 类型 | 说明 |
|---|---|---|
| name | string | 可选;触发器显示名,1–100 字符且不能全为空白;不要求唯一。 minLength: 1;maxLength: 100 |
| description | string | 可选;说明,最多 1000 个字符。 maxLength: 1000 |
| labels | object | 可选;最多 64 个用户标签,禁止 praxis. 前缀;内部标签不占用名额。键 1–40 字符、值最多 500 字符。 |
| target | string | 可选;ns/name@tag 或 ns/name@version,省略 @ 时用 latest;触发器不接受版本范围。 |
| input | null / string / number / boolean / object / null / string / number / boolean / object / JSON[][] | 可选;定时触发的静态 JSON 输入,默认 {};创建与修改时校验目标契约。webhook 未显式提供时不在创建阶段校验回调输入。 |
| input(分支5).*(分支5) | object | 递归 JSON 值。 |
| input(分支5).*(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| input(分支6)[](分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| input(分支6)[](分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| kind | "schedule" / "webhook" | 可选;schedule 按计划触发,webhook 由 HTTP 回调触发;创建后不可更改。 |
| schedule | object / object / object | 可选;三选一:cron 为五段表达式(支持 L/W/#);every 为 ISO 8601 时长或时长对象,须为正整数毫秒且在 1 分钟至 366 天之间;at 为未来一年内的一次性 RFC 3339 时间。 |
| schedule(分支1).cron | string | 必填 / 必有;Five fields; supports L, W, #. DST gaps skip the day and overlaps run once. |
| schedule(分支2).every | string / object | 必填 / 必有;时长:ISO 8601 字符串(如 PT5M),或 {days, hours, minutes, seconds, milliseconds} 对象;折算后必须是 60000 至 31622400000 毫秒(1 分钟至 366 天)的整数毫秒。 |
| schedule(分支2).every(分支2).days | integer | 可选;天数,非负整数。 minimum: 0 |
| schedule(分支2).every(分支2).hours | integer | 可选;小时数,非负整数。 minimum: 0 |
| schedule(分支2).every(分支2).minutes | integer | 可选;分钟数,非负整数。 minimum: 0 |
| schedule(分支2).every(分支2).seconds | integer | 可选;秒数,非负整数。 minimum: 0 |
| schedule(分支2).every(分支2).milliseconds | integer | 可选;毫秒数,非负整数。 minimum: 0 |
| schedule(分支3).at | string | 必填 / 必有;一次性触发时刻,需带 Z 或 ±HH:MM 时区;必须在请求时刻至一年后之间。调用时将示例替换为该范围内的未来时间。 pattern: "(Z|[+-]\d\d:\d\d)$";format: "date-time" |
| timezone | string | 可选;IANA 时区,默认 UTC;夏令时跳过不存在的时刻,重复时刻只触发一次。 default: "UTC" |
| start_at | string / null | 可选;可选开始时间,RFC 3339 且带时区;null 表示不设下界。 |
| end_at | string / null | 可选;可选结束时间,RFC 3339 且带时区;不能早于 start_at,null 表示不设上界。 |
| overlap | "skip" / "allow" | 可选;skip(默认)在前次运行未结束时跳过,allow 允许并行触发。 default: "skip" |
| catchup_window_seconds | integer | 可选;非负整数秒,默认 300;仅对定时触发器生效;延迟超过窗口时记为 missed,不补跑,webhook 不受此窗口影响。 default: 300;minimum: 0 |
| webhook | object | 可选;input_mode 为 body(默认)或 envelope;后者包含 body、raw_body、raw_body_encoding、白名单 headers、webhook_id、received_at,完整 URL 仅创建或轮换时返回。 不接受额外字段。 |
| webhook.input_mode | "body" / "envelope" | 必填 / 必有;webhook 触发时传给目标的输入形态。body(默认)只传请求体;envelope 传含 body、raw_body、raw_body_encoding、headers、webhook_id、received_at 的信封对象。 default: "body" |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| TRIGGER_ID | 触发器 id;webhook 调用前需恢复启用 |
| ETAG | 最新 GET 响应头 ETag(保留引号) |
: "${TRIGGER_ID:?Set TRIGGER_ID}"
: "${ETAG:?Set ETAG}"
curl --fail-with-body -X PATCH "https://api.deepraxis.ai/automation/v1/triggers/${TRIGGER_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "If-Match: ${ETAG}" \
-H "Content-Type: application/json" \
--data '{
"description": "Sample webhook",
"input": {
"n": 41
}
}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.triggers.update({
"path": {
"id": env("TRIGGER_ID")
},
"headers": {
"If-Match": env("ETAG")
},
"body": {
"description": "Sample webhook",
"input": {
"n": 41
}
}
});
console.log(result);Success
| 响应头 | 类型 | 说明 |
|---|---|---|
| ETag | string | Current resource revision for conditional updates. |
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| name | string | 必填 / 必有;触发器名称,1–100 字符。 minLength: 1;maxLength: 100 |
| description | string | 必填 / 必有;触发器说明,最多 1000 字符。 maxLength: 1000 |
| labels | object | 必填 / 必有;触发器标签:字符串键值对,最多 64 个;键不能以保留前缀 praxis. 开头,违反返回 400 INPUT_INVALID。 |
| target | string | 必填 / 必有;要运行的脚本或工作流引用,形如 ns/name@标签或版本;默认跟随 latest,写成 @1.2.0 则钉死版本。 |
| input | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| input(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| input(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| kind | "schedule" / "webhook" | 必填 / 必有;触发器类型。schedule 按计划(cron、every 或 at)触发;webhook 由入站 HTTP 请求触发。 |
| schedule | object / object / object / null | 必填 / 必有;定时规则,kind=schedule 时有值(cron、every 或 at 三选一);webhook 为 null。 |
| schedule(分支1)(分支1).cron | string | 必填 / 必有;Five fields; supports L, W, #. DST gaps skip the day and overlaps run once. |
| schedule(分支1)(分支2).every | string / object | 必填 / 必有;时长:ISO 8601 字符串(如 PT5M),或 {days, hours, minutes, seconds, milliseconds} 对象;折算后必须是 60000 至 31622400000 毫秒(1 分钟至 366 天)的整数毫秒。 |
| schedule(分支1)(分支2).every(分支2).days | integer | 可选;天数,非负整数。 minimum: 0 |
| schedule(分支1)(分支2).every(分支2).hours | integer | 可选;小时数,非负整数。 minimum: 0 |
| schedule(分支1)(分支2).every(分支2).minutes | integer | 可选;分钟数,非负整数。 minimum: 0 |
| schedule(分支1)(分支2).every(分支2).seconds | integer | 可选;秒数,非负整数。 minimum: 0 |
| schedule(分支1)(分支2).every(分支2).milliseconds | integer | 可选;毫秒数,非负整数。 minimum: 0 |
| schedule(分支1)(分支3).at | string | 必填 / 必有;一次性触发的时刻(RFC 3339 UTC);不能早于当前时间,也不能晚于一年后。执行后触发器进入 expired。 format: "date-time" |
| timezone | string | 必填 / 必有;IANA 时区名,定时规则按它解释;API 缺省为 UTC。 default: "UTC" |
| start_at | string / null | 必填 / 必有;定时触发器的开始时间(RFC 3339 UTC);此前不触发。没有限制为 null。 |
| end_at | string / null | 必填 / 必有;定时触发器的结束时间(RFC 3339 UTC);超过后进入 expired。没有期限为 null。 |
| overlap | "skip" / "allow" | 必填 / 必有;重叠策略:上一次运行未结束时又到点,skip(默认)跳过,allow 照常启动。 default: "skip" |
| catchup_window_seconds | integer | 必填 / 必有;补跑窗口(秒),默认 300,仅定时触发器适用:到点时若已延迟超过该值(宕机、暂停期间),记为 missed 且不补跑。 default: 300;minimum: 0 |
| webhook | object / null | 必填 / 必有;webhook 设置,kind=webhook 时有值;schedule 触发器为 null。 |
| webhook(分支1).input_mode | "body" / "envelope" | 必填 / 必有;webhook 触发时传给目标的输入形态。body(默认)只传请求体;envelope 传含 body、raw_body、raw_body_encoding、headers、webhook_id、received_at 的信封对象。 |
| webhook(分支1).url_hint | string | 必填 / 必有;webhook 地址的掩码提示,省略号代替私密 token,不能用于调用。新建触发器为公开完整 URL;历史记录可能为 /automation/v1/hooks/{id}/… 相对路径。 |
| id | string | 必填 / 必有;触发器 ID,前缀 trg_;用于 webhook 地址以及触发器的所有接口。 |
| owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| state | "enabled" / "paused" / "expired" | 必填 / 必有;触发器状态。enabled 启用,会按计划或请求触发;paused 已暂停,不触发;expired 已到期,一次性触发器执行完或超过 end_at 后进入,不再触发。 |
| source | "api" / "definition" | 必填 / 必有;触发器来源。api 为通过 API 创建,可修改和删除;definition 为由工作流 YAML 的 schedule 生成,只能暂停或恢复,修改返回 409 TRIGGER_MANAGED。 |
| created_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| created_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| created_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| created_by_user_id | string | 必填 / 必有;创建者的真实用户 ID,由网关转发;触发器启动的运行以该用户身份取令牌,用于审计与用量归属。 |
| next_fire_times | string[] | 必填 / 必有;接下来最多 5 次的触发时间(RFC 3339 UTC);webhook、已暂停或已到期的触发器为空数组。 maxItems: 5 |
| last_firing | object / null | 必填 / 必有;最近一次触发记录;从未触发为 null。 |
| last_firing(分支1).id | string | 必填 / 必有;触发记录 ID;记录保留 30 天。 |
| last_firing(分支1).trigger_id | string | 必填 / 必有;所属触发器 ID(trg_ 前缀)。 |
| last_firing(分支1).scheduled_at | string | 必填 / 必有;计划触发的时间(RFC 3339 UTC);webhook 取请求到达时间。 format: "date-time" |
| last_firing(分支1).fired_at | string | 必填 / 必有;实际触发的时间(RFC 3339 UTC)。 format: "date-time" |
| last_firing(分支1).outcome | "accepted" / "started" / "skipped_overlap" / "missed" / "failed" / "deduped" | 必填 / 必有;触发结果。accepted 已持久化等待处理;started 已创建运行;skipped_overlap 因上一次运行未结束而跳过;missed 到点时延迟超过补跑窗口,不补跑;failed 创建运行失败;deduped 与 24 小时内相同 webhook-id 的请求重复,已去重。 |
| last_firing(分支1).run_id | string / null | 必填 / 必有;本次触发创建的运行 ID(run_ 前缀);未创建运行为 null。 |
| last_firing(分支1).resolved_version | string / null | 必填 / 必有;本次触发实际解析到的精确版本号;尚未解析或失败时为 null。 |
| last_firing(分支1).error | object / null | 必填 / 必有;触发失败时的原因 {code, message};没有失败为 null。 |
| last_firing(分支1).error(分支1).code | string | 必填 / 必有;失败的错误码。 |
| last_firing(分支1).error(分支1).message | string | 必填 / 必有;失败的说明文字。 |
| counts | object | 必填 / 必有;触发结果累计次数 {started, skipped, missed, failed}。 不接受额外字段。 |
| counts.started | integer | 必填 / 必有;成功启动运行的次数。 minimum: 0 |
| counts.skipped | integer | 必填 / 必有;因重叠策略为 skip 且上一次运行未结束而跳过的次数。 minimum: 0 |
| counts.missed | integer | 必填 / 必有;因延迟超过补跑窗口而错过的次数。 minimum: 0 |
| counts.failed | integer | 必填 / 必有;创建运行失败的次数。 minimum: 0 |
| created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 format: "date-time" |
| updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 format: "date-time" |
| etag | string | 必填 / 必有;触发器当前修订标识,更新时作为 If-Match;不匹配返回 412。 |
| usage_30d | object / null | 可选;仅 GET /triggers/{id} 返回,列表省略。最近 30 天由此触发器启动的运行及子运行的归因实扣。运行本身不收费;这里是运行中调用模型、搜索等能力产生的实扣,按调用归因;未评级的用量稍后计入。汇总超时(1.5 秒)或失败时为 null,详情仍返回 200。 |
| usage_30d(分支1).currency | "USD" | 必填 / 必有;金额币种,固定为 USD。 |
| usage_30d(分支1).cost | string | 必填 / 必有;已评级实扣的美元十进制字符串,精确到 6 位小数;没有用量时为 0.000000。 pattern: "^[0-9]+\.[0-9]{6}$" |
| usage_30d(分支1).pending_events | integer | 必填 / 必有;尚未评级的用量事件数,金额稍后才计入。 minimum: 0 |
HTTP 200
{
"id": "trg_00mv67mzzqa0d63b98d72446dd9d1331051a3e100e",
"owner": "tnt_3a9759864ccb4e00",
"name": "sample-webhook-1791867412840-b05e8a",
"description": "Sample webhook",
"labels": {
"namespace": "docs-samples"
},
"target": "docs-samples/sample-scripts-1791867412840-b05e8a@1.0.0",
"input": {
"n": 41
},
"kind": "webhook",
"schedule": null,
"timezone": "UTC",
"start_at": null,
"end_at": null,
"overlap": "skip",
"catchup_window_seconds": 300,
"webhook": {
"input_mode": "body",
"url_hint": "https://api-develop.deepraxis.ai/automation/v1/hooks/trg_00mv67mzzqa0d63b98d72446dd9d1331051a3e100e/…"
},
"state": "paused",
"source": "api",
"created_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"created_by_user_id": "usr_49d4fcb99517",
"next_fire_times": [],
"last_firing": null,
"counts": {
"started": 0,
"skipped": 0,
"missed": 0,
"failed": 0
},
"created_at": "2026-10-13T04:58:09.974Z",
"updated_at": "2026-10-13T04:58:14.661Z",
"etag": "etag_00mv67n3ib18c0371214b84064b86e9375320685fa"
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 SCHEDULE_INVALID:定时规则或时间边界无效。 TIMEZONE_INVALID:时区不是有效的 IANA 时区。 INTERVAL_TOO_SHORT:定时间隔短于一分钟。 INPUT_INVALID:输入不满足目标契约或业务校验。 |
| 404 | TRIGGER_NOT_FOUND:触发器不存在或不可访问,回调鉴权失败也使用此错误。 TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 VERSION_NOT_FOUND:指定版本或修订不存在。 |
| 409 | TRIGGER_MANAGED:触发器由定义管理,不能直接修改。 TARGET_ARCHIVED:目标已归档,不能用于本操作;动作执行错误的 detail 包含 ns/name。 |
| 412 | PRECONDITION_FAILED:修订、源码摘要或并发写入条件不匹配。 |
| 422 | NO_MATCHING_VERSION:没有满足标签、版本或范围的已发布版本。 |
| 429 | TRIGGER_LIMIT:租户已达到 100 个启用触发器的上限。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
删除触发器及其触发历史,返回 204;已经启动的运行不受影响。由定义管理的触发器返回 409 TRIGGER_MANAGED,需在工作流定义里删除 schedule 后重新发布。
DELETE /automation/v1/triggers/{id}
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: id | string | 必填;触发器 ID(trg_)。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| TRIGGER_ID | 触发器 id;webhook 调用前需恢复启用 |
: "${TRIGGER_ID:?Set TRIGGER_ID}"
curl --fail-with-body -X DELETE "https://api.deepraxis.ai/automation/v1/triggers/${TRIGGER_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.triggers.delete({
"path": {
"id": env("TRIGGER_ID")
}
});
console.log(result);Deleted
HTTP 204
| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | TRIGGER_NOT_FOUND:触发器不存在或不可访问,回调鉴权失败也使用此错误。 |
| 409 | TRIGGER_MANAGED:触发器由定义管理,不能直接修改。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
暂停后停止新触发,不终止已经启动的运行;由定义管理的触发器也可以暂停。
POST /automation/v1/triggers/{id}/pause
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: id | string | 必填;触发器 ID(trg_)。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| TRIGGER_ID | 触发器 id;webhook 调用前需恢复启用 |
: "${TRIGGER_ID:?Set TRIGGER_ID}"
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/triggers/${TRIGGER_ID}/pause" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.triggers.pause({
"path": {
"id": env("TRIGGER_ID")
},
"body": {}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| name | string | 必填 / 必有;触发器名称,1–100 字符。 minLength: 1;maxLength: 100 |
| description | string | 必填 / 必有;触发器说明,最多 1000 字符。 maxLength: 1000 |
| labels | object | 必填 / 必有;触发器标签:字符串键值对,最多 64 个;键不能以保留前缀 praxis. 开头,违反返回 400 INPUT_INVALID。 |
| target | string | 必填 / 必有;要运行的脚本或工作流引用,形如 ns/name@标签或版本;默认跟随 latest,写成 @1.2.0 则钉死版本。 |
| input | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| input(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| input(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| kind | "schedule" / "webhook" | 必填 / 必有;触发器类型。schedule 按计划(cron、every 或 at)触发;webhook 由入站 HTTP 请求触发。 |
| schedule | object / object / object / null | 必填 / 必有;定时规则,kind=schedule 时有值(cron、every 或 at 三选一);webhook 为 null。 |
| schedule(分支1)(分支1).cron | string | 必填 / 必有;Five fields; supports L, W, #. DST gaps skip the day and overlaps run once. |
| schedule(分支1)(分支2).every | string / object | 必填 / 必有;时长:ISO 8601 字符串(如 PT5M),或 {days, hours, minutes, seconds, milliseconds} 对象;折算后必须是 60000 至 31622400000 毫秒(1 分钟至 366 天)的整数毫秒。 |
| schedule(分支1)(分支2).every(分支2).days | integer | 可选;天数,非负整数。 minimum: 0 |
| schedule(分支1)(分支2).every(分支2).hours | integer | 可选;小时数,非负整数。 minimum: 0 |
| schedule(分支1)(分支2).every(分支2).minutes | integer | 可选;分钟数,非负整数。 minimum: 0 |
| schedule(分支1)(分支2).every(分支2).seconds | integer | 可选;秒数,非负整数。 minimum: 0 |
| schedule(分支1)(分支2).every(分支2).milliseconds | integer | 可选;毫秒数,非负整数。 minimum: 0 |
| schedule(分支1)(分支3).at | string | 必填 / 必有;一次性触发的时刻(RFC 3339 UTC);不能早于当前时间,也不能晚于一年后。执行后触发器进入 expired。 format: "date-time" |
| timezone | string | 必填 / 必有;IANA 时区名,定时规则按它解释;API 缺省为 UTC。 default: "UTC" |
| start_at | string / null | 必填 / 必有;定时触发器的开始时间(RFC 3339 UTC);此前不触发。没有限制为 null。 |
| end_at | string / null | 必填 / 必有;定时触发器的结束时间(RFC 3339 UTC);超过后进入 expired。没有期限为 null。 |
| overlap | "skip" / "allow" | 必填 / 必有;重叠策略:上一次运行未结束时又到点,skip(默认)跳过,allow 照常启动。 default: "skip" |
| catchup_window_seconds | integer | 必填 / 必有;补跑窗口(秒),默认 300,仅定时触发器适用:到点时若已延迟超过该值(宕机、暂停期间),记为 missed 且不补跑。 default: 300;minimum: 0 |
| webhook | object / null | 必填 / 必有;webhook 设置,kind=webhook 时有值;schedule 触发器为 null。 |
| webhook(分支1).input_mode | "body" / "envelope" | 必填 / 必有;webhook 触发时传给目标的输入形态。body(默认)只传请求体;envelope 传含 body、raw_body、raw_body_encoding、headers、webhook_id、received_at 的信封对象。 |
| webhook(分支1).url_hint | string | 必填 / 必有;webhook 地址的掩码提示,省略号代替私密 token,不能用于调用。新建触发器为公开完整 URL;历史记录可能为 /automation/v1/hooks/{id}/… 相对路径。 |
| id | string | 必填 / 必有;触发器 ID,前缀 trg_;用于 webhook 地址以及触发器的所有接口。 |
| owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| state | "enabled" / "paused" / "expired" | 必填 / 必有;触发器状态。enabled 启用,会按计划或请求触发;paused 已暂停,不触发;expired 已到期,一次性触发器执行完或超过 end_at 后进入,不再触发。 |
| source | "api" / "definition" | 必填 / 必有;触发器来源。api 为通过 API 创建,可修改和删除;definition 为由工作流 YAML 的 schedule 生成,只能暂停或恢复,修改返回 409 TRIGGER_MANAGED。 |
| created_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| created_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| created_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| created_by_user_id | string | 必填 / 必有;创建者的真实用户 ID,由网关转发;触发器启动的运行以该用户身份取令牌,用于审计与用量归属。 |
| next_fire_times | string[] | 必填 / 必有;接下来最多 5 次的触发时间(RFC 3339 UTC);webhook、已暂停或已到期的触发器为空数组。 maxItems: 5 |
| last_firing | object / null | 必填 / 必有;最近一次触发记录;从未触发为 null。 |
| last_firing(分支1).id | string | 必填 / 必有;触发记录 ID;记录保留 30 天。 |
| last_firing(分支1).trigger_id | string | 必填 / 必有;所属触发器 ID(trg_ 前缀)。 |
| last_firing(分支1).scheduled_at | string | 必填 / 必有;计划触发的时间(RFC 3339 UTC);webhook 取请求到达时间。 format: "date-time" |
| last_firing(分支1).fired_at | string | 必填 / 必有;实际触发的时间(RFC 3339 UTC)。 format: "date-time" |
| last_firing(分支1).outcome | "accepted" / "started" / "skipped_overlap" / "missed" / "failed" / "deduped" | 必填 / 必有;触发结果。accepted 已持久化等待处理;started 已创建运行;skipped_overlap 因上一次运行未结束而跳过;missed 到点时延迟超过补跑窗口,不补跑;failed 创建运行失败;deduped 与 24 小时内相同 webhook-id 的请求重复,已去重。 |
| last_firing(分支1).run_id | string / null | 必填 / 必有;本次触发创建的运行 ID(run_ 前缀);未创建运行为 null。 |
| last_firing(分支1).resolved_version | string / null | 必填 / 必有;本次触发实际解析到的精确版本号;尚未解析或失败时为 null。 |
| last_firing(分支1).error | object / null | 必填 / 必有;触发失败时的原因 {code, message};没有失败为 null。 |
| last_firing(分支1).error(分支1).code | string | 必填 / 必有;失败的错误码。 |
| last_firing(分支1).error(分支1).message | string | 必填 / 必有;失败的说明文字。 |
| counts | object | 必填 / 必有;触发结果累计次数 {started, skipped, missed, failed}。 不接受额外字段。 |
| counts.started | integer | 必填 / 必有;成功启动运行的次数。 minimum: 0 |
| counts.skipped | integer | 必填 / 必有;因重叠策略为 skip 且上一次运行未结束而跳过的次数。 minimum: 0 |
| counts.missed | integer | 必填 / 必有;因延迟超过补跑窗口而错过的次数。 minimum: 0 |
| counts.failed | integer | 必填 / 必有;创建运行失败的次数。 minimum: 0 |
| created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 format: "date-time" |
| updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 format: "date-time" |
| etag | string | 必填 / 必有;触发器当前修订标识,更新时作为 If-Match;不匹配返回 412。 |
| usage_30d | object / null | 可选;仅 GET /triggers/{id} 返回,列表省略。最近 30 天由此触发器启动的运行及子运行的归因实扣。运行本身不收费;这里是运行中调用模型、搜索等能力产生的实扣,按调用归因;未评级的用量稍后计入。汇总超时(1.5 秒)或失败时为 null,详情仍返回 200。 |
| usage_30d(分支1).currency | "USD" | 必填 / 必有;金额币种,固定为 USD。 |
| usage_30d(分支1).cost | string | 必填 / 必有;已评级实扣的美元十进制字符串,精确到 6 位小数;没有用量时为 0.000000。 pattern: "^[0-9]+\.[0-9]{6}$" |
| usage_30d(分支1).pending_events | integer | 必填 / 必有;尚未评级的用量事件数,金额稍后才计入。 minimum: 0 |
HTTP 200
{
"id": "trg_00mv67mzzqa0d63b98d72446dd9d1331051a3e100e",
"owner": "tnt_3a9759864ccb4e00",
"name": "sample-webhook-1791867412840-b05e8a",
"description": "",
"labels": {
"namespace": "docs-samples"
},
"target": "docs-samples/sample-scripts-1791867412840-b05e8a@1.0.0",
"input": {},
"kind": "webhook",
"schedule": null,
"timezone": "UTC",
"start_at": null,
"end_at": null,
"overlap": "skip",
"catchup_window_seconds": 300,
"webhook": {
"input_mode": "body",
"url_hint": "https://api-develop.deepraxis.ai/automation/v1/hooks/trg_00mv67mzzqa0d63b98d72446dd9d1331051a3e100e/…"
},
"state": "paused",
"source": "api",
"created_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"created_by_user_id": "usr_49d4fcb99517",
"next_fire_times": [],
"last_firing": null,
"counts": {
"started": 0,
"skipped": 0,
"missed": 0,
"failed": 0
},
"created_at": "2026-10-13T04:58:09.974Z",
"updated_at": "2026-10-13T04:58:12.519Z",
"etag": "etag_00mv67n1yf40e7b8d39ce5459d9ce835bfb1083701"
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | TRIGGER_NOT_FOUND:触发器不存在或不可访问,回调鉴权失败也使用此错误。 |
| 412 | PRECONDITION_FAILED:修订、源码摘要或并发写入条件不匹配。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
恢复触发并清空连续失败计数;已过结束时间或已执行完的一次性触发器保持 expired,启用配额已满时返回 TRIGGER_LIMIT。
POST /automation/v1/triggers/{id}/resume
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: id | string | 必填;触发器 ID(trg_)。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| TRIGGER_ID | 触发器 id;webhook 调用前需恢复启用 |
: "${TRIGGER_ID:?Set TRIGGER_ID}"
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/triggers/${TRIGGER_ID}/resume" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.triggers.resume({
"path": {
"id": env("TRIGGER_ID")
},
"body": {}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| name | string | 必填 / 必有;触发器名称,1–100 字符。 minLength: 1;maxLength: 100 |
| description | string | 必填 / 必有;触发器说明,最多 1000 字符。 maxLength: 1000 |
| labels | object | 必填 / 必有;触发器标签:字符串键值对,最多 64 个;键不能以保留前缀 praxis. 开头,违反返回 400 INPUT_INVALID。 |
| target | string | 必填 / 必有;要运行的脚本或工作流引用,形如 ns/name@标签或版本;默认跟随 latest,写成 @1.2.0 则钉死版本。 |
| input | null / string / number / boolean / object / JSON[] | 必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。 |
| input(分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| input(分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| kind | "schedule" / "webhook" | 必填 / 必有;触发器类型。schedule 按计划(cron、every 或 at)触发;webhook 由入站 HTTP 请求触发。 |
| schedule | object / object / object / null | 必填 / 必有;定时规则,kind=schedule 时有值(cron、every 或 at 三选一);webhook 为 null。 |
| schedule(分支1)(分支1).cron | string | 必填 / 必有;Five fields; supports L, W, #. DST gaps skip the day and overlaps run once. |
| schedule(分支1)(分支2).every | string / object | 必填 / 必有;时长:ISO 8601 字符串(如 PT5M),或 {days, hours, minutes, seconds, milliseconds} 对象;折算后必须是 60000 至 31622400000 毫秒(1 分钟至 366 天)的整数毫秒。 |
| schedule(分支1)(分支2).every(分支2).days | integer | 可选;天数,非负整数。 minimum: 0 |
| schedule(分支1)(分支2).every(分支2).hours | integer | 可选;小时数,非负整数。 minimum: 0 |
| schedule(分支1)(分支2).every(分支2).minutes | integer | 可选;分钟数,非负整数。 minimum: 0 |
| schedule(分支1)(分支2).every(分支2).seconds | integer | 可选;秒数,非负整数。 minimum: 0 |
| schedule(分支1)(分支2).every(分支2).milliseconds | integer | 可选;毫秒数,非负整数。 minimum: 0 |
| schedule(分支1)(分支3).at | string | 必填 / 必有;一次性触发的时刻(RFC 3339 UTC);不能早于当前时间,也不能晚于一年后。执行后触发器进入 expired。 format: "date-time" |
| timezone | string | 必填 / 必有;IANA 时区名,定时规则按它解释;API 缺省为 UTC。 default: "UTC" |
| start_at | string / null | 必填 / 必有;定时触发器的开始时间(RFC 3339 UTC);此前不触发。没有限制为 null。 |
| end_at | string / null | 必填 / 必有;定时触发器的结束时间(RFC 3339 UTC);超过后进入 expired。没有期限为 null。 |
| overlap | "skip" / "allow" | 必填 / 必有;重叠策略:上一次运行未结束时又到点,skip(默认)跳过,allow 照常启动。 default: "skip" |
| catchup_window_seconds | integer | 必填 / 必有;补跑窗口(秒),默认 300,仅定时触发器适用:到点时若已延迟超过该值(宕机、暂停期间),记为 missed 且不补跑。 default: 300;minimum: 0 |
| webhook | object / null | 必填 / 必有;webhook 设置,kind=webhook 时有值;schedule 触发器为 null。 |
| webhook(分支1).input_mode | "body" / "envelope" | 必填 / 必有;webhook 触发时传给目标的输入形态。body(默认)只传请求体;envelope 传含 body、raw_body、raw_body_encoding、headers、webhook_id、received_at 的信封对象。 |
| webhook(分支1).url_hint | string | 必填 / 必有;webhook 地址的掩码提示,省略号代替私密 token,不能用于调用。新建触发器为公开完整 URL;历史记录可能为 /automation/v1/hooks/{id}/… 相对路径。 |
| id | string | 必填 / 必有;触发器 ID,前缀 trg_;用于 webhook 地址以及触发器的所有接口。 |
| owner | string | 必填 / 必有;所属租户,由网关注入;按不透明字符串处理。 |
| state | "enabled" / "paused" / "expired" | 必填 / 必有;触发器状态。enabled 启用,会按计划或请求触发;paused 已暂停,不触发;expired 已到期,一次性触发器执行完或超过 end_at 后进入,不再触发。 |
| source | "api" / "definition" | 必填 / 必有;触发器来源。api 为通过 API 创建,可修改和删除;definition 为由工作流 YAML 的 schedule 生成,只能暂停或恢复,修改返回 409 TRIGGER_MANAGED。 |
| created_by | object | 必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。 |
| created_by.type | "user" / "api_key" / "agent" / "run" / "trigger" | 必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。 |
| created_by.id | string | 必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。 |
| created_by_user_id | string | 必填 / 必有;创建者的真实用户 ID,由网关转发;触发器启动的运行以该用户身份取令牌,用于审计与用量归属。 |
| next_fire_times | string[] | 必填 / 必有;接下来最多 5 次的触发时间(RFC 3339 UTC);webhook、已暂停或已到期的触发器为空数组。 maxItems: 5 |
| last_firing | object / null | 必填 / 必有;最近一次触发记录;从未触发为 null。 |
| last_firing(分支1).id | string | 必填 / 必有;触发记录 ID;记录保留 30 天。 |
| last_firing(分支1).trigger_id | string | 必填 / 必有;所属触发器 ID(trg_ 前缀)。 |
| last_firing(分支1).scheduled_at | string | 必填 / 必有;计划触发的时间(RFC 3339 UTC);webhook 取请求到达时间。 format: "date-time" |
| last_firing(分支1).fired_at | string | 必填 / 必有;实际触发的时间(RFC 3339 UTC)。 format: "date-time" |
| last_firing(分支1).outcome | "accepted" / "started" / "skipped_overlap" / "missed" / "failed" / "deduped" | 必填 / 必有;触发结果。accepted 已持久化等待处理;started 已创建运行;skipped_overlap 因上一次运行未结束而跳过;missed 到点时延迟超过补跑窗口,不补跑;failed 创建运行失败;deduped 与 24 小时内相同 webhook-id 的请求重复,已去重。 |
| last_firing(分支1).run_id | string / null | 必填 / 必有;本次触发创建的运行 ID(run_ 前缀);未创建运行为 null。 |
| last_firing(分支1).resolved_version | string / null | 必填 / 必有;本次触发实际解析到的精确版本号;尚未解析或失败时为 null。 |
| last_firing(分支1).error | object / null | 必填 / 必有;触发失败时的原因 {code, message};没有失败为 null。 |
| last_firing(分支1).error(分支1).code | string | 必填 / 必有;失败的错误码。 |
| last_firing(分支1).error(分支1).message | string | 必填 / 必有;失败的说明文字。 |
| counts | object | 必填 / 必有;触发结果累计次数 {started, skipped, missed, failed}。 不接受额外字段。 |
| counts.started | integer | 必填 / 必有;成功启动运行的次数。 minimum: 0 |
| counts.skipped | integer | 必填 / 必有;因重叠策略为 skip 且上一次运行未结束而跳过的次数。 minimum: 0 |
| counts.missed | integer | 必填 / 必有;因延迟超过补跑窗口而错过的次数。 minimum: 0 |
| counts.failed | integer | 必填 / 必有;创建运行失败的次数。 minimum: 0 |
| created_at | string | 必填 / 必有;创建时间(RFC 3339 UTC)。 format: "date-time" |
| updated_at | string | 必填 / 必有;最近一次更新的时间(RFC 3339 UTC)。 format: "date-time" |
| etag | string | 必填 / 必有;触发器当前修订标识,更新时作为 If-Match;不匹配返回 412。 |
| usage_30d | object / null | 可选;仅 GET /triggers/{id} 返回,列表省略。最近 30 天由此触发器启动的运行及子运行的归因实扣。运行本身不收费;这里是运行中调用模型、搜索等能力产生的实扣,按调用归因;未评级的用量稍后计入。汇总超时(1.5 秒)或失败时为 null,详情仍返回 200。 |
| usage_30d(分支1).currency | "USD" | 必填 / 必有;金额币种,固定为 USD。 |
| usage_30d(分支1).cost | string | 必填 / 必有;已评级实扣的美元十进制字符串,精确到 6 位小数;没有用量时为 0.000000。 pattern: "^[0-9]+\.[0-9]{6}$" |
| usage_30d(分支1).pending_events | integer | 必填 / 必有;尚未评级的用量事件数,金额稍后才计入。 minimum: 0 |
HTTP 200
{
"id": "trg_00mv67mzzqa0d63b98d72446dd9d1331051a3e100e",
"owner": "tnt_3a9759864ccb4e00",
"name": "sample-webhook-1791867412840-b05e8a",
"description": "Sample webhook",
"labels": {
"namespace": "docs-samples"
},
"target": "docs-samples/sample-scripts-1791867412840-b05e8a@1.0.0",
"input": {
"n": 41
},
"kind": "webhook",
"schedule": null,
"timezone": "UTC",
"start_at": null,
"end_at": null,
"overlap": "skip",
"catchup_window_seconds": 300,
"webhook": {
"input_mode": "body",
"url_hint": "https://api-develop.deepraxis.ai/automation/v1/hooks/trg_00mv67mzzqa0d63b98d72446dd9d1331051a3e100e/…"
},
"state": "enabled",
"source": "api",
"created_by": {
"type": "api_key",
"id": "key_3e00b8984967"
},
"created_by_user_id": "usr_49d4fcb99517",
"next_fire_times": [],
"last_firing": null,
"counts": {
"started": 0,
"skipped": 0,
"missed": 0,
"failed": 0
},
"created_at": "2026-10-13T04:58:09.974Z",
"updated_at": "2026-10-13T04:58:17.058Z",
"etag": "etag_00mv67n5gidea13751125d4ad292fb95b07fac032e"
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | TRIGGER_NOT_FOUND:触发器不存在或不可访问,回调鉴权失败也使用此错误。 |
| 412 | PRECONDITION_FAILED:修订、源码摘要或并发写入条件不匹配。 |
| 429 | TRIGGER_LIMIT:租户已达到 100 个启用触发器的上限。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
立即触发一次并返回 Firing,仍受当前状态、补跑窗口和 overlap 约束;启动失败记在触发结果的 error 中。
POST /automation/v1/triggers/{id}/fire
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: id | string | 必填;触发器 ID(trg_)。 |
| header: Idempotency-Key | string | 可选;可选;1–256 字符。24 小时内同一 key 重放首个响应并带 Idempotent-Replayed: true;同 key 不同请求体返回 422;处理中返回 409。 minLength: 1;maxLength: 256 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| TRIGGER_ID | 触发器 id;webhook 调用前需恢复启用 |
: "${TRIGGER_ID:?Set TRIGGER_ID}"
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/triggers/${TRIGGER_ID}/fire" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.triggers.fire({
"path": {
"id": env("TRIGGER_ID")
},
"body": {}
});
console.log(result);Success
| 响应头 | 类型 | 说明 |
|---|---|---|
| Idempotent-Replayed | boolean | Present and true when replaying the first response for this key. |
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;触发记录 ID;记录保留 30 天。 |
| trigger_id | string | 必填 / 必有;所属触发器 ID(trg_ 前缀)。 |
| scheduled_at | string | 必填 / 必有;计划触发的时间(RFC 3339 UTC);webhook 取请求到达时间。 format: "date-time" |
| fired_at | string | 必填 / 必有;实际触发的时间(RFC 3339 UTC)。 format: "date-time" |
| outcome | "accepted" / "started" / "skipped_overlap" / "missed" / "failed" / "deduped" | 必填 / 必有;触发结果。accepted 已持久化等待处理;started 已创建运行;skipped_overlap 因上一次运行未结束而跳过;missed 到点时延迟超过补跑窗口,不补跑;failed 创建运行失败;deduped 与 24 小时内相同 webhook-id 的请求重复,已去重。 |
| run_id | string / null | 必填 / 必有;本次触发创建的运行 ID(run_ 前缀);未创建运行为 null。 |
| resolved_version | string / null | 必填 / 必有;本次触发实际解析到的精确版本号;尚未解析或失败时为 null。 |
| error | object / null | 必填 / 必有;触发失败时的原因 {code, message};没有失败为 null。 |
| error(分支1).code | string | 必填 / 必有;失败的错误码。 |
| error(分支1).message | string | 必填 / 必有;失败的说明文字。 |
HTTP 200
{
"id": "frg_00mv67n833fec8a47a90904782ac1a8f1fef264379",
"trigger_id": "trg_00mv67mzzqa0d63b98d72446dd9d1331051a3e100e",
"scheduled_at": "2026-10-13T04:58:20.215Z",
"fired_at": "2026-10-13T04:58:20.215Z",
"outcome": "started",
"run_id": "run_00mv67n8ao7de994212f453fdfe7def756b57ec5cdeb562a1222f554c6f3d9f428ec25480e",
"resolved_version": "1.0.0",
"error": null
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | TRIGGER_NOT_FOUND:触发器不存在或不可访问,回调鉴权失败也使用此错误。 |
| 409 | IDEMPOTENCY_IN_FLIGHT:同一幂等键的请求仍在处理中。 RUN_INVALID_STATE:当前状态不允许执行该动作。 |
| 412 | PRECONDITION_FAILED:修订、源码摘要或并发写入条件不匹配。 |
| 422 | IDEMPOTENCY_KEY_MISMATCH:同一幂等键已用于不同请求内容。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
仅适用于 webhook 触发器:立即作废旧 token,返回新的完整 webhook_url;之后的详情读取不会再次显示完整地址。
POST /automation/v1/triggers/{id}/rotate-webhook
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: id | string | 必填;触发器 ID(trg_)。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| TRIGGER_ID | 触发器 id;webhook 调用前需恢复启用 |
: "${TRIGGER_ID:?Set TRIGGER_ID}"
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/triggers/${TRIGGER_ID}/rotate-webhook" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.triggers.rotateWebhook({
"path": {
"id": env("TRIGGER_ID")
},
"body": {}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| webhook_url | string | 必填 / 必有;新的完整 webhook 地址,含私密 token;只返回这一次,请妥善保存,丢失后需再次轮换。旧地址立即失效。 format: "uri" |
HTTP 200
{
"webhook_url": "https://api-develop.deepraxis.ai/automation/v1/hooks/trg_00mv67mzzqa0d63b98d72446dd9d1331051a3e100e/${WEBHOOK_TOKEN}"
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | TRIGGER_NOT_FOUND:触发器不存在或不可访问,回调鉴权失败也使用此错误。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
按时间倒序读取最近 30 天的触发记录。结果包括实际版本、运行 ID 与失败原因。
GET /automation/v1/triggers/{id}/firings
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| path: id | string | 必填;触发器 ID(trg_)。 |
| query: limit | integer | 可选;每页条数,整数 1–100,默认 25。 minimum: 1;maximum: 100 |
| query: cursor | string | 可选;上一页返回的 next_cursor,不透明字符串;保持原查询条件继续翻页。 |
| query: outcome | "accepted" / "started" / "skipped_overlap" / "missed" / "failed" / "deduped"[] | 可选;按结果筛选,多个值用逗号分隔(OR);与 run_id 同时提供时取交集。 |
| query: run_id | string | 可选;仅返回关联此运行 ID 的记录。 |
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| TRIGGER_ID | 触发器 id;webhook 调用前需恢复启用 |
: "${TRIGGER_ID:?Set TRIGGER_ID}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/triggers/${TRIGGER_ID}/firings" \
-H "Authorization: Bearer $PRAXIS_API_KEY"import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.triggers.firings.list({
"path": {
"id": env("TRIGGER_ID")
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| data | object[] | 必填 / 必有;本页的最近 30 天的触发记录,按 created_at 倒序、id 倒序排列。 |
| data[].id | string | 必填 / 必有;触发记录 ID;记录保留 30 天。 |
| data[].trigger_id | string | 必填 / 必有;所属触发器 ID(trg_ 前缀)。 |
| data[].scheduled_at | string | 必填 / 必有;计划触发的时间(RFC 3339 UTC);webhook 取请求到达时间。 format: "date-time" |
| data[].fired_at | string | 必填 / 必有;实际触发的时间(RFC 3339 UTC)。 format: "date-time" |
| data[].outcome | "accepted" / "started" / "skipped_overlap" / "missed" / "failed" / "deduped" | 必填 / 必有;触发结果。accepted 已持久化等待处理;started 已创建运行;skipped_overlap 因上一次运行未结束而跳过;missed 到点时延迟超过补跑窗口,不补跑;failed 创建运行失败;deduped 与 24 小时内相同 webhook-id 的请求重复,已去重。 |
| data[].run_id | string / null | 必填 / 必有;本次触发创建的运行 ID(run_ 前缀);未创建运行为 null。 |
| data[].resolved_version | string / null | 必填 / 必有;本次触发实际解析到的精确版本号;尚未解析或失败时为 null。 |
| data[].error | object / null | 必填 / 必有;触发失败时的原因 {code, message};没有失败为 null。 |
| data[].error(分支1).code | string | 必填 / 必有;失败的错误码。 |
| data[].error(分支1).message | string | 必填 / 必有;失败的说明文字。 |
| next_cursor | string / null | 必填 / 必有;下一页游标,原样传给 cursor 参数并保持原查询条件;没有更多页为 null。接口不返回总数。 |
HTTP 200
{
"data": [
{
"id": "frg_00mv67n833fec8a47a90904782ac1a8f1fef264379",
"trigger_id": "trg_00mv67mzzqa0d63b98d72446dd9d1331051a3e100e",
"scheduled_at": "2026-10-13T04:58:20.215Z",
"fired_at": "2026-10-13T04:58:20.215Z",
"outcome": "started",
"run_id": "run_00mv67n8ao7de994212f453fdfe7def756b57ec5cdeb562a1222f554c6f3d9f428ec25480e",
"resolved_version": "1.0.0",
"error": null
},
{
"id": "frg_00mv67n6in516077a64cfc4102a4da939476a3fa78",
"trigger_id": "trg_00mv67mzzqa0d63b98d72446dd9d1331051a3e100e",
"scheduled_at": "2026-10-13T04:58:18.384Z",
"fired_at": "2026-10-13T04:58:18.384Z",
"outcome": "started",
"run_id": "run_00mv67n6vvebb47a96bf4b54630d8a07786ec923a68d3b722c2f7ffca4e0a553053c4a5421",
"resolved_version": "1.0.0",
"error": null
}
],
"next_cursor": null
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | TRIGGER_NOT_FOUND:触发器不存在或不可访问,回调鉴权失败也使用此错误。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
校验规则与时区并预览未来触发时间。返回人读说明及最多五个未来时间,不会创建触发器或运行。
POST /automation/v1/triggers/preview
Authorization: Bearer $PRAXIS_API_KEY
| 参数 | 类型 | 说明 |
|---|---|---|
| header: Accept-Language | string | 可选;人读描述的语言,支持中文(默认)与英文,按语言权重选择。 |
不接受额外字段。
| 字段 | 类型 | 说明 |
|---|---|---|
| schedule | object / object / object | 必填 / 必有;三选一:cron 为五段表达式(支持 L/W/#);every 至少一分钟;at 为带时区的一次性时间。与创建使用相同校验:at 须在当前时间至一年后之间;every 须为正整数毫秒且不超过 366 天。 |
| schedule(分支1).cron | string | 必填 / 必有;Five fields; supports L, W, #. DST gaps skip the day and overlaps run once. |
| schedule(分支2).every | string / object | 必填 / 必有;时长:ISO 8601 字符串(如 PT5M),或 {days, hours, minutes, seconds, milliseconds} 对象;折算后必须是 60000 至 31622400000 毫秒(1 分钟至 366 天)的整数毫秒。 |
| schedule(分支2).every(分支2).days | integer | 可选;天数,非负整数。 minimum: 0 |
| schedule(分支2).every(分支2).hours | integer | 可选;小时数,非负整数。 minimum: 0 |
| schedule(分支2).every(分支2).minutes | integer | 可选;分钟数,非负整数。 minimum: 0 |
| schedule(分支2).every(分支2).seconds | integer | 可选;秒数,非负整数。 minimum: 0 |
| schedule(分支2).every(分支2).milliseconds | integer | 可选;毫秒数,非负整数。 minimum: 0 |
| schedule(分支3).at | string | 必填 / 必有;一次性触发时刻,需带 Z 或 ±HH:MM 时区;必须在请求时刻至一年后之间。调用时将示例替换为该范围内的未来时间。 pattern: "(Z|[+-]\d\d:\d\d)$";format: "date-time" |
| timezone | string | 可选;IANA 时区,默认 UTC;夏令时跳过不存在的时刻,重复时刻只触发一次。 |
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/triggers/preview" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"schedule": {
"cron": "0 9 * * *"
},
"timezone": "UTC"
}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: env('PRAXIS_API_KEY'),
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.triggers.preview({
"body": {
"schedule": {
"cron": "0 9 * * *"
},
"timezone": "UTC"
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| description | string | 必填 / 必有;规则的人读描述;常见 cron 为自然语言,其余回显表达式。语言由 Accept-Language 决定,默认中文。 |
| next_fire_times | string[] | 必填 / 必有;按该规则和时区计算的接下来最多 5 次触发时间(RFC 3339 UTC)。 maxItems: 5 |
HTTP 200
{
"description": "每天 09:00 · UTC",
"next_fire_times": [
"2026-10-13T09:00:00.000Z",
"2026-10-14T09:00:00.000Z",
"2026-10-15T09:00:00.000Z",
"2026-10-16T09:00:00.000Z",
"2026-10-17T09:00:00.000Z"
]
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 SCHEDULE_INVALID:定时规则或时间边界无效。 TIMEZONE_INVALID:时区不是有效的 IANA 时区。 INTERVAL_TOO_SHORT:定时间隔短于一分钟。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
无需 API Key,以 URL 中 token 鉴权;token 错误、触发器不存在、类型不符或不在时间窗口内均返回 404;触发器处于暂停状态(连续 5 次失败熔断或人工暂停)返回 409 TRIGGER_PAUSED,message 说明原因,hint 给出恢复办法 POST /automation/v1/triggers/{id}/resume。原始请求体上限 512 KiB;组装后的运行输入(含原文与解析后的副本)序列化后最多 1 MiB,超限同步返回 413,不创建触发记录;webhook-id 去重 24 小时。202 的 outcome=accepted 表示已受理,最终结果随后更新,重复请求为 deduped。JSON 解析失败时 body 为 null;其它 UTF-8 为原文,非 UTF-8 为 base64。envelope 包含 body、raw_body、raw_body_encoding、白名单 headers、webhook_id 和 received_at;raw_body 保留原始字节,raw_body_encoding 为 utf8 或 base64,可用于自行验签。
POST /automation/v1/hooks/{trigger_id}/{token}
使用创建或轮换时返回的 webhook URL;路径中的 token 是凭据,无需 Bearer Key。
| 参数 | 类型 | 说明 |
|---|---|---|
| path: trigger_id | string | 必填;触发器 ID(trg_)。 |
| path: token | string | 必填;创建或轮换时返回的私密 URL token;请勿公开。 |
| header: webhook-id | string | 可选;可选去重标识,同一触发器内保留 24 小时。 |
任意 JSON 值:null、布尔、数字、字符串、数组或对象。
| 字段 | 类型 | 说明 |
|---|---|---|
| (分支5).* | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
| (分支6)[] | null / string / number / boolean / object / JSON[] | 递归 JSON 值。 |
string
string
先设置以下环境变量,使用你自己的资源:
| 变量 | 来源 |
|---|---|
| TRIGGER_ID | 触发器 id;webhook 调用前需恢复启用 |
| WEBHOOK_TOKEN | 新 webhook_url 的最后一段;不要公开 |
: "${TRIGGER_ID:?Set TRIGGER_ID}"
: "${WEBHOOK_TOKEN:?Set WEBHOOK_TOKEN}"
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/hooks/${TRIGGER_ID}/${WEBHOOK_TOKEN}" \
-H "Content-Type: application/json" \
--data '{
"n": 41
}'import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';
function env(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}`);
return value;
}
const automation = createAutomationClient({
apiKey: '',
baseUrl: 'https://api.deepraxis.ai',
maxRetries: 0,
timeoutMs: 90_000,
});
const result = await automation.hooks.send({
"path": {
"trigger_id": env("TRIGGER_ID"),
"token": env("WEBHOOK_TOKEN")
},
"body": {
"n": 41
}
});
console.log(result);Success
application/json
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必填 / 必有;触发记录 ID;记录保留 30 天。 |
| trigger_id | string | 必填 / 必有;所属触发器 ID(trg_ 前缀)。 |
| scheduled_at | string | 必填 / 必有;计划触发的时间(RFC 3339 UTC);webhook 取请求到达时间。 format: "date-time" |
| fired_at | string | 必填 / 必有;实际触发的时间(RFC 3339 UTC)。 format: "date-time" |
| outcome | "accepted" / "started" / "skipped_overlap" / "missed" / "failed" / "deduped" | 必填 / 必有;触发结果。accepted 已持久化等待处理;started 已创建运行;skipped_overlap 因上一次运行未结束而跳过;missed 到点时延迟超过补跑窗口,不补跑;failed 创建运行失败;deduped 与 24 小时内相同 webhook-id 的请求重复,已去重。 |
| run_id | string / null | 必填 / 必有;本次触发创建的运行 ID(run_ 前缀);未创建运行为 null。 |
| resolved_version | string / null | 必填 / 必有;本次触发实际解析到的精确版本号;尚未解析或失败时为 null。 |
| error | object / null | 必填 / 必有;触发失败时的原因 {code, message};没有失败为 null。 |
| error(分支1).code | string | 必填 / 必有;失败的错误码。 |
| error(分支1).message | string | 必填 / 必有;失败的说明文字。 |
HTTP 202
{
"id": "frg_00mv67n6in516077a64cfc4102a4da939476a3fa78",
"trigger_id": "trg_00mv67mzzqa0d63b98d72446dd9d1331051a3e100e",
"scheduled_at": "2026-10-13T04:58:18.384Z",
"fired_at": "2026-10-13T04:58:18.384Z",
"outcome": "accepted",
"run_id": null,
"resolved_version": null,
"error": null
}| HTTP | 错误码与说明 |
|---|---|
| 400 | INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 |
| 404 | TRIGGER_NOT_FOUND:触发器不存在或不可访问,回调鉴权失败也使用此错误。 |
| 405 | METHOD_NOT_ALLOWED:仅支持 POST;其它方法无需鉴权即返回 405,Allow 为 POST。 |
| 409 | TRIGGER_PAUSED:触发器处于暂停状态:连续 5 次触发失败触发熔断自动暂停,或被人工暂停;响应 message 说明原因,hint 给出恢复办法:恢复该触发器(triggers.resume)。 |
| 412 | PRECONDITION_FAILED:修订、源码摘要或并发写入条件不匹配。 |
| 413 | PAYLOAD_TOO_LARGE:请求内容超过本操作允许的大小。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |
鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。
加载中…| 事实 | 说明 |
|---|---|
| 组织由 Key 决定 | 调用方的 API Key 解析出唯一的组织;路径里没有组织 ID,组织的任何有效 API Key 都可读本域 |
| 只覆盖资金账户扣费 | 仅统计从资金账户以 USD 扣费的用量;Credits 不在统计内 |
| 字段名按 FOCUS 1.3 | BilledCost、ServiceName、ConsumedQuantity 等列名与 FOCUS 1.3 规范逐字一致 |
| 时间一律 UTC | 窗口边界与时间桶都是 UTC ISO 8601;桶对齐到整点或自然日 |
| 查询窗口上限 93 天 | 查询费用 / 查询用量 / 用量事件一次最多查 93 天;更久的账用费用明细导出,它按天在服务端分页 |
| 分页是不透明游标 | 列表带 has_more 与 next_page;把 next_page 原样放进 page 参数取下一页 |
金额都是美元十进制字符串(如 "0.001234"),不要用浮点数相加——对账请按字符串精确十进制求和。
这里只统计从资金账户以美元扣费的用量;Credits 余额不在这个域。鉴权方式见鉴权。
| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| GET | /v1/costs | 查询费用 | ● 支持 |
| GET | /v1/usage | 查询用量 | ● 支持 |
| GET | /v1/events | 列出用量事件 | ● 支持 |
| GET | /v1/events/{id} | 查看单个用量事件 | ● 支持 |
| GET | /v1/charges | 导出费用明细 | ● 支持 |
参数与字段的权威定义以本站 /meta/v1/openapi.yaml 公开的规范与 FOCUS 1.3 规范为准。
/organization/v1/costs● 支持starting_atstring必填query: 窗口开始(含),UTC ISO 8601,如 2026-09-26T00:00:00Z
ending_atstring必填query: 窗口结束(不含),UTC ISO 8601;距 starting_at 最多 93 天(费用明细导出无此限制)
bucket_widthstring必填query: 时间桶宽度:1h(整点对齐)或 1d(自然日对齐),一律 UTC
time_zonestring可选query: IANA time zone name (for example Asia/Shanghai) whose local hours or days form the buckets. Defaults to UTC. Offsets such as +08:00 are rejected. The window widens to whole local buckets; a day that crosses a daylight-saving change lasts 23 or 25 hours. starting_at and ending_at stay UTC instants.
group_byarray可选query: 分组列,可重复:ServiceName、ServiceCategory、ResourceId、ConsumedUnit;查询用量时 ConsumedUnit 恒被服务端拆出
pagestring可选query: 上一页响应里 next_page 给出的不透明游标,原样带回即可
200 page
错误按 problem+json 格式返回,参见 错误码
Cost page
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| object | string | Object type; always `page`. |
| data | array<object> | Cost buckets in time order, one per hour or day of the requested window. |
| data[].object | string | Object type; always `bucket`. |
| data[].starting_at | string | Start of the bucket, UTC, inclusive. |
| data[].ending_at | string | End of the bucket, UTC, exclusive. |
| data[].estimated | boolean | True when at least one contributing event is not settled yet, so the amounts can still change. |
| data[].results | array<object> | Aggregates of the bucket, one entry per group requested with group_by. |
| has_more | boolean | Whether more results exist beyond this page; request again with `page` set to `next_page` to read them. |
| next_page | string | null | Opaque cursor for the next page; null on the last page. Pass it unchanged as `page`. |
| 字段 | 说明 |
|---|---|
object | 固定 "page" |
data[].object | 固定 "bucket" |
data[].starting_at / data[].ending_at | 桶的起止时间(UTC,整点或自然日对齐) |
data[].estimated | true 表示该桶含尚未结算的用量,金额之后可能变化 |
data[].results[].ServiceName | 产生用量的服务名(仅在请求 group_by 含 ServiceName 时出现) |
data[].results[].ServiceCategory | FOCUS 服务类别(仅按请求出现) |
data[].results[].ResourceId / data[].results[].ResourceName | 资源 ID 与显示名;ResourceName 随 ResourceId 附带,解析不到显示名时等于 ResourceId |
data[].results[].BilledCost | 该桶该组的费用,美元十进制字符串 |
data[].results[].BillingCurrency | 固定 "USD" |
has_more / next_page | 是否还有下一页;下一页的不透明游标(null 表示没有更多) |
单条明细的逐计量项拆分见查看单个用量事件。
/organization/v1/usage● 支持starting_atstring必填query: 窗口开始(含),UTC ISO 8601,如 2026-09-26T00:00:00Z
ending_atstring必填query: 窗口结束(不含),UTC ISO 8601;距 starting_at 最多 93 天(费用明细导出无此限制)
bucket_widthstring必填query: 时间桶宽度:1h(整点对齐)或 1d(自然日对齐),一律 UTC
time_zonestring可选query: IANA time zone name (for example Asia/Shanghai) whose local hours or days form the buckets. Defaults to UTC. Offsets such as +08:00 are rejected. The window widens to whole local buckets; a day that crosses a daylight-saving change lasts 23 or 25 hours. starting_at and ending_at stay UTC instants.
group_byarray可选query: 分组列,可重复:ServiceName、ServiceCategory、ResourceId、ConsumedUnit;查询用量时 ConsumedUnit 恒被服务端拆出
pagestring可选query: 上一页响应里 next_page 给出的不透明游标,原样带回即可
200 page
错误按 problem+json 格式返回,参见 错误码
Usage page
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| object | string | Object type; always `page`. |
| data | array<object> | Usage buckets in time order, one per hour or day of the requested window. |
| data[].object | string | Object type; always `bucket`. |
| data[].starting_at | string | Start of the bucket, UTC, inclusive. |
| data[].ending_at | string | End of the bucket, UTC, exclusive. |
| data[].estimated | boolean | True when at least one contributing event is not settled yet, so the amounts can still change. |
| data[].results | array<object> | Aggregates of the bucket, one entry per group requested with group_by. |
| has_more | boolean | Whether more results exist beyond this page; request again with `page` set to `next_page` to read them. |
| next_page | string | null | Opaque cursor for the next page; null on the last page. Pass it unchanged as `page`. |
| 字段 | 说明 |
|---|---|
object / data[].object | 固定 "page" / 固定 "bucket" |
data[].starting_at / data[].ending_at / data[].estimated | 桶的起止(UTC)与待结算标记,与查询费用相同 |
data[].results[].ServiceName / ServiceCategory | 服务列(仅按请求出现) |
data[].results[].ResourceId / data[].results[].ResourceName | 资源列;ResourceName 随 ResourceId 附带 |
data[].results[].ConsumedQuantity | 该桶该组的消耗数量,十进制字符串 |
data[].results[].ConsumedUnit | 计量单位;不同单位各成一行,永远不会相加 |
has_more / next_page | 游标分页,与查询费用相同 |
单条明细的逐计量项拆分见查看单个用量事件。
/organization/v1/events● 支持starting_atstring必填query: 窗口开始(含),UTC ISO 8601,如 2026-09-26T00:00:00Z
ending_atstring必填query: 窗口结束(不含),UTC ISO 8601;距 starting_at 最多 93 天(费用明细导出无此限制)
limitinteger可选query: 每页条数,1–100,默认 25
pagestring可选query: 上一页响应里 next_page 给出的不透明游标,原样带回即可
200 page
错误按 problem+json 格式返回,参见 错误码
Event page
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| object | string | Object type; always `page`. |
| data | array<object> | Usage events, newest first. |
| data[].object | string | Object type; always `usage.event`. |
| data[].id | string | Id of the usage event; pass it to getOrganizationEvent. |
| data[].occurred_at | string | Time at which the usage happened, UTC. |
| data[].ServiceName | string | Name of the platform service that produced the usage (the source service of the usage event). |
| data[].ServiceCategory | string | Category of the service; a service without a registered category reports its own name. |
| data[].ResourceId | string | Id of the resource that the usage belongs to. |
| data[].ResourceName | string | Display name of the resource; falls back to ResourceId when no name is known. |
| data[].BilledCost | string | Amount billed in USD as an exact decimal string; unsettled usage counts as 0 until it settles. |
| data[].BillingCurrency | string | Currency of BilledCost; always `USD`. |
| data[].ChargeClass | string | null | `Correction` for an event that corrects an earlier charge (its BilledCost is negative); null for ordinary usage. |
| data[].request_id | string | null | X-Request-Id of the API call that produced the usage; null for usage that does not come from a request. |
| data[].settlement | object | How the usage was charged: settlement state, any shortfall, and why nothing was charged. |
| data[].lines | array<object> | Metering lines mapped from the billing measurements; the priced split (ListUnitPrice, PricingUnit, BilledCost) rides only GET /events/{id}. |
| has_more | boolean | Whether more results exist beyond this page; request again with `page` set to `next_page` to read them. |
| next_page | string | null | Opaque cursor for the next page; null on the last page. Pass it unchanged as `page`. |
| 字段 | 说明 |
|---|---|
object | 固定 "page" |
data[].object | 固定 "usage.event" |
data[].id | 事件 id;查单条明细、对账都用它 |
data[].occurred_at | 事件发生时间(UTC) |
data[].ServiceName / ServiceCategory / ResourceId / ResourceName | FOCUS 服务与资源列 |
data[].BilledCost / BillingCurrency | 事件费用(美元十进制字符串)与币种 |
data[].ChargeClass | 更正事件为 "Correction"(费用为负数),普通事件为 null |
data[].request_id | 产生这次用量的那次 API 调用响应头 X-Request-Id 的值,可拿去调用日志里查同一次请求 |
data[].settlement.status | settled(已结算)/ unsettled(未结算)/ settled_with_shortfall(结算有缺口)/ no_asset(无计费资产,零费用) |
data[].settlement.shortfall / data[].settlement.zero_reason | 结算缺口金额(十进制字符串或 null);零费用的原因(或 null) |
has_more / next_page | 按发生时间倒序逐页;游标不透明,不重复、不遗漏 |
单条明细的逐计量项拆分见查看单个用量事件。
/organization/v1/events/{id}● 支持idstring必填path: 用量事件 id,来自用量事件列表的 data[].id
200 usage.event
错误按 problem+json 格式返回,参见 错误码
The usage event
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| object | string | Object type; always `usage.event`. |
| id | string | Id of the usage event; pass it to getOrganizationEvent. |
| occurred_at | string | Time at which the usage happened, UTC. |
| ServiceName | string | Name of the platform service that produced the usage (the source service of the usage event). |
| ServiceCategory | string | Category of the service; a service without a registered category reports its own name. |
| ResourceId | string | Id of the resource that the usage belongs to. |
| ResourceName | string | Display name of the resource; falls back to ResourceId when no name is known. |
| BilledCost | string | Amount billed in USD as an exact decimal string; unsettled usage counts as 0 until it settles. |
| BillingCurrency | string | Currency of BilledCost; always `USD`. |
| ChargeClass | string | null | `Correction` for an event that corrects an earlier charge (its BilledCost is negative); null for ordinary usage. |
| request_id | string | null | X-Request-Id of the API call that produced the usage; null for usage that does not come from a request. |
| settlement | object | How the usage was charged: settlement state, any shortfall, and why nothing was charged. |
| settlement.status | string | Settlement state of the event. |
| settlement.shortfall | string | null | USD amount that could not be charged, as a decimal string, when status is settled_with_shortfall; null otherwise. |
| settlement.zero_reason | string | null | Why nothing was charged for the event: `byok` when the caller used its own provider key; null when a charge applies. |
| lines | array<object> | Priced lines of the event; their BilledCost values add up to the event's BilledCost. |
| lines[].meter | string | Key of the meter that measured the line. |
| lines[].display_name | string | English label of the meter; falls back to the meter key in list pages. |
| lines[].ConsumedQuantity | string | Quantity consumed, an exact decimal string in ConsumedUnit. |
| lines[].ConsumedUnit | string | Unit of ConsumedQuantity as reported by the metering line; quantities of different units are never added together. |
| lines[].ListUnitPrice | string | null | List price in USD per PricingUnit as a decimal string; null when the line is not priced. |
| lines[].PricingUnit | string | null | Unit that ListUnitPrice applies to; null when the line is not priced. |
| lines[].BilledCost | string | Amount billed for this line in USD as a decimal string. |
| 字段 | 说明 |
|---|---|
object / id / occurred_at | 固定 "usage.event"、事件 id、发生时间(UTC) |
ServiceName / ServiceCategory / ResourceId / ResourceName / BilledCost / BillingCurrency / ChargeClass / request_id / settlement | 与用量事件列表中同一事件完全相同的字段 |
lines[].meter / lines[].display_name | 计量项标识与其英文显示名 |
lines[].ConsumedQuantity / ConsumedUnit | 该计量项的消耗数量与单位 |
lines[].ListUnitPrice / PricingUnit | 官方单价与计价单位(未公布时为 null) |
lines[].BilledCost | 该计量项的费用;各项之和等于事件的 BilledCost |
单条明细的逐计量项拆分见查看单个用量事件。
/organization/v1/charges● 支持starting_atstring必填query: 窗口开始(含),UTC ISO 8601,如 2026-09-26T00:00:00Z
ending_atstring必填query: 窗口结束(不含),UTC ISO 8601;距 starting_at 最多 93 天(费用明细导出无此限制)
200
错误按 problem+json 格式返回,参见 错误码
FOCUS 1.3 JSONL stream
application/x-ndjson
| 名称 | 类型 | 说明 |
|---|---|---|
| ChargePeriodStart | string | Start of the charge period (the event time), UTC. |
| ChargePeriodEnd | string | End of the charge period (the event time), UTC. |
| BilledCost | string | Amount billed in USD as an exact decimal string; unsettled usage counts as 0 until it settles. |
| BillingCurrency | string | Currency of BilledCost; always `USD`. |
| ServiceName | string | Name of the platform service that produced the usage (the source service of the usage event). |
| ServiceCategory | string | Category of the service; a service without a registered category reports its own name. |
| ResourceId | string | Id of the resource that the usage belongs to. |
| ResourceName | string | Display name of the resource; falls back to ResourceId when no name is known. |
| ConsumedQuantity | string | Quantity consumed, an exact decimal string in ConsumedUnit. |
| ConsumedUnit | string | Unit of ConsumedQuantity as reported by the metering line; quantities of different units are never added together. |
| ChargeCategory | string | Kind of charge. |
| ChargeClass | string | null | `Correction` for an event that corrects an earlier charge (its BilledCost is negative); null for ordinary usage. |
| ChargeDescription | string | Text such as `<service>/<offering> usage` that says what was charged. |
| x_RequestId | string | null | Always null in the export; look up the request id of an event with getOrganizationEvent. |
| x_EventId | string | Id of the usage event this record comes from; pass it to getOrganizationEvent. |
| 字段 | 说明 |
|---|---|
ChargePeriodStart / ChargePeriodEnd | 计费周期起止(UTC) |
BilledCost / BillingCurrency | 该事件费用(美元十进制字符串)与币种(USD) |
ServiceName / ServiceCategory / ResourceId / ResourceName | FOCUS 服务与资源列 |
ConsumedQuantity / ConsumedUnit | 消耗数量与计量单位 |
ChargeCategory | Usage(用量)或 Adjustment(调整) |
ChargeClass | 更正记录为 "Correction",普通记录为 null |
ChargeDescription | 计量项的人类可读描述 |
x_RequestId / x_EventId | 产生这条记录的 API 调用的 X-Request-Id;对应的用量事件 id |
单条明细的逐计量项拆分见查看单个用量事件。
加载中…| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| GET | /v1/health | 健康检查 | ● 支持 |
| GET | /v1/methods | 搜索方法 | ● 支持 |
| GET | /v1/methods/{name} | 读取方法 | ● 支持 |
ok。Meta 是平台自描述面:/meta/v1/openapi.yaml 返回当前环境的完整 OpenAPI 规范,参数与字段以它为准。
/meta/v1/methods● 支持qstring可选query: Words to look for, for example `list agents` or `create table`. Matched against method name, summary and description; every word must match when the query has two words or fewer, otherwise at least 60% of them. Omit to list methods without ranking.
limitinteger可选query: Maximum methods returned. Without q, defaults to 50 and accepts 1–200. Search with q defaults to 20 and accepts 1–50. Out-of-range values return 400 INVALID_PARAMS.
after_idstring可选query: Return names lexically after this method name, usually last_id from the previous page. Ignored when q is present. An empty or expired cursor still uses lexical ordering.
200
非空 q 按方法名、摘要和描述的相关度搜索,词序和大小写不影响匹配;limit 为 1 到 50 的整数,默认 20。不带 q 或 q 全为空白时按方法名排序列出,limit 为 1 到 200 的整数,默认 50;has_more 为 true 时将 last_id 原样作为 after_id 取下一页。搜索时忽略 after_id。limit 越界返回 400 INVALID_PARAMS。目录只包含平台方法(praxis.*),不含会话里的 MCP 工具。
错误按 problem+json 格式返回,参见 错误码
Matching methods, best match first. An empty `data` array means nothing matched; try fewer or different words.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| has_more | boolean | Present without q; true when another page follows. |
| first_id | string | null | Present without q; first method name in this page, or null for an empty page. |
| last_id | string | null | Present without q; last method name in this page, or null for an empty page. Pass as after_id to continue. |
| data | array<object> | Matching methods ordered by relevance for search, or by name for unranked listing. |
| data[].params | string | Compact argument list grouped by location, for example `path: database_id*, table* · query: select, order · body*`. A trailing `*` marks a required argument; `body` stands for the JSON request body. Call `GET /meta/v1/methods/{name}` for each argument's type and description. |
| data[].name | string | Method name such as `praxis.agent.agents.list`. Pass it to `GET /meta/v1/methods/{name}` and call it as `await praxis.agent.agents.list(args)` in codemode or an automation script. |
| data[].summary | string | One-line statement of what the method does. |
| data[].http | string | HTTP verb the method sends, for example GET or POST. |
| data[].path | string | Public API path template the method calls, with `{param}` placeholders filled from `args.path`. |
/meta/v1/methods/{name}● 支持namestring必填path: Exact method name from the search results, for example `praxis.database.databases.tables.create`.
200
name 取自搜索结果,必须与方法名完全一致。声明不会被截断,字段名和枚举值请直接从中复制。未知名称返回 404 METHOD_NOT_FOUND,hint 列出最多三个相近的名称。
错误按 problem+json 格式返回,参见 错误码
The method with its complete declaration.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| name | string | Method name, for example `praxis.agent.agents.list`. |
| summary | string | One-line statement of what the method does. |
| description | string | Full guidance for the method from the API reference, including when to use it, limits and error behaviour. May be empty for methods documented only by summary. |
| http | string | HTTP verb the method sends. |
| path | string | Public API path template with `{param}` placeholders. |
| declaration | string | Complete TypeScript signature, `name(args): Promise<Result>`. `args` carries `path`, `query`, `headers` and `body` members exactly as declared. Never truncated. |
| parameters | array<object> | Path, query and header parameters of the operation. |
| parameters[].name | string | Parameter name as sent on the wire. |
| parameters[].in | string | Where the parameter goes, one of `path`, `query` or `header`; maps to the matching member of `args`. |
| parameters[].required | boolean | Whether the call is rejected when the parameter is missing. |
| parameters[].description | string | Meaning, format and allowed values of the parameter. |
| parameters[].type | string | TypeScript type of the parameter value. |
| request_body | object | Request body expectations; null when the method takes no body. |
| request_body.required | boolean | Whether `args.body` must be supplied. |
| request_body.description | string | What the body carries. |
| request_body.content_types | array<string> | Media types the body may use; the first is the default. |
| responses | array<object> | Documented responses, successful and failed. |
| responses[].status | string | HTTP status code or `default`. |
| responses[].description | string | What the response means and what to do next. |
| responses[].content_types | array<string> | Media types the response may use. |
基础地址: https://api-develop.deepraxis.ai/browser
请求头: Authorization: Bearer $PRAXIS_API_KEY
请求 ID 响应头: X-Request-Id
| 操作 | 方法与路径 |
|---|---|
| 创建浏览器会话 | POST /browser/v1/sessions |
| 列出浏览器会话 | GET /browser/v1/sessions |
| 读取浏览器会话 | GET /browser/v1/sessions/{sessionId} |
| 关闭浏览器会话 | POST /browser/v1/sessions/{sessionId} |
| 读取调试地址 | GET /browser/v1/sessions/{sessionId}/debug |
| 列出会话事件 | GET /browser/v1/sessions/{sessionId}/events |
| 请求人工接管 | POST /browser/v1/sessions/{sessionId}/handoff |
| 完成人工接管 | POST /browser/v1/sessions/{sessionId}/handoff/complete |
| 更新查看者心跳 | POST /browser/v1/sessions/{sessionId}/viewer |
| 创建登录态 | POST /browser/v1/contexts |
| 列出登录态 | GET /browser/v1/contexts |
| 读取登录态 | GET /browser/v1/contexts/{contextId} |
| 更新登录态 | PUT /browser/v1/contexts/{contextId} |
| 删除登录态 | DELETE /browser/v1/contexts/{contextId} |
| 连接云端浏览器 | GET /browser/v1/connect |
| 打开实时浏览器画面 | GET /browser/v1/live/{sessionId}/{pageId} |
| 订阅会话动态 | GET /browser/v1/sessions/{sessionId}/stream |
| 读取 Selenium 不支持提示 | GET /browser/v1/selenium-unsupported |
/browser/v1/sessions● 支持projectIdstring可选可省略;账户使用 default 项目。
keepAliveboolean可选false 时最后一个客户端断开且无人观看后结束会话;true 时保留至关闭或超时。
timeoutnumber可选从创建时刻起算的会话最长寿命,单位为秒;可含小数。
browserSettingsobject可选创建浏览器时的登录态、视口及兼容选项;省略时不加载已保存的登录态。
contextobject可选新会话使用的已保存登录态;必须属于当前账户;persist 为 true 时同一登录态只能有一个写入会话。
idstring必填登录态 ID;使用创建或列出登录态返回的 id,以 bsc_ 开头。
persistboolean可选关闭会话时合并保存 cookie 和 localStorage;false 只读取登录态;不保存 IndexedDB。
viewportobject可选浏览器视口尺寸;创建时省略整个对象则使用宽 1280、高 800 像素。
widthinteger必填浏览器视口宽度,单位为像素,必须为正整数。
heightinteger必填浏览器视口高度,单位为像素,必须为正整数。
blockAdsboolean可选◐ 部分支持接受但忽略;不会启用此能力。
solveCaptchasboolean可选◐ 部分支持接受但忽略;不会启用此能力。
recordSessionboolean可选◐ 部分支持接受但忽略;不会启用此能力。
logSessionboolean可选◐ 部分支持接受但忽略;不会启用此能力。
extensionIdstring可选○ 未支持不支持此配置。
verifiedboolean可选○ 未支持不支持此配置。
advancedStealthboolean可选○ 未支持不支持此配置。
osstring可选○ 未支持不支持此配置。
fingerprintobject可选○ 未支持不支持此配置。
allowedDomainsarray可选○ 未支持不支持此配置。
ignoreCertificateErrorsboolean可选○ 未支持不支持此配置。
proxiesunion可选◐ 部分支持仅省略、false 或 [{type: 'none'}] 可用,其它代理配置返回 501。
regionstring可选◐ 部分支持接受但忽略;不会启用此能力。
extensionIdstring可选○ 未支持不支持此配置。
userMetadataobject可选自定义 JSON 元数据;序列化后的长度最多为 512 个 UTF-16 代码单元。
namestring可选会话名称;1–128 个 ASCII 字母、数字或 . _ : -,可用于筛选会话。
labelsobject可选自定义字符串标签;最多 32 项,键最多 128 个 UTF-8 字节,值最多 1024 个 UTF-8 字节。
201
错误含 statusCode、error、message;自有面另含 code。请求 ID 见 X-Request-Id。 错误
请求成功。
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | 浏览器会话 ID;使用创建或列出会话返回的 id,以 bss_ 开头。 |
| projectId | string | 兼容项目标识,当前账户的会话固定返回 default。 |
| status | string | 会话生命周期状态;释放中的会话仍显示 RUNNING,但已不能建立新连接。 |
| keepAlive | boolean | API 创建的会话是否在客户端断开后保留;true 不因空闲释放,仍受最长寿命限制。 |
| region | string | 兼容字段,不代表可选择部署区域。 |
| proxyBytes | integer | 兼容的代理流量字节数;当前未使用代理,固定返回 0。 |
| createdAt | string | 会话创建时刻,UTC ISO 8601 时间。 |
| updatedAt | string | 会话状态最近一次更新的时刻,UTC ISO 8601 时间。 |
| startedAt | string | 浏览器开始运行的时刻;尚未开始运行时返回创建时刻,UTC ISO 8601 时间。 |
| expiresAt | string | 会话最长寿命的到期时刻,等于创建时刻加 timeout 秒,UTC ISO 8601 时间。 |
| endedAt | string | 浏览器使用区间的结束时刻,UTC ISO 8601 时间;尚未记录结束时刻时省略。 |
| contextId | string | 登录态 ID;使用创建或列出登录态返回的 id,以 bsc_ 开头。 |
| userMetadata | object | 创建会话时传入的自定义 JSON 元数据;未设置时为空对象。 |
| name | string | 会话名称;1–128 个 ASCII 字母、数字或 . _ : -,可用于筛选会话。 |
| labels | object | 自定义字符串标签;最多 32 项,键最多 128 个 UTF-8 字节,值最多 1024 个 UTF-8 字节。 |
| origin | string | 会话创建入口;api 为 API 创建,connect 为一步连接创建,console 为 Console 创建。 |
| closeReason | string | 会话释放原因;未开始释放时省略。 |
| viewport | object | 浏览器视口尺寸;创建时省略整个对象则使用宽 1280、高 800 像素。 |
| viewport.width | integer | 浏览器视口宽度,单位为像素,必须为正整数。 |
| viewport.height | integer | 浏览器视口高度,单位为像素,必须为正整数。 |
| billedSeconds | number | 会话计费时长,单位为秒;运行时随时长增长,结束后为最终计费时长,可含小数。 |
| currentUrl | string | 最近观察到的页面导航地址;尚未观察到导航时省略。 |
| clients | integer | 当前连接的 CDP 客户端数量;不包含仅观看页面的用户。 |
| handoff | object | null | 待完成的人工接管请求;没有请求、已完成或已过期时为 null。 |
| handoff.message | string | 请求人工接管时提供给操作者的说明文字。 |
| handoff.requestedAt | string | 人工接管请求的发起时刻,UTC ISO 8601 时间。 |
| handoff.expiresAt | string | 人工接管请求的失效时刻,UTC ISO 8601 时间。 |
| connectUrl | string | 自带凭证的 CDP WebSocket 地址,有效期覆盖会话寿命;连接无需额外 API Key。 |
| signingKey | string | connectUrl 内的连接凭证,请勿公开。 |
| seleniumRemoteUrl | string | 该地址返回 501;不支持 Selenium。 |
/browser/v1/sessions● 支持statusstring可选按会话生命周期状态筛选;省略时返回所有状态。
qstring可选按单个用户元数据键的字符串值精确筛选,例如 user_metadata['purpose']:'docs'。
namestring可选按会话名称精确匹配;省略时不按名称筛选。
labelsstring可选JSON 编码的标签对象;仅返回同时匹配所有标签键值的会话。
cursorstring可选上一页返回的 nextCursor,原样传入以继续读取;省略时读取第一页。
limitinteger可选每页最多返回的记录数量;默认 50,范围 1–200。
200
错误含 statusCode、error、message;自有面另含 code。请求 ID 见 X-Request-Id。 错误
请求成功。
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | 本页查询匹配的记录;没有匹配项时为空数组。 |
| data[].id | string | 浏览器会话 ID;使用创建或列出会话返回的 id,以 bss_ 开头。 |
| data[].projectId | string | 兼容项目标识,当前账户的会话固定返回 default。 |
| data[].status | string | 会话生命周期状态;释放中的会话仍显示 RUNNING,但已不能建立新连接。 |
| data[].keepAlive | boolean | API 创建的会话是否在客户端断开后保留;true 不因空闲释放,仍受最长寿命限制。 |
| data[].region | string | 兼容字段,不代表可选择部署区域。 |
| data[].proxyBytes | integer | 兼容的代理流量字节数;当前未使用代理,固定返回 0。 |
| data[].createdAt | string | 会话创建时刻,UTC ISO 8601 时间。 |
| data[].updatedAt | string | 会话状态最近一次更新的时刻,UTC ISO 8601 时间。 |
| data[].startedAt | string | 浏览器开始运行的时刻;尚未开始运行时返回创建时刻,UTC ISO 8601 时间。 |
| data[].expiresAt | string | 会话最长寿命的到期时刻,等于创建时刻加 timeout 秒,UTC ISO 8601 时间。 |
| data[].endedAt | string | 浏览器使用区间的结束时刻,UTC ISO 8601 时间;尚未记录结束时刻时省略。 |
| data[].contextId | string | 登录态 ID;使用创建或列出登录态返回的 id,以 bsc_ 开头。 |
| data[].userMetadata | object | 创建会话时传入的自定义 JSON 元数据;未设置时为空对象。 |
| data[].name | string | 会话名称;1–128 个 ASCII 字母、数字或 . _ : -,可用于筛选会话。 |
| data[].labels | object | 自定义字符串标签;最多 32 项,键最多 128 个 UTF-8 字节,值最多 1024 个 UTF-8 字节。 |
| data[].origin | string | 会话创建入口;api 为 API 创建,connect 为一步连接创建,console 为 Console 创建。 |
| data[].closeReason | string | 会话释放原因;未开始释放时省略。 |
| data[].viewport | object | 浏览器视口尺寸;创建时省略整个对象则使用宽 1280、高 800 像素。 |
| data[].billedSeconds | number | 会话计费时长,单位为秒;运行时随时长增长,结束后为最终计费时长,可含小数。 |
| data[].currentUrl | string | 最近观察到的页面导航地址;尚未观察到导航时省略。 |
| data[].clients | integer | 当前连接的 CDP 客户端数量;不包含仅观看页面的用户。 |
| data[].handoff | object | null | 待完成的人工接管请求;没有请求、已完成或已过期时为 null。 |
| nextCursor | string | null | 下一页游标;原样传入 cursor,null 表示没有更多结果。 |
/browser/v1/sessions/{sessionId}● 支持sessionIdstring必填浏览器会话 ID;使用创建或列出会话返回的 id,以 bss_ 开头。
expandstring可选逗号分隔的 debug、events;在同一响应中返回调试地址和事件。
200
错误含 statusCode、error、message;自有面另含 code。请求 ID 见 X-Request-Id。 错误
请求成功。
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | 浏览器会话 ID;使用创建或列出会话返回的 id,以 bss_ 开头。 |
| projectId | string | 兼容项目标识,当前账户的会话固定返回 default。 |
| status | string | 会话生命周期状态;释放中的会话仍显示 RUNNING,但已不能建立新连接。 |
| keepAlive | boolean | API 创建的会话是否在客户端断开后保留;true 不因空闲释放,仍受最长寿命限制。 |
| region | string | 兼容字段,不代表可选择部署区域。 |
| proxyBytes | integer | 兼容的代理流量字节数;当前未使用代理,固定返回 0。 |
| createdAt | string | 会话创建时刻,UTC ISO 8601 时间。 |
| updatedAt | string | 会话状态最近一次更新的时刻,UTC ISO 8601 时间。 |
| startedAt | string | 浏览器开始运行的时刻;尚未开始运行时返回创建时刻,UTC ISO 8601 时间。 |
| expiresAt | string | 会话最长寿命的到期时刻,等于创建时刻加 timeout 秒,UTC ISO 8601 时间。 |
| endedAt | string | 浏览器使用区间的结束时刻,UTC ISO 8601 时间;尚未记录结束时刻时省略。 |
| contextId | string | 登录态 ID;使用创建或列出登录态返回的 id,以 bsc_ 开头。 |
| userMetadata | object | 创建会话时传入的自定义 JSON 元数据;未设置时为空对象。 |
| name | string | 会话名称;1–128 个 ASCII 字母、数字或 . _ : -,可用于筛选会话。 |
| labels | object | 自定义字符串标签;最多 32 项,键最多 128 个 UTF-8 字节,值最多 1024 个 UTF-8 字节。 |
| origin | string | 会话创建入口;api 为 API 创建,connect 为一步连接创建,console 为 Console 创建。 |
| closeReason | string | 会话释放原因;未开始释放时省略。 |
| viewport | object | 浏览器视口尺寸;创建时省略整个对象则使用宽 1280、高 800 像素。 |
| viewport.width | integer | 浏览器视口宽度,单位为像素,必须为正整数。 |
| viewport.height | integer | 浏览器视口高度,单位为像素,必须为正整数。 |
| billedSeconds | number | 会话计费时长,单位为秒;运行时随时长增长,结束后为最终计费时长,可含小数。 |
| currentUrl | string | 最近观察到的页面导航地址;尚未观察到导航时省略。 |
| clients | integer | 当前连接的 CDP 客户端数量;不包含仅观看页面的用户。 |
| handoff | object | null | 待完成的人工接管请求;没有请求、已完成或已过期时为 null。 |
| handoff.message | string | 请求人工接管时提供给操作者的说明文字。 |
| handoff.requestedAt | string | 人工接管请求的发起时刻,UTC ISO 8601 时间。 |
| handoff.expiresAt | string | 人工接管请求的失效时刻,UTC ISO 8601 时间。 |
| debug | object | 会话和标签页的实时观看地址,以及当前会话的 CDP 连接地址。 |
| debug.debuggerFullscreenUrl | string | 会话实时画面的完整跳转地址,携带观看凭证;与 debuggerUrl 相同。 |
| debug.debuggerUrl | string | 会话实时画面的完整跳转地址;直接打开,勿移除查询凭证。 |
| debug.wsUrl | string | 连接当前会话的 CDP WebSocket 地址,自带 signingKey,无需额外 API Key。 |
| debug.pages | array<object> | 当前浏览器标签页及各页的实时观看地址;会话不在运行状态时为空数组。 |
| events | object | expand 包含 events 时返回的会话事件首页;后续页通过事件列表读取。 |
| events.data | array<object> | 本页查询匹配的记录;没有匹配项时为空数组。 |
| events.nextCursor | string | null | 下一页游标;原样传入 cursor,null 表示没有更多结果。 |
/browser/v1/sessions/{sessionId}● 支持sessionIdstring必填浏览器会话 ID;使用创建或列出会话返回的 id,以 bss_ 开头。
statusstring必填会话操作指令;REQUEST_RELEASE 表示请求关闭浏览器并结束会话。
200
错误含 statusCode、error、message;自有面另含 code。请求 ID 见 X-Request-Id。 错误
请求成功。
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | 浏览器会话 ID;使用创建或列出会话返回的 id,以 bss_ 开头。 |
| projectId | string | 兼容项目标识,当前账户的会话固定返回 default。 |
| status | string | 会话生命周期状态;释放中的会话仍显示 RUNNING,但已不能建立新连接。 |
| keepAlive | boolean | API 创建的会话是否在客户端断开后保留;true 不因空闲释放,仍受最长寿命限制。 |
| region | string | 兼容字段,不代表可选择部署区域。 |
| proxyBytes | integer | 兼容的代理流量字节数;当前未使用代理,固定返回 0。 |
| createdAt | string | 会话创建时刻,UTC ISO 8601 时间。 |
| updatedAt | string | 会话状态最近一次更新的时刻,UTC ISO 8601 时间。 |
| startedAt | string | 浏览器开始运行的时刻;尚未开始运行时返回创建时刻,UTC ISO 8601 时间。 |
| expiresAt | string | 会话最长寿命的到期时刻,等于创建时刻加 timeout 秒,UTC ISO 8601 时间。 |
| endedAt | string | 浏览器使用区间的结束时刻,UTC ISO 8601 时间;尚未记录结束时刻时省略。 |
| contextId | string | 登录态 ID;使用创建或列出登录态返回的 id,以 bsc_ 开头。 |
| userMetadata | object | 创建会话时传入的自定义 JSON 元数据;未设置时为空对象。 |
| name | string | 会话名称;1–128 个 ASCII 字母、数字或 . _ : -,可用于筛选会话。 |
| labels | object | 自定义字符串标签;最多 32 项,键最多 128 个 UTF-8 字节,值最多 1024 个 UTF-8 字节。 |
| origin | string | 会话创建入口;api 为 API 创建,connect 为一步连接创建,console 为 Console 创建。 |
| closeReason | string | 会话释放原因;未开始释放时省略。 |
| viewport | object | 浏览器视口尺寸;创建时省略整个对象则使用宽 1280、高 800 像素。 |
| viewport.width | integer | 浏览器视口宽度,单位为像素,必须为正整数。 |
| viewport.height | integer | 浏览器视口高度,单位为像素,必须为正整数。 |
| billedSeconds | number | 会话计费时长,单位为秒;运行时随时长增长,结束后为最终计费时长,可含小数。 |
| currentUrl | string | 最近观察到的页面导航地址;尚未观察到导航时省略。 |
| clients | integer | 当前连接的 CDP 客户端数量;不包含仅观看页面的用户。 |
| handoff | object | null | 待完成的人工接管请求;没有请求、已完成或已过期时为 null。 |
| handoff.message | string | 请求人工接管时提供给操作者的说明文字。 |
| handoff.requestedAt | string | 人工接管请求的发起时刻,UTC ISO 8601 时间。 |
| handoff.expiresAt | string | 人工接管请求的失效时刻,UTC ISO 8601 时间。 |
/browser/v1/sessions/{sessionId}/debug● 支持sessionIdstring必填浏览器会话 ID;使用创建或列出会话返回的 id,以 bss_ 开头。
200
错误含 statusCode、error、message;自有面另含 code。请求 ID 见 X-Request-Id。 错误
请求成功。
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| debuggerFullscreenUrl | string | 会话实时画面的完整跳转地址,携带观看凭证;与 debuggerUrl 相同。 |
| debuggerUrl | string | 会话实时画面的完整跳转地址;直接打开,勿移除查询凭证。 |
| wsUrl | string | 连接当前会话的 CDP WebSocket 地址,自带 signingKey,无需额外 API Key。 |
| pages | array<object> | 当前浏览器标签页及各页的实时观看地址;会话不在运行状态时为空数组。 |
| pages[].id | string | 浏览器标签页的目标 ID,可用于实时画面地址中的 pageId。 |
| pages[].url | string | 该浏览器标签页当前报告的页面地址。 |
| pages[].title | string | 该浏览器标签页当前报告的页面标题。 |
| pages[].faviconUrl | string | 兼容的页面图标地址字段,当前固定返回空字符串。 |
| pages[].debuggerUrl | string | 此标签页实时画面的完整跳转地址,包含观看凭证。 |
| pages[].debuggerFullscreenUrl | string | 此标签页实时画面的完整跳转地址,与该页 debuggerUrl 相同。 |
/browser/v1/sessions/{sessionId}/events● 支持sessionIdstring必填浏览器会话 ID;使用创建或列出会话返回的 id,以 bss_ 开头。
cursorstring可选上一页返回的 nextCursor,表示已读到的事件序号;省略时从最早事件开始。
limitinteger可选每页最多返回的记录数量;默认 50,范围 1–200。
typesstring可选逗号分隔的账本事件类型,仅返回匹配项;省略时不按类型筛选。
200
错误含 statusCode、error、message;自有面另含 code。请求 ID 见 X-Request-Id。 错误
请求成功。
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | 本页查询匹配的记录;没有匹配项时为空数组。 |
| data[].seq | integer | 当前会话内递增的事件序号,用于事件排序及分页。 |
| data[].id | string | 服务生成的事件唯一标识,使用 UUID 格式。 |
| data[].type | string | 会话账本中的事件类型,用于区分状态变化和会话操作。 |
| data[].processed_at | string | 事件记录时刻,UTC ISO 8601 时间。 |
| data[].session_id | string | 浏览器会话 ID;使用创建或列出会话返回的 id,以 bss_ 开头。 |
| data[].reason | string | 事件发生原因;关闭相关事件记录对应的会话释放原因。 |
| data[].payload | object | 事件附加数据,内容取决于事件类型;没有附加数据时省略。 |
| nextCursor | string | null | 下一页游标;原样传入 cursor,null 表示没有更多结果。 |
/browser/v1/sessions/{sessionId}/handoff● 支持sessionIdstring必填浏览器会话 ID;使用创建或列出会话返回的 id,以 bss_ 开头。
messagestring必填交给人工操作者的接管说明,可为空字符串。
timeoutMsnumber可选接管请求有效时长,单位为毫秒;必须大于 0,可含小数。
200
错误含 statusCode、error、message;自有面另含 code。请求 ID 见 X-Request-Id。 错误
请求成功。
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| seq | integer | 当前会话内递增的事件序号,用于事件排序及分页。 |
| id | string | 服务生成的事件唯一标识,使用 UUID 格式。 |
| type | string | 会话账本中的事件类型,用于区分状态变化和会话操作。 |
| processed_at | string | 事件记录时刻,UTC ISO 8601 时间。 |
| session_id | string | 浏览器会话 ID;使用创建或列出会话返回的 id,以 bss_ 开头。 |
| reason | string | 事件发生原因;关闭相关事件记录对应的会话释放原因。 |
| payload | object | 事件附加数据,内容取决于事件类型;没有附加数据时省略。 |
/browser/v1/sessions/{sessionId}/handoff/complete● 支持sessionIdstring必填浏览器会话 ID;使用创建或列出会话返回的 id,以 bss_ 开头。
200
错误含 statusCode、error、message;自有面另含 code。请求 ID 见 X-Request-Id。 错误
请求成功。
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| seq | integer | 当前会话内递增的事件序号,用于事件排序及分页。 |
| id | string | 服务生成的事件唯一标识,使用 UUID 格式。 |
| type | string | 会话账本中的事件类型,用于区分状态变化和会话操作。 |
| processed_at | string | 事件记录时刻,UTC ISO 8601 时间。 |
| session_id | string | 浏览器会话 ID;使用创建或列出会话返回的 id,以 bss_ 开头。 |
| reason | string | 事件发生原因;关闭相关事件记录对应的会话释放原因。 |
| payload | object | 事件附加数据,内容取决于事件类型;没有附加数据时省略。 |
/browser/v1/sessions/{sessionId}/viewer● 支持sessionIdstring必填浏览器会话 ID;使用创建或列出会话返回的 id,以 bss_ 开头。
viewerIdstring必填当前观看者的稳定标识;同一观看者重复心跳应使用相同值,长度为 1–128 个 UTF-16 代码单元。
200
错误含 statusCode、error、message;自有面另含 code。请求 ID 见 X-Request-Id。 错误
请求成功。
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| ok | boolean | 心跳已被接受,成功时固定返回 true。 |
/browser/v1/contexts● 支持projectIdstring可选兼容项目字段;传入值被忽略,创建结果的 projectId 固定为 default。
namestring可选登录态名称;非空时为 1–128 个 ASCII 字母、数字或 . _ : -,在当前账户内唯一;空字符串表示不设名称或清除名称。
labelsobject可选自定义字符串标签;最多 32 项,键最多 128 个 UTF-8 字节,值最多 1024 个 UTF-8 字节。
201
错误含 statusCode、error、message;自有面另含 code。请求 ID 见 X-Request-Id。 错误
请求成功。
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | 登录态 ID;使用创建或列出登录态返回的 id,以 bsc_ 开头。 |
| projectId | string | 兼容项目标识,当前账户的登录态固定返回 default。 |
| createdAt | string | 登录态创建时刻,UTC ISO 8601 时间。 |
| updatedAt | string | 登录态名称、标签或保存内容最近一次更新的时刻,UTC ISO 8601 时间。 |
| name | string | 登录态名称;非空时为 1–128 个 ASCII 字母、数字或 . _ : -,在当前账户内唯一;空字符串表示不设名称或清除名称。 |
| labels | object | 自定义字符串标签;最多 32 项,键最多 128 个 UTF-8 字节,值最多 1024 个 UTF-8 字节。 |
| sites | array<string> | 已保存的 localStorage 主机名和 cookie 域名,去掉 cookie 域名前导点后去重排序。 |
| cookieCount | integer | 登录态中已保存的 cookie 条目数量;新登录态为 0。 |
| bytes | integer | 登录态加密后保存内容的大小,单位为 UTF-8 字节。 |
| lockedBy | string | 当前登录态写入租约的持有者标识;无有效租约时省略。 |
| lastUsedAt | string | |
| publicKey | string | |
| cipherAlgorithm | string | |
| initializationVectorSize | integer |
/browser/v1/contexts● 支持cursorstring可选上一页返回的 nextCursor,原样传入以继续读取;省略时读取第一页。
limitinteger可选每页最多返回的登录态数量;默认 25,范围 1–100。
200
错误含 statusCode、error、message;自有面另含 code。请求 ID 见 X-Request-Id。 错误
请求成功。
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | 本页查询匹配的记录;没有匹配项时为空数组。 |
| data[].id | string | 登录态 ID;使用创建或列出登录态返回的 id,以 bsc_ 开头。 |
| data[].projectId | string | 兼容项目标识,当前账户的登录态固定返回 default。 |
| data[].createdAt | string | 登录态创建时刻,UTC ISO 8601 时间。 |
| data[].updatedAt | string | 登录态名称、标签或保存内容最近一次更新的时刻,UTC ISO 8601 时间。 |
| data[].name | string | 登录态名称;非空时为 1–128 个 ASCII 字母、数字或 . _ : -,在当前账户内唯一;空字符串表示不设名称或清除名称。 |
| data[].labels | object | 自定义字符串标签;最多 32 项,键最多 128 个 UTF-8 字节,值最多 1024 个 UTF-8 字节。 |
| data[].sites | array<string> | 已保存的 localStorage 主机名和 cookie 域名,去掉 cookie 域名前导点后去重排序。 |
| data[].cookieCount | integer | 登录态中已保存的 cookie 条目数量;新登录态为 0。 |
| data[].bytes | integer | 登录态加密后保存内容的大小,单位为 UTF-8 字节。 |
| data[].lockedBy | string | 当前登录态写入租约的持有者标识;无有效租约时省略。 |
| data[].lastUsedAt | string | |
| nextCursor | string | null | 下一页游标;原样传入 cursor,null 表示没有更多结果。 |
/browser/v1/contexts/{contextId}● 支持contextIdstring必填登录态 ID;使用创建或列出登录态返回的 id,以 bsc_ 开头。
200
错误含 statusCode、error、message;自有面另含 code。请求 ID 见 X-Request-Id。 错误
请求成功。
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | 登录态 ID;使用创建或列出登录态返回的 id,以 bsc_ 开头。 |
| projectId | string | 兼容项目标识,当前账户的登录态固定返回 default。 |
| createdAt | string | 登录态创建时刻,UTC ISO 8601 时间。 |
| updatedAt | string | 登录态名称、标签或保存内容最近一次更新的时刻,UTC ISO 8601 时间。 |
| name | string | 登录态名称;非空时为 1–128 个 ASCII 字母、数字或 . _ : -,在当前账户内唯一;空字符串表示不设名称或清除名称。 |
| labels | object | 自定义字符串标签;最多 32 项,键最多 128 个 UTF-8 字节,值最多 1024 个 UTF-8 字节。 |
| sites | array<string> | 已保存的 localStorage 主机名和 cookie 域名,去掉 cookie 域名前导点后去重排序。 |
| cookieCount | integer | 登录态中已保存的 cookie 条目数量;新登录态为 0。 |
| bytes | integer | 登录态加密后保存内容的大小,单位为 UTF-8 字节。 |
| lockedBy | string | 当前登录态写入租约的持有者标识;无有效租约时省略。 |
| lastUsedAt | string |
/browser/v1/contexts/{contextId}● 支持contextIdstring必填登录态 ID;使用创建或列出登录态返回的 id,以 bsc_ 开头。
namestring可选登录态名称;非空时为 1–128 个 ASCII 字母、数字或 . _ : -,在当前账户内唯一;空字符串表示不设名称或清除名称。
labelsobject可选自定义字符串标签;最多 32 项,键最多 128 个 UTF-8 字节,值最多 1024 个 UTF-8 字节。 更新时整体替换;空对象清除标签,省略则保留。
200
错误含 statusCode、error、message;自有面另含 code。请求 ID 见 X-Request-Id。 错误
请求成功。
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | 登录态 ID;使用创建或列出登录态返回的 id,以 bsc_ 开头。 |
| projectId | string | 兼容项目标识,当前账户的登录态固定返回 default。 |
| createdAt | string | 登录态创建时刻,UTC ISO 8601 时间。 |
| updatedAt | string | 登录态名称、标签或保存内容最近一次更新的时刻,UTC ISO 8601 时间。 |
| name | string | 登录态名称;非空时为 1–128 个 ASCII 字母、数字或 . _ : -,在当前账户内唯一;空字符串表示不设名称或清除名称。 |
| labels | object | 自定义字符串标签;最多 32 项,键最多 128 个 UTF-8 字节,值最多 1024 个 UTF-8 字节。 |
| sites | array<string> | 已保存的 localStorage 主机名和 cookie 域名,去掉 cookie 域名前导点后去重排序。 |
| cookieCount | integer | 登录态中已保存的 cookie 条目数量;新登录态为 0。 |
| bytes | integer | 登录态加密后保存内容的大小,单位为 UTF-8 字节。 |
| lockedBy | string | 当前登录态写入租约的持有者标识;无有效租约时省略。 |
| lastUsedAt | string |
/browser/v1/connect● 支持sessionstring可选要连接的已有会话 ID,来自创建或列表响应;不能同时提供 name。
namestring可选按名称连接或创建。
signingKeystring可选connectUrl 自带凭证;必须同时带 session。
contextstring可选新会话使用的登录态 ID,来自创建或列表响应;连接已有会话时忽略。
persistboolean可选关闭时保存登录态。
timeoutnumber可选新会话最长寿命,单位为秒,可含小数;连接已有会话时忽略。
idlenumber可选新会话无人连接或观看后的释放等待时长,单位为毫秒;允许 0 或小数,连接已有会话时忽略。
labelsstring可选JSON 编码的字符串标签对象。
viewportstring可选JSON 编码的视口,例如 {"width":1280,"height":800}。
101
错误含 statusCode、error、message;自有面另含 code。请求 ID 见 X-Request-Id。 错误
此端点没有声明成功响应。
加载中…单文件上限 100 MB(104857600 字节),上传与下载全程流式。不提供 Uploads 分片。文件按内容识别类型;支持格式见上传端点。组织之间的文件互不可见。
| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| POST | /v1/files | 上传文件 | ◐ 部分支持 |
| GET | /v1/files | 列出文件 | ● 支持 |
| GET | /v1/files/{file_id} | 查看文件 | ● 支持 |
| GET | /v1/files/{file_id}/content | 下载文件 | ● 支持 |
| DELETE | /v1/files/{file_id} | 删除文件 | ● 支持 |
参数与字段的权威定义以 OpenAI 官方文档为准。
/file/v1/files◐ 部分支持filestring必填The File object (not file name) to be uploaded.
purposestring必填The file purpose: user_data, assistants or vision.
expires_afterobject可选Optional expiry relative to created_at. Files without an expiry persist until deleted.
anchorstring必填Anchor timestamp after which the expiration policy applies. Supported anchors: `created_at`.
secondsinteger必填The number of seconds after the anchor time that the file will expire. Must be between 3600 (1 hour) and 2592000 (30 days).
praxisobject可选Own-face extensions. Use at most one expiry setting.
expires_in_secondsinteger可选Expiry up to 90 days (Anthropic union). Mutually exclusive with expires_after.
200 file
支持 PDF、DOCX / XLSX / PPTX、PNG / JPEG / GIF / WebP、MP3 / WAV / FLAC / OGG / M4A、MP4 / WebM,以及 UTF-8 JSON / NDJSON / CSV / Markdown / 纯文本。purpose 支持 user_data / assistants / vision。上限 104857600 字节;空文件、类型不支持、用途不支持、超限均返回 400。不提供 Uploads 分片。可用 expires_after[anchor] 与 expires_after[seconds] 或 praxis[expires_in_seconds] 设置有效期,两组互斥。
错误按 OpenAI 格式返回,参见 错误码
OK
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | The file identifier, which can be referenced in the API endpoints. |
| bytes | integer | The size of the file, in bytes. |
| created_at | integer | The Unix timestamp (in seconds) for when the file was created. |
| expires_at | integer | The Unix timestamp (in seconds) for when the file will expire. |
| filename | string | The name of the file. |
| object | string | The object type, which is always `file`. |
| purpose | string | Upload purpose. Image references in conversations require user_data. |
| status | string | Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`. |
| status_details | string | null | Deprecated; always null or absent. |
| mime_type | string | Content-detected MIME type. |
| downloadable | boolean | Tenant-owned live files can be downloaded through this face. |
| scope | object | Present for session output files. |
| scope.type | string | Kind of scope; always `session`. |
| scope.id | string | Id of the session the file belongs to. |
| relative_path | string | Path within the session output directory; present for session outputs. |
| revision | integer | Session output revision; present for session outputs. |
/file/v1/files● 支持purposestring可选query: Only return files with the given purpose.
limitinteger可选query: A limit on the number of objects to be returned. Limit can range between 1 and 10,000, and the default is 10,000.
orderstring可选query: Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
afterstring可选query: A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
scope_idstring可选query: Filter files by session scope. A nonexistent scope returns 404.
beforestring可选query: Return the preceding page; mutually exclusive with after.
200 list
错误按 OpenAI 格式返回,参见 错误码
OK
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| object | string | Object type; always `list`. |
| data | array<object> | Files of the page, in the requested order. |
| data[].id | string | The file identifier, which can be referenced in the API endpoints. |
| data[].bytes | integer | The size of the file, in bytes. |
| data[].created_at | integer | The Unix timestamp (in seconds) for when the file was created. |
| data[].expires_at | integer | The Unix timestamp (in seconds) for when the file will expire. |
| data[].filename | string | The name of the file. |
| data[].object | string | The object type, which is always `file`. |
| data[].purpose | string | Upload purpose. Image references in conversations require user_data. |
| data[].status | string | Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`. |
| data[].status_details | string | null | Deprecated; always null or absent. |
| data[].mime_type | string | Content-detected MIME type. |
| data[].downloadable | boolean | Tenant-owned live files can be downloaded through this face. |
| data[].scope | object | Present for session output files. |
| data[].relative_path | string | Path within the session output directory; present for session outputs. |
| data[].revision | integer | Session output revision; present for session outputs. |
| first_id | string | Id of the first file of the page; usable as `before` to read the preceding page. |
| last_id | string | Id of the last file of the page; usable as `after` to read the next page. |
| has_more | boolean | Whether more files exist beyond this page. |
先调用「上传文件」,用返回的文件 ID 替换示例文件 ID。
/file/v1/files/{file_id}● 支持file_idstring必填path: The ID of the file to use for this request.
200 file
错误按 OpenAI 格式返回,参见 错误码
OK
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | The file identifier, which can be referenced in the API endpoints. |
| bytes | integer | The size of the file, in bytes. |
| created_at | integer | The Unix timestamp (in seconds) for when the file was created. |
| expires_at | integer | The Unix timestamp (in seconds) for when the file will expire. |
| filename | string | The name of the file. |
| object | string | The object type, which is always `file`. |
| purpose | string | Upload purpose. Image references in conversations require user_data. |
| status | string | Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`. |
| status_details | string | null | Deprecated; always null or absent. |
| mime_type | string | Content-detected MIME type. |
| downloadable | boolean | Tenant-owned live files can be downloaded through this face. |
| scope | object | Present for session output files. |
| scope.type | string | Kind of scope; always `session`. |
| scope.id | string | Id of the session the file belongs to. |
| relative_path | string | Path within the session output directory; present for session outputs. |
| revision | integer | Session output revision; present for session outputs. |
先调用「上传文件」,用返回的文件 ID 替换示例文件 ID。
/file/v1/files/{file_id}● 支持file_idstring必填path: The ID of the file to use for this request.
200 file
错误按 OpenAI 格式返回,参见 错误码
OK
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Id of the deleted file. |
| object | string | Object type; always `file`. |
| deleted | boolean | Always true; the file can no longer be read, though downloads already authorized may finish. |
POST /media/v1/libraries
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| models | MediaModelsInput | 否 | 各角色的模型调用 ID;局部更新,null 恢复默认 |
| name | string | 是 | 名称,1–64 个字符;允许重名 |
| labels | object | 否 | 标签对象;GET 时传 JSON 字符串;PATCH 整体替换,传 {} 清空 |
| understanding | object | 否 | 视觉、转写与语义理解开关 |
返回: Library.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| search | object | Search capabilities of this library’s embedding model. |
| search.image | boolean | Whether this library’s embedding model supports image-based visual search. |
| models | object | Resolved model call IDs used for new uploads and reprocessing. |
| models.vision | string | Model call ID for visual descriptions; the model must support image input. |
| models.embedding | string | Model call ID for search embeddings; must produce compatible vectors and cannot change while assets exist. |
| models.transcription | string | Model call ID for speech transcription. |
| id | string | Generated library identifier: lib_ followed by 32 lowercase hexadecimal characters. |
| name | string | Display name of the library; duplicate names are allowed. |
| labels | object | Caller-defined string labels used to organize and filter libraries. |
| status | string | Library lifecycle: provisioning initializes the library; active permits asset operations; deleting awaits purge and may be restored before purge_at; deleted has been purged; failed indicates initialization failure. |
| asset_count | number | Number of assets currently stored in the library. |
| bytes | number | Total source-content size of the library’s assets, in bytes. |
| understanding | object | Settings controlling understanding tasks for new uploads. |
| understanding.visual | boolean | Enable captions, tags and OCR for images and video frames. |
| understanding.transcript | boolean | Enable speech transcription for audio and video soundtracks. |
| understanding.embedding | boolean | Enable generation of vectors for semantic search. |
| created_at | string | Time the library was created, in UTC. |
| updated_at | string | Time library settings, lifecycle or usage were last updated, in UTC. |
| deleted_at | string | null | Time the library entered deleting, or null when active or restored. |
| purge_at | string | null | Scheduled purge time while the library is deleting; null for an active or restored library. |
curl -X POST "https://api.deepraxis.ai/media/v1/libraries" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"name":"walk-lib-r1-MDP-1791733789929","labels":{"sample":"walk-lib-r1-MDP-1791733789929"}}'HTTP 200
{
"id": "lib_d3881a2f54a34cd79121b9d659e8378c",
"name": "walk-lib-r1-MDP-1791733789929",
"labels": {
"sample": "walk-lib-r1-MDP-1791733789929"
},
"status": "active",
"asset_count": 0,
"bytes": 0,
"models": {
"vision": "qwen3.8-flash",
"embedding": "qwen3-vl-embedding",
"transcription": "whisper-large-v3-turbo"
},
"search": {
"image": true
},
"understanding": {
"visual": true,
"transcript": true,
"embedding": true
},
"created_at": "2026-10-11T15:50:04.230Z",
"updated_at": "2026-10-11T15:50:04.931Z",
"deleted_at": null,
"purge_at": null
}GET /media/v1/libraries
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| cursor | query | string | 上一页的 next_cursor |
| limit | query | integer | 每页 1–200 条,默认 50 |
| labels | query | string | 标签对象;GET 时传 JSON 字符串;PATCH 整体替换,传 {} 清空 |
| status | query | active / deleting | 资源状态 |
返回: LibraryPage.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | Libraries in this page, ordered by creation time descending. |
| data[].search | object | Search capabilities of this library’s embedding model. |
| data[].models | object | Resolved model call IDs used for new uploads and reprocessing. |
| data[].id | string | Generated library identifier: lib_ followed by 32 lowercase hexadecimal characters. |
| data[].name | string | Display name of the library; duplicate names are allowed. |
| data[].labels | object | Caller-defined string labels used to organize and filter libraries. |
| data[].status | string | Library lifecycle: provisioning initializes the library; active permits asset operations; deleting awaits purge and may be restored before purge_at; deleted has been purged; failed indicates initialization failure. |
| data[].asset_count | number | Number of assets currently stored in the library. |
| data[].bytes | number | Total source-content size of the library’s assets, in bytes. |
| data[].understanding | object | Settings controlling understanding tasks for new uploads. |
| data[].created_at | string | Time the library was created, in UTC. |
| data[].updated_at | string | Time library settings, lifecycle or usage were last updated, in UTC. |
| data[].deleted_at | string | null | Time the library entered deleting, or null when active or restored. |
| data[].purge_at | string | null | Scheduled purge time while the library is deleting; null for an active or restored library. |
| next_cursor | string | null | Opaque token to pass as cursor to listLibraries; null means no further page. |
curl -X GET "https://api.deepraxis.ai/media/v1/libraries?labels=%7B%22sample%22%3A%22walk-lib-r1-MDP-1791733789929%22%7D" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"data": [
{
"id": "lib_d3881a2f54a34cd79121b9d659e8378c",
"name": "walk-lib-r1-MDP-1791733789929",
"status": "active",
"asset_count": 0,
"bytes": 0,
"created_at": "2026-10-11T15:50:04.230Z",
"updated_at": "2026-10-11T15:50:04.931Z",
"deleted_at": null,
"purge_at": null,
"search": {
"image": true
},
"models": {
"vision": "qwen3.8-flash",
"embedding": "qwen3-vl-embedding",
"transcription": "whisper-large-v3-turbo"
},
"labels": {
"sample": "walk-lib-r1-MDP-1791733789929"
},
"understanding": {
"visual": true,
"transcript": true,
"embedding": true
}
}
],
"next_cursor": null
}GET /media/v1/libraries/{library_id}
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
返回: Library.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| search | object | Search capabilities of this library’s embedding model. |
| search.image | boolean | Whether this library’s embedding model supports image-based visual search. |
| models | object | Resolved model call IDs used for new uploads and reprocessing. |
| models.vision | string | Model call ID for visual descriptions; the model must support image input. |
| models.embedding | string | Model call ID for search embeddings; must produce compatible vectors and cannot change while assets exist. |
| models.transcription | string | Model call ID for speech transcription. |
| id | string | Generated library identifier: lib_ followed by 32 lowercase hexadecimal characters. |
| name | string | Display name of the library; duplicate names are allowed. |
| labels | object | Caller-defined string labels used to organize and filter libraries. |
| status | string | Library lifecycle: provisioning initializes the library; active permits asset operations; deleting awaits purge and may be restored before purge_at; deleted has been purged; failed indicates initialization failure. |
| asset_count | number | Number of assets currently stored in the library. |
| bytes | number | Total source-content size of the library’s assets, in bytes. |
| understanding | object | Settings controlling understanding tasks for new uploads. |
| understanding.visual | boolean | Enable captions, tags and OCR for images and video frames. |
| understanding.transcript | boolean | Enable speech transcription for audio and video soundtracks. |
| understanding.embedding | boolean | Enable generation of vectors for semantic search. |
| created_at | string | Time the library was created, in UTC. |
| updated_at | string | Time library settings, lifecycle or usage were last updated, in UTC. |
| deleted_at | string | null | Time the library entered deleting, or null when active or restored. |
| purge_at | string | null | Scheduled purge time while the library is deleting; null for an active or restored library. |
curl -X GET "https://api.deepraxis.ai/media/v1/libraries/${LIBRARY_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"id": "lib_d3881a2f54a34cd79121b9d659e8378c",
"name": "walk-lib-r1-MDP-1791733789929",
"status": "active",
"asset_count": 0,
"bytes": 0,
"created_at": "2026-10-11T15:50:04.230Z",
"updated_at": "2026-10-11T15:50:04.931Z",
"deleted_at": null,
"purge_at": null,
"search": {
"image": true
},
"models": {
"vision": "qwen3.8-flash",
"embedding": "qwen3-vl-embedding",
"transcription": "whisper-large-v3-turbo"
},
"labels": {
"sample": "walk-lib-r1-MDP-1791733789929"
},
"understanding": {
"visual": true,
"transcript": true,
"embedding": true
}
}PATCH /media/v1/libraries/{library_id}
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| models | MediaModelsInput | 否 | 各角色的模型调用 ID;局部更新,null 恢复默认 |
| name | string | 否 | 名称,1–64 个字符;允许重名 |
| labels | object | 否 | 标签对象;GET 时传 JSON 字符串;PATCH 整体替换,传 {} 清空 |
| understanding | object | 否 | 视觉、转写与语义理解开关 |
返回: Library.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| search | object | Search capabilities of this library’s embedding model. |
| search.image | boolean | Whether this library’s embedding model supports image-based visual search. |
| models | object | Resolved model call IDs used for new uploads and reprocessing. |
| models.vision | string | Model call ID for visual descriptions; the model must support image input. |
| models.embedding | string | Model call ID for search embeddings; must produce compatible vectors and cannot change while assets exist. |
| models.transcription | string | Model call ID for speech transcription. |
| id | string | Generated library identifier: lib_ followed by 32 lowercase hexadecimal characters. |
| name | string | Display name of the library; duplicate names are allowed. |
| labels | object | Caller-defined string labels used to organize and filter libraries. |
| status | string | Library lifecycle: provisioning initializes the library; active permits asset operations; deleting awaits purge and may be restored before purge_at; deleted has been purged; failed indicates initialization failure. |
| asset_count | number | Number of assets currently stored in the library. |
| bytes | number | Total source-content size of the library’s assets, in bytes. |
| understanding | object | Settings controlling understanding tasks for new uploads. |
| understanding.visual | boolean | Enable captions, tags and OCR for images and video frames. |
| understanding.transcript | boolean | Enable speech transcription for audio and video soundtracks. |
| understanding.embedding | boolean | Enable generation of vectors for semantic search. |
| created_at | string | Time the library was created, in UTC. |
| updated_at | string | Time library settings, lifecycle or usage were last updated, in UTC. |
| deleted_at | string | null | Time the library entered deleting, or null when active or restored. |
| purge_at | string | null | Scheduled purge time while the library is deleting; null for an active or restored library. |
curl -X PATCH "https://api.deepraxis.ai/media/v1/libraries/${LIBRARY_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"name":"walk-lib-r1-MDP-1791733789929-updated"}'HTTP 200
{
"id": "lib_d3881a2f54a34cd79121b9d659e8378c",
"name": "walk-lib-r1-MDP-1791733789929-updated",
"status": "active",
"asset_count": 0,
"bytes": 0,
"created_at": "2026-10-11T15:50:04.230Z",
"updated_at": "2026-10-11T15:50:07.147Z",
"deleted_at": null,
"purge_at": null,
"search": {
"image": true
},
"models": {
"vision": "qwen3.8-flash",
"embedding": "qwen3-vl-embedding",
"transcription": "whisper-large-v3-turbo"
},
"labels": {
"sample": "walk-lib-r1-MDP-1791733789929"
},
"understanding": {
"visual": true,
"transcript": true,
"embedding": true
}
}DELETE /media/v1/libraries/{library_id}
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
返回: Library.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| search | object | Search capabilities of this library’s embedding model. |
| search.image | boolean | Whether this library’s embedding model supports image-based visual search. |
| models | object | Resolved model call IDs used for new uploads and reprocessing. |
| models.vision | string | Model call ID for visual descriptions; the model must support image input. |
| models.embedding | string | Model call ID for search embeddings; must produce compatible vectors and cannot change while assets exist. |
| models.transcription | string | Model call ID for speech transcription. |
| id | string | Generated library identifier: lib_ followed by 32 lowercase hexadecimal characters. |
| name | string | Display name of the library; duplicate names are allowed. |
| labels | object | Caller-defined string labels used to organize and filter libraries. |
| status | string | Library lifecycle: provisioning initializes the library; active permits asset operations; deleting awaits purge and may be restored before purge_at; deleted has been purged; failed indicates initialization failure. |
| asset_count | number | Number of assets currently stored in the library. |
| bytes | number | Total source-content size of the library’s assets, in bytes. |
| understanding | object | Settings controlling understanding tasks for new uploads. |
| understanding.visual | boolean | Enable captions, tags and OCR for images and video frames. |
| understanding.transcript | boolean | Enable speech transcription for audio and video soundtracks. |
| understanding.embedding | boolean | Enable generation of vectors for semantic search. |
| created_at | string | Time the library was created, in UTC. |
| updated_at | string | Time library settings, lifecycle or usage were last updated, in UTC. |
| deleted_at | string | null | Time the library entered deleting, or null when active or restored. |
| purge_at | string | null | Scheduled purge time while the library is deleting; null for an active or restored library. |
curl -X DELETE "https://api.deepraxis.ai/media/v1/libraries/${LIBRARY_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"id": "lib_d3881a2f54a34cd79121b9d659e8378c",
"name": "walk-lib-r1-MDP-1791733789929-updated",
"status": "deleting",
"asset_count": 2,
"bytes": 140,
"created_at": "2026-10-11T15:50:04.230Z",
"updated_at": "2026-10-11T15:50:30.664Z",
"deleted_at": "2026-10-11T15:50:30.664Z",
"purge_at": "2026-10-18T15:50:30.664Z",
"search": {
"image": true
},
"models": {
"vision": "qwen3.8-flash",
"embedding": "qwen3-vl-embedding",
"transcription": "whisper-large-v3-turbo"
},
"labels": {
"sample": "walk-lib-r1-MDP-1791733789929"
},
"understanding": {
"visual": true,
"transcript": true,
"embedding": true
}
}POST /media/v1/libraries/{library_id}/restore
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
返回: Library.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| search | object | Search capabilities of this library’s embedding model. |
| search.image | boolean | Whether this library’s embedding model supports image-based visual search. |
| models | object | Resolved model call IDs used for new uploads and reprocessing. |
| models.vision | string | Model call ID for visual descriptions; the model must support image input. |
| models.embedding | string | Model call ID for search embeddings; must produce compatible vectors and cannot change while assets exist. |
| models.transcription | string | Model call ID for speech transcription. |
| id | string | Generated library identifier: lib_ followed by 32 lowercase hexadecimal characters. |
| name | string | Display name of the library; duplicate names are allowed. |
| labels | object | Caller-defined string labels used to organize and filter libraries. |
| status | string | Library lifecycle: provisioning initializes the library; active permits asset operations; deleting awaits purge and may be restored before purge_at; deleted has been purged; failed indicates initialization failure. |
| asset_count | number | Number of assets currently stored in the library. |
| bytes | number | Total source-content size of the library’s assets, in bytes. |
| understanding | object | Settings controlling understanding tasks for new uploads. |
| understanding.visual | boolean | Enable captions, tags and OCR for images and video frames. |
| understanding.transcript | boolean | Enable speech transcription for audio and video soundtracks. |
| understanding.embedding | boolean | Enable generation of vectors for semantic search. |
| created_at | string | Time the library was created, in UTC. |
| updated_at | string | Time library settings, lifecycle or usage were last updated, in UTC. |
| deleted_at | string | null | Time the library entered deleting, or null when active or restored. |
| purge_at | string | null | Scheduled purge time while the library is deleting; null for an active or restored library. |
curl -X POST "https://api.deepraxis.ai/media/v1/libraries/${LIBRARY_ID}/restore" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{}'HTTP 200
{
"id": "lib_d3881a2f54a34cd79121b9d659e8378c",
"name": "walk-lib-r1-MDP-1791733789929-updated",
"status": "active",
"asset_count": 2,
"bytes": 140,
"created_at": "2026-10-11T15:50:04.230Z",
"updated_at": "2026-10-11T15:50:31.379Z",
"deleted_at": null,
"purge_at": null,
"search": {
"image": true
},
"models": {
"vision": "qwen3.8-flash",
"embedding": "qwen3-vl-embedding",
"transcription": "whisper-large-v3-turbo"
},
"labels": {
"sample": "walk-lib-r1-MDP-1791733789929"
},
"understanding": {
"visual": true,
"transcript": true,
"embedding": true
}
}POST /media/v1/libraries/{library_id}/purge
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
返回: PurgedLibrary.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Identifier of the library that was permanently purged. |
| object | string | Resource discriminator identifying a library receipt. |
| purged | boolean | True when permanent library cleanup has completed. |
curl -X POST "https://api.deepraxis.ai/media/v1/libraries/${LIBRARY_ID}/purge" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{}'HTTP 200
{
"id": "lib_d3881a2f54a34cd79121b9d659e8378c",
"object": "library",
"purged": true
}| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| search | object | 是 | 检索能力;search.image 为 true 时支持以图搜图 |
| models | MediaModels | 是 | 各角色的模型调用 ID;局部更新,null 恢复默认 |
| id | LibraryId | 是 | 资源 ID |
| name | string | 是 | 名称,1–64 个字符;允许重名 |
| labels | object | 是 | 标签对象;GET 时传 JSON 字符串;PATCH 整体替换,传 {} 清空 |
| status | LibraryStatus | 是 | 资源状态 |
| asset_count | number | 是 | 素材数量 |
| bytes | number | 是 | 文件字节数 |
| understanding | UnderstandingSettings | 是 | 视觉、转写与语义理解开关 |
| created_at | IsoTimestamp | 是 | 创建时间 |
| updated_at | IsoTimestamp | 是 | 更新时间 |
| deleted_at | IsoTimestamp / null | 是 | 删除时间;未删除为 null |
| purge_at | IsoTimestamp / null | 是 | 恢复截止时间 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| data | Library[] | 是 | 本页结果 |
| next_cursor | string / null | 是 | 下一页游标;没有时为 null 或省略 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| id | LibraryId | 是 | 资源 ID |
| object | "library" | 是 | — |
| purged | true | 是 | — |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| data | JSON[] | 是 | 本页结果 |
| next_cursor | string / null | 是 | 下一页游标;没有时为 null 或省略 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| visual | boolean | 是 | 视觉理解开关 |
| transcript | boolean | 是 | 转写开关 |
| embedding | boolean | 是 | 语义理解开关 |
models 指定三个角色使用的模型调用 ID(callModelId)。创建库时省略它会使用下表默认值;更新时只改传入的角色,未传的角色保持不变。某个角色传 null 恢复该角色默认值,models: null 恢复全部默认值。
| 角色 | 用途 | 默认值 |
|---|---|---|
| vision | 图片与视频帧的视觉理解 | qwen3.8-flash |
| embedding | 将内容和检索查询生成向量,用于语义检索 | qwen3-vl-embedding |
| transcription | 音频转写 | whisper-large-v3-turbo |
写入时查询模型目录,校验传入的模型调用 ID。模型不存在返回 400 INVALID_PARAMS,消息为 Model <id> is not available;目录查询失败返回 502 UPSTREAM_FAILED。vision 必须支持图片输入,否则返回 400 INVALID_PARAMS。未知角色、空白 ID 或不合法的值也返回 400。
库中已有素材时不能更换 embedding,返回 409 LIBRARY_INVALID_STATE,消息为「库中已有素材时不能更换嵌入模型」。同一个向量空间必须由同一个模型生成,才能比较已有素材与查询向量;恢复默认值如果改变了 embedding,也受此限制。
修改 vision 或 transcription 只对新上传或重新处理(reprocess)的素材生效,不会自动重跑已有素材。reprocess 不带 kinds 时只重试失败项;显式指定 kinds 时,会强制重跑所选的已成功、失败或不支持项并替换结果。例如,修改 vision 后传入 { kinds: ["visual"] },修改 transcription 后传入 { kinds: ["transcript"] }。
以下 PATCH 只将 vision 恢复默认,保留其他角色:
curl -X PATCH "https://api.deepraxis.ai/media/v1/libraries/${LIBRARY_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"models":{"vision":null}}'新建库默认使用 qwen3-vl-embedding,支持以图搜图;旧库保留 bge-m3。只读字段 search.image 表示当前库是否支持以图搜图。选择其他模型时,会验证它能否输出 1024 维向量;无法输出则返回 INVALID_PARAMS,探测不可用或缺少调用者身份返回 UPSTREAM_FAILED。
GET /media/v1/libraries/{library_id}/assets
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| asset_folder | query | string | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| resource_type | query | image / video / raw | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
| cursor | query | string | 上一页的 next_cursor |
| limit | query | integer | 每页 1–200 条,默认 50 |
返回: AssetPage.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | Assets in this page, ordered by creation time descending. |
| data[].asset_id | string | Generated asset identifier: 32 lowercase hexadecimal characters, preserved across overwrites. |
| data[].public_id | string | Delivery identifier unique within this library, used in asset URLs. |
| data[].display_name | string | Human-readable asset name, independent of its delivery identifier. |
| data[].asset_folder | string | Organizational folder path; the empty string denotes the root folder. |
| data[].resource_type | string | Stored media category: image for images, video for video or audio, and raw for other files. Upload also accepts auto for detection. |
| data[].type | string | Public asset delivery mode; upload is the only supported value. |
| data[].format | string | Detected file format used as the delivery URL extension. |
| data[].version | number | Monotonically increasing asset version used in delivery URLs; based on upload time in Unix seconds and advanced on overwrite. |
| data[].version_id | string | Identifier for this asset version, regenerated on overwrite. |
| data[].bytes | number | Size of the original source content, in bytes. |
| data[].etag | string | MD5 digest of the source bytes, as 32 lowercase hexadecimal characters. |
| data[].width | number | Source image or video width in pixels, when known. |
| data[].height | number | Source image or video height in pixels, when known. |
| data[].duration | number | Source audio or video duration in seconds, when known. |
| data[].pages | number | |
| data[].is_audio | boolean | True for audio-only media, which uses resource_type video. |
| data[].original_filename | string | Original or overridden source filename with its final extension removed. |
| data[].tags | array<string> | Labels attached to the asset. |
| data[].context | object | Custom string metadata; omitted when empty or excluded by the search projection. |
| data[].created_at | string | Time this asset identity was created, in UTC. |
| data[].url | string | URL for retrieving this version of the asset’s original content. |
| data[].secure_url | string | HTTPS delivery URL for this asset version; equal to url. |
| data[].placeholder | boolean | False because this response represents stored source content. |
| data[].existing | boolean | |
| data[].processing | object | Progress of understanding and embedding tasks for the asset. |
| data[].library_id | string | Identifier of the library containing this asset. |
| data[].sha256 | string | SHA-256 digest of the source bytes, as 64 lowercase hexadecimal characters. |
| data[].status | string | Resource status; active identifies an asset that has not been deleted. |
| data[].semantic | string | Search-vector status: pending awaits vector generation or reprocessing; ready has searchable vectors; unavailable indicates disabled, unsupported or failed embedding. Existing vectors may still serve searches while reprocessing is pending. |
| data[].preview | object | Generated video previews, present once preview generation succeeds. |
| next_cursor | string | null | Opaque token to pass as cursor to listAssets; null means no further page. |
curl -X GET "https://api.deepraxis.ai/media/v1/libraries/${LIBRARY_ID}/assets" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"data": [
{
"asset_id": "9dfa312ef9bc4b00816339b598b1152c",
"public_id": "walk-lib-r1-MDP-1791733789929-tagged",
"display_name": "walk-lib-r1-MDP-1791733789929-tagged",
"asset_folder": "",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791733815,
"version_id": "26cb8171caa5431b8373ad417fd71e32",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"tags": [
"docs"
],
"processing": {
"state": "processing",
"kinds": {
"embedding": "pending",
"visual": "running",
"tagging": "running"
},
"updated_at": "2026-10-11T15:50:17.571Z"
},
"created_at": "2026-10-11T15:50:15.996Z",
"url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733815/walk-lib-r1-MDP-1791733789929-tagged.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733815/walk-lib-r1-MDP-1791733789929-tagged.png",
"placeholder": false,
"library_id": "lib_d3881a2f54a34cd79121b9d659e8378c",
"sha256": "497790947d4666760ce38f3c00e852c71fdb66cae849bae8e9ede352719e1581",
"status": "active",
"semantic": "pending"
},
{
"asset_id": "85b7ef616a8b4719a41777a036ebc1d2",
"public_id": "walk-lib-r1-MDP-1791733789929-plain",
"display_name": "walk-lib-r1-MDP-1791733789929-plain",
"asset_folder": "",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791733810,
"version_id": "fdf3c8cd40c2424d86e8397425a69857",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"tags": [
"docs"
],
"created_at": "2026-10-11T15:50:10.842Z",
"url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733810/walk-lib-r1-MDP-1791733789929-plain.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733810/walk-lib-r1-MDP-1791733789929-plain.png",
"placeholder": false,
"library_id": "lib_d3881a2f54a34cd79121b9d659e8378c",
"sha256": "497790947d4666760ce38f3c00e852c71fdb66cae849bae8e9ede352719e1581",
"status": "active",
"processing": {
"state": "processing",
"kinds": {
"embedding": "pending",
"visual": "running"
},
"updated_at": "2026-10-11T15:50:17.571Z"
},
"semantic": "pending"
}
],
"next_cursor": null
}POST /media/v1/libraries/{library_id}/assets
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| X-Unique-Upload-Id | header | string | — |
| Content-Range | header | string | — |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| file | string / string | 是 | 文件字节、HTTPS URL、data URI 或同账户 file_… |
| public_id | string | 否 | 交付地址中的素材名称,可带路径 |
| public_id_prefix | string | 否 | public_id 的路径前缀;末尾的 / 可有可无,前缀与 ID 之间只保留一个 / |
| display_name | string | 否 | 显示名称 |
| asset_folder | string | 否 | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| use_filename | boolean | 否 | 用文件名生成 public_id |
| unique_filename | boolean | 否 | 自动附加唯一后缀 |
| use_filename_as_display_name | boolean | 否 | 用文件名作为显示名称 |
| filename_override | string | 否 | 覆盖原文件名称 |
| overwrite | boolean | 否 | 是否覆盖同名素材 |
| tags | string / string[] | 否 | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| context | string / object | 否 | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
| auto_tagging | number | 否 | 理解后将达到阈值的标签合并;0–1 |
| resource_type | image / video / raw / auto | 否 | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
返回: CloudinaryResource.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| asset_id | string | Generated asset identifier: 32 lowercase hexadecimal characters, preserved across overwrites. |
| public_id | string | Delivery identifier unique within this library, used in asset URLs. |
| display_name | string | Human-readable asset name, independent of its delivery identifier. |
| asset_folder | string | Organizational folder path; the empty string denotes the root folder. |
| resource_type | string | Stored media category: image for images, video for video or audio, and raw for other files. Upload also accepts auto for detection. |
| type | string | Public asset delivery mode; upload is the only supported value. |
| format | string | Detected file format used as the delivery URL extension. |
| version | number | Monotonically increasing asset version used in delivery URLs; based on upload time in Unix seconds and advanced on overwrite. |
| version_id | string | Identifier for this asset version, regenerated on overwrite. |
| bytes | number | Size of the original source content, in bytes. |
| etag | string | MD5 digest of the source bytes, as 32 lowercase hexadecimal characters. |
| width | number | Source image or video width in pixels, when known. |
| height | number | Source image or video height in pixels, when known. |
| duration | number | Source audio or video duration in seconds, when known. |
| pages | number | |
| is_audio | boolean | True for audio-only media, which uses resource_type video. |
| original_filename | string | Original or overridden source filename with its final extension removed. |
| tags | array<string> | Labels attached to the asset. |
| context | object | Custom string metadata; omitted when empty or excluded by the search projection. |
| context.custom | object | Caller-supplied metadata entries with string values. |
| created_at | string | Time this asset identity was created, in UTC. |
| url | string | URL for retrieving this version of the asset’s original content. |
| secure_url | string | HTTPS delivery URL for this asset version; equal to url. |
| placeholder | boolean | False because this response represents stored source content. |
| existing | boolean | True when overwrite=false returns the asset already stored under the requested public_id. |
| processing | object | Processing progress, included when auto_tagging was requested. |
| processing.state | string | |
| processing.kinds | object | Processing states by kind. tagging is present when auto_tagging was requested and follows visual understanding. |
| processing.updated_at | string | Time the processing state was last updated, in UTC. |
| done | boolean | False while more chunks are needed before the asset is complete. / True when the final chunk has completed the asset upload. |
| upload_id | string | Upload session identifier supplied in X-Unique-Upload-Id; reuse it for subsequent chunks. |
curl -X POST "https://api.deepraxis.ai/media/v1/libraries/${LIBRARY_ID}/assets" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"file":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==","public_id":"walk-lib-r1-MDP-1791733789929-tagged","tags":["docs"],"auto_tagging":0.6}'HTTP 200
{
"asset_id": "9dfa312ef9bc4b00816339b598b1152c",
"public_id": "walk-lib-r1-MDP-1791733789929-tagged",
"display_name": "walk-lib-r1-MDP-1791733789929-tagged",
"asset_folder": "",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791733815,
"version_id": "26cb8171caa5431b8373ad417fd71e32",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"tags": [
"docs"
],
"processing": {
"state": "pending",
"kinds": {
"visual": "pending",
"embedding": "pending",
"tagging": "pending"
},
"updated_at": "2026-10-11T15:50:15.996Z"
},
"created_at": "2026-10-11T15:50:15.996Z",
"url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733815/walk-lib-r1-MDP-1791733789929-tagged.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733815/walk-lib-r1-MDP-1791733789929-tagged.png",
"placeholder": false
}POST /media/v1/libraries/{library_id}/assets/import
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| file_id | string | 是 | 同账户文件 ID |
| public_id | string | 否 | 交付地址中的素材名称,可带路径 |
| public_id_prefix | string | 否 | public_id 的路径前缀;末尾的 / 可有可无,前缀与 ID 之间只保留一个 / |
| display_name | string | 否 | 显示名称 |
| asset_folder | string | 否 | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| use_filename | boolean | 否 | 用文件名生成 public_id |
| unique_filename | boolean | 否 | 自动附加唯一后缀 |
| use_filename_as_display_name | boolean | 否 | 用文件名作为显示名称 |
| filename_override | string | 否 | 覆盖原文件名称 |
| overwrite | boolean | 否 | 是否覆盖同名素材 |
| tags | string / string[] | 否 | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| context | string / object | 否 | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
| auto_tagging | number | 否 | 理解后将达到阈值的标签合并;0–1 |
| resource_type | image / video / raw / auto | 否 | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
返回: Asset.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| asset_id | string | Generated asset identifier: 32 lowercase hexadecimal characters, preserved across overwrites. |
| public_id | string | Delivery identifier unique within this library, used in asset URLs. |
| display_name | string | Human-readable asset name, independent of its delivery identifier. |
| asset_folder | string | Organizational folder path; the empty string denotes the root folder. |
| resource_type | string | Stored media category: image for images, video for video or audio, and raw for other files. Upload also accepts auto for detection. |
| type | string | Public asset delivery mode; upload is the only supported value. |
| format | string | Detected file format used as the delivery URL extension. |
| version | number | Monotonically increasing asset version used in delivery URLs; based on upload time in Unix seconds and advanced on overwrite. |
| version_id | string | Identifier for this asset version, regenerated on overwrite. |
| bytes | number | Size of the original source content, in bytes. |
| etag | string | MD5 digest of the source bytes, as 32 lowercase hexadecimal characters. |
| width | number | Source image or video width in pixels, when known. |
| height | number | Source image or video height in pixels, when known. |
| duration | number | Source audio or video duration in seconds, when known. |
| pages | number | |
| is_audio | boolean | True for audio-only media, which uses resource_type video. |
| original_filename | string | Original or overridden source filename with its final extension removed. |
| tags | array<string> | Labels attached to the asset. |
| context | object | Custom string metadata; omitted when empty or excluded by the search projection. |
| context.custom | object | Caller-supplied metadata entries with string values. |
| created_at | string | Time this asset identity was created, in UTC. |
| url | string | URL for retrieving this version of the asset’s original content. |
| secure_url | string | HTTPS delivery URL for this asset version; equal to url. |
| placeholder | boolean | False because this response represents stored source content. |
| existing | boolean | |
| processing | object | Progress of understanding and embedding tasks for the asset. |
| processing.state | string | |
| processing.kinds | object | Processing states by kind. tagging is present when auto_tagging was requested and follows visual understanding. |
| processing.updated_at | string | Time the processing state was last updated, in UTC. |
| library_id | string | Identifier of the library containing this asset. |
| sha256 | string | SHA-256 digest of the source bytes, as 64 lowercase hexadecimal characters. |
| status | string | Resource status; active identifies an asset that has not been deleted. |
| semantic | string | Search-vector status: pending awaits vector generation or reprocessing; ready has searchable vectors; unavailable indicates disabled, unsupported or failed embedding. Existing vectors may still serve searches while reprocessing is pending. |
| preview | object | Generated video previews, present once preview generation succeeds. |
| preview.poster_url | string | Delivery URL of the video’s first-frame poster. |
| preview.storyboard | object | Preview sprite sheet with tile dimensions and sample spacing. |
GET /media/v1/libraries/{library_id}/assets/{asset_id}
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| asset_id | path | string | 素材 ID |
返回: Asset.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| asset_id | string | Generated asset identifier: 32 lowercase hexadecimal characters, preserved across overwrites. |
| public_id | string | Delivery identifier unique within this library, used in asset URLs. |
| display_name | string | Human-readable asset name, independent of its delivery identifier. |
| asset_folder | string | Organizational folder path; the empty string denotes the root folder. |
| resource_type | string | Stored media category: image for images, video for video or audio, and raw for other files. Upload also accepts auto for detection. |
| type | string | Public asset delivery mode; upload is the only supported value. |
| format | string | Detected file format used as the delivery URL extension. |
| version | number | Monotonically increasing asset version used in delivery URLs; based on upload time in Unix seconds and advanced on overwrite. |
| version_id | string | Identifier for this asset version, regenerated on overwrite. |
| bytes | number | Size of the original source content, in bytes. |
| etag | string | MD5 digest of the source bytes, as 32 lowercase hexadecimal characters. |
| width | number | Source image or video width in pixels, when known. |
| height | number | Source image or video height in pixels, when known. |
| duration | number | Source audio or video duration in seconds, when known. |
| pages | number | |
| is_audio | boolean | True for audio-only media, which uses resource_type video. |
| original_filename | string | Original or overridden source filename with its final extension removed. |
| tags | array<string> | Labels attached to the asset. |
| context | object | Custom string metadata; omitted when empty or excluded by the search projection. |
| context.custom | object | Caller-supplied metadata entries with string values. |
| created_at | string | Time this asset identity was created, in UTC. |
| url | string | URL for retrieving this version of the asset’s original content. |
| secure_url | string | HTTPS delivery URL for this asset version; equal to url. |
| placeholder | boolean | False because this response represents stored source content. |
| existing | boolean | |
| processing | object | Progress of understanding and embedding tasks for the asset. |
| processing.state | string | |
| processing.kinds | object | Processing states by kind. tagging is present when auto_tagging was requested and follows visual understanding. |
| processing.updated_at | string | Time the processing state was last updated, in UTC. |
| library_id | string | Identifier of the library containing this asset. |
| sha256 | string | SHA-256 digest of the source bytes, as 64 lowercase hexadecimal characters. |
| status | string | Resource status; active identifies an asset that has not been deleted. |
| semantic | string | Search-vector status: pending awaits vector generation or reprocessing; ready has searchable vectors; unavailable indicates disabled, unsupported or failed embedding. Existing vectors may still serve searches while reprocessing is pending. |
| preview | object | Generated video previews, present once preview generation succeeds. |
| preview.poster_url | string | Delivery URL of the video’s first-frame poster. |
| preview.storyboard | object | Preview sprite sheet with tile dimensions and sample spacing. |
curl -X GET "https://api.deepraxis.ai/media/v1/libraries/${LIBRARY_ID}/assets/85b7ef616a8b4719a41777a036ebc1d2" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"asset_id": "85b7ef616a8b4719a41777a036ebc1d2",
"public_id": "walk-lib-r1-MDP-1791733789929-plain",
"display_name": "walk-lib-r1-MDP-1791733789929-plain",
"asset_folder": "",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791733810,
"version_id": "fdf3c8cd40c2424d86e8397425a69857",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"tags": [
"docs"
],
"created_at": "2026-10-11T15:50:10.842Z",
"url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733810/walk-lib-r1-MDP-1791733789929-plain.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733810/walk-lib-r1-MDP-1791733789929-plain.png",
"placeholder": false,
"library_id": "lib_d3881a2f54a34cd79121b9d659e8378c",
"sha256": "497790947d4666760ce38f3c00e852c71fdb66cae849bae8e9ede352719e1581",
"status": "active",
"processing": {
"state": "processing",
"kinds": {
"embedding": "pending",
"visual": "running"
},
"updated_at": "2026-10-11T15:50:17.571Z"
},
"semantic": "pending"
}PATCH /media/v1/libraries/{library_id}/assets/{asset_id}
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| asset_id | path | string | 素材 ID |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| display_name | string | 否 | 显示名称 |
| asset_folder | string | 否 | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| tags | string[] | 否 | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| context | object | 否 | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
返回: Asset.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| asset_id | string | Generated asset identifier: 32 lowercase hexadecimal characters, preserved across overwrites. |
| public_id | string | Delivery identifier unique within this library, used in asset URLs. |
| display_name | string | Human-readable asset name, independent of its delivery identifier. |
| asset_folder | string | Organizational folder path; the empty string denotes the root folder. |
| resource_type | string | Stored media category: image for images, video for video or audio, and raw for other files. Upload also accepts auto for detection. |
| type | string | Public asset delivery mode; upload is the only supported value. |
| format | string | Detected file format used as the delivery URL extension. |
| version | number | Monotonically increasing asset version used in delivery URLs; based on upload time in Unix seconds and advanced on overwrite. |
| version_id | string | Identifier for this asset version, regenerated on overwrite. |
| bytes | number | Size of the original source content, in bytes. |
| etag | string | MD5 digest of the source bytes, as 32 lowercase hexadecimal characters. |
| width | number | Source image or video width in pixels, when known. |
| height | number | Source image or video height in pixels, when known. |
| duration | number | Source audio or video duration in seconds, when known. |
| pages | number | |
| is_audio | boolean | True for audio-only media, which uses resource_type video. |
| original_filename | string | Original or overridden source filename with its final extension removed. |
| tags | array<string> | Labels attached to the asset. |
| context | object | Custom string metadata; omitted when empty or excluded by the search projection. |
| context.custom | object | Caller-supplied metadata entries with string values. |
| created_at | string | Time this asset identity was created, in UTC. |
| url | string | URL for retrieving this version of the asset’s original content. |
| secure_url | string | HTTPS delivery URL for this asset version; equal to url. |
| placeholder | boolean | False because this response represents stored source content. |
| existing | boolean | |
| processing | object | Progress of understanding and embedding tasks for the asset. |
| processing.state | string | |
| processing.kinds | object | Processing states by kind. tagging is present when auto_tagging was requested and follows visual understanding. |
| processing.updated_at | string | Time the processing state was last updated, in UTC. |
| library_id | string | Identifier of the library containing this asset. |
| sha256 | string | SHA-256 digest of the source bytes, as 64 lowercase hexadecimal characters. |
| status | string | Resource status; active identifies an asset that has not been deleted. |
| semantic | string | Search-vector status: pending awaits vector generation or reprocessing; ready has searchable vectors; unavailable indicates disabled, unsupported or failed embedding. Existing vectors may still serve searches while reprocessing is pending. |
| preview | object | Generated video previews, present once preview generation succeeds. |
| preview.poster_url | string | Delivery URL of the video’s first-frame poster. |
| preview.storyboard | object | Preview sprite sheet with tile dimensions and sample spacing. |
curl -X PATCH "https://api.deepraxis.ai/media/v1/libraries/${LIBRARY_ID}/assets/85b7ef616a8b4719a41777a036ebc1d2" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"display_name":"walk-lib-r1-MDP-1791733789929-plain"}'HTTP 200
{
"asset_id": "85b7ef616a8b4719a41777a036ebc1d2",
"public_id": "walk-lib-r1-MDP-1791733789929-plain",
"display_name": "walk-lib-r1-MDP-1791733789929-plain",
"asset_folder": "",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791733810,
"version_id": "fdf3c8cd40c2424d86e8397425a69857",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"tags": [
"docs"
],
"created_at": "2026-10-11T15:50:10.842Z",
"url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733810/walk-lib-r1-MDP-1791733789929-plain.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733810/walk-lib-r1-MDP-1791733789929-plain.png",
"placeholder": false,
"library_id": "lib_d3881a2f54a34cd79121b9d659e8378c",
"sha256": "497790947d4666760ce38f3c00e852c71fdb66cae849bae8e9ede352719e1581",
"status": "active",
"processing": {
"state": "processing",
"kinds": {
"embedding": "pending",
"visual": "running"
},
"updated_at": "2026-10-11T15:50:17.571Z"
},
"semantic": "pending"
}DELETE /media/v1/libraries/{library_id}/assets/{asset_id}
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| asset_id | path | string | 素材 ID |
返回: Deleted.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| deleted | boolean | True once this asset has been removed from the library. |
curl -X DELETE "https://api.deepraxis.ai/media/v1/libraries/${LIBRARY_ID}/assets/e5f3de0d8609482d8b351894b133c8cb" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"deleted": true
}POST /media/v1/libraries/{library_id}/assets/{asset_id}/reprocess
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| asset_id | path | string | 素材 ID |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| kinds | ProcessingKind[] | 否 | 要强制重跑的处理种类;省略时只重试失败项 |
返回: Asset.
kinds 可选 visual、frames、transcript、embedding。不带 kinds 时,只重跑当前素材版本的失败任务。显式传 kinds 时,所选的 ready、failed、unsupported 任务会重置为 pending 并强制重跑;pending 或 running 任务原样跳过,重复请求不会重复入队。
kinds 必须适用于素材类型:图片为 visual、embedding;音频为 transcript、embedding;视频为 frames、visual、transcript、embedding;raw 没有可重跑的种类。全部不适用时返回 400 INVALID_PARAMS,消息列出该素材可用的 kinds;部分适用时只处理适用的种类,其余忽略(返回的 Asset 没有字段说明被忽略的种类,请以 processing.kinds 为准)。
重跑 visual、frames 或 transcript 时,旧结果立即标记为 superseded,同时将 embedding 与素材的 semantic 置为 pending。旧向量继续服务语义检索,直到新的向量写入后才被替换,因此重新处理期间素材不会从检索结果中消失;期间命中片段可能显示素材名称而非旧描述。默认读取只返回当前结果;使用 include_superseded=true 可查看历史。请求立即返回更新后的 Asset,处理异步完成。
curl -X POST "https://api.deepraxis.ai/media/v1/libraries/${LIBRARY_ID}/assets/${ASSET_ID}/reprocess" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{}'Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| asset_id | string | Generated asset identifier: 32 lowercase hexadecimal characters, preserved across overwrites. |
| public_id | string | Delivery identifier unique within this library, used in asset URLs. |
| display_name | string | Human-readable asset name, independent of its delivery identifier. |
| asset_folder | string | Organizational folder path; the empty string denotes the root folder. |
| resource_type | string | Stored media category: image for images, video for video or audio, and raw for other files. Upload also accepts auto for detection. |
| type | string | Public asset delivery mode; upload is the only supported value. |
| format | string | Detected file format used as the delivery URL extension. |
| version | number | Monotonically increasing asset version used in delivery URLs; based on upload time in Unix seconds and advanced on overwrite. |
| version_id | string | Identifier for this asset version, regenerated on overwrite. |
| bytes | number | Size of the original source content, in bytes. |
| etag | string | MD5 digest of the source bytes, as 32 lowercase hexadecimal characters. |
| width | number | Source image or video width in pixels, when known. |
| height | number | Source image or video height in pixels, when known. |
| duration | number | Source audio or video duration in seconds, when known. |
| pages | number | |
| is_audio | boolean | True for audio-only media, which uses resource_type video. |
| original_filename | string | Original or overridden source filename with its final extension removed. |
| tags | array<string> | Labels attached to the asset. |
| context | object | Custom string metadata; omitted when empty or excluded by the search projection. |
| context.custom | object | Caller-supplied metadata entries with string values. |
| created_at | string | Time this asset identity was created, in UTC. |
| url | string | URL for retrieving this version of the asset’s original content. |
| secure_url | string | HTTPS delivery URL for this asset version; equal to url. |
| placeholder | boolean | False because this response represents stored source content. |
| existing | boolean | |
| processing | object | Progress of understanding and embedding tasks for the asset. |
| processing.state | string | |
| processing.kinds | object | Processing states by kind. tagging is present when auto_tagging was requested and follows visual understanding. |
| processing.updated_at | string | Time the processing state was last updated, in UTC. |
| library_id | string | Identifier of the library containing this asset. |
| sha256 | string | SHA-256 digest of the source bytes, as 64 lowercase hexadecimal characters. |
| status | string | Resource status; active identifies an asset that has not been deleted. |
| semantic | string | Search-vector status: pending awaits vector generation or reprocessing; ready has searchable vectors; unavailable indicates disabled, unsupported or failed embedding. Existing vectors may still serve searches while reprocessing is pending. |
| preview | object | Generated video previews, present once preview generation succeeds. |
| preview.poster_url | string | Delivery URL of the video’s first-frame poster. |
| preview.storyboard | object | Preview sprite sheet with tile dimensions and sample spacing. |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| data | Asset[] | 是 | 本页结果 |
| next_cursor | string / null | 是 | 下一页游标;没有时为 null 或省略 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| asset_id | AssetId | 是 | 素材 ID |
| public_id | string | 是 | 交付地址中的素材名称,可带路径 |
| display_name | string | 是 | 显示名称 |
| asset_folder | string | 是 | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| resource_type | ResourceType | 是 | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
| type | DeliveryType | 是 | 资源或事件类型 |
| format | string | 是 | 文件格式 |
| version | number | 是 | 交付版本号 |
| version_id | string | 是 | 版本标识 |
| bytes | number | 是 | 文件字节数 |
| etag | string | 是 | 文件校验标识 |
| width | number | 否 | 宽度像素 |
| height | number | 否 | 高度像素 |
| duration | number | 否 | 时长秒数 |
| pages | number | 否 | 文档页数 |
| is_audio | boolean | 否 | 是否为音频 |
| original_filename | string | 否 | 原文件名称 |
| tags | string[] | 是 | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| context | object | 否 | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
| created_at | IsoTimestamp | 是 | 创建时间 |
| url | string | 是 | 原文件地址 |
| secure_url | string | 是 | HTTPS 交付地址 |
| placeholder | false | 是 | 固定为 false |
| existing | boolean | 否 | 未覆盖时是否返回已有素材 |
| processing | Processing | 否 | 整体与各项理解状态 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| asset_id | AssetId | 是 | 素材 ID |
| public_id | string | 是 | 交付地址中的素材名称,可带路径 |
| display_name | string | 是 | 显示名称 |
| asset_folder | string | 是 | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| resource_type | ResourceType | 是 | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
| type | DeliveryType | 是 | 资源或事件类型 |
| format | string | 是 | 文件格式 |
| version | number | 是 | 交付版本号 |
| version_id | string | 是 | 版本标识 |
| bytes | number | 是 | 文件字节数 |
| etag | string | 是 | 文件校验标识 |
| width | number | 否 | 宽度像素 |
| height | number | 否 | 高度像素 |
| duration | number | 否 | 时长秒数 |
| pages | number | 否 | 文档页数 |
| is_audio | boolean | 否 | 是否为音频 |
| original_filename | string | 否 | 原文件名称 |
| tags | string[] | 是 | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| context | object | 否 | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
| created_at | IsoTimestamp | 是 | 创建时间 |
| url | string | 是 | 原文件地址 |
| secure_url | string | 是 | HTTPS 交付地址 |
| placeholder | false | 是 | 固定为 false |
| existing | boolean | 否 | 未覆盖时是否返回已有素材 |
| processing | Processing | 是 | 整体与各项理解状态 |
| library_id | LibraryId | 是 | 库 ID |
| sha256 | string | 是 | 内容校验摘要 |
| status | "active" | 是 | 资源状态 |
| semantic | "pending" / "ready" / "unavailable" | 是 | ready 时可语义检索 |
| preview | object | 否 | 预览海报和故事板 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| deleted | true | 是 | 删除结果 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| state | ProcessingState | 是 | 整体处理状态 |
| kinds | object | 是 | 各项处理状态 |
| updated_at | IsoTimestamp | 是 | 更新时间 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| url | string | 是 | 原文件地址 |
| tiles | number | 是 | 故事板画面数 |
| interval_ms | number | 是 | 画面间隔毫秒数 |
| tile_width | number | 是 | 单个画面宽度 |
| tile_height | number | 是 | 单个画面高度 |
kinds 可选 visual、frames、transcript、embedding。不带 kinds 时,只重跑当前素材版本的失败任务。显式传 kinds 时,所选的 ready、failed、unsupported 任务会重置为 pending 并强制重跑;pending 或 running 任务原样跳过,重复请求不会重复入队。
kinds 必须适用于素材类型:图片为 visual、embedding;音频为 transcript、embedding;视频为 frames、visual、transcript、embedding;raw 没有可重跑的种类。全部不适用时返回 400 INVALID_PARAMS,消息列出该素材可用的 kinds;部分适用时只处理适用的种类,其余忽略(返回的 Asset 没有字段说明被忽略的种类,请以 processing.kinds 为准)。
重跑 visual、frames 或 transcript 时,旧结果立即标记为 superseded,同时将 embedding 与素材的 semantic 置为 pending。旧向量继续服务语义检索,直到新的向量写入后才被替换,因此重新处理期间素材不会从检索结果中消失;期间命中片段可能显示素材名称而非旧描述。默认读取只返回当前结果;使用 include_superseded=true 可查看历史。请求立即返回更新后的 Asset,处理异步完成。
转写片段先做全角转半角、转小写并去除首尾空白和标点。规范化后为空,或整段命中常见幻听短语表时,丢弃该片段。仅完整匹配,不做子串匹配,例如 “thank you for the report” 会保留。
短语表包括:thank you、thanks for watching、thank you for watching、please subscribe、subscribe、you、bye、字幕由amara.org社区提供、请不吝点赞 订阅 转发 打赏支持明镜与点点栏目、谢谢观看、优优独播剧场——yoyo television series exclusive。
被过滤的片段不进入转写文字、关键词索引或转写向量。全部被过滤时,transcript 理解仍为 ready,content 为空字符串,data 为 { "filtered_segments": n },n 是被过滤的片段数;该素材不会生成转写向量。
GET /media/v1/libraries/{library_id}/assets/{asset_id}/understandings
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| asset_id | path | string | 素材 ID |
| include_superseded | query | boolean | 包含已被新版本替代的结果;只接受 true 或 false |
| kind | query | caption / tags / ocr / transcript / frame | 理解或处理种类;列出理解结果时按此筛选 |
| cursor | query | string | 上一页的 next_cursor |
| limit | query | integer | 每页 1–200 条,默认 200 |
返回: UnderstandingPage.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | Understanding results in this page, ordered by creation time ascending. |
| data[].id | string | Generated identifier of this understanding result. |
| data[].asset_id | string | Identifier of the asset from which this result was produced. |
| data[].asset_version | number | Asset version processed to produce this result; compare with the asset’s current version. |
| data[].kind | string | Result kind: caption is a visual description, tags are recognized labels, ocr is text recognized in the image, transcript is speech text, and frame is a description of a video segment. |
| data[].producer | string | Producer model identifier; a failure may use the configured model when no model response is available. |
| data[].producer_version | string | |
| data[].segment | object | null | Source-media time range for a frame or transcript segment; null for results without a segment. |
| data[].status | string | Result status: ready contains completed output; failed records an error. |
| data[].content | string | null | Text output, such as a caption, recognized text or transcript; null for structured-only or failed results. |
| data[].data | any | null | Structured producer output, such as recognized labels or frame details; null when absent. |
| data[].confidence | number | null | |
| data[].error | object | null | Failure code and message, or null for a successful result. |
| data[].superseded | boolean | Whether a newer result or asset version has replaced this result. Excluded from listing unless include_superseded is true. |
| data[].created_at | string | Time this immutable result was recorded, in UTC. |
| next_cursor | string | null | Opaque token to pass as cursor to listUnderstandings; null means no further page. |
curl -X GET "https://api.deepraxis.ai/media/v1/libraries/${LIBRARY_ID}/assets/9339cdae93804c0c8c65d5189ef1f646/understandings" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"data": [],
"next_cursor": null
}| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| data | Understanding[] | 是 | 本页结果 |
| next_cursor | string / null | 是 | 下一页游标;没有时为 null 或省略 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| id | UnderstandingId | 是 | 资源 ID |
| asset_id | AssetId | 是 | 素材 ID |
| asset_version | number | 是 | 理解对应的素材版本 |
| kind | UnderstandingKind | 是 | 理解或处理种类;列出理解结果时按此筛选 |
| producer | string | 是 | 理解生成者 |
| producer_version | string | 是 | 生成者版本 |
| segment | Segment / null | 是 | 起止毫秒;整份素材为 null |
| status | "ready" / "failed" | 是 | 资源状态 |
| content | string / null | 是 | 理解的文字内容 |
| data | JSON / null | 是 | 本页结果 |
| confidence | number / null | 是 | 置信度;可能为空 |
| error | object / null | 是 | 错误码与消息;成功时为空 |
| superseded | boolean | 是 | 是否被新版本替代 |
| created_at | IsoTimestamp | 是 | 创建时间 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| start_ms | number | 是 | 片段开始毫秒 |
| end_ms | number | 是 | 片段结束毫秒 |
expression 接受表达式;semantic 与 search 接受自然语言。语义检索只返回就绪素材。
POST /media/v1/libraries/{library_id}/search/expression
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| expression | string | 否 | 结构化查询表达式;空表达式返回全部素材 |
| sort_by | object[] | 否 | 排序字段与方向 |
| max_results | integer | 否 | 最多 500;检索默认 100,Admin 默认 10 |
| next_cursor | string | 否 | 下一页游标;没有时为 null 或省略 |
| with_field | tags / context[] | 否 | 额外返回 tags 或 context |
| aggregate | AggregateField[] | 否 | 统计字段 |
返回: ExpressionSearchResult.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| total_count | number | Number of matching assets across pages; a lower bound when total_count_exact is false. |
| time | number | Elapsed search time in whole milliseconds. |
| next_cursor | string | Continuation token for the next page; omitted when no further page is available. |
| resources | array<object> | Assets in this page, ordered by sort_by; tags and context follow with_field. |
| resources[].asset_id | string | Generated asset identifier: 32 lowercase hexadecimal characters, preserved across overwrites. |
| resources[].public_id | string | Delivery identifier unique within this library, used in asset URLs. |
| resources[].display_name | string | Human-readable asset name, independent of its delivery identifier. |
| resources[].asset_folder | string | Organizational folder path; the empty string denotes the root folder. |
| resources[].resource_type | string | Stored media category: image for images, video for video or audio, and raw for other files. Upload also accepts auto for detection. |
| resources[].type | string | Public asset delivery mode; upload is the only supported value. |
| resources[].format | string | Detected file format used as the delivery URL extension. |
| resources[].version | number | Monotonically increasing asset version used in delivery URLs; based on upload time in Unix seconds and advanced on overwrite. |
| resources[].version_id | string | Identifier for this asset version, regenerated on overwrite. |
| resources[].bytes | number | Size of the original source content, in bytes. |
| resources[].etag | string | MD5 digest of the source bytes, as 32 lowercase hexadecimal characters. |
| resources[].width | number | Source image or video width in pixels, when known. |
| resources[].height | number | Source image or video height in pixels, when known. |
| resources[].duration | number | Source audio or video duration in seconds, when known. |
| resources[].pages | number | |
| resources[].is_audio | boolean | True for audio-only media, which uses resource_type video. |
| resources[].original_filename | string | Original or overridden source filename with its final extension removed. |
| resources[].tags | array<string> | Labels attached to the asset. |
| resources[].context | object | Custom string metadata; omitted when empty or excluded by the search projection. |
| resources[].created_at | string | Time this asset identity was created, in UTC. |
| resources[].url | string | URL for retrieving this version of the asset’s original content. |
| resources[].secure_url | string | HTTPS delivery URL for this asset version; equal to url. |
| resources[].placeholder | boolean | False because this response represents stored source content. |
| resources[].existing | boolean | |
| resources[].processing | object | Progress of understanding and embedding tasks for the asset. |
| resources[].library_id | string | Identifier of the library containing this asset. |
| resources[].sha256 | string | SHA-256 digest of the source bytes, as 64 lowercase hexadecimal characters. |
| resources[].status | string | Resource status; active identifies an asset that has not been deleted. |
| resources[].semantic | string | Search-vector status: pending awaits vector generation or reprocessing; ready has searchable vectors; unavailable indicates disabled, unsupported or failed embedding. Existing vectors may still serve searches while reprocessing is pending. |
| resources[].preview | object | Generated video previews, present once preview generation succeeds. |
| aggregations | object | Requested facet counts, keyed by facet name and then by field value. |
| total_count_exact | boolean | Whether total_count covers all matches; false indicates a bounded partial count. |
| aggregations_exact | boolean | Whether the returned facet counts cover all matching assets. |
curl -X POST "https://api.deepraxis.ai/media/v1/libraries/${LIBRARY_ID}/search/expression" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"expression":"tags:docs"}'HTTP 200
{
"total_count": 2,
"total_count_exact": true,
"time": 0,
"resources": [
{
"asset_id": "9dfa312ef9bc4b00816339b598b1152c",
"public_id": "walk-lib-r1-MDP-1791733789929-tagged",
"display_name": "walk-lib-r1-MDP-1791733789929-tagged",
"asset_folder": "",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791733815,
"version_id": "26cb8171caa5431b8373ad417fd71e32",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"processing": {
"state": "processing",
"kinds": {
"embedding": "pending",
"visual": "running",
"tagging": "running"
},
"updated_at": "2026-10-11T15:50:17.571Z"
},
"created_at": "2026-10-11T15:50:15.996Z",
"url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733815/walk-lib-r1-MDP-1791733789929-tagged.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733815/walk-lib-r1-MDP-1791733789929-tagged.png",
"placeholder": false,
"library_id": "lib_d3881a2f54a34cd79121b9d659e8378c",
"sha256": "497790947d4666760ce38f3c00e852c71fdb66cae849bae8e9ede352719e1581",
"status": "active",
"semantic": "pending"
},
{
"asset_id": "85b7ef616a8b4719a41777a036ebc1d2",
"public_id": "walk-lib-r1-MDP-1791733789929-plain",
"display_name": "walk-lib-r1-MDP-1791733789929-plain",
"asset_folder": "",
"resource_type": "image",
"type": "upload",
"format": "png",
"version": 1791733810,
"version_id": "fdf3c8cd40c2424d86e8397425a69857",
"bytes": 70,
"etag": "b357a19c87624c7c4d131aeeb4ae677f",
"width": 1,
"height": 1,
"original_filename": "file",
"created_at": "2026-10-11T15:50:10.842Z",
"url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733810/walk-lib-r1-MDP-1791733789929-plain.png",
"secure_url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733810/walk-lib-r1-MDP-1791733789929-plain.png",
"placeholder": false,
"library_id": "lib_d3881a2f54a34cd79121b9d659e8378c",
"sha256": "497790947d4666760ce38f3c00e852c71fdb66cae849bae8e9ede352719e1581",
"status": "active",
"processing": {
"state": "processing",
"kinds": {
"embedding": "pending",
"visual": "running"
},
"updated_at": "2026-10-11T15:50:17.571Z"
},
"semantic": "pending"
}
]
}POST /media/v1/libraries/{library_id}/search/visual
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| asset_id | AssetId | 否 | 素材 ID |
| image | object | 否 | 查询图片对象,data 为 base64,mime 为图片类型 |
| top_k | integer | 否 | 命中数,1–50 |
| filter | string | 否 | 表达式筛选条件 |
返回: SemanticSearchResult.
库的 search.image 为 true 时可用;不支持的库返回 LIBRARY_INVALID_STATE。图片仅接受 JPEG、PNG、WebP、GIF,解码后最大 10 MiB。每个素材返回最高分命中,视频定位到最佳帧。qwen3-vl-embedding 的图片相似度门槛为 0.35。标定来自 2026-10-10 的测试:同图变体 0.82–0.96,同类场景 0.38–0.66,无关图片最高 0.34。
asset_id 与 image: { data, mime } 必须且只能给一个。asset_id 复用已有图片理解并排除素材自身;视频使用第一帧,未完成理解返回 LIBRARY_INVALID_STATE。上传图片的 data 为 base64。top_k 默认 20,范围 1–50;filter 使用与 semantic 相同的表达式。仅检索图片相似内容,返回与 semantic 相同的 hits、embedding_producer、not_ready_excluded;matches.kind 为 image,snippet 为最新描述或素材名称。删除、旧版本及已替换的理解不会出现在结果中。
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| hits | array<object> | Ranked assets up to top_k; an empty array means no eligible matches were found. |
| hits[].asset | object | Asset matched by the query. |
| hits[].score | number | Ranking score: cosine similarity for semantic or visual search; normalized rank-fusion score for hybrid search. Higher values rank first. |
| hits[].semantic_score | number | null | Cosine similarity for hybrid hits with a semantic match; null for keyword-only hybrid hits. Omitted outside hybrid mode. |
| hits[].matches | array<object> | Supporting content or metadata matches contributing to this asset’s hit. |
| embedding_producer | string | Embedding model identifier used for the query, or for the source asset embedding in an asset-based visual query. |
| not_ready_excluded | number | Number of distinct candidate asset identifiers, or unresolved vector identifiers, excluded because their vectors or assets were missing, deleted or stale; not a count of all pending assets in the library. |
POST /media/v1/libraries/{library_id}/search/semantic
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| query | string | 是 | 用自然语言描述要找的内容 |
| filter | string | 否 | 表达式筛选条件 |
| top_k | integer | 否 | 命中数,1–50 |
| mode | hybrid / semantic | 否 | hybrid 结合关键词与语义;semantic 仅语义 |
返回: SemanticSearchResult.
使用 bge-m3 时,向量候选在与关键词结果融合前按余弦相似度 ≥ 0.55 筛选,新完成的内容也使用相同门槛。门槛依据 2026-10-09 的 7 个演示素材标定:相关结果最低约 0.58(0.581–0.729),不相关结果最高 0.523;完全无关的查询最高 0.478。qwen3-vl-embedding 的文字查询对文字内容(描述、转写)门槛为 0.40,对图片内容门槛为 0.25;其他模型尚未标定,暂不过滤。关键词命中不受此门槛影响。查询与库内容都不相关时返回空列表;mode=semantic 只返回达到向量门槛的结果。
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| hits | array<object> | Ranked assets up to top_k; an empty array means no eligible matches were found. |
| hits[].asset | object | Asset matched by the query. |
| hits[].score | number | Ranking score: cosine similarity for semantic or visual search; normalized rank-fusion score for hybrid search. Higher values rank first. |
| hits[].semantic_score | number | null | Cosine similarity for hybrid hits with a semantic match; null for keyword-only hybrid hits. Omitted outside hybrid mode. |
| hits[].matches | array<object> | Supporting content or metadata matches contributing to this asset’s hit. |
| embedding_producer | string | Embedding model identifier used for the query, or for the source asset embedding in an asset-based visual query. |
| not_ready_excluded | number | Number of distinct candidate asset identifiers, or unresolved vector identifiers, excluded because their vectors or assets were missing, deleted or stale; not a count of all pending assets in the library. |
POST /media/v1/libraries/{library_id}/search
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| query | string | 是 | 用自然语言描述要找的内容 |
| filter | string | 否 | 表达式筛选条件 |
| top_k | integer | 否 | 命中数,1–50 |
| mode | hybrid / semantic | 否 | hybrid 结合关键词与语义;semantic 仅语义 |
返回: SemanticSearchResult.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| hits | array<object> | Ranked assets up to top_k; an empty array means no eligible matches were found. |
| hits[].asset | object | Asset matched by the query. |
| hits[].score | number | Ranking score: cosine similarity for semantic or visual search; normalized rank-fusion score for hybrid search. Higher values rank first. |
| hits[].semantic_score | number | null | Cosine similarity for hybrid hits with a semantic match; null for keyword-only hybrid hits. Omitted outside hybrid mode. |
| hits[].matches | array<object> | Supporting content or metadata matches contributing to this asset’s hit. |
| embedding_producer | string | Embedding model identifier used for the query, or for the source asset embedding in an asset-based visual query. |
| not_ready_excluded | number | Number of distinct candidate asset identifiers, or unresolved vector identifiers, excluded because their vectors or assets were missing, deleted or stale; not a count of all pending assets in the library. |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| total_count | number | 是 | 匹配总数 |
| time | number | 是 | 检索耗时,整数毫秒,由服务端测得 |
| next_cursor | string | 否 | 下一页游标;没有时为 null 或省略 |
| resources | SearchAsset[] | 是 | 本页素材 |
| aggregations | object | 否 | 按请求字段统计 |
| total_count_exact | boolean | 否 | 计数是否精确 |
| aggregations_exact | boolean | 否 | 统计是否精确 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| hits | SemanticHit[] | 是 | 检索命中 |
| embedding_producer | string | 是 | 语义理解生成者 |
| not_ready_excluded | number | 是 | 因未就绪而排除的素材数 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| asset_id | AssetId | 是 | 素材 ID |
| public_id | string | 是 | 交付地址中的素材名称,可带路径 |
| display_name | string | 是 | 显示名称 |
| asset_folder | string | 是 | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| resource_type | ResourceType | 是 | image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400 |
| type | DeliveryType | 是 | 资源或事件类型 |
| format | string | 是 | 文件格式 |
| version | number | 是 | 交付版本号 |
| version_id | string | 是 | 版本标识 |
| bytes | number | 是 | 文件字节数 |
| etag | string | 是 | 文件校验标识 |
| width | number | 否 | 宽度像素 |
| height | number | 否 | 高度像素 |
| duration | number | 否 | 时长秒数 |
| pages | number | 否 | 文档页数 |
| is_audio | boolean | 否 | 是否为音频 |
| original_filename | string | 否 | 原文件名称 |
| tags | string[] | 否 | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| context | object | 否 | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
| created_at | IsoTimestamp | 是 | 创建时间 |
| url | string | 是 | 原文件地址 |
| secure_url | string | 是 | HTTPS 交付地址 |
| placeholder | false | 是 | 固定为 false |
| existing | boolean | 否 | 未覆盖时是否返回已有素材 |
| processing | Processing | 是 | 整体与各项理解状态 |
| library_id | LibraryId | 是 | 库 ID |
| sha256 | string | 是 | 内容校验摘要 |
| status | "active" | 是 | 资源状态 |
| semantic | "pending" / "ready" / "unavailable" | 是 | ready 时可语义检索 |
| preview | object | 否 | 预览海报和故事板 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| asset | Asset | 是 | 命中的素材 |
| score | number | 是 | 相关度分数 |
| semantic_score | number / null | 否 | — |
| matches | SemanticMatch[] | 是 | 匹配内容与片段时间 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| kind | UnderstandingKind / "metadata" / "image" | 是 | 理解或处理种类;列出理解结果时按此筛选 |
| understanding_id | UnderstandingId / null | 是 | 对应的理解记录;元数据命中为空 |
| segment | Segment / null | 是 | 起止毫秒;整份素材为 null |
| snippet | string | 是 | 命中文字片段 |
GET /media/v1/libraries/{library_id}/folders
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| parent | query | string | 父文件夹路径;省略或空字符串为根。一次返回这一层的全部子文件夹,不分页;传 limit 或 cursor 返回 400 |
返回: Folders.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| folders | array<object> | All immediate child folders of parent, sorted by path. |
| folders[].name | string | Final path segment naming the child folder. |
| folders[].path | string | Full folder path relative to the library root. |
| folders[].asset_count | number | Number of assets in this folder and all descendant folders. |
curl -X GET "https://api.deepraxis.ai/media/v1/libraries/${LIBRARY_ID}/folders" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"folders": [
{
"name": "examples",
"path": "examples",
"asset_count": 1
}
]
}| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| folders | object[] | 是 | 文件夹列表 |
POST /media/v1/libraries/{library_id}/batches
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| action | "tag" / "untag" | 是 | 批量操作 |
| tags | string[] | 是 | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| action | "set_context" | 是 | 批量操作 |
| context | object | 是 | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| action | "move" | 是 | 批量操作 |
| asset_folder | string | 是 | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| action | "delete" | 是 | 批量操作 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| selector | BatchSelector | 是 | 按 ID 或表达式选择 |
返回: Job.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Generated batch identifier: job_ followed by 32 lowercase hexadecimal characters. |
| library_id | string | Identifier of the library in which the batch operates. |
| action | string | Batch operation: tag adds labels, untag removes labels, set_context replaces custom metadata, move changes asset_folder, and delete removes selected assets. |
| status | string | Job status: queued awaits execution; running is processing items; completed means all items succeeded; completed_with_errors means some succeeded and some failed; failed means all selected items failed. An empty job completes successfully. |
| total | number | Number of distinct assets selected when the job was created. |
| done | number | Number of items successfully processed; failed items are counted separately. |
| failed | number | Number of items that could not be processed successfully. |
| failures | array<object> | Always present, including an empty array before any item failure or when all items succeed. At most 20 item failures are returned. |
| failures[].asset_id | string | Identifier supplied for the failed item; it may identify a missing asset. |
| failures[].code | string | Domain error code explaining the individual item failure. |
| created_at | string | Time the batch job was created, in UTC. |
| finished_at | string | null | Time the job reached a terminal status, or null while queued or running. |
curl -X POST "https://api.deepraxis.ai/media/v1/libraries/${LIBRARY_ID}/batches" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"action":"tag","tags":["sample"],"selector":{"ids":["85b7ef616a8b4719a41777a036ebc1d2","00000000000000000000000000000000"]}}'HTTP 200
{
"id": "job_b562f087623c4756b43813e3dce670ba",
"library_id": "lib_d3881a2f54a34cd79121b9d659e8378c",
"action": "tag",
"status": "queued",
"total": 2,
"done": 0,
"failed": 0,
"created_at": "2026-10-11T15:50:24.942Z",
"failures": [],
"finished_at": null
}GET /media/v1/libraries/{library_id}/batches/{job_id}
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| job_id | path | string | 任务 ID |
返回: Job.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Generated batch identifier: job_ followed by 32 lowercase hexadecimal characters. |
| library_id | string | Identifier of the library in which the batch operates. |
| action | string | Batch operation: tag adds labels, untag removes labels, set_context replaces custom metadata, move changes asset_folder, and delete removes selected assets. |
| status | string | Job status: queued awaits execution; running is processing items; completed means all items succeeded; completed_with_errors means some succeeded and some failed; failed means all selected items failed. An empty job completes successfully. |
| total | number | Number of distinct assets selected when the job was created. |
| done | number | Number of items successfully processed; failed items are counted separately. |
| failed | number | Number of items that could not be processed successfully. |
| failures | array<object> | Always present, including an empty array before any item failure or when all items succeed. At most 20 item failures are returned. |
| failures[].asset_id | string | Identifier supplied for the failed item; it may identify a missing asset. |
| failures[].code | string | Domain error code explaining the individual item failure. |
| created_at | string | Time the batch job was created, in UTC. |
| finished_at | string | null | Time the job reached a terminal status, or null while queued or running. |
curl -X GET "https://api.deepraxis.ai/media/v1/libraries/${LIBRARY_ID}/batches/job_b562f087623c4756b43813e3dce670ba" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"id": "job_b562f087623c4756b43813e3dce670ba",
"library_id": "lib_d3881a2f54a34cd79121b9d659e8378c",
"action": "tag",
"status": "completed_with_errors",
"total": 2,
"done": 1,
"failed": 1,
"created_at": "2026-10-11T15:50:24.942Z",
"failures": [
{
"asset_id": "00000000000000000000000000000000",
"code": "ASSET_NOT_FOUND"
}
],
"finished_at": "2026-10-11T15:50:27.555Z"
}POST /media/v1/libraries/{library_id}/assets:batch
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| action | "tag" / "untag" | 是 | 批量操作 |
| tags | string[] | 是 | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| action | "set_context" | 是 | 批量操作 |
| context | object | 是 | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| action | "move" | 是 | 批量操作 |
| asset_folder | string | 是 | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| action | "delete" | 是 | 批量操作 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| selector | BatchSelector | 是 | 按 ID 或表达式选择 |
返回: Job.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Generated batch identifier: job_ followed by 32 lowercase hexadecimal characters. |
| library_id | string | Identifier of the library in which the batch operates. |
| action | string | Batch operation: tag adds labels, untag removes labels, set_context replaces custom metadata, move changes asset_folder, and delete removes selected assets. |
| status | string | Job status: queued awaits execution; running is processing items; completed means all items succeeded; completed_with_errors means some succeeded and some failed; failed means all selected items failed. An empty job completes successfully. |
| total | number | Number of distinct assets selected when the job was created. |
| done | number | Number of items successfully processed; failed items are counted separately. |
| failed | number | Number of items that could not be processed successfully. |
| failures | array<object> | Always present, including an empty array before any item failure or when all items succeed. At most 20 item failures are returned. |
| failures[].asset_id | string | Identifier supplied for the failed item; it may identify a missing asset. |
| failures[].code | string | Domain error code explaining the individual item failure. |
| created_at | string | Time the batch job was created, in UTC. |
| finished_at | string | null | Time the job reached a terminal status, or null while queued or running. |
curl -X POST "https://api.deepraxis.ai/media/v1/libraries/${LIBRARY_ID}/assets:batch" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"action":"tag","tags":["sample"],"selector":{"ids":["85b7ef616a8b4719a41777a036ebc1d2"]}}'HTTP 200
{
"id": "job_3c2fe728de054c7396058c7438b289d2",
"library_id": "lib_d3881a2f54a34cd79121b9d659e8378c",
"action": "tag",
"status": "queued",
"total": 1,
"done": 0,
"failed": 0,
"created_at": "2026-10-11T15:50:29.266Z",
"failures": [],
"finished_at": null
}GET /media/v1/libraries/{library_id}/jobs/{job_id}
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| job_id | path | string | 任务 ID |
返回: Job.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Generated batch identifier: job_ followed by 32 lowercase hexadecimal characters. |
| library_id | string | Identifier of the library in which the batch operates. |
| action | string | Batch operation: tag adds labels, untag removes labels, set_context replaces custom metadata, move changes asset_folder, and delete removes selected assets. |
| status | string | Job status: queued awaits execution; running is processing items; completed means all items succeeded; completed_with_errors means some succeeded and some failed; failed means all selected items failed. An empty job completes successfully. |
| total | number | Number of distinct assets selected when the job was created. |
| done | number | Number of items successfully processed; failed items are counted separately. |
| failed | number | Number of items that could not be processed successfully. |
| failures | array<object> | Always present, including an empty array before any item failure or when all items succeed. At most 20 item failures are returned. |
| failures[].asset_id | string | Identifier supplied for the failed item; it may identify a missing asset. |
| failures[].code | string | Domain error code explaining the individual item failure. |
| created_at | string | Time the batch job was created, in UTC. |
| finished_at | string | null | Time the job reached a terminal status, or null while queued or running. |
curl -X GET "https://api.deepraxis.ai/media/v1/libraries/${LIBRARY_ID}/jobs/job_3c2fe728de054c7396058c7438b289d2" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"id": "job_3c2fe728de054c7396058c7438b289d2",
"library_id": "lib_d3881a2f54a34cd79121b9d659e8378c",
"action": "tag",
"status": "completed",
"total": 1,
"done": 1,
"failed": 0,
"created_at": "2026-10-11T15:50:29.266Z",
"failures": [],
"finished_at": "2026-10-11T15:50:29.494Z"
}| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| id | JobId | 是 | 资源 ID |
| library_id | LibraryId | 是 | 库 ID |
| action | tag / untag / set_context / move / delete | 是 | 批量操作 |
| status | "queued" / "running" / "completed" / "completed_with_errors" / "failed" | 是 | 资源状态 |
| total | number | 是 | 任务素材总数 |
| done | number | 是 | 已完成数量;分片响应中表示是否完成 |
| failed | number | 是 | 失败数量 |
| failures | object[] | 是 | — |
| created_at | IsoTimestamp | 是 | 创建时间 |
| finished_at | IsoTimestamp / null | 是 | 结束时间;未结束为空 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| ids | AssetId[] | 是 | 素材 ID 列表 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| expression | string | 是 | 结构化查询表达式;空表达式返回全部素材 |
| exclusions | AssetId[] | 否 | 从选择中排除的素材 ID |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| action | "tag" / "untag" | 是 | 批量操作 |
| tags | string[] | 是 | 素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| action | "set_context" | 是 | 批量操作 |
| context | object | 是 | 自定义文字键值;PATCH 整体替换,传 {} 清空 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| action | "move" | 是 | 批量操作 |
| asset_folder | string | 是 | 组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| action | "delete" | 是 | 批量操作 |
按 seq 翻页:asc 配 after_seq,desc 配 before_seq;两个游标不可同用。
GET /media/v1/libraries/{library_id}/events
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| library_id | path | string | 库 ID |
| after_seq | query | integer | 升序游标;不可与 before_seq 同用 |
| before_seq | query | integer | 降序游标;不可与 after_seq 同用 |
| order | query | asc / desc | asc 默认升序或 desc 降序 |
| limit | query | integer | 每页 1–200 条,默认 50 |
返回: MediaEventPage.
Successful response.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | Events in this page, ordered by sequence in the requested direction. |
| data[].seq | number | Increasing sequence number within this library; use it with after_seq or before_seq to page through events. |
| data[].id | string | Unique identifier of this recorded event. |
| data[].type | string | Type of lifecycle, asset, processing, search or batch change recorded. |
| data[].processed_at | string | Time this event was recorded, in UTC. |
| data[].library_id | string | Identifier of the library whose event was recorded. |
| data[].asset_id | string | Related asset identifier, when the event concerns an asset. |
| data[].job_id | string | Related batch job identifier, when present. |
| data[].kind | string | Related processing task: visual, frames, transcript or embedding. |
| data[].detail | object | Event-specific details, such as changed values, reprocessing kinds or failed-item counts. |
| next_cursor | string | null | Last returned sequence as a string when more events exist; convert to a number and pass as after_seq for asc or before_seq for desc. Null means no further page. |
curl -X GET "https://api.deepraxis.ai/media/v1/libraries/${LIBRARY_ID}/events?limit=1" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
{
"data": [
{
"seq": 1,
"id": "2cd2cd71-1fc5-41fc-aeb0-29583af9b900",
"type": "library.status_provisioning",
"processed_at": "2026-10-09T09:34:09.858Z",
"library_id": "lib_fff73e25733449b1bf6f880d91f5c045"
}
],
"next_cursor": "1"
}| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| data | MediaEvent[] | 是 | 本页结果 |
| next_cursor | string / null | 是 | 下一页游标;没有时为 null 或省略 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| seq | number | 是 | 库内递增的事件序号 |
| id | string | 是 | 资源 ID |
| type | MediaEventType | 是 | 资源或事件类型 |
| processed_at | IsoTimestamp | 是 | 事件时间 |
| library_id | LibraryId | 是 | 库 ID |
| asset_id | AssetId | 否 | 素材 ID |
| job_id | JobId | 否 | 任务 ID |
| kind | ProcessingKind | 否 | 理解或处理种类;列出理解结果时按此筛选 |
| detail | object | 否 | 事件详情 |
自有 API 返回 error.code、error.message、error.details。兼容接口返回 error.message,并通过 X-Cld-Error 响应头重复消息;非 ASCII 消息在响应头中使用百分号编码。
| 领域码 | 自有 HTTP | 兼容 HTTP | 可重试 |
|---|---|---|---|
| LIBRARY_NOT_FOUND | 404 | 404 | 否 |
| ASSET_NOT_FOUND | 404 | 404 | 否 |
| JOB_NOT_FOUND | 404 | 404 | 否 |
| UNDERSTANDING_NOT_FOUND | 404 | 404 | 否 |
| LIBRARY_INVALID_STATE | 409 | 400 | 否 |
| INVALID_PARAMS | 400 | 400 | 否 |
| INVALID_EXPRESSION | 400 | 400 | 否 |
| UNSUPPORTED | 400 | 400 | 否 |
| NOT_IMPLEMENTED | 501 | 400 | 否 |
| FILE_TOO_LARGE | 413 | 400 | 否 |
| FILE_EMPTY | 400 | 400 | 否 |
| UNSUPPORTED_MEDIA | 415 | 400 | 否 |
| FETCH_FAILED | 400 | 400 | 否 |
| LIMIT_EXCEEDED | 400 | 400 | 否 |
| CHUNK_INVALID | 400 | 400 | 否 |
| RATE_LIMITED | 429 | 420 | 是 |
| CAPACITY | 503 | 500 | 是 |
| UPSTREAM_FAILED | 502 | 500 | 是 |
可重试错误采用退避重试;其它错误先修正请求或资源状态。
INVALID_PARAMS:模型调用 ID 不存在(Model <id> is not available)、vision 模型不支持图片输入,或 models 含未知角色、空白 ID 或不合法的值。LIBRARY_INVALID_STATE:库中已有素材时更换 embedding,包括恢复默认值导致模型改变。消息为「库中已有素材时不能更换嵌入模型」。UPSTREAM_FAILED:写入模型配置时无法查询模型目录;可退避重试。把文件加入知识库,按语义和关键词搜索相关分段。使用 API Key 作为 Bearer 凭据,建议从服务端调用。
https://api.deepraxis.ai/knowledge/v1
路径中的 ID 使用已有资源的 ID。示例中的环境变量由调用者设置。
POST /knowledge/v1/vector_stores
创建知识库。可用 file_ids 添加已有 File 并异步入库;后续调用使用返回的 id。最小请求体:{"name":"Refund policies"}。
| 字段 | 类型 | 说明 |
|---|---|---|
| name | string | 可选; 省略时为空字符串;不接受 null。; 最长字符数: 256; 默认: "" |
| metadata | object / null | 可选; 知识库自定义字符串元数据;省略或 null 得到空对象。; 默认: {} |
| expires_after | object / null | 可选; 从最近活动计算的过期策略;省略或 null 表示不自动过期。; 默认: null |
| expires_after (1).anchor | "last_active_at" | 必填; last_active_at 表示从最近活动时间开始计算过期。 |
| expires_after (1).days | integer | 必填; 自最近活动起的天数;添加文件和搜索会刷新活动时间。; 最小: 1; 最大: 365 |
| file_ids | string[] | 可选; 要加入的已有文件 ID;每库最多 10,000 个文件。 |
| chunking_strategy | object / object | 可选; auto 等同于每段 800 token、重叠 400 token。; 默认: {"type":"auto"} |
| chunking_strategy (1).type | "auto" | 必填; auto 使用默认静态分段:800 个估算 token,重叠 400 个。 |
| chunking_strategy (2).type | "static" | 必填; static 表示使用显式分段大小与重叠设置。 |
| chunking_strategy (2).static | object | 必填; 以估算 token 数表示的分段大小与重叠限制。 |
| chunking_strategy (2).static.max_chunk_size_tokens | integer | 必填; 每段的估算 token 数。; 最小: 100; 最大: 4096 |
| chunking_strategy (2).static.chunk_overlap_tokens | integer | 必填; 不得超过 max_chunk_size_tokens 的一半。; 最小: 0; 最大: 2048 |
| description | string | 可选; 不生效: 接受后丢弃,不保存也不返回;当前不校验类型。 |
| models | object / null | 可选; 要设置的模型角色。模型必须在模型目录中且支持该角色(embedding → openai.embeddings,rerank → cohere.rerank,query_rewrite → openai.chat.completions)。嵌入模型必须输出 1024 维向量。省略的角色不变;null 恢复全部默认。未知角色或空 ID 返回 400 INVALID_PARAMS。OpenAI 兼容接口传入此字段返回 400。; Praxis 扩展 |
| models (1).embedding | string / null | 可选; 给文件分段和查询生成向量。库中已有文件后不能更换。null 恢复默认(bge-m3)。 |
| models (1).rerank | string / null | 可选; ranking_options.ranker 为 default-2024-11-15 时用于重排结果。null 恢复默认(bge-reranker-base)。 |
| models (1).query_rewrite | string / null | 可选; 搜索设置 rewrite_query 时用于改写查询。null 恢复默认(qwen3.8-flash)。 |
curl -X POST "https://api.deepraxis.ai/knowledge/v1/vector_stores" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"name\":\"Refund policies\"}"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必有; 资源 ID。; 最短字符数: 1 |
| object | "vector_store" | 必有; 对象标记;vector_store 表示知识库。 |
| name | string | 必有; 知识库显示名称;空字符串表示未设置名称。; 最长字符数: 256 |
| status | "in_progress" / "completed" / "expired" / "deleting" | 必有; in_progress 表示仍有文件入库中;completed 表示没有入库中的文件,不保证全部成功;expired 表示过期策略已生效。deleting 表示已软删除、等待永久清除。 |
| usage_bytes | integer | 必有; 已完成源文件的字节数之和。; 最小: 0 |
| file_counts | object | 必有; 仍属于该库或批次的附件数量,按入库状态分组。 |
| file_counts.in_progress | integer | 必有; 等待或正在入库的文件数。; 最小: 0 |
| file_counts.completed | integer | 必有; 已完成入库的文件数。; 最小: 0 |
| file_counts.failed | integer | 必有; 入库失败的文件数。; 最小: 0 |
| file_counts.cancelled | integer | 必有; 因批次取消而停止入库的文件数。; 最小: 0 |
| file_counts.total | integer | 必有; 全部入库状态的附件总数。; 最小: 0 |
| created_at | integer | 必有; Unix 时间戳,单位秒。 |
| last_active_at | integer / null | 必有; 最近创建、添加文件或搜索的 Unix 秒时间戳;不可用时为 null。 |
| expires_after | object / null | 必有; 从最近活动开始计算的过期策略;null 表示不自动过期。 |
| expires_after (1).anchor | "last_active_at" | 必有; last_active_at 表示从最近活动时间开始计算过期。 |
| expires_after (1).days | integer | 必有; 自最近活动起的天数;添加文件和搜索会刷新活动时间。; 最小: 1; 最大: 365 |
| expires_at | integer / null | 必有; 预计过期的 Unix 秒时间戳;未设置过期策略时为 null。 |
| metadata | object | 必有; 最多 16 个键;键最多 64 字符;字符串值最多 512 字符。; 最多键数: 16; 键最多 64 字符; 值: string |
| purge_at | string / null | 可选; ISO 8601 格式的恢复截止时间;未软删除时为 null。 |
| models | object | 可选; 各角色生效的模型(Router 模型 ID);未设置的角色使用默认模型。; Praxis 扩展 |
| models.embedding | string | 必有; 给文件分段和查询生成向量。库中已有文件后不能更换。默认 bge-m3。; 最短字符数: 1 |
| models.rerank | string | 必有; ranking_options.ranker 为 default-2024-11-15 时用于重排结果。默认 bge-reranker-base。; 最短字符数: 1 |
| models.query_rewrite | string | 必有; 搜索设置 rewrite_query 时用于改写查询。默认 qwen3.8-flash。; 最短字符数: 1 |
| praxis | object | 可选; 此知识库的原生生命周期与恢复信息。 |
| praxis.lifecycle | "provisioning" / "active" / "expired" / "deleted" / "failed" | 必有; provisioning 表示正在初始化;active 允许文件操作与搜索;expired 表示已过期;deleted 表示已软删除;failed 表示初始化失败。 |
| praxis.deleted_at | integer / null | 必有; 软删除的 Unix 秒时间戳;未软删除时为 null。 |
| praxis.purge_at | integer / null | 必有; 恢复截止的 Unix 秒时间戳;未软删除时为 null。 |
GET /knowledge/v1/vector_stores
列出调用方可见的知识库,默认最新在前。将 last_id 作为 after 读取下一页,例如 ?limit=20。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| status | query: "active" / "deleting" | active 筛选活跃库;deleting 筛选软删除待清除的库。省略时排除软删除库。 |
| after | query: string | 上一页的 ID 游标。 最短字符数: 1 |
| before | query: string | 返回此 ID 之前的条目。 最短字符数: 1 |
| limit | query: integer | 每页条数。 最小: 1; 最大: 100; 默认: 20 |
| order | query: "asc" / "desc" | 知识库和文件默认按创建时间降序;分段默认按序号升序。 默认: "desc" |
curl -X GET "https://api.deepraxis.ai/knowledge/v1/vector_stores" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| object | "list" | 必有; 对象标记;list 表示游标分页集合。 |
| data | object[] | 必有; 按请求顺序返回的当前页条目。 |
| data[].id | string | 必有; 资源 ID。; 最短字符数: 1 |
| data[].object | "vector_store" | 必有; 对象标记;vector_store 表示知识库。 |
| data[].name | string | 必有; 知识库显示名称;空字符串表示未设置名称。; 最长字符数: 256 |
| data[].status | "in_progress" / "completed" / "expired" / "deleting" | 必有; in_progress 表示仍有文件入库中;completed 表示没有入库中的文件,不保证全部成功;expired 表示过期策略已生效。deleting 表示已软删除、等待永久清除。 |
| data[].usage_bytes | integer | 必有; 已完成源文件的字节数之和。; 最小: 0 |
| data[].file_counts | object | 必有; 仍属于该库或批次的附件数量,按入库状态分组。 |
| data[].file_counts.in_progress | integer | 必有; 等待或正在入库的文件数。; 最小: 0 |
| data[].file_counts.completed | integer | 必有; 已完成入库的文件数。; 最小: 0 |
| data[].file_counts.failed | integer | 必有; 入库失败的文件数。; 最小: 0 |
| data[].file_counts.cancelled | integer | 必有; 因批次取消而停止入库的文件数。; 最小: 0 |
| data[].file_counts.total | integer | 必有; 全部入库状态的附件总数。; 最小: 0 |
| data[].created_at | integer | 必有; Unix 时间戳,单位秒。 |
| data[].last_active_at | integer / null | 必有; 最近创建、添加文件或搜索的 Unix 秒时间戳;不可用时为 null。 |
| data[].expires_after | object / null | 必有; 从最近活动开始计算的过期策略;null 表示不自动过期。 |
| data[].expires_after (1).anchor | "last_active_at" | 必有; last_active_at 表示从最近活动时间开始计算过期。 |
| data[].expires_after (1).days | integer | 必有; 自最近活动起的天数;添加文件和搜索会刷新活动时间。; 最小: 1; 最大: 365 |
| data[].expires_at | integer / null | 必有; 预计过期的 Unix 秒时间戳;未设置过期策略时为 null。 |
| data[].metadata | object | 必有; 最多 16 个键;键最多 64 字符;字符串值最多 512 字符。; 最多键数: 16; 键最多 64 字符; 值: string |
| data[].purge_at | string / null | 可选; ISO 8601 格式的恢复截止时间;未软删除时为 null。 |
| data[].models | object | 可选; 各角色生效的模型(Router 模型 ID);未设置的角色使用默认模型。; Praxis 扩展 |
| data[].models.embedding | string | 必有; 给文件分段和查询生成向量。库中已有文件后不能更换。默认 bge-m3。; 最短字符数: 1 |
| data[].models.rerank | string | 必有; ranking_options.ranker 为 default-2024-11-15 时用于重排结果。默认 bge-reranker-base。; 最短字符数: 1 |
| data[].models.query_rewrite | string | 必有; 搜索设置 rewrite_query 时用于改写查询。默认 qwen3.8-flash。; 最短字符数: 1 |
| data[].praxis | object | 可选; 此知识库的原生生命周期与恢复信息。 |
| data[].praxis.lifecycle | "provisioning" / "active" / "expired" / "deleted" / "failed" | 必有; provisioning 表示正在初始化;active 允许文件操作与搜索;expired 表示已过期;deleted 表示已软删除;failed 表示初始化失败。 |
| data[].praxis.deleted_at | integer / null | 必有; 软删除的 Unix 秒时间戳;未软删除时为 null。 |
| data[].praxis.purge_at | integer / null | 必有; 恢复截止的 Unix 秒时间戳;未软删除时为 null。 |
| first_id | string / null | 必有; 本页首项的 ID;空页为 null。 |
| last_id | string / null | 必有; 本页末项的 ID,可作为 after 继续查询;空页为 null。 |
| has_more | boolean | 必有; 当前游标范围内,本页之后是否还有条目。 |
GET /knowledge/v1/vector_stores/{vector_store_id}
使用创建或列表返回的 id 读取知识库。添加 ?expand=files 可同时返回附件首页。软删除的库在永久清除前仍可读取,status 为 deleting。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| expand | query: "files"[] | 两个地址均支持的 Praxis 扩展:files 附带文件首页;未知值忽略。 |
| expand[] | query: "files"[] | 两个地址均支持的 Praxis 扩展:files 附带文件首页;未知值忽略。 |
curl -X GET "https://api.deepraxis.ai/knowledge/v1/vector_stores/${VECTOR_STORE_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| (1).id | string | 必有; 资源 ID。; 最短字符数: 1 |
| (1).object | "vector_store" | 必有; 对象标记;vector_store 表示知识库。 |
| (1).name | string | 必有; 知识库显示名称;空字符串表示未设置名称。; 最长字符数: 256 |
| (1).status | "in_progress" / "completed" / "expired" / "deleting" | 必有; in_progress 表示仍有文件入库中;completed 表示没有入库中的文件,不保证全部成功;expired 表示过期策略已生效。deleting 表示已软删除、等待永久清除。 |
| (1).usage_bytes | integer | 必有; 已完成源文件的字节数之和。; 最小: 0 |
| (1).file_counts | object | 必有; 仍属于该库或批次的附件数量,按入库状态分组。 |
| (1).file_counts.in_progress | integer | 必有; 等待或正在入库的文件数。; 最小: 0 |
| (1).file_counts.completed | integer | 必有; 已完成入库的文件数。; 最小: 0 |
| (1).file_counts.failed | integer | 必有; 入库失败的文件数。; 最小: 0 |
| (1).file_counts.cancelled | integer | 必有; 因批次取消而停止入库的文件数。; 最小: 0 |
| (1).file_counts.total | integer | 必有; 全部入库状态的附件总数。; 最小: 0 |
| (1).created_at | integer | 必有; Unix 时间戳,单位秒。 |
| (1).last_active_at | integer / null | 必有; 最近创建、添加文件或搜索的 Unix 秒时间戳;不可用时为 null。 |
| (1).expires_after | object / null | 必有; 从最近活动开始计算的过期策略;null 表示不自动过期。 |
| (1).expires_after (1).anchor | "last_active_at" | 必有; last_active_at 表示从最近活动时间开始计算过期。 |
| (1).expires_after (1).days | integer | 必有; 自最近活动起的天数;添加文件和搜索会刷新活动时间。; 最小: 1; 最大: 365 |
| (1).expires_at | integer / null | 必有; 预计过期的 Unix 秒时间戳;未设置过期策略时为 null。 |
| (1).metadata | object | 必有; 最多 16 个键;键最多 64 字符;字符串值最多 512 字符。; 最多键数: 16; 键最多 64 字符; 值: string |
| (1).purge_at | string / null | 可选; ISO 8601 格式的恢复截止时间;未软删除时为 null。 |
| (1).models | object | 可选; 各角色生效的模型(Router 模型 ID);未设置的角色使用默认模型。; Praxis 扩展 |
| (1).models.embedding | string | 必有; 给文件分段和查询生成向量。库中已有文件后不能更换。默认 bge-m3。; 最短字符数: 1 |
| (1).models.rerank | string | 必有; ranking_options.ranker 为 default-2024-11-15 时用于重排结果。默认 bge-reranker-base。; 最短字符数: 1 |
| (1).models.query_rewrite | string | 必有; 搜索设置 rewrite_query 时用于改写查询。默认 qwen3.8-flash。; 最短字符数: 1 |
| (1).praxis | object | 可选; 此知识库的原生生命周期与恢复信息。 |
| (1).praxis.lifecycle | "provisioning" / "active" / "expired" / "deleted" / "failed" | 必有; provisioning 表示正在初始化;active 允许文件操作与搜索;expired 表示已过期;deleted 表示已软删除;failed 表示初始化失败。 |
| (1).praxis.deleted_at | integer / null | 必有; 软删除的 Unix 秒时间戳;未软删除时为 null。 |
| (1).praxis.purge_at | integer / null | 必有; 恢复截止的 Unix 秒时间戳;未软删除时为 null。 |
| (2).files | object | 可选; 仅在 expand=files 时返回文件首页。 |
| (2).files.object | "list" | 必有; 对象标记;list 表示游标分页集合。 |
| (2).files.data | object[] | 必有; 按请求顺序返回的当前页条目。 |
| (2).files.data[].id | string | 必有; 与源文件相同的 ID。; 最短字符数: 1 |
| (2).files.data[].object | "vector_store.file" | 必有; 对象标记;vector_store.file 表示知识库中的附件。 |
| (2).files.data[].vector_store_id | string | 必有; 资源 ID。; 最短字符数: 1 |
| (2).files.data[].status | "in_progress" / "completed" / "cancelled" / "failed" | 必有; in_progress 表示等待或正在入库;completed 表示可检索;failed 表示入库失败;cancelled 表示批次取消已停止入库。 |
| (2).files.data[].last_error | object / null | 必有; 入库失败详情;未失败、成功完成或重新入库时为 null。 |
| (2).files.data[].last_error (1).code | "server_error" / "unsupported_file" / "invalid_file" | 必有; unsupported_file 表示不支持的文件类型;invalid_file 表示加密、空文件或超过解析 token 上限;server_error 表示其它入库失败或超过截止时间。 |
| (2).files.data[].last_error (1).message | string | 必有; 与 code 对应的入库失败说明。 |
| (2).files.data[].usage_bytes | integer | 必有; 完成后计入源文件字节数;处理中、失败或已取消时为零。; 最小: 0 |
| (2).files.data[].created_at | integer | 必有; Unix 时间戳,单位秒。 |
| (2).files.data[].chunking_strategy | object / object | 必有; 此附件已保存的分段策略;auto 输入返回为具体 static 设置。 |
| (2).files.data[].chunking_strategy (1).type | "static" | 必有; static 表示使用显式分段大小与重叠设置。 |
| (2).files.data[].chunking_strategy (1).static | object | 必有; 以估算 token 数表示的分段大小与重叠限制。 |
| (2).files.data[].chunking_strategy (1).static.max_chunk_size_tokens | integer | 必有; 每段的估算 token 数。; 最小: 100; 最大: 4096 |
| (2).files.data[].chunking_strategy (1).static.chunk_overlap_tokens | integer | 必有; 不得超过 max_chunk_size_tokens 的一半。; 最小: 0; 最大: 2048 |
| (2).files.data[].chunking_strategy (2).type | "other" | 必有 |
| (2).files.data[].attributes | object / null | 必有; 用于搜索筛选的文件属性;null 表示未设置。 |
| (2).files.data[].praxis | object | 可选; 原生入库进度与源文件统计。 |
| (2).files.data[].praxis.stage | "queued" / "parse" / "chunk" / "embed" / "index" / null | 必有; queued 表示等待;parse 提取文本;chunk 划分分段;embed 生成向量;index 建立检索索引。null 表示入库已不在进行中。 |
| (2).files.data[].praxis.deadline_at | integer / null | 必有; 入库截止的 Unix 秒时间戳;到点仍未完成的入库转为失败。 |
| (2).files.data[].praxis.filename | string | 必有; File 服务返回的源文件名。 |
| (2).files.data[].praxis.bytes | integer | 必有; 源文件字节数。; 最小: 0 |
| (2).files.data[].praxis.pages | integer / null | 必有; 成功入库后的解析页数;成功结果保存前为 null。 |
| (2).files.data[].praxis.chunk_count | integer | 必有; 已完成入库的分段数;完成前、失败或取消后为零。; 最小: 0 |
| (2).files.first_id | string / null | 必有; 本页首项的 ID;空页为 null。 |
| (2).files.last_id | string / null | 必有; 本页末项的 ID,可作为 after 继续查询;空页为 null。 |
| (2).files.has_more | boolean | 必有; 当前游标范围内,本页之后是否还有条目。 |
POST /knowledge/v1/vector_stores/{vector_store_id}
使用返回的 id 修改活跃知识库。省略的字段不变;metadata 替换整个对象。请求体示例:{"name":"Refund policies"}。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| 字段 | 类型 | 说明 |
|---|---|---|
| name | string / null | 可选; null 将名称清空为空字符串;省略的字段不变。 |
| metadata | object / null | 可选; 替换全部元数据;null 清空为一个空对象。 |
| expires_after | object / null | 可选; null 取消自动过期。 |
| expires_after (1).anchor | "last_active_at" | 必填; last_active_at 表示从最近活动时间开始计算过期。 |
| expires_after (1).days | integer | 必填; 自最近活动起的天数;添加文件和搜索会刷新活动时间。; 最小: 1; 最大: 365 |
| models | object / null | 可选; 要设置的模型角色。模型必须在模型目录中且支持该角色(embedding → openai.embeddings,rerank → cohere.rerank,query_rewrite → openai.chat.completions)。嵌入模型必须输出 1024 维向量。省略的角色不变;null 恢复全部默认。未知角色或空 ID 返回 400 INVALID_PARAMS。OpenAI 兼容接口传入此字段返回 400。; Praxis 扩展 |
| models (1).embedding | string / null | 可选; 给文件分段和查询生成向量。库中已有文件后不能更换。null 恢复默认(bge-m3)。 |
| models (1).rerank | string / null | 可选; ranking_options.ranker 为 default-2024-11-15 时用于重排结果。null 恢复默认(bge-reranker-base)。 |
| models (1).query_rewrite | string / null | 可选; 搜索设置 rewrite_query 时用于改写查询。null 恢复默认(qwen3.8-flash)。 |
curl -X POST "https://api.deepraxis.ai/knowledge/v1/vector_stores/${VECTOR_STORE_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"models\":{\"query_rewrite\":\"qwen3.8-flash\"}}"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必有; 资源 ID。; 最短字符数: 1 |
| object | "vector_store" | 必有; 对象标记;vector_store 表示知识库。 |
| name | string | 必有; 知识库显示名称;空字符串表示未设置名称。; 最长字符数: 256 |
| status | "in_progress" / "completed" / "expired" / "deleting" | 必有; in_progress 表示仍有文件入库中;completed 表示没有入库中的文件,不保证全部成功;expired 表示过期策略已生效。deleting 表示已软删除、等待永久清除。 |
| usage_bytes | integer | 必有; 已完成源文件的字节数之和。; 最小: 0 |
| file_counts | object | 必有; 仍属于该库或批次的附件数量,按入库状态分组。 |
| file_counts.in_progress | integer | 必有; 等待或正在入库的文件数。; 最小: 0 |
| file_counts.completed | integer | 必有; 已完成入库的文件数。; 最小: 0 |
| file_counts.failed | integer | 必有; 入库失败的文件数。; 最小: 0 |
| file_counts.cancelled | integer | 必有; 因批次取消而停止入库的文件数。; 最小: 0 |
| file_counts.total | integer | 必有; 全部入库状态的附件总数。; 最小: 0 |
| created_at | integer | 必有; Unix 时间戳,单位秒。 |
| last_active_at | integer / null | 必有; 最近创建、添加文件或搜索的 Unix 秒时间戳;不可用时为 null。 |
| expires_after | object / null | 必有; 从最近活动开始计算的过期策略;null 表示不自动过期。 |
| expires_after (1).anchor | "last_active_at" | 必有; last_active_at 表示从最近活动时间开始计算过期。 |
| expires_after (1).days | integer | 必有; 自最近活动起的天数;添加文件和搜索会刷新活动时间。; 最小: 1; 最大: 365 |
| expires_at | integer / null | 必有; 预计过期的 Unix 秒时间戳;未设置过期策略时为 null。 |
| metadata | object | 必有; 最多 16 个键;键最多 64 字符;字符串值最多 512 字符。; 最多键数: 16; 键最多 64 字符; 值: string |
| purge_at | string / null | 可选; ISO 8601 格式的恢复截止时间;未软删除时为 null。 |
| models | object | 可选; 各角色生效的模型(Router 模型 ID);未设置的角色使用默认模型。; Praxis 扩展 |
| models.embedding | string | 必有; 给文件分段和查询生成向量。库中已有文件后不能更换。默认 bge-m3。; 最短字符数: 1 |
| models.rerank | string | 必有; ranking_options.ranker 为 default-2024-11-15 时用于重排结果。默认 bge-reranker-base。; 最短字符数: 1 |
| models.query_rewrite | string | 必有; 搜索设置 rewrite_query 时用于改写查询。默认 qwen3.8-flash。; 最短字符数: 1 |
| praxis | object | 可选; 此知识库的原生生命周期与恢复信息。 |
| praxis.lifecycle | "provisioning" / "active" / "expired" / "deleted" / "failed" | 必有; provisioning 表示正在初始化;active 允许文件操作与搜索;expired 表示已过期;deleted 表示已软删除;failed 表示初始化失败。 |
| praxis.deleted_at | integer / null | 必有; 软删除的 Unix 秒时间戳;未软删除时为 null。 |
| praxis.purge_at | integer / null | 必有; 恢复截止的 Unix 秒时间戳;未软删除时为 null。 |
DELETE /knowledge/v1/vector_stores/{vector_store_id}
软删除后保留 7 天;返回 status=deleting 和 ISO purge_at,重复删除幂等。读取仍为 200,对象操作返回 409。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
curl -X DELETE "https://api.deepraxis.ai/knowledge/v1/vector_stores/${VECTOR_STORE_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必有; 资源 ID。; 最短字符数: 1 |
| object | "vector_store" | 必有; 对象标记;vector_store 表示知识库。 |
| name | string | 必有; 知识库显示名称;空字符串表示未设置名称。; 最长字符数: 256 |
| status | "in_progress" / "completed" / "expired" / "deleting" | 必有; in_progress 表示仍有文件入库中;completed 表示没有入库中的文件,不保证全部成功;expired 表示过期策略已生效。deleting 表示已软删除、等待永久清除。 |
| usage_bytes | integer | 必有; 已完成源文件的字节数之和。; 最小: 0 |
| file_counts | object | 必有; 仍属于该库或批次的附件数量,按入库状态分组。 |
| file_counts.in_progress | integer | 必有; 等待或正在入库的文件数。; 最小: 0 |
| file_counts.completed | integer | 必有; 已完成入库的文件数。; 最小: 0 |
| file_counts.failed | integer | 必有; 入库失败的文件数。; 最小: 0 |
| file_counts.cancelled | integer | 必有; 因批次取消而停止入库的文件数。; 最小: 0 |
| file_counts.total | integer | 必有; 全部入库状态的附件总数。; 最小: 0 |
| created_at | integer | 必有; Unix 时间戳,单位秒。 |
| last_active_at | integer / null | 必有; 最近创建、添加文件或搜索的 Unix 秒时间戳;不可用时为 null。 |
| expires_after | object / null | 必有; 从最近活动开始计算的过期策略;null 表示不自动过期。 |
| expires_after (1).anchor | "last_active_at" | 必有; last_active_at 表示从最近活动时间开始计算过期。 |
| expires_after (1).days | integer | 必有; 自最近活动起的天数;添加文件和搜索会刷新活动时间。; 最小: 1; 最大: 365 |
| expires_at | integer / null | 必有; 预计过期的 Unix 秒时间戳;未设置过期策略时为 null。 |
| metadata | object | 必有; 最多 16 个键;键最多 64 字符;字符串值最多 512 字符。; 最多键数: 16; 键最多 64 字符; 值: string |
| purge_at | string / null | 可选; ISO 8601 格式的恢复截止时间;未软删除时为 null。 |
| models | object | 可选; 各角色生效的模型(Router 模型 ID);未设置的角色使用默认模型。; Praxis 扩展 |
| models.embedding | string | 必有; 给文件分段和查询生成向量。库中已有文件后不能更换。默认 bge-m3。; 最短字符数: 1 |
| models.rerank | string | 必有; ranking_options.ranker 为 default-2024-11-15 时用于重排结果。默认 bge-reranker-base。; 最短字符数: 1 |
| models.query_rewrite | string | 必有; 搜索设置 rewrite_query 时用于改写查询。默认 qwen3.8-flash。; 最短字符数: 1 |
| praxis | object | 可选; 此知识库的原生生命周期与恢复信息。 |
| praxis.lifecycle | "provisioning" / "active" / "expired" / "deleted" / "failed" | 必有; provisioning 表示正在初始化;active 允许文件操作与搜索;expired 表示已过期;deleted 表示已软删除;failed 表示初始化失败。 |
| praxis.deleted_at | integer / null | 必有; 软删除的 Unix 秒时间戳;未软删除时为 null。 |
| praxis.purge_at | integer / null | 必有; 恢复截止的 Unix 秒时间戳;未软删除时为 null。 |
POST /knowledge/v1/vector_stores/{vector_store_id}/restore
恢复删除未满 7 天的知识库;可用库返回 409 VECTOR_STORE_INVALID_STATE,不存在返回 404;请求体可为空。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
curl -X POST "https://api.deepraxis.ai/knowledge/v1/vector_stores/${VECTOR_STORE_ID}/restore" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必有; 资源 ID。; 最短字符数: 1 |
| object | "vector_store" | 必有; 对象标记;vector_store 表示知识库。 |
| name | string | 必有; 知识库显示名称;空字符串表示未设置名称。; 最长字符数: 256 |
| status | "in_progress" / "completed" / "expired" / "deleting" | 必有; in_progress 表示仍有文件入库中;completed 表示没有入库中的文件,不保证全部成功;expired 表示过期策略已生效。deleting 表示已软删除、等待永久清除。 |
| usage_bytes | integer | 必有; 已完成源文件的字节数之和。; 最小: 0 |
| file_counts | object | 必有; 仍属于该库或批次的附件数量,按入库状态分组。 |
| file_counts.in_progress | integer | 必有; 等待或正在入库的文件数。; 最小: 0 |
| file_counts.completed | integer | 必有; 已完成入库的文件数。; 最小: 0 |
| file_counts.failed | integer | 必有; 入库失败的文件数。; 最小: 0 |
| file_counts.cancelled | integer | 必有; 因批次取消而停止入库的文件数。; 最小: 0 |
| file_counts.total | integer | 必有; 全部入库状态的附件总数。; 最小: 0 |
| created_at | integer | 必有; Unix 时间戳,单位秒。 |
| last_active_at | integer / null | 必有; 最近创建、添加文件或搜索的 Unix 秒时间戳;不可用时为 null。 |
| expires_after | object / null | 必有; 从最近活动开始计算的过期策略;null 表示不自动过期。 |
| expires_after (1).anchor | "last_active_at" | 必有; last_active_at 表示从最近活动时间开始计算过期。 |
| expires_after (1).days | integer | 必有; 自最近活动起的天数;添加文件和搜索会刷新活动时间。; 最小: 1; 最大: 365 |
| expires_at | integer / null | 必有; 预计过期的 Unix 秒时间戳;未设置过期策略时为 null。 |
| metadata | object | 必有; 最多 16 个键;键最多 64 字符;字符串值最多 512 字符。; 最多键数: 16; 键最多 64 字符; 值: string |
| purge_at | string / null | 可选; ISO 8601 格式的恢复截止时间;未软删除时为 null。 |
| models | object | 可选; 各角色生效的模型(Router 模型 ID);未设置的角色使用默认模型。; Praxis 扩展 |
| models.embedding | string | 必有; 给文件分段和查询生成向量。库中已有文件后不能更换。默认 bge-m3。; 最短字符数: 1 |
| models.rerank | string | 必有; ranking_options.ranker 为 default-2024-11-15 时用于重排结果。默认 bge-reranker-base。; 最短字符数: 1 |
| models.query_rewrite | string | 必有; 搜索设置 rewrite_query 时用于改写查询。默认 qwen3.8-flash。; 最短字符数: 1 |
| praxis | object | 可选; 此知识库的原生生命周期与恢复信息。 |
| praxis.lifecycle | "provisioning" / "active" / "expired" / "deleted" / "failed" | 必有; provisioning 表示正在初始化;active 允许文件操作与搜索;expired 表示已过期;deleted 表示已软删除;failed 表示初始化失败。 |
| praxis.deleted_at | integer / null | 必有; 软删除的 Unix 秒时间戳;未软删除时为 null。 |
| praxis.purge_at | integer / null | 必有; 恢复截止的 Unix 秒时间戳;未软删除时为 null。 |
POST /knowledge/v1/vector_stores/{vector_store_id}/purge
立即永久清除删除中的知识库,不可撤销;复用到期清理路径。可用库返回 409,不存在返回 404;请求体可为空。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
curl -X POST "https://api.deepraxis.ai/knowledge/v1/vector_stores/${VECTOR_STORE_ID}/purge" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必有; 已永久清除的知识库 ID。 |
| object | "vector_store" | 必有; 对象标记;vector_store 表示此操作回执。 |
| purged | true | 必有; 确认已永久清除知识库及其索引内容。 |
路径中的 ID 使用已有资源的 ID。示例中的环境变量由调用者设置。
POST /knowledge/v1/vector_stores/{vector_store_id}/files
异步处理。重复加入同一文件返回已有记录,不应用新的属性或分段策略。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| 字段 | 类型 | 说明 |
|---|---|---|
| file_id | string | 必填; 上传文件返回的已有源 File ID;文件必须对调用方可见。; 最短字符数: 1 |
| attributes | object / null | 可选; 新附件的搜索筛选属性;省略或 null 表示不设置。重复加入已有文件不改变属性。 |
| chunking_strategy | object / object | 可选; auto 等同于每段 800 token、重叠 400 token。; 默认: {"type":"auto"} |
| chunking_strategy (1).type | "auto" | 必填; auto 使用默认静态分段:800 个估算 token,重叠 400 个。 |
| chunking_strategy (2).type | "static" | 必填; static 表示使用显式分段大小与重叠设置。 |
| chunking_strategy (2).static | object | 必填; 以估算 token 数表示的分段大小与重叠限制。 |
| chunking_strategy (2).static.max_chunk_size_tokens | integer | 必填; 每段的估算 token 数。; 最小: 100; 最大: 4096 |
| chunking_strategy (2).static.chunk_overlap_tokens | integer | 必填; 不得超过 max_chunk_size_tokens 的一半。; 最小: 0; 最大: 2048 |
curl -X POST "https://api.deepraxis.ai/knowledge/v1/vector_stores/${VECTOR_STORE_ID}/files" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"file_id\":\"${FILE_ID}\"}"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必有; 与源文件相同的 ID。; 最短字符数: 1 |
| object | "vector_store.file" | 必有; 对象标记;vector_store.file 表示知识库中的附件。 |
| vector_store_id | string | 必有; 资源 ID。; 最短字符数: 1 |
| status | "in_progress" / "completed" / "cancelled" / "failed" | 必有; in_progress 表示等待或正在入库;completed 表示可检索;failed 表示入库失败;cancelled 表示批次取消已停止入库。 |
| last_error | object / null | 必有; 入库失败详情;未失败、成功完成或重新入库时为 null。 |
| last_error (1).code | "server_error" / "unsupported_file" / "invalid_file" | 必有; unsupported_file 表示不支持的文件类型;invalid_file 表示加密、空文件或超过解析 token 上限;server_error 表示其它入库失败或超过截止时间。 |
| last_error (1).message | string | 必有; 与 code 对应的入库失败说明。 |
| usage_bytes | integer | 必有; 完成后计入源文件字节数;处理中、失败或已取消时为零。; 最小: 0 |
| created_at | integer | 必有; Unix 时间戳,单位秒。 |
| chunking_strategy | object / object | 必有; 此附件已保存的分段策略;auto 输入返回为具体 static 设置。 |
| chunking_strategy (1).type | "static" | 必有; static 表示使用显式分段大小与重叠设置。 |
| chunking_strategy (1).static | object | 必有; 以估算 token 数表示的分段大小与重叠限制。 |
| chunking_strategy (1).static.max_chunk_size_tokens | integer | 必有; 每段的估算 token 数。; 最小: 100; 最大: 4096 |
| chunking_strategy (1).static.chunk_overlap_tokens | integer | 必有; 不得超过 max_chunk_size_tokens 的一半。; 最小: 0; 最大: 2048 |
| chunking_strategy (2).type | "other" | 必有 |
| attributes | object / null | 必有; 用于搜索筛选的文件属性;null 表示未设置。 |
| praxis | object | 可选; 原生入库进度与源文件统计。 |
| praxis.stage | "queued" / "parse" / "chunk" / "embed" / "index" / null | 必有; queued 表示等待;parse 提取文本;chunk 划分分段;embed 生成向量;index 建立检索索引。null 表示入库已不在进行中。 |
| praxis.deadline_at | integer / null | 必有; 入库截止的 Unix 秒时间戳;到点仍未完成的入库转为失败。 |
| praxis.filename | string | 必有; File 服务返回的源文件名。 |
| praxis.bytes | integer | 必有; 源文件字节数。; 最小: 0 |
| praxis.pages | integer / null | 必有; 成功入库后的解析页数;成功结果保存前为 null。 |
| praxis.chunk_count | integer | 必有; 已完成入库的分段数;完成前、失败或取消后为零。; 最小: 0 |
GET /knowledge/v1/vector_stores/{vector_store_id}/files
列出附件及入库状态,默认最新附件在前。使用 last_id 作为 after 继续查询;?filter=failed 筛选可重新入库的失败文件。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| after | query: string | 上一页的 ID 游标。 最短字符数: 1 |
| before | query: string | 返回此 ID 之前的条目。 最短字符数: 1 |
| limit | query: integer | 每页条数。 最小: 1; 最大: 100; 默认: 20 |
| order | query: "asc" / "desc" | 知识库和文件默认按创建时间降序;分段默认按序号升序。 默认: "desc" |
| filter | query: "in_progress" / "completed" / "failed" / "cancelled" | in_progress 表示等待或正在入库;completed 表示可检索;failed 表示入库失败;cancelled 表示批次取消已停止入库。省略时包含全部状态。 |
curl -X GET "https://api.deepraxis.ai/knowledge/v1/vector_stores/${VECTOR_STORE_ID}/files" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| object | "list" | 必有; 对象标记;list 表示游标分页集合。 |
| data | object[] | 必有; 按请求顺序返回的当前页条目。 |
| data[].id | string | 必有; 与源文件相同的 ID。; 最短字符数: 1 |
| data[].object | "vector_store.file" | 必有; 对象标记;vector_store.file 表示知识库中的附件。 |
| data[].vector_store_id | string | 必有; 资源 ID。; 最短字符数: 1 |
| data[].status | "in_progress" / "completed" / "cancelled" / "failed" | 必有; in_progress 表示等待或正在入库;completed 表示可检索;failed 表示入库失败;cancelled 表示批次取消已停止入库。 |
| data[].last_error | object / null | 必有; 入库失败详情;未失败、成功完成或重新入库时为 null。 |
| data[].last_error (1).code | "server_error" / "unsupported_file" / "invalid_file" | 必有; unsupported_file 表示不支持的文件类型;invalid_file 表示加密、空文件或超过解析 token 上限;server_error 表示其它入库失败或超过截止时间。 |
| data[].last_error (1).message | string | 必有; 与 code 对应的入库失败说明。 |
| data[].usage_bytes | integer | 必有; 完成后计入源文件字节数;处理中、失败或已取消时为零。; 最小: 0 |
| data[].created_at | integer | 必有; Unix 时间戳,单位秒。 |
| data[].chunking_strategy | object / object | 必有; 此附件已保存的分段策略;auto 输入返回为具体 static 设置。 |
| data[].chunking_strategy (1).type | "static" | 必有; static 表示使用显式分段大小与重叠设置。 |
| data[].chunking_strategy (1).static | object | 必有; 以估算 token 数表示的分段大小与重叠限制。 |
| data[].chunking_strategy (1).static.max_chunk_size_tokens | integer | 必有; 每段的估算 token 数。; 最小: 100; 最大: 4096 |
| data[].chunking_strategy (1).static.chunk_overlap_tokens | integer | 必有; 不得超过 max_chunk_size_tokens 的一半。; 最小: 0; 最大: 2048 |
| data[].chunking_strategy (2).type | "other" | 必有 |
| data[].attributes | object / null | 必有; 用于搜索筛选的文件属性;null 表示未设置。 |
| data[].praxis | object | 可选; 原生入库进度与源文件统计。 |
| data[].praxis.stage | "queued" / "parse" / "chunk" / "embed" / "index" / null | 必有; queued 表示等待;parse 提取文本;chunk 划分分段;embed 生成向量;index 建立检索索引。null 表示入库已不在进行中。 |
| data[].praxis.deadline_at | integer / null | 必有; 入库截止的 Unix 秒时间戳;到点仍未完成的入库转为失败。 |
| data[].praxis.filename | string | 必有; File 服务返回的源文件名。 |
| data[].praxis.bytes | integer | 必有; 源文件字节数。; 最小: 0 |
| data[].praxis.pages | integer / null | 必有; 成功入库后的解析页数;成功结果保存前为 null。 |
| data[].praxis.chunk_count | integer | 必有; 已完成入库的分段数;完成前、失败或取消后为零。; 最小: 0 |
| first_id | string / null | 必有; 本页首项的 ID;空页为 null。 |
| last_id | string / null | 必有; 本页末项的 ID,可作为 after 继续查询;空页为 null。 |
| has_more | boolean | 必有; 当前游标范围内,本页之后是否还有条目。 |
GET /knowledge/v1/vector_stores/{vector_store_id}/files/{file_id}
使用添加附件或附件列表返回的 id 读取文件。可轮询此操作,直到 status 离开 in_progress 后确认入库结果。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| file_id | path: string | 必填;添加附件或附件列表返回的源 File ID。 最短字符数: 1 |
curl -X GET "https://api.deepraxis.ai/knowledge/v1/vector_stores/${VECTOR_STORE_ID}/files/${FILE_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必有; 与源文件相同的 ID。; 最短字符数: 1 |
| object | "vector_store.file" | 必有; 对象标记;vector_store.file 表示知识库中的附件。 |
| vector_store_id | string | 必有; 资源 ID。; 最短字符数: 1 |
| status | "in_progress" / "completed" / "cancelled" / "failed" | 必有; in_progress 表示等待或正在入库;completed 表示可检索;failed 表示入库失败;cancelled 表示批次取消已停止入库。 |
| last_error | object / null | 必有; 入库失败详情;未失败、成功完成或重新入库时为 null。 |
| last_error (1).code | "server_error" / "unsupported_file" / "invalid_file" | 必有; unsupported_file 表示不支持的文件类型;invalid_file 表示加密、空文件或超过解析 token 上限;server_error 表示其它入库失败或超过截止时间。 |
| last_error (1).message | string | 必有; 与 code 对应的入库失败说明。 |
| usage_bytes | integer | 必有; 完成后计入源文件字节数;处理中、失败或已取消时为零。; 最小: 0 |
| created_at | integer | 必有; Unix 时间戳,单位秒。 |
| chunking_strategy | object / object | 必有; 此附件已保存的分段策略;auto 输入返回为具体 static 设置。 |
| chunking_strategy (1).type | "static" | 必有; static 表示使用显式分段大小与重叠设置。 |
| chunking_strategy (1).static | object | 必有; 以估算 token 数表示的分段大小与重叠限制。 |
| chunking_strategy (1).static.max_chunk_size_tokens | integer | 必有; 每段的估算 token 数。; 最小: 100; 最大: 4096 |
| chunking_strategy (1).static.chunk_overlap_tokens | integer | 必有; 不得超过 max_chunk_size_tokens 的一半。; 最小: 0; 最大: 2048 |
| chunking_strategy (2).type | "other" | 必有 |
| attributes | object / null | 必有; 用于搜索筛选的文件属性;null 表示未设置。 |
| praxis | object | 可选; 原生入库进度与源文件统计。 |
| praxis.stage | "queued" / "parse" / "chunk" / "embed" / "index" / null | 必有; queued 表示等待;parse 提取文本;chunk 划分分段;embed 生成向量;index 建立检索索引。null 表示入库已不在进行中。 |
| praxis.deadline_at | integer / null | 必有; 入库截止的 Unix 秒时间戳;到点仍未完成的入库转为失败。 |
| praxis.filename | string | 必有; File 服务返回的源文件名。 |
| praxis.bytes | integer | 必有; 源文件字节数。; 最小: 0 |
| praxis.pages | integer / null | 必有; 成功入库后的解析页数;成功结果保存前为 null。 |
| praxis.chunk_count | integer | 必有; 已完成入库的分段数;完成前、失败或取消后为零。; 最小: 0 |
POST /knowledge/v1/vector_stores/{vector_store_id}/files/{file_id}
替换已有附件的搜索筛选属性,不重新入库。使用附件 id。请求体示例:{"attributes":{"category":"refund"}};null 清空属性。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| file_id | path: string | 必填;添加附件或附件列表返回的源 File ID。 最短字符数: 1 |
| 字段 | 类型 | 说明 |
|---|---|---|
| attributes | object / null | 可选; 替换全部搜索筛选属性;null 清空属性。 |
curl -X POST "https://api.deepraxis.ai/knowledge/v1/vector_stores/${VECTOR_STORE_ID}/files/${FILE_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"attributes\":{\"category\":\"refund\"}}"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必有; 与源文件相同的 ID。; 最短字符数: 1 |
| object | "vector_store.file" | 必有; 对象标记;vector_store.file 表示知识库中的附件。 |
| vector_store_id | string | 必有; 资源 ID。; 最短字符数: 1 |
| status | "in_progress" / "completed" / "cancelled" / "failed" | 必有; in_progress 表示等待或正在入库;completed 表示可检索;failed 表示入库失败;cancelled 表示批次取消已停止入库。 |
| last_error | object / null | 必有; 入库失败详情;未失败、成功完成或重新入库时为 null。 |
| last_error (1).code | "server_error" / "unsupported_file" / "invalid_file" | 必有; unsupported_file 表示不支持的文件类型;invalid_file 表示加密、空文件或超过解析 token 上限;server_error 表示其它入库失败或超过截止时间。 |
| last_error (1).message | string | 必有; 与 code 对应的入库失败说明。 |
| usage_bytes | integer | 必有; 完成后计入源文件字节数;处理中、失败或已取消时为零。; 最小: 0 |
| created_at | integer | 必有; Unix 时间戳,单位秒。 |
| chunking_strategy | object / object | 必有; 此附件已保存的分段策略;auto 输入返回为具体 static 设置。 |
| chunking_strategy (1).type | "static" | 必有; static 表示使用显式分段大小与重叠设置。 |
| chunking_strategy (1).static | object | 必有; 以估算 token 数表示的分段大小与重叠限制。 |
| chunking_strategy (1).static.max_chunk_size_tokens | integer | 必有; 每段的估算 token 数。; 最小: 100; 最大: 4096 |
| chunking_strategy (1).static.chunk_overlap_tokens | integer | 必有; 不得超过 max_chunk_size_tokens 的一半。; 最小: 0; 最大: 2048 |
| chunking_strategy (2).type | "other" | 必有 |
| attributes | object / null | 必有; 用于搜索筛选的文件属性;null 表示未设置。 |
| praxis | object | 可选; 原生入库进度与源文件统计。 |
| praxis.stage | "queued" / "parse" / "chunk" / "embed" / "index" / null | 必有; queued 表示等待;parse 提取文本;chunk 划分分段;embed 生成向量;index 建立检索索引。null 表示入库已不在进行中。 |
| praxis.deadline_at | integer / null | 必有; 入库截止的 Unix 秒时间戳;到点仍未完成的入库转为失败。 |
| praxis.filename | string | 必有; File 服务返回的源文件名。 |
| praxis.bytes | integer | 必有; 源文件字节数。; 最小: 0 |
| praxis.pages | integer / null | 必有; 成功入库后的解析页数;成功结果保存前为 null。 |
| praxis.chunk_count | integer | 必有; 已完成入库的分段数;完成前、失败或取消后为零。; 最小: 0 |
DELETE /knowledge/v1/vector_stores/{vector_store_id}/files/{file_id}
返回后立即不再搜索到该文件;不会删除源文件。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| file_id | path: string | 必填;添加附件或附件列表返回的源 File ID。 最短字符数: 1 |
curl -X DELETE "https://api.deepraxis.ai/knowledge/v1/vector_stores/${VECTOR_STORE_ID}/files/${FILE_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必有; 资源 ID。; 最短字符数: 1 |
| object | "vector_store.file.deleted" | 必有; 对象标记;vector_store.file.deleted 表示此操作回执。 |
| deleted | true | 必有; 确认已从此知识库移出;源 File 未删除。 |
GET /knowledge/v1/vector_stores/{vector_store_id}/files/{file_id}/content
抽取文本按分段返回,可能重叠。图片内容可能是生成的描述,并非逐字 OCR。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| file_id | path: string | 必填;添加附件或附件列表返回的源 File ID。 最短字符数: 1 |
curl -X GET "https://api.deepraxis.ai/knowledge/v1/vector_stores/${VECTOR_STORE_ID}/files/${FILE_ID}/content" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| object | "vector_store.file_content.page" | 必有; 对象标记;vector_store.file_content.page 表示提取的文件内容。 |
| data | object[] | 必有; 按分段序号排列的全部现存文本分段;相邻分段可能重叠。 |
| data[].type | "text" | 必有; text 表示提取出的文本分段。 |
| data[].text | string | 必有; 此分段的提取文本;可能与相邻分段重叠。 |
| has_more | false | 必有; 恒为 false;此响应返回全部现存分段。 |
| next_page | null | 必有; 恒为 null;提取内容不分页。 |
POST /knowledge/v1/vector_stores/{vector_store_id}/files/{file_id}/retry
仅重试 failed 文件;其他状态返回 409 FILE_INVALID_STATE。本次实测尚未覆盖失败后的重试。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| file_id | path: string | 必填;添加附件或附件列表返回的源 File ID。 最短字符数: 1 |
curl -X POST "https://api.deepraxis.ai/knowledge/v1/vector_stores/${VECTOR_STORE_ID}/files/${FILE_ID}/retry" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必有; 与源文件相同的 ID。; 最短字符数: 1 |
| object | "vector_store.file" | 必有; 对象标记;vector_store.file 表示知识库中的附件。 |
| vector_store_id | string | 必有; 资源 ID。; 最短字符数: 1 |
| status | "in_progress" / "completed" / "cancelled" / "failed" | 必有; in_progress 表示等待或正在入库;completed 表示可检索;failed 表示入库失败;cancelled 表示批次取消已停止入库。 |
| last_error | object / null | 必有; 入库失败详情;未失败、成功完成或重新入库时为 null。 |
| last_error (1).code | "server_error" / "unsupported_file" / "invalid_file" | 必有; unsupported_file 表示不支持的文件类型;invalid_file 表示加密、空文件或超过解析 token 上限;server_error 表示其它入库失败或超过截止时间。 |
| last_error (1).message | string | 必有; 与 code 对应的入库失败说明。 |
| usage_bytes | integer | 必有; 完成后计入源文件字节数;处理中、失败或已取消时为零。; 最小: 0 |
| created_at | integer | 必有; Unix 时间戳,单位秒。 |
| chunking_strategy | object / object | 必有; 此附件已保存的分段策略;auto 输入返回为具体 static 设置。 |
| chunking_strategy (1).type | "static" | 必有; static 表示使用显式分段大小与重叠设置。 |
| chunking_strategy (1).static | object | 必有; 以估算 token 数表示的分段大小与重叠限制。 |
| chunking_strategy (1).static.max_chunk_size_tokens | integer | 必有; 每段的估算 token 数。; 最小: 100; 最大: 4096 |
| chunking_strategy (1).static.chunk_overlap_tokens | integer | 必有; 不得超过 max_chunk_size_tokens 的一半。; 最小: 0; 最大: 2048 |
| chunking_strategy (2).type | "other" | 必有 |
| attributes | object / null | 必有; 用于搜索筛选的文件属性;null 表示未设置。 |
| praxis | object | 可选; 原生入库进度与源文件统计。 |
| praxis.stage | "queued" / "parse" / "chunk" / "embed" / "index" / null | 必有; queued 表示等待;parse 提取文本;chunk 划分分段;embed 生成向量;index 建立检索索引。null 表示入库已不在进行中。 |
| praxis.deadline_at | integer / null | 必有; 入库截止的 Unix 秒时间戳;到点仍未完成的入库转为失败。 |
| praxis.filename | string | 必有; File 服务返回的源文件名。 |
| praxis.bytes | integer | 必有; 源文件字节数。; 最小: 0 |
| praxis.pages | integer / null | 必有; 成功入库后的解析页数;成功结果保存前为 null。 |
| praxis.chunk_count | integer | 必有; 已完成入库的分段数;完成前、失败或取消后为零。; 最小: 0 |
路径中的 ID 使用已有资源的 ID。示例中的环境变量由调用者设置。
POST /knowledge/v1/vector_stores/{vector_store_id}/file_batches
批量添加已有 File 并异步入库。file_ids 与 files 必须且只能提供一个;files 支持逐文件设置。已有附件直接复用。使用返回的批次 id 查询进度。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
file_ids 与 files 必须且只能提供一个。已有文件直接复用,不修改属性或分段策略。
| 字段 | 类型 | 说明 |
|---|---|---|
| (1).file_ids | string[] | 必填; 使用共同属性和分段设置的已有 File ID 列表。file_ids 与 files 二选一。; 最少条数: 1; 最多条数: 500 |
| (1).attributes | object / null | 可选; 用于每个新附件的搜索筛选属性;省略或 null 表示不设置。 |
| (1).chunking_strategy | object / object | 可选; auto 等同于每段 800 token、重叠 400 token。; 默认: {"type":"auto"} |
| (1).chunking_strategy (1).type | "auto" | 必填; auto 使用默认静态分段:800 个估算 token,重叠 400 个。 |
| (1).chunking_strategy (2).type | "static" | 必填; static 表示使用显式分段大小与重叠设置。 |
| (1).chunking_strategy (2).static | object | 必填; 以估算 token 数表示的分段大小与重叠限制。 |
| (1).chunking_strategy (2).static.max_chunk_size_tokens | integer | 必填; 每段的估算 token 数。; 最小: 100; 最大: 4096 |
| (1).chunking_strategy (2).static.chunk_overlap_tokens | integer | 必填; 不得超过 max_chunk_size_tokens 的一半。; 最小: 0; 最大: 2048 |
| (2).files | object[] | 必填; 分别指定属性和分段设置的附件列表;忽略顶层 attributes 与 chunking_strategy。; 最少条数: 1; 最多条数: 500 |
| (2).files[].file_id | string | 必填; 上传文件返回的已有源 File ID;文件必须对调用方可见。; 最短字符数: 1 |
| (2).files[].attributes | object | 可选; 用于搜索筛选的文件属性。最多 16 个键,键最多 64 字符,字符串值最多 512 字符。; 最多键数: 16; 键最多 64 字符; 值: string / number / boolean |
| (2).files[].chunking_strategy | object / object | 可选; auto 等同于每段 800 token、重叠 400 token。; 默认: {"type":"auto"} |
| (2).files[].chunking_strategy (1).type | "auto" | 必填; auto 使用默认静态分段:800 个估算 token,重叠 400 个。 |
| (2).files[].chunking_strategy (2).type | "static" | 必填; static 表示使用显式分段大小与重叠设置。 |
| (2).files[].chunking_strategy (2).static | object | 必填; 以估算 token 数表示的分段大小与重叠限制。 |
| (2).files[].chunking_strategy (2).static.max_chunk_size_tokens | integer | 必填; 每段的估算 token 数。; 最小: 100; 最大: 4096 |
| (2).files[].chunking_strategy (2).static.chunk_overlap_tokens | integer | 必填; 不得超过 max_chunk_size_tokens 的一半。; 最小: 0; 最大: 2048 |
| (2).attributes | JSON | 可选; 不生效: 使用 files 时不生效。 |
| (2).chunking_strategy | JSON | 可选; 不生效: 使用 files 时不生效。 |
curl -X POST "https://api.deepraxis.ai/knowledge/v1/vector_stores/${VECTOR_STORE_ID}/file_batches" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"file_ids\":[\"${FILE_ID}\"]}"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必有; 资源 ID。; 最短字符数: 1 |
| object | "vector_store.files_batch" | 必有; 对象标记;vector_store.files_batch 表示批量附件。 |
| vector_store_id | string | 必有; 资源 ID。; 最短字符数: 1 |
| status | "in_progress" / "completed" / "cancelled" / "failed" | 必有; cancelled 表示批次已取消;否则 in_progress 表示仍有成员入库中,failed 表示入库结束且有失败成员,completed 表示无入库中或失败成员。取消终态批次不会改变它。 |
| file_counts | object | 必有; 仍属于该库或批次的附件数量,按入库状态分组。 |
| file_counts.in_progress | integer | 必有; 等待或正在入库的文件数。; 最小: 0 |
| file_counts.completed | integer | 必有; 已完成入库的文件数。; 最小: 0 |
| file_counts.failed | integer | 必有; 入库失败的文件数。; 最小: 0 |
| file_counts.cancelled | integer | 必有; 因批次取消而停止入库的文件数。; 最小: 0 |
| file_counts.total | integer | 必有; 全部入库状态的附件总数。; 最小: 0 |
| created_at | integer | 必有; Unix 时间戳,单位秒。 |
GET /knowledge/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}
读取此知识库中创建的批次,包括当前状态和文件计数。使用创建批次返回的 id 监测入库结果。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| batch_id | path: string | 必填;此知识库创建批次时返回的文件批次 ID。 最短字符数: 1 |
curl -X GET "https://api.deepraxis.ai/knowledge/v1/vector_stores/${VECTOR_STORE_ID}/file_batches/${BATCH_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必有; 资源 ID。; 最短字符数: 1 |
| object | "vector_store.files_batch" | 必有; 对象标记;vector_store.files_batch 表示批量附件。 |
| vector_store_id | string | 必有; 资源 ID。; 最短字符数: 1 |
| status | "in_progress" / "completed" / "cancelled" / "failed" | 必有; cancelled 表示批次已取消;否则 in_progress 表示仍有成员入库中,failed 表示入库结束且有失败成员,completed 表示无入库中或失败成员。取消终态批次不会改变它。 |
| file_counts | object | 必有; 仍属于该库或批次的附件数量,按入库状态分组。 |
| file_counts.in_progress | integer | 必有; 等待或正在入库的文件数。; 最小: 0 |
| file_counts.completed | integer | 必有; 已完成入库的文件数。; 最小: 0 |
| file_counts.failed | integer | 必有; 入库失败的文件数。; 最小: 0 |
| file_counts.cancelled | integer | 必有; 因批次取消而停止入库的文件数。; 最小: 0 |
| file_counts.total | integer | 必有; 全部入库状态的附件总数。; 最小: 0 |
| created_at | integer | 必有; Unix 时间戳,单位秒。 |
POST /knowledge/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel
只取消处理中的批次和文件。已完成、失败或已取消的批次原样返回(200,幂等),计数不变。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| batch_id | path: string | 必填;此知识库创建批次时返回的文件批次 ID。 最短字符数: 1 |
curl -X POST "https://api.deepraxis.ai/knowledge/v1/vector_stores/${VECTOR_STORE_ID}/file_batches/${BATCH_ID}/cancel" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必有; 资源 ID。; 最短字符数: 1 |
| object | "vector_store.files_batch" | 必有; 对象标记;vector_store.files_batch 表示批量附件。 |
| vector_store_id | string | 必有; 资源 ID。; 最短字符数: 1 |
| status | "in_progress" / "completed" / "cancelled" / "failed" | 必有; cancelled 表示批次已取消;否则 in_progress 表示仍有成员入库中,failed 表示入库结束且有失败成员,completed 表示无入库中或失败成员。取消终态批次不会改变它。 |
| file_counts | object | 必有; 仍属于该库或批次的附件数量,按入库状态分组。 |
| file_counts.in_progress | integer | 必有; 等待或正在入库的文件数。; 最小: 0 |
| file_counts.completed | integer | 必有; 已完成入库的文件数。; 最小: 0 |
| file_counts.failed | integer | 必有; 入库失败的文件数。; 最小: 0 |
| file_counts.cancelled | integer | 必有; 因批次取消而停止入库的文件数。; 最小: 0 |
| file_counts.total | integer | 必有; 全部入库状态的附件总数。; 最小: 0 |
| created_at | integer | 必有; Unix 时间戳,单位秒。 |
GET /knowledge/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}/files
列出指定批次仍在库中的附件,默认最新附件在前。使用批次创建返回的 id;?filter=failed 查看失败文件,last_id 可作为下一页 after。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| batch_id | path: string | 必填;此知识库创建批次时返回的文件批次 ID。 最短字符数: 1 |
| after | query: string | 上一页的 ID 游标。 最短字符数: 1 |
| before | query: string | 返回此 ID 之前的条目。 最短字符数: 1 |
| limit | query: integer | 每页条数。 最小: 1; 最大: 100; 默认: 20 |
| order | query: "asc" / "desc" | 知识库和文件默认按创建时间降序;分段默认按序号升序。 默认: "desc" |
| filter | query: "in_progress" / "completed" / "failed" / "cancelled" | in_progress 表示等待或正在入库;completed 表示可检索;failed 表示入库失败;cancelled 表示批次取消已停止入库。省略时包含全部状态。 |
curl -X GET "https://api.deepraxis.ai/knowledge/v1/vector_stores/${VECTOR_STORE_ID}/file_batches/${BATCH_ID}/files" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| object | "list" | 必有; 对象标记;list 表示游标分页集合。 |
| data | object[] | 必有; 按请求顺序返回的当前页条目。 |
| data[].id | string | 必有; 与源文件相同的 ID。; 最短字符数: 1 |
| data[].object | "vector_store.file" | 必有; 对象标记;vector_store.file 表示知识库中的附件。 |
| data[].vector_store_id | string | 必有; 资源 ID。; 最短字符数: 1 |
| data[].status | "in_progress" / "completed" / "cancelled" / "failed" | 必有; in_progress 表示等待或正在入库;completed 表示可检索;failed 表示入库失败;cancelled 表示批次取消已停止入库。 |
| data[].last_error | object / null | 必有; 入库失败详情;未失败、成功完成或重新入库时为 null。 |
| data[].last_error (1).code | "server_error" / "unsupported_file" / "invalid_file" | 必有; unsupported_file 表示不支持的文件类型;invalid_file 表示加密、空文件或超过解析 token 上限;server_error 表示其它入库失败或超过截止时间。 |
| data[].last_error (1).message | string | 必有; 与 code 对应的入库失败说明。 |
| data[].usage_bytes | integer | 必有; 完成后计入源文件字节数;处理中、失败或已取消时为零。; 最小: 0 |
| data[].created_at | integer | 必有; Unix 时间戳,单位秒。 |
| data[].chunking_strategy | object / object | 必有; 此附件已保存的分段策略;auto 输入返回为具体 static 设置。 |
| data[].chunking_strategy (1).type | "static" | 必有; static 表示使用显式分段大小与重叠设置。 |
| data[].chunking_strategy (1).static | object | 必有; 以估算 token 数表示的分段大小与重叠限制。 |
| data[].chunking_strategy (1).static.max_chunk_size_tokens | integer | 必有; 每段的估算 token 数。; 最小: 100; 最大: 4096 |
| data[].chunking_strategy (1).static.chunk_overlap_tokens | integer | 必有; 不得超过 max_chunk_size_tokens 的一半。; 最小: 0; 最大: 2048 |
| data[].chunking_strategy (2).type | "other" | 必有 |
| data[].attributes | object / null | 必有; 用于搜索筛选的文件属性;null 表示未设置。 |
| data[].praxis | object | 可选; 原生入库进度与源文件统计。 |
| data[].praxis.stage | "queued" / "parse" / "chunk" / "embed" / "index" / null | 必有; queued 表示等待;parse 提取文本;chunk 划分分段;embed 生成向量;index 建立检索索引。null 表示入库已不在进行中。 |
| data[].praxis.deadline_at | integer / null | 必有; 入库截止的 Unix 秒时间戳;到点仍未完成的入库转为失败。 |
| data[].praxis.filename | string | 必有; File 服务返回的源文件名。 |
| data[].praxis.bytes | integer | 必有; 源文件字节数。; 最小: 0 |
| data[].praxis.pages | integer / null | 必有; 成功入库后的解析页数;成功结果保存前为 null。 |
| data[].praxis.chunk_count | integer | 必有; 已完成入库的分段数;完成前、失败或取消后为零。; 最小: 0 |
| first_id | string / null | 必有; 本页首项的 ID;空页为 null。 |
| last_id | string / null | 必有; 本页末项的 ID,可作为 after 继续查询;空页为 null。 |
| has_more | boolean | 必有; 当前游标范围内,本页之后是否还有条目。 |
路径中的 ID 使用已有资源的 ID。示例中的环境变量由调用者设置。
POST /knowledge/v1/vector_stores/{vector_store_id}/search
按分段返回,同一文件可出现多次。最多 50 条,没有下一页。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| 字段 | 类型 | 说明 |
|---|---|---|
| query | string / string[] | 必填; 非空白文本;多个查询以换行连接后共同搜索。 |
| filters | object / object / object | 可选; 按类型严格匹配文件属性;根条件以下最多嵌套 20 层。 |
| filters (1).type | "eq" / "ne" / "gt" / "gte" / "lt" / "lte" | 必填; eq 等于,ne 不等于,gt 大于,gte 大于等于,lt 小于,lte 小于等于;属性必须存在且值类型一致。 |
| filters (1).key | string | 必填; 要比较的文件属性原始键名,标点也是键名的一部分。; 最短字符数: 1 |
| filters (1).value | string / number / boolean | 必填; 不进行类型转换的比较值。 |
| filters (2).type | "in" / "nin" | 必填; in 匹配数组中的值;nin 匹配不在数组中的值。属性不存在时均不匹配。 |
| filters (2).key | string | 必填; 要比较的文件属性原始键名,标点也是键名的一部分。; 最短字符数: 1 |
| filters (2).value | string / number[] | 必填; 不进行类型转换的字符串或数值成员列表。 |
| filters (3).type | "and" / "or" | 必填; and 要求所有子条件匹配;or 要求至少一个子条件匹配。 |
| filters (3).filters | object / object / object[] | 必填; 按选定 and/or 运算符组合的非空子条件列表。; 最少条数: 1 |
| filters (3).filters[] | object / object / object | 递归使用同一筛选结构,嵌套上限 20 层。 |
| max_num_results | integer | 可选; 最多返回的分段数,不是不同文件数。; 最小: 1; 最大: 50; 默认: 10 |
| rewrite_query | boolean | 可选; 支持: 为 true 时,先用该库 query_rewrite 角色的模型把每条查询改写为简洁的检索查询;检索使用改写结果,search_query 返回改写后的查询。每次改写是一次小模型调用,按模型用量计费。改写失败、超时(5 秒)或为空时,该条查询回退为原文,搜索照常完成。省略或为 false 时不调用模型。 |
| next_page | string | 可选; 不生效: 搜索不支持翻页;提供游标不生效。 |
| ranking_options | object | 可选; 控制结果排序与纳入结果的最低分数。 |
| ranking_options.ranker | "none" / "auto" / "default-2024-11-15" | 可选; 只有 default-2024-11-15 请求重排;none、auto 和省略时使用初始排序。尚未单独实测重排效果。 |
| ranking_options.score_threshold | number | 可选; 最低分数;分数不是相关性概率。尚未单独实测阈值效果。; 最小: 0; 最大: 1; 默认: 0 |
| ranking_options.hybrid_search | object | 可选; Praxis 扩展。两个权重均须提供,必须非负且总和大于 0;省略时使用 0.7 / 0.3。; Praxis 扩展 |
| ranking_options.hybrid_search.embedding_weight | number | 必填; 语义检索相对权重;零表示禁用语义检索。; 最小: 0; 默认: 0.7 |
| ranking_options.hybrid_search.text_weight | number | 必填; 关键词检索相对权重;零表示禁用关键词检索。; 最小: 0; 默认: 0.3 |
| praxis | object | 可选; 设置 explain=true 返回分数和关键词解释。; Praxis 扩展 |
| praxis.explain | boolean | 可选; true 请求每条结果的分数、排名与关键词解释。; 默认: false |
curl -X POST "https://api.deepraxis.ai/knowledge/v1/vector_stores/${VECTOR_STORE_ID}/search" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"query\":\"When will I receive my refund?\",\"max_num_results\":5,\"praxis\":{\"explain\":true}}"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| object | "vector_store.search_results.page" | 必有; 对象标记;vector_store.search_results.page 表示搜索结果页。 |
| search_query | string[] | 必有; 实际用于检索的查询,与输入一一对应;rewrite_query 为 true 时为改写后的查询,否则原样返回。 |
| data | object[] | 必有; 每个命中分段返回一条;同一 file_id 可重复出现。 |
| data[].file_id | string | 必有; 资源 ID。; 最短字符数: 1 |
| data[].filename | string | 必有; 命中文件的源文件名。 |
| data[].score | number | 必有; 此分段的相关排序分数,限制在 0 到 1;不是概率。; 最小: 0; 最大: 1 |
| data[].attributes | object / null | 必有; 用于筛选的当前文件属性;未设置时为 null。 |
| data[].content | object[] | 必有; 命中分段文本与源文坐标;原生结果每条包含一个分段。 |
| data[].content[].type | "text" | 必有; text 表示提取出的文本分段。 |
| data[].content[].text | string | 必有; 命中分段的提取文本,可能与相邻分段重叠。 |
| data[].content[].chunk_id | string | 可选; 资源 ID。; 最短字符数: 1 |
| data[].content[].page | integer / null | 可选; 此段起点所在的源文页码,从一开始;无页码映射时为 null。 |
| data[].content[].span | integer[] | 可选; 以 UTF-16 代码单元表示的起止位置。; 最少条数: 2; 最多条数: 2 |
| data[].praxis | object | 可选; 原生搜索解释;仅请求 praxis.explain 时返回。 |
| data[].praxis.explain | object | 必有; 每个命中分段的检索分数、排名与匹配词。 |
| data[].praxis.explain.semantic_score | number / null | 必有; 此段语义检索分数;不在语义候选中时为 null。 |
| data[].praxis.explain.keyword_score | number / null | 必有; 此段关键词检索分数;不在关键词候选中时为 null。 |
| data[].praxis.explain.rerank_score | number / null | 必有; 重排模型分数;未重排时为 null。 |
| data[].praxis.explain.semantic_rank | integer / null | 必有; 语义候选中的排名,从一开始;该路未召回时为 null。 |
| data[].praxis.explain.keyword_rank | integer / null | 必有; 关键词候选中的排名,从一开始;该路未召回时为 null。 |
| data[].praxis.explain.rank_before_rerank | integer | 必有; 最小: 1 |
| data[].praxis.explain.query_terms | string[] | 必有; 解释使用的归一化查询词,包括相邻汉字组成的双字词。 |
| data[].praxis.explain.matched_terms | string[] | 必有; 归一化分段文本中出现的查询词。 |
| has_more | boolean | 必有; 过滤后的分段数超过 max_num_results 时为 true;next_page 仍为 null。; 支持: |
| next_page | null | 必有; 不生效: 恒为 null,没有下一页搜索结果。 |
路径中的 ID 使用已有资源的 ID。示例中的环境变量由调用者设置。
GET /knowledge/v1/vector_stores/{vector_store_id}/files/{file_id}/segments
列出附件已有分段,默认按分段序号升序。使用附件 id,并将 last_id 作为 after 继续查询;返回的分段 id 可单独读取。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| file_id | path: string | 必填;添加附件或附件列表返回的源 File ID。 最短字符数: 1 |
| after | query: string | 上一页的 ID 游标。 最短字符数: 1 |
| before | query: string | 返回此 ID 之前的条目。 最短字符数: 1 |
| limit | query: integer | 每页条数。 最小: 1; 最大: 100; 默认: 20 |
| order | query: "asc" / "desc" | 知识库和文件默认按创建时间降序;分段默认按序号升序。 默认: "asc" |
curl -X GET "https://api.deepraxis.ai/knowledge/v1/vector_stores/${VECTOR_STORE_ID}/files/${FILE_ID}/segments" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| object | "list" | 必有; 对象标记;list 表示游标分页集合。 |
| data | object[] | 必有; 按请求顺序返回的当前页条目。 |
| data[].id | string | 必有; 资源 ID。; 最短字符数: 1 |
| data[].file_id | string | 必有; 资源 ID。; 最短字符数: 1 |
| data[].index | integer | 必有; 此段在源文中的序号,从零开始。; 最小: 0 |
| data[].text | string | 必有; 此分段覆盖的提取文本;相邻分段可能重叠。 |
| data[].tokens | integer | 必有; 此段的估算 token 数,不是模型分词器计数。; 最小: 0 |
| data[].page | integer / null | 必有; 分段起点所在源文页码,从一开始;无页码映射时为 null。 |
| data[].span | integer[] | 必有; 以 UTF-16 代码单元表示的起止位置。; 最少条数: 2; 最多条数: 2 |
| data[].overlap_prev_tokens | integer | 必有; 与前段重叠的估算 token 数;首段为零。; 最小: 0 |
| data[].overlap_next_tokens | integer | 必有; 与后段重叠的估算 token 数;末段为零。; 最小: 0 |
| first_id | string / null | 必有; 本页首项的 ID;空页为 null。 |
| last_id | string / null | 必有; 本页末项的 ID,可作为 after 继续查询;空页为 null。 |
| has_more | boolean | 必有; 当前游标范围内,本页之后是否还有条目。 |
GET /knowledge/v1/vector_stores/{vector_store_id}/segments/{chunk_id}
读取一个分段及其词频统计。chunk_id 来自分段列表或原生搜索 content;分段必须属于此知识库。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| chunk_id | path: string | 必填;分段列表或原生搜索 content 返回的分段 ID。 最短字符数: 1 |
curl -X GET "https://api.deepraxis.ai/knowledge/v1/vector_stores/${VECTOR_STORE_ID}/segments/${CHUNK_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 必有; 资源 ID。; 最短字符数: 1 |
| file_id | string | 必有; 资源 ID。; 最短字符数: 1 |
| index | integer | 必有; 此段在源文中的序号,从零开始。; 最小: 0 |
| text | string | 必有; 此分段覆盖的提取文本;相邻分段可能重叠。 |
| tokens | integer | 必有; 此段的估算 token 数,不是模型分词器计数。; 最小: 0 |
| page | integer / null | 必有; 分段起点所在源文页码,从一开始;无页码映射时为 null。 |
| span | integer[] | 必有; 以 UTF-16 代码单元表示的起止位置。; 最少条数: 2; 最多条数: 2 |
| overlap_prev_tokens | integer | 必有; 与前段重叠的估算 token 数;首段为零。; 最小: 0 |
| overlap_next_tokens | integer | 必有; 与后段重叠的估算 token 数;末段为零。; 最小: 0 |
| terms | object[] | 必有; 此段出现的关键词及其段内频次、全库包含段数。 |
| terms[].term | string | 必有; 小写文本词;连续汉字还生成相邻双字词。 |
| terms[].count | integer | 必有; 该词在此段中的出现次数。; 最小: 0 |
| terms[].chunks_in_store | integer | 必有; 此库索引中包含该词的分段数。; 最小: 0 |
路径中的 ID 使用已有资源的 ID。示例中的环境变量由调用者设置。
GET /knowledge/v1/vector_stores/{vector_store_id}/events
按序号升序读取此知识库事件,软删除期间仍可读取。将 next_seq 作为 after_seq 继续查询;next_seq 为 null 表示当前已到末尾。例如 ?after_seq=0&limit=20。
| 名称 | 位置与类型 | 说明 |
|---|---|---|
| vector_store_id | path: string | 必填;创建或列表返回的知识库 ID;不要使用显示名称。 最短字符数: 1 |
| after_seq | query: integer | 返回 seq 更大的事件;使用 next_seq 继续。当前忽略非数字文本。 默认: 0 |
| limit | query: integer | 每页条数。 最小: 1; 最大: 100; 默认: 20 |
curl -X GET "https://api.deepraxis.ai/knowledge/v1/vector_stores/${VECTOR_STORE_ID}/events" \
-H "Authorization: Bearer $PRAXIS_API_KEY"HTTP 200
| 字段 | 类型 | 说明 |
|---|---|---|
| data | object[] | 必有; seq 大于 after_seq 的事件,按 seq 升序返回。 |
| data[].seq | integer | 必有; 库内递增事件序号;将返回的 next_seq 作为 after_seq 继续查询。; 最小: 1 |
| data[].id | string | 必有; 服务端生成的事件 UUID。 |
| data[].type | "vector_store.created" / "vector_store.updated" / "vector_store.expired" / "vector_store.deleted" / "vector_store.restored" / "file.attached" / "file.stage_changed" / "file.completed" / "file.failed" / "file.cancelled" / "file.removed" / "batch.created" / "batch.completed" / "batch.cancelled" | 必有; 此知识库记录的库、文件入库或批次事件类别。 |
| data[].processed_at | integer | 必有; Unix 时间戳,单位秒。 |
| data[].vector_store_id | string | 必有; 资源 ID。; 最短字符数: 1 |
| data[].file_id | string / null | 必有; 关联的源 File ID;无关联文件时为 null。 |
| data[].batch_id | string / null | 必有; 关联的文件批次 ID;无关联批次时为 null。 |
| data[].data | object | 必有; 事件详情;阶段变化含 stage,入库失败含 code,其它事件可为空对象。 |
| next_seq | integer / null | 必有; 作为下一页的 after_seq;null 表示没有后续。 |
| HTTP | code | 处理建议 |
|---|---|---|
| 400 | INVALID_PARAMS | 字段、筛选条件或分页参数无效。 |
| 400 | LIMIT_EXCEEDED | 超过容量或批次上限。 |
| 401 | UNAUTHENTICATED | 检查 API Key;兼容响应 code 为 null。 |
| 404 | VECTOR_STORE_NOT_FOUND | 知识库不存在或不可访问。 |
| 404 | FILE_NOT_FOUND | 源文件不存在。 |
| 404 | FILE_NOT_IN_STORE | 文件未加入此知识库。 |
| 404 | BATCH_NOT_FOUND | 批次不存在。 |
| 404 | CHUNK_NOT_FOUND | 分段不存在。 |
| 409 | VECTOR_STORE_INVALID_STATE | 知识库当前状态不允许该操作。 |
| 409 | FILE_INVALID_STATE | 仅 failed 文件可以重试。 |
| 413 | PAYLOAD_TOO_LARGE | JSON 请求超过 1,000,000 字节;兼容响应的 code 可能为 null。 |
| 429 | RATE_LIMITED | 稍后重试。 |
| 500 | — / null | 服务内部错误;保留请求 ID 并稍后重试。 |
| 501 | NOT_IMPLEMENTED | 操作尚未实现。 |
| 503 | PROVIDER_UNAVAILABLE | 处理服务暂不可用,可稍后重试。 |
| 字段 | 类型 | 说明 |
|---|---|---|
| error | object | 必有 |
| error.code | "INVALID_PARAMS" / "LIMIT_EXCEEDED" / "UNAUTHENTICATED" / "VECTOR_STORE_NOT_FOUND" / "FILE_NOT_FOUND" / "FILE_NOT_IN_STORE" / "BATCH_NOT_FOUND" / "CHUNK_NOT_FOUND" / "VECTOR_STORE_INVALID_STATE" / "FILE_INVALID_STATE" / "PAYLOAD_TOO_LARGE" / "RATE_LIMITED" / "NOT_IMPLEMENTED" / "PROVIDER_UNAVAILABLE" | 可选 |
| error.message | string | 必有 |
| error.details | string / null | 可选 |
| 字段 | 类型 | 说明 |
|---|---|---|
| error | object | 必有 |
| error.message | string | 必有 |
| error.type | "invalid_request_error" / "not_found_error" / "rate_limit_error" / "server_error" | 必有 |
| error.param | string / null | 必有 |
| error.code | "INVALID_PARAMS" / "LIMIT_EXCEEDED" / "UNAUTHENTICATED" / "VECTOR_STORE_NOT_FOUND" / "FILE_NOT_FOUND" / "FILE_NOT_IN_STORE" / "BATCH_NOT_FOUND" / "CHUNK_NOT_FOUND" / "VECTOR_STORE_INVALID_STATE" / "FILE_INVALID_STATE" / "PAYLOAD_TOO_LARGE" / "RATE_LIMITED" / "NOT_IMPLEMENTED" / "PROVIDER_UNAVAILABLE" / null | 必有 |
未知路径的 404 可能只有 error.message;401 可能没有 details,兼容接口的 413 可能返回 code: null。路径编码错误也可能返回 HTML。不要假定每个失败都有业务错误码。
添加文件成功并不表示内容已可搜索。检查文件 status;failed 时读取 last_error。
| last_error.code | 含义 | 建议 |
|---|---|---|
| unsupported_file | 解析器不支持该文件 | 转换为 TXT、Markdown 或已验证的格式 |
| invalid_file | 内容无效、为空、加密或超过估算 token 上限 | 检查内容、解密或拆分文件 |
| server_error | 处理失败或超过 30 分钟截止时间 | 稍后用 retry 重试失败文件 |
用 API Key 作为 Bearer 凭据,通过以下地址管理库与表结构。
https://api.deepraxis.ai/database/v1
POST /database/v1/databases
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| name | string | 是 | 名称 |
| labels | object | 否 | 标签 |
返回: Database.
Success
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Database identifier, prefixed db_. Pass it as database_id in every database, table, field, rows and events path. |
| name | string | Display name given at creation or by the last update; it is not an identifier. |
| labels | object | String tags attached to the database, as key and value pairs; empty object when none. |
| status | string | Lifecycle state of the database. Table, field and row calls work only while it is active. |
| table_count | integer | Number of tables currently in the database, at most 50; refreshed when the schema changes. |
| size_bytes | integer | Storage size; row writes and GET refresh usage at most once per five seconds, schema changes refresh immediately. |
| created_at | string | Time the database was created, as an RFC 3339 UTC timestamp. |
| updated_at | string | Time of the last change to the name, labels, status or usage snapshot, as an RFC 3339 UTC timestamp. |
| deleted_at | string | null | Time the database entered the deleting state, as an RFC 3339 UTC timestamp; null while it is active and again after a restore. |
| purge_at | string | null | Permanent deletion deadline for deleting databases; null otherwise. |
curl -X POST "https://api.deepraxis.ai/database/v1/databases" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"walk-lib-r1-DOC-5320-tasks","labels":{"purpose":"docs","sample":"walk-lib-r1-doc-5320-"}}'响应示例 — HTTP 201
{
"id": "db_d6f0d743d5a645e8",
"name": "walk-lib-r1-DOC-5320-tasks",
"labels": {
"purpose": "docs",
"sample": "walk-lib-r1-doc-5320-"
},
"status": "active",
"table_count": 0,
"size_bytes": 53248,
"created_at": "2026-10-11T17:41:40.620Z",
"updated_at": "2026-10-11T17:41:41.488Z",
"deleted_at": null,
"purge_at": null
}GET /database/v1/databases
| 参数 | 位置 | 说明 |
|---|---|---|
| cursor | query | 上一页返回的 next_cursor。 |
| limit | query | 最多返回的条数。 (default: 20) (1–100) |
| labels | query | 精确匹配标签,例如 labels[purpose]=docs。 |
| status | query | 库状态:active 或 deleting;省略时只列出 active。 |
返回: Page + object.
Success
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | Databases on this page, newest first (created_at descending, ties by id). Deleting databases are excluded unless status=deleting. |
| data[].id | string | Database identifier, prefixed db_. Pass it as database_id in every database, table, field, rows and events path. |
| data[].name | string | Display name given at creation or by the last update; it is not an identifier. |
| data[].labels | object | String tags attached to the database, as key and value pairs; empty object when none. |
| data[].status | string | Lifecycle state of the database. Table, field and row calls work only while it is active. |
| data[].table_count | integer | Number of tables currently in the database, at most 50; refreshed when the schema changes. |
| data[].size_bytes | integer | Storage size; row writes and GET refresh usage at most once per five seconds, schema changes refresh immediately. |
| data[].created_at | string | Time the database was created, as an RFC 3339 UTC timestamp. |
| data[].updated_at | string | Time of the last change to the name, labels, status or usage snapshot, as an RFC 3339 UTC timestamp. |
| data[].deleted_at | string | null | Time the database entered the deleting state, as an RFC 3339 UTC timestamp; null while it is active and again after a restore. |
| data[].purge_at | string | null | Permanent deletion deadline for deleting databases; null otherwise. |
| next_cursor | string | null | Opaque cursor for the next page, or null when there are no more items. Databases list: pass it as cursor. Events list: pass it as after_seq (order asc) or before_seq (order desc). |
curl -g -X GET "https://api.deepraxis.ai/database/v1/databases?limit=10&labels[purpose]=docs&labels[sample]=walk-lib-r1-doc-5320-" \
-H "Authorization: Bearer $PRAXIS_API_KEY"响应示例 — HTTP 200
{
"data": [
{
"id": "db_d6f0d743d5a645e8",
"name": "walk-lib-r1-DOC-5320-tasks",
"labels": {
"purpose": "docs",
"sample": "walk-lib-r1-doc-5320-"
},
"status": "active",
"table_count": 0,
"size_bytes": 53248,
"created_at": "2026-10-11T17:41:40.620Z",
"updated_at": "2026-10-11T17:41:41.488Z",
"deleted_at": null,
"purge_at": null
}
],
"next_cursor": null
}GET /database/v1/databases/{database_id}
| 参数 | 位置 | 说明 |
|---|---|---|
| database_id | path | 库 ID。 |
返回: Database.
Success
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Database identifier, prefixed db_. Pass it as database_id in every database, table, field, rows and events path. |
| name | string | Display name given at creation or by the last update; it is not an identifier. |
| labels | object | String tags attached to the database, as key and value pairs; empty object when none. |
| status | string | Lifecycle state of the database. Table, field and row calls work only while it is active. |
| table_count | integer | Number of tables currently in the database, at most 50; refreshed when the schema changes. |
| size_bytes | integer | Storage size; row writes and GET refresh usage at most once per five seconds, schema changes refresh immediately. |
| created_at | string | Time the database was created, as an RFC 3339 UTC timestamp. |
| updated_at | string | Time of the last change to the name, labels, status or usage snapshot, as an RFC 3339 UTC timestamp. |
| deleted_at | string | null | Time the database entered the deleting state, as an RFC 3339 UTC timestamp; null while it is active and again after a restore. |
| purge_at | string | null | Permanent deletion deadline for deleting databases; null otherwise. |
curl -X GET "https://api.deepraxis.ai/database/v1/databases/${DATABASE_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"响应示例 — HTTP 200
{
"id": "db_d6f0d743d5a645e8",
"name": "walk-lib-r1-DOC-5320-tasks",
"labels": {
"purpose": "docs",
"sample": "walk-lib-r1-doc-5320-"
},
"status": "active",
"table_count": 0,
"size_bytes": 53248,
"created_at": "2026-10-11T17:41:40.620Z",
"updated_at": "2026-10-11T17:41:41.488Z",
"deleted_at": null,
"purge_at": null
}PATCH /database/v1/databases/{database_id}
| 参数 | 位置 | 说明 |
|---|---|---|
| database_id | path | 库 ID。 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| name | string | 否 | 名称 |
| labels | object | 否 | 标签 |
返回: Database.
Success
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Database identifier, prefixed db_. Pass it as database_id in every database, table, field, rows and events path. |
| name | string | Display name given at creation or by the last update; it is not an identifier. |
| labels | object | String tags attached to the database, as key and value pairs; empty object when none. |
| status | string | Lifecycle state of the database. Table, field and row calls work only while it is active. |
| table_count | integer | Number of tables currently in the database, at most 50; refreshed when the schema changes. |
| size_bytes | integer | Storage size; row writes and GET refresh usage at most once per five seconds, schema changes refresh immediately. |
| created_at | string | Time the database was created, as an RFC 3339 UTC timestamp. |
| updated_at | string | Time of the last change to the name, labels, status or usage snapshot, as an RFC 3339 UTC timestamp. |
| deleted_at | string | null | Time the database entered the deleting state, as an RFC 3339 UTC timestamp; null while it is active and again after a restore. |
| purge_at | string | null | Permanent deletion deadline for deleting databases; null otherwise. |
curl -X PATCH "https://api.deepraxis.ai/database/v1/databases/${DATABASE_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"walk-lib-r1-DOC-5320-notes"}'响应示例 — HTTP 200
{
"id": "db_d6f0d743d5a645e8",
"name": "walk-lib-r1-DOC-5320-notes",
"labels": {
"purpose": "docs",
"sample": "walk-lib-r1-doc-5320-"
},
"status": "active",
"table_count": 0,
"size_bytes": 53248,
"created_at": "2026-10-11T17:41:40.620Z",
"updated_at": "2026-10-11T17:41:43.514Z",
"deleted_at": null,
"purge_at": null
}DELETE /database/v1/databases/{database_id}
| 参数 | 位置 | 说明 |
|---|---|---|
| database_id | path | 库 ID。 |
返回: Database.
Success
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Database identifier, prefixed db_. Pass it as database_id in every database, table, field, rows and events path. |
| name | string | Display name given at creation or by the last update; it is not an identifier. |
| labels | object | String tags attached to the database, as key and value pairs; empty object when none. |
| status | string | Lifecycle state of the database. Table, field and row calls work only while it is active. |
| table_count | integer | Number of tables currently in the database, at most 50; refreshed when the schema changes. |
| size_bytes | integer | Storage size; row writes and GET refresh usage at most once per five seconds, schema changes refresh immediately. |
| created_at | string | Time the database was created, as an RFC 3339 UTC timestamp. |
| updated_at | string | Time of the last change to the name, labels, status or usage snapshot, as an RFC 3339 UTC timestamp. |
| deleted_at | string | null | Time the database entered the deleting state, as an RFC 3339 UTC timestamp; null while it is active and again after a restore. |
| purge_at | string | null | Permanent deletion deadline for deleting databases; null otherwise. |
curl -X DELETE "https://api.deepraxis.ai/database/v1/databases/${DATABASE_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"响应示例 — HTTP 200
{
"id": "db_d6f0d743d5a645e8",
"name": "walk-lib-r1-DOC-5320-notes",
"labels": {
"purpose": "docs",
"sample": "walk-lib-r1-doc-5320-"
},
"status": "deleting",
"table_count": 0,
"size_bytes": 53248,
"created_at": "2026-10-11T17:41:40.620Z",
"updated_at": "2026-10-11T17:41:51.868Z",
"deleted_at": "2026-10-11T17:41:51.868Z",
"purge_at": "2026-10-18T17:41:51.868Z"
}POST /database/v1/databases/{database_id}/restore
| 参数 | 位置 | 说明 |
|---|---|---|
| database_id | path | 库 ID。 |
返回: Database.
Success
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Database identifier, prefixed db_. Pass it as database_id in every database, table, field, rows and events path. |
| name | string | Display name given at creation or by the last update; it is not an identifier. |
| labels | object | String tags attached to the database, as key and value pairs; empty object when none. |
| status | string | Lifecycle state of the database. Table, field and row calls work only while it is active. |
| table_count | integer | Number of tables currently in the database, at most 50; refreshed when the schema changes. |
| size_bytes | integer | Storage size; row writes and GET refresh usage at most once per five seconds, schema changes refresh immediately. |
| created_at | string | Time the database was created, as an RFC 3339 UTC timestamp. |
| updated_at | string | Time of the last change to the name, labels, status or usage snapshot, as an RFC 3339 UTC timestamp. |
| deleted_at | string | null | Time the database entered the deleting state, as an RFC 3339 UTC timestamp; null while it is active and again after a restore. |
| purge_at | string | null | Permanent deletion deadline for deleting databases; null otherwise. |
curl -X POST "https://api.deepraxis.ai/database/v1/databases/${DATABASE_ID}/restore" \
-H "Authorization: Bearer $PRAXIS_API_KEY"响应示例 — HTTP 200
{
"id": "db_d6f0d743d5a645e8",
"name": "walk-lib-r1-DOC-5320-notes",
"labels": {
"purpose": "docs",
"sample": "walk-lib-r1-doc-5320-"
},
"status": "active",
"table_count": 0,
"size_bytes": 53248,
"created_at": "2026-10-11T17:41:40.620Z",
"updated_at": "2026-10-11T17:41:51.528Z",
"deleted_at": null,
"purge_at": null
}POST /database/v1/databases/{database_id}/purge
| 参数 | 位置 | 说明 |
|---|---|---|
| database_id | path | 库 ID。 |
返回: object.
Permanently purged
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Id (db_…) of the database that was permanently purged; it no longer resolves. |
| object | string | Resource type of the purged object; always database. |
| purged | boolean | Always true: the database and all of its data were permanently removed and cannot be recovered. |
curl -X POST "https://api.deepraxis.ai/database/v1/databases/${DATABASE_ID}/purge" \
-H "Authorization: Bearer $PRAXIS_API_KEY"响应示例 — HTTP 200
{
"id": "db_d6f0d743d5a645e8",
"object": "database",
"purged": true
}| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 资源 ID; ^db_ |
| name | string | 是 | 名称 |
| labels | object | 是 | 标签 |
| status | "provisioning" / "active" / "deleting" / "deleted" / "failed" | 是 | 库状态 |
| table_count | integer | 是 | 表数量 |
| size_bytes | integer | 是 | 占用字节数 |
| created_at | date-time | 是 | 创建时间 |
| updated_at | date-time | 是 | 更新时间 |
| deleted_at | date-time / null | 是 | 删除时间;未删除时为 null |
| purge_at | date-time / null | 是 | — |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| data | JSON[] | 是 | 资源数组 |
| next_cursor | string / null | 是 | 下一页游标;没有后续时为 null |
POST /database/v1/databases/{database_id}/tables
| 参数 | 位置 | 说明 |
|---|---|---|
| database_id | path | 库 ID。 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| name | string | 是 | 名称; ^[a-z_][a-z0-9_]{0,62}$ |
| description | string | 否 | 描述 |
| fields | NewField[] | 是 | 字段列表 |
返回: Table.
Success
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Table identifier, prefixed tbl_. Stable across renames and accepted wherever a table path parameter takes an id or name. |
| name | string | Current table name, usable in the rows path; may change when the table is renamed. |
| description | string | null | Free-text note about the table, or null when none was set. |
| fields | array<object> | Field definitions of the table, in display order. Row values are keyed by each field's name. |
| fields[].id | string | Field identifier, prefixed fld_. Stable across renames; accepted wherever a field path parameter takes an id or name. |
| fields[].name | string | Current field name; rows are keyed by it in requests and responses. May change when the field is renamed. |
| fields[].description | string | null | Free-text note about the field, or null when none was set. |
| fields[].required | boolean | Whether every row must hold a non-null value for this field. |
| fields[].unique | boolean | Whether values must be distinct across rows; fixed at creation. A unique field is indexed, and a violation returns 409 UNIQUE_VIOLATION. |
| fields[].indexed | boolean | Whether an index is maintained for faster filters and ordering. Always false for json and link fields. |
| fields[].type | string | Scalar data type of the field; it cannot be changed after the field is created. / Type json: the value is any JSON document validated against options.schema. It cannot be changed after the field is created. / Type link: the value is the id of a row in another table (an array of ids when options.multiple is true). It cannot be changed after the field is created. |
| fields[].options | object | Scalar fields take no options; always an empty object. / Settings of a json field. schema is required. / Settings of a link field. Both linked_table_id and multiple are required. |
| fields[].default | any | Default JSON value for omitted insert fields; must match the field type and JSON schema. A datetime default of "now()" evaluates to server time on insertion and reads back as "now()" in the field definition. For string and json fields it is a literal string. Explicit null remains null. Link fields do not support defaults. |
| schema_revision | integer | Counter that starts at 1 and increases by one each time the table's name, description or fields change; use it to detect schema changes. |
| created_at | string | Time the table was created, as an RFC 3339 UTC timestamp. |
| updated_at | string | Time of the last schema change to the table, as an RFC 3339 UTC timestamp. |
| row_count | integer | Number of rows currently stored. Returned only by databaseGetTable; absent from list, create and field responses. |
curl -X POST "https://api.deepraxis.ai/database/v1/databases/${DATABASE_ID}/tables" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"tasks","fields":[{"name":"title","type":"string","required":true,"unique":true},{"name":"done","type":"boolean"}]}'响应示例 — HTTP 201
{
"id": "tbl_2b3431c772754599",
"name": "tasks",
"description": null,
"schema_revision": 1,
"created_at": "2026-10-11T17:41:44.246Z",
"updated_at": "2026-10-11T17:41:44.246Z",
"fields": [
{
"id": "fld_bc71f7c6a1a848d2",
"name": "title",
"type": "string",
"description": null,
"required": true,
"unique": true,
"indexed": true
},
{
"id": "fld_c7879883dfe04ca0",
"name": "done",
"type": "boolean",
"description": null,
"required": false,
"unique": false,
"indexed": true
}
]
}GET /database/v1/databases/{database_id}/tables
| 参数 | 位置 | 说明 |
|---|---|---|
| database_id | path | 库 ID。 |
返回: Page + object.
Success
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | Every table of the database with its fields, in creation order; at most 50 items. |
| data[].id | string | Table identifier, prefixed tbl_. Stable across renames and accepted wherever a table path parameter takes an id or name. |
| data[].name | string | Current table name, usable in the rows path; may change when the table is renamed. |
| data[].description | string | null | Free-text note about the table, or null when none was set. |
| data[].fields | array<object> | Field definitions of the table, in display order. Row values are keyed by each field's name. |
| data[].schema_revision | integer | Counter that starts at 1 and increases by one each time the table's name, description or fields change; use it to detect schema changes. |
| data[].created_at | string | Time the table was created, as an RFC 3339 UTC timestamp. |
| data[].updated_at | string | Time of the last schema change to the table, as an RFC 3339 UTC timestamp. |
| data[].row_count | integer | Number of rows currently stored. Returned only by databaseGetTable; absent from list, create and field responses. |
| next_cursor | string | null | Opaque cursor for the next page, or null when there are no more items. Databases list: pass it as cursor. Events list: pass it as after_seq (order asc) or before_seq (order desc). |
curl -X GET "https://api.deepraxis.ai/database/v1/databases/${DATABASE_ID}/tables" \
-H "Authorization: Bearer $PRAXIS_API_KEY"响应示例 — HTTP 200
{
"data": [
{
"id": "tbl_2b3431c772754599",
"name": "tasks",
"description": null,
"schema_revision": 1,
"created_at": "2026-10-11T17:41:44.246Z",
"updated_at": "2026-10-11T17:41:44.246Z",
"fields": [
{
"id": "fld_bc71f7c6a1a848d2",
"name": "title",
"type": "string",
"description": null,
"required": true,
"unique": true,
"indexed": true
},
{
"id": "fld_c7879883dfe04ca0",
"name": "done",
"type": "boolean",
"description": null,
"required": false,
"unique": false,
"indexed": true
}
]
}
],
"next_cursor": null
}GET /database/v1/databases/{database_id}/tables/{table}
| 参数 | 位置 | 说明 |
|---|---|---|
| database_id | path | 库 ID。 |
| table | path | 表 ID 或名称。 |
返回: Table.
Success
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Table identifier, prefixed tbl_. Stable across renames and accepted wherever a table path parameter takes an id or name. |
| name | string | Current table name, usable in the rows path; may change when the table is renamed. |
| description | string | null | Free-text note about the table, or null when none was set. |
| fields | array<object> | Field definitions of the table, in display order. Row values are keyed by each field's name. |
| fields[].id | string | Field identifier, prefixed fld_. Stable across renames; accepted wherever a field path parameter takes an id or name. |
| fields[].name | string | Current field name; rows are keyed by it in requests and responses. May change when the field is renamed. |
| fields[].description | string | null | Free-text note about the field, or null when none was set. |
| fields[].required | boolean | Whether every row must hold a non-null value for this field. |
| fields[].unique | boolean | Whether values must be distinct across rows; fixed at creation. A unique field is indexed, and a violation returns 409 UNIQUE_VIOLATION. |
| fields[].indexed | boolean | Whether an index is maintained for faster filters and ordering. Always false for json and link fields. |
| fields[].type | string | Scalar data type of the field; it cannot be changed after the field is created. / Type json: the value is any JSON document validated against options.schema. It cannot be changed after the field is created. / Type link: the value is the id of a row in another table (an array of ids when options.multiple is true). It cannot be changed after the field is created. |
| fields[].options | object | Scalar fields take no options; always an empty object. / Settings of a json field. schema is required. / Settings of a link field. Both linked_table_id and multiple are required. |
| fields[].default | any | Default JSON value for omitted insert fields; must match the field type and JSON schema. A datetime default of "now()" evaluates to server time on insertion and reads back as "now()" in the field definition. For string and json fields it is a literal string. Explicit null remains null. Link fields do not support defaults. |
| schema_revision | integer | Counter that starts at 1 and increases by one each time the table's name, description or fields change; use it to detect schema changes. |
| created_at | string | Time the table was created, as an RFC 3339 UTC timestamp. |
| updated_at | string | Time of the last schema change to the table, as an RFC 3339 UTC timestamp. |
| row_count | integer | Number of rows currently stored. Returned only by databaseGetTable; absent from list, create and field responses. |
curl -X GET "https://api.deepraxis.ai/database/v1/databases/${DATABASE_ID}/tables/tasks" \
-H "Authorization: Bearer $PRAXIS_API_KEY"响应示例 — HTTP 200
{
"id": "tbl_2b3431c772754599",
"name": "tasks",
"description": null,
"schema_revision": 1,
"created_at": "2026-10-11T17:41:44.246Z",
"updated_at": "2026-10-11T17:41:44.246Z",
"fields": [
{
"id": "fld_bc71f7c6a1a848d2",
"name": "title",
"type": "string",
"description": null,
"required": true,
"unique": true,
"indexed": true
},
{
"id": "fld_c7879883dfe04ca0",
"name": "done",
"type": "boolean",
"description": null,
"required": false,
"unique": false,
"indexed": true
}
],
"row_count": 0
}PATCH /database/v1/databases/{database_id}/tables/{table}
| 参数 | 位置 | 说明 |
|---|---|---|
| database_id | path | 库 ID。 |
| table | path | 表 ID 或名称。 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| name | string | 否 | 名称 |
| description | string / null | 否 | 描述 |
返回: Table.
Success
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Table identifier, prefixed tbl_. Stable across renames and accepted wherever a table path parameter takes an id or name. |
| name | string | Current table name, usable in the rows path; may change when the table is renamed. |
| description | string | null | Free-text note about the table, or null when none was set. |
| fields | array<object> | Field definitions of the table, in display order. Row values are keyed by each field's name. |
| fields[].id | string | Field identifier, prefixed fld_. Stable across renames; accepted wherever a field path parameter takes an id or name. |
| fields[].name | string | Current field name; rows are keyed by it in requests and responses. May change when the field is renamed. |
| fields[].description | string | null | Free-text note about the field, or null when none was set. |
| fields[].required | boolean | Whether every row must hold a non-null value for this field. |
| fields[].unique | boolean | Whether values must be distinct across rows; fixed at creation. A unique field is indexed, and a violation returns 409 UNIQUE_VIOLATION. |
| fields[].indexed | boolean | Whether an index is maintained for faster filters and ordering. Always false for json and link fields. |
| fields[].type | string | Scalar data type of the field; it cannot be changed after the field is created. / Type json: the value is any JSON document validated against options.schema. It cannot be changed after the field is created. / Type link: the value is the id of a row in another table (an array of ids when options.multiple is true). It cannot be changed after the field is created. |
| fields[].options | object | Scalar fields take no options; always an empty object. / Settings of a json field. schema is required. / Settings of a link field. Both linked_table_id and multiple are required. |
| fields[].default | any | Default JSON value for omitted insert fields; must match the field type and JSON schema. A datetime default of "now()" evaluates to server time on insertion and reads back as "now()" in the field definition. For string and json fields it is a literal string. Explicit null remains null. Link fields do not support defaults. |
| schema_revision | integer | Counter that starts at 1 and increases by one each time the table's name, description or fields change; use it to detect schema changes. |
| created_at | string | Time the table was created, as an RFC 3339 UTC timestamp. |
| updated_at | string | Time of the last schema change to the table, as an RFC 3339 UTC timestamp. |
| row_count | integer | Number of rows currently stored. Returned only by databaseGetTable; absent from list, create and field responses. |
curl -X PATCH "https://api.deepraxis.ai/database/v1/databases/${DATABASE_ID}/tables/tasks" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"description":"Tasks for an agent"}'响应示例 — HTTP 200
{
"id": "tbl_2b3431c772754599",
"name": "tasks",
"description": "Tasks for an agent",
"schema_revision": 2,
"created_at": "2026-10-11T17:41:44.246Z",
"updated_at": "2026-10-11T17:41:45.127Z",
"fields": [
{
"id": "fld_bc71f7c6a1a848d2",
"name": "title",
"type": "string",
"description": null,
"required": true,
"unique": true,
"indexed": true
},
{
"id": "fld_c7879883dfe04ca0",
"name": "done",
"type": "boolean",
"description": null,
"required": false,
"unique": false,
"indexed": true
}
]
}DELETE /database/v1/databases/{database_id}/tables/{table}
| 参数 | 位置 | 说明 |
|---|---|---|
| database_id | path | 库 ID。 |
| table | path | 表 ID 或名称。 |
返回: object.
Success
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| deleted | boolean | Always true: the table and all of its rows were dropped immediately and cannot be recovered. |
curl -X DELETE "https://api.deepraxis.ai/database/v1/databases/${DATABASE_ID}/tables/tasks" \
-H "Authorization: Bearer $PRAXIS_API_KEY"响应示例 — HTTP 200
{
"deleted": true
}| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 资源 ID; ^tbl_ |
| name | string | 是 | 名称 |
| description | string / null | 是 | 描述 |
| fields | Field[] | 是 | 字段列表 |
| schema_revision | integer | 是 | 表结构版本 |
| created_at | date-time | 是 | 创建时间 |
| updated_at | date-time | 是 | 更新时间 |
| row_count | integer | 否 | 行数;仅单表查询返回 |
添加、更新和删除字段均返回完整 Table。字段 type 不可修改;link 的关联目标不可修改。json 的 schema 更新仅约束之后的写入。
新增带 default 的字段时,已有行一律用 default 回填(无论是否 required),行的 _version 不变;不带 default 的新字段在已有行上为 null。在已有行的表上新增 required 字段时必须提供 default,没有 default 时返回 400 VALIDATION_FAILED。把字段改为 required 时,若仍有行在该字段为空,返回 400 VALIDATION_FAILED 并在 message 中给出空行数。空请求体、只含被忽略键或所有值都与当前相同的 PATCH 不修改 updated_at 与 schema_revision、不产生事件,直接返回当前对象。
datetime 的 default 可以是字符串 "now()",插入时生成服务器当前 UTC 时间;读回字段定义仍是 "now()"。例如 {"name":"created_at","type":"datetime","default":"now()"}。string/json 的 "now()" 保持字面量;其他类型仍按原校验规则处理。新增字段回填已有行时也会求值。
POST /database/v1/databases/{database_id}/tables/{table}/fields
| 参数 | 位置 | 说明 |
|---|---|---|
| database_id | path | 库 ID。 |
| table | path | 表 ID 或名称。 |
"string" / "integer" / "number" / "boolean" / "datetime"
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| name | string | 是 | 字段名;只保留 id;新字段不能以下划线开头。created_at、updated_at、version 可作为用户字段名;已有下划线字段照常使用,且优先于同名元数据。; ^(?!id$)[a-z][a-z0-9_]{0,62}$ |
| description | string | 否 | 描述 |
| required | boolean | 否 | 是否必填 |
| unique | boolean | 否 | 是否唯一 |
| indexed | boolean | 否 | 是否索引 |
| type | "string" / "integer" / "number" / "boolean" / "datetime" | 是 | 类型 |
| options | object | 否 | json:schema;link:linked_table_id 与 multiple |
| default | JSON | 否 | 省略插入值时的默认值;datetime 的 now() 在写入时取服务器时间,字段定义仍读回 now()。string/json 中为字面量。显式 null 不使用默认值。 |
"json"
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| name | string | 是 | 字段名;只保留 id;新字段不能以下划线开头。created_at、updated_at、version 可作为用户字段名;已有下划线字段照常使用,且优先于同名元数据。; ^(?!id$)[a-z][a-z0-9_]{0,62}$ |
| description | string | 否 | 描述 |
| required | boolean | 否 | 是否必填 |
| unique | boolean | 否 | 是否唯一 |
| indexed | boolean | 否 | 是否索引 |
| type | "json" | 是 | 类型 |
| options | object | 是 | json:schema;link:linked_table_id 与 multiple |
| default | JSON | 否 | 省略插入值时的默认值;datetime 的 now() 在写入时取服务器时间,字段定义仍读回 now()。string/json 中为字面量。显式 null 不使用默认值。 |
"link"
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| name | string | 是 | 字段名;只保留 id;新字段不能以下划线开头。created_at、updated_at、version 可作为用户字段名;已有下划线字段照常使用,且优先于同名元数据。; ^(?!id$)[a-z][a-z0-9_]{0,62}$ |
| description | string | 否 | 描述 |
| required | boolean | 否 | 是否必填 |
| unique | boolean | 否 | 是否唯一 |
| indexed | boolean | 否 | 是否索引 |
| type | "link" | 是 | 类型 |
| options | object | 是 | json:schema;link:linked_table_id 与 multiple |
返回: Table.
Success
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Table identifier, prefixed tbl_. Stable across renames and accepted wherever a table path parameter takes an id or name. |
| name | string | Current table name, usable in the rows path; may change when the table is renamed. |
| description | string | null | Free-text note about the table, or null when none was set. |
| fields | array<object> | Field definitions of the table, in display order. Row values are keyed by each field's name. |
| fields[].id | string | Field identifier, prefixed fld_. Stable across renames; accepted wherever a field path parameter takes an id or name. |
| fields[].name | string | Current field name; rows are keyed by it in requests and responses. May change when the field is renamed. |
| fields[].description | string | null | Free-text note about the field, or null when none was set. |
| fields[].required | boolean | Whether every row must hold a non-null value for this field. |
| fields[].unique | boolean | Whether values must be distinct across rows; fixed at creation. A unique field is indexed, and a violation returns 409 UNIQUE_VIOLATION. |
| fields[].indexed | boolean | Whether an index is maintained for faster filters and ordering. Always false for json and link fields. |
| fields[].type | string | Scalar data type of the field; it cannot be changed after the field is created. / Type json: the value is any JSON document validated against options.schema. It cannot be changed after the field is created. / Type link: the value is the id of a row in another table (an array of ids when options.multiple is true). It cannot be changed after the field is created. |
| fields[].options | object | Scalar fields take no options; always an empty object. / Settings of a json field. schema is required. / Settings of a link field. Both linked_table_id and multiple are required. |
| fields[].default | any | Default JSON value for omitted insert fields; must match the field type and JSON schema. A datetime default of "now()" evaluates to server time on insertion and reads back as "now()" in the field definition. For string and json fields it is a literal string. Explicit null remains null. Link fields do not support defaults. |
| schema_revision | integer | Counter that starts at 1 and increases by one each time the table's name, description or fields change; use it to detect schema changes. |
| created_at | string | Time the table was created, as an RFC 3339 UTC timestamp. |
| updated_at | string | Time of the last schema change to the table, as an RFC 3339 UTC timestamp. |
| row_count | integer | Number of rows currently stored. Returned only by databaseGetTable; absent from list, create and field responses. |
curl -X POST "https://api.deepraxis.ai/database/v1/databases/${DATABASE_ID}/tables/tasks/fields" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"priority","type":"integer"}'响应示例 — HTTP 201
{
"id": "tbl_2b3431c772754599",
"name": "tasks",
"description": "Tasks for an agent",
"schema_revision": 3,
"created_at": "2026-10-11T17:41:44.246Z",
"updated_at": "2026-10-11T17:41:45.420Z",
"fields": [
{
"id": "fld_bc71f7c6a1a848d2",
"name": "title",
"type": "string",
"description": null,
"required": true,
"unique": true,
"indexed": true
},
{
"id": "fld_c7879883dfe04ca0",
"name": "done",
"type": "boolean",
"description": null,
"required": false,
"unique": false,
"indexed": true
},
{
"id": "fld_4c3e63869e35458c",
"name": "priority",
"type": "integer",
"description": null,
"required": false,
"unique": false,
"indexed": true
}
]
}PATCH /database/v1/databases/{database_id}/tables/{table}/fields/{field}
| 参数 | 位置 | 说明 |
|---|---|---|
| database_id | path | 库 ID。 |
| table | path | 表 ID 或名称。 |
| field | path | 字段 ID 或名称。 |
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| name | string | 否 | 名称 |
| description | string / null | 否 | 描述 |
| required | boolean | 否 | 是否必填 |
| indexed | boolean | 否 | 是否索引 |
| options | object | 否 | json:schema;link:linked_table_id 与 multiple |
| default | JSON | 否 | 省略插入值时的默认值;datetime 的 now() 在写入时取服务器时间,字段定义仍读回 now()。string/json 中为字面量。显式 null 不使用默认值。 |
返回: Table.
Success
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Table identifier, prefixed tbl_. Stable across renames and accepted wherever a table path parameter takes an id or name. |
| name | string | Current table name, usable in the rows path; may change when the table is renamed. |
| description | string | null | Free-text note about the table, or null when none was set. |
| fields | array<object> | Field definitions of the table, in display order. Row values are keyed by each field's name. |
| fields[].id | string | Field identifier, prefixed fld_. Stable across renames; accepted wherever a field path parameter takes an id or name. |
| fields[].name | string | Current field name; rows are keyed by it in requests and responses. May change when the field is renamed. |
| fields[].description | string | null | Free-text note about the field, or null when none was set. |
| fields[].required | boolean | Whether every row must hold a non-null value for this field. |
| fields[].unique | boolean | Whether values must be distinct across rows; fixed at creation. A unique field is indexed, and a violation returns 409 UNIQUE_VIOLATION. |
| fields[].indexed | boolean | Whether an index is maintained for faster filters and ordering. Always false for json and link fields. |
| fields[].type | string | Scalar data type of the field; it cannot be changed after the field is created. / Type json: the value is any JSON document validated against options.schema. It cannot be changed after the field is created. / Type link: the value is the id of a row in another table (an array of ids when options.multiple is true). It cannot be changed after the field is created. |
| fields[].options | object | Scalar fields take no options; always an empty object. / Settings of a json field. schema is required. / Settings of a link field. Both linked_table_id and multiple are required. |
| fields[].default | any | Default JSON value for omitted insert fields; must match the field type and JSON schema. A datetime default of "now()" evaluates to server time on insertion and reads back as "now()" in the field definition. For string and json fields it is a literal string. Explicit null remains null. Link fields do not support defaults. |
| schema_revision | integer | Counter that starts at 1 and increases by one each time the table's name, description or fields change; use it to detect schema changes. |
| created_at | string | Time the table was created, as an RFC 3339 UTC timestamp. |
| updated_at | string | Time of the last schema change to the table, as an RFC 3339 UTC timestamp. |
| row_count | integer | Number of rows currently stored. Returned only by databaseGetTable; absent from list, create and field responses. |
curl -X PATCH "https://api.deepraxis.ai/database/v1/databases/${DATABASE_ID}/tables/tasks/fields/priority" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"description":"Task priority"}'响应示例 — HTTP 200
{
"id": "tbl_2b3431c772754599",
"name": "tasks",
"description": "Tasks for an agent",
"schema_revision": 4,
"created_at": "2026-10-11T17:41:44.246Z",
"updated_at": "2026-10-11T17:41:46.276Z",
"fields": [
{
"id": "fld_bc71f7c6a1a848d2",
"name": "title",
"type": "string",
"description": null,
"required": true,
"unique": true,
"indexed": true
},
{
"id": "fld_c7879883dfe04ca0",
"name": "done",
"type": "boolean",
"description": null,
"required": false,
"unique": false,
"indexed": true
},
{
"id": "fld_4c3e63869e35458c",
"name": "priority",
"type": "integer",
"description": "Task priority",
"required": false,
"unique": false,
"indexed": true
}
]
}DELETE /database/v1/databases/{database_id}/tables/{table}/fields/{field}
| 参数 | 位置 | 说明 |
|---|---|---|
| database_id | path | 库 ID。 |
| table | path | 表 ID 或名称。 |
| field | path | 字段 ID 或名称。 |
返回: Table.
Success
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Table identifier, prefixed tbl_. Stable across renames and accepted wherever a table path parameter takes an id or name. |
| name | string | Current table name, usable in the rows path; may change when the table is renamed. |
| description | string | null | Free-text note about the table, or null when none was set. |
| fields | array<object> | Field definitions of the table, in display order. Row values are keyed by each field's name. |
| fields[].id | string | Field identifier, prefixed fld_. Stable across renames; accepted wherever a field path parameter takes an id or name. |
| fields[].name | string | Current field name; rows are keyed by it in requests and responses. May change when the field is renamed. |
| fields[].description | string | null | Free-text note about the field, or null when none was set. |
| fields[].required | boolean | Whether every row must hold a non-null value for this field. |
| fields[].unique | boolean | Whether values must be distinct across rows; fixed at creation. A unique field is indexed, and a violation returns 409 UNIQUE_VIOLATION. |
| fields[].indexed | boolean | Whether an index is maintained for faster filters and ordering. Always false for json and link fields. |
| fields[].type | string | Scalar data type of the field; it cannot be changed after the field is created. / Type json: the value is any JSON document validated against options.schema. It cannot be changed after the field is created. / Type link: the value is the id of a row in another table (an array of ids when options.multiple is true). It cannot be changed after the field is created. |
| fields[].options | object | Scalar fields take no options; always an empty object. / Settings of a json field. schema is required. / Settings of a link field. Both linked_table_id and multiple are required. |
| fields[].default | any | Default JSON value for omitted insert fields; must match the field type and JSON schema. A datetime default of "now()" evaluates to server time on insertion and reads back as "now()" in the field definition. For string and json fields it is a literal string. Explicit null remains null. Link fields do not support defaults. |
| schema_revision | integer | Counter that starts at 1 and increases by one each time the table's name, description or fields change; use it to detect schema changes. |
| created_at | string | Time the table was created, as an RFC 3339 UTC timestamp. |
| updated_at | string | Time of the last schema change to the table, as an RFC 3339 UTC timestamp. |
| row_count | integer | Number of rows currently stored. Returned only by databaseGetTable; absent from list, create and field responses. |
curl -X DELETE "https://api.deepraxis.ai/database/v1/databases/${DATABASE_ID}/tables/tasks/fields/priority" \
-H "Authorization: Bearer $PRAXIS_API_KEY"响应示例 — HTTP 200
{
"id": "tbl_2b3431c772754599",
"name": "tasks",
"description": "Tasks for an agent",
"schema_revision": 5,
"created_at": "2026-10-11T17:41:44.246Z",
"updated_at": "2026-10-11T17:41:47.136Z",
"fields": [
{
"id": "fld_bc71f7c6a1a848d2",
"name": "title",
"type": "string",
"description": null,
"required": true,
"unique": true,
"indexed": true
},
{
"id": "fld_c7879883dfe04ca0",
"name": "done",
"type": "boolean",
"description": null,
"required": false,
"unique": false,
"indexed": true
}
]
}"string" / "integer" / "number" / "boolean" / "datetime"
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 资源 ID |
| name | string | 是 | 名称 |
| description | string / null | 是 | 描述 |
| required | boolean | 是 | 是否必填 |
| unique | boolean | 是 | 是否唯一 |
| indexed | boolean | 是 | 是否索引 |
| type | "string" / "integer" / "number" / "boolean" / "datetime" | 是 | 类型 |
| options | object | 否 | json:schema;link:linked_table_id 与 multiple |
| default | JSON | 否 | 省略插入值时的默认值;datetime 的 now() 在写入时取服务器时间,字段定义仍读回 now()。string/json 中为字面量。显式 null 不使用默认值。 |
"json"
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 资源 ID |
| name | string | 是 | 名称 |
| description | string / null | 是 | 描述 |
| required | boolean | 是 | 是否必填 |
| unique | boolean | 是 | 是否唯一 |
| indexed | boolean | 是 | 是否索引 |
| type | "json" | 是 | 类型 |
| options | object | 是 | json:schema;link:linked_table_id 与 multiple |
| default | JSON | 否 | 省略插入值时的默认值;datetime 的 now() 在写入时取服务器时间,字段定义仍读回 now()。string/json 中为字面量。显式 null 不使用默认值。 |
"link"
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 资源 ID |
| name | string | 是 | 名称 |
| description | string / null | 是 | 描述 |
| required | boolean | 是 | 是否必填 |
| unique | boolean | 是 | 是否唯一 |
| indexed | boolean | 是 | 是否索引 |
| type | "link" | 是 | 类型 |
| options | object | 是 | json:schema;link:linked_table_id 与 multiple |
"string" / "integer" / "number" / "boolean" / "datetime"
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| name | string | 是 | 字段名;只保留 id;新字段不能以下划线开头。created_at、updated_at、version 可作为用户字段名;已有下划线字段照常使用,且优先于同名元数据。; ^(?!id$)[a-z][a-z0-9_]{0,62}$ |
| description | string | 否 | 描述 |
| required | boolean | 否 | 是否必填 |
| unique | boolean | 否 | 是否唯一 |
| indexed | boolean | 否 | 是否索引 |
| type | "string" / "integer" / "number" / "boolean" / "datetime" | 是 | 类型 |
| options | object | 否 | json:schema;link:linked_table_id 与 multiple |
| default | JSON | 否 | 省略插入值时的默认值;datetime 的 now() 在写入时取服务器时间,字段定义仍读回 now()。string/json 中为字面量。显式 null 不使用默认值。 |
"json"
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| name | string | 是 | 字段名;只保留 id;新字段不能以下划线开头。created_at、updated_at、version 可作为用户字段名;已有下划线字段照常使用,且优先于同名元数据。; ^(?!id$)[a-z][a-z0-9_]{0,62}$ |
| description | string | 否 | 描述 |
| required | boolean | 否 | 是否必填 |
| unique | boolean | 否 | 是否唯一 |
| indexed | boolean | 否 | 是否索引 |
| type | "json" | 是 | 类型 |
| options | object | 是 | json:schema;link:linked_table_id 与 multiple |
| default | JSON | 否 | 省略插入值时的默认值;datetime 的 now() 在写入时取服务器时间,字段定义仍读回 now()。string/json 中为字面量。显式 null 不使用默认值。 |
"link"
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| name | string | 是 | 字段名;只保留 id;新字段不能以下划线开头。created_at、updated_at、version 可作为用户字段名;已有下划线字段照常使用,且优先于同名元数据。; ^(?!id$)[a-z][a-z0-9_]{0,62}$ |
| description | string | 否 | 描述 |
| required | boolean | 否 | 是否必填 |
| unique | boolean | 否 | 是否唯一 |
| indexed | boolean | 否 | 是否索引 |
| type | "link" | 是 | 类型 |
| options | object | 是 | json:schema;link:linked_table_id 与 multiple |
事件记录库生命周期与表、字段结构变化,不记录行读写。
默认按 seq 升序;只给 before_seq 时默认按 desc(最新在前)。next_cursor 是不透明的字符串游标,原样传回:asc 时传给 after_seq,desc 时传给 before_seq。两个游标同时提供,或 before_seq 与 order=asc 同时提供,返回 400 INVALID_PARAMS。删除中的库仍可读取事件。
next_cursor 是不透明的字符串游标,原样传回,不要对它做运算;为 null 表示没有后续页。下方响应为省略 order 的升序实测结果。倒序翻页按以下请求使用;该扩展的线上响应将在服务更新后补充。
# 最新一页
curl "https://api.deepraxis.ai/database/v1/databases/${DATABASE_ID}/events?order=desc&limit=10" \
-H "Authorization: Bearer $PRAXIS_API_KEY"
# 把 NEXT_CURSOR 设为上一页返回的 next_cursor
curl "https://api.deepraxis.ai/database/v1/databases/${DATABASE_ID}/events?order=desc&before_seq=${NEXT_CURSOR}&limit=10" \
-H "Authorization: Bearer $PRAXIS_API_KEY"GET /database/v1/databases/{database_id}/events
| 参数 | 位置 | 说明 |
|---|---|---|
| database_id | path | 库 ID。 |
| after_seq | query | order=asc 时,只取 seq 大于该值的事件;不可同时提供 before_seq。 |
| limit | query | 最多返回的条数。 (default: 50) (1–200) |
| order | query | asc 按 seq 升序,desc 为最新在前。默认 asc;只给 before_seq 时默认 desc。 |
| before_seq | query | 只取 seq 小于该值的事件,最新在前;省略 order 时按 desc。不可同时提供 after_seq 或 order=asc。 |
返回: Page + object.
Success
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | Events on this page in the requested order (ascending seq by default, newest first with before_seq or order=desc). |
| data[].seq | integer | Position of the event in the database's event log; starts at 1 and strictly increases. Use it as after_seq or before_seq to page. |
| data[].id | string | Unique identifier of this event record. |
| data[].type | string | What happened: a lifecycle transition of the database, or a schema change to a table or field. |
| data[].processed_at | string | Time the event was recorded, as an RFC 3339 UTC timestamp. |
| data[].database_id | string | Id (db_…) of the database the event belongs to. |
| data[].table_id | string | Id (tbl_…) of the affected table; present only for table and field events. |
| data[].field_id | string | Id (fld_…) of the affected field; present only for field events. |
| next_cursor | string | null | Opaque cursor for the next page, or null when there are no more items. Databases list: pass it as cursor. Events list: pass it as after_seq (order asc) or before_seq (order desc). |
curl -X GET "https://api.deepraxis.ai/database/v1/databases/${DATABASE_ID}/events?after_seq=0&limit=10" \
-H "Authorization: Bearer $PRAXIS_API_KEY"响应示例 — HTTP 200
{
"data": [
{
"seq": 1,
"id": "7390d75e-216c-4799-891e-c043bac8bce5",
"type": "database.status_provisioning",
"processed_at": "2026-10-11T17:41:41.339Z",
"database_id": "db_d6f0d743d5a645e8"
},
{
"seq": 2,
"id": "39db0ef4-99b4-4846-9d50-9998e25cf48f",
"type": "database.status_active",
"processed_at": "2026-10-11T17:41:41.339Z",
"database_id": "db_d6f0d743d5a645e8"
},
{
"seq": 3,
"id": "d295651d-5e83-4b42-bcd3-c979fb71f375",
"type": "table.created",
"processed_at": "2026-10-11T17:41:44.246Z",
"database_id": "db_d6f0d743d5a645e8",
"table_id": "tbl_2b3431c772754599"
},
{
"seq": 4,
"id": "eb255753-3dd7-4eae-8861-d53408bfcaf4",
"type": "table.updated",
"processed_at": "2026-10-11T17:41:45.127Z",
"database_id": "db_d6f0d743d5a645e8",
"table_id": "tbl_2b3431c772754599"
},
{
"seq": 5,
"id": "99c86e22-0629-4391-85e5-d7b8b31de833",
"type": "field.added",
"processed_at": "2026-10-11T17:41:45.420Z",
"database_id": "db_d6f0d743d5a645e8",
"table_id": "tbl_2b3431c772754599",
"field_id": "fld_4c3e63869e35458c"
},
{
"seq": 6,
"id": "a9b85950-363d-4ab3-8c85-6228eec3d099",
"type": "field.updated",
"processed_at": "2026-10-11T17:41:46.276Z",
"database_id": "db_d6f0d743d5a645e8",
"table_id": "tbl_2b3431c772754599",
"field_id": "fld_4c3e63869e35458c"
},
{
"seq": 7,
"id": "73ca124f-6cbb-4a43-8a37-4ff50a211dd5",
"type": "field.deleted",
"processed_at": "2026-10-11T17:41:47.136Z",
"database_id": "db_d6f0d743d5a645e8",
"table_id": "tbl_2b3431c772754599",
"field_id": "fld_4c3e63869e35458c"
}
],
"next_cursor": null
}| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| seq | integer | 是 | 库内递增序号 |
| id | string | 是 | 资源 ID |
| type | "database.status_provisioning" / "database.status_active" / "database.status_deleting" / "database.status_deleted" / "database.status_failed" / "database.restored" / "table.created" / "table.updated" / "table.deleted" / "field.added" / "field.updated" / "field.deleted" | 是 | 类型 |
| processed_at | date-time | 是 | 事件时间 |
| database_id | string | 是 | 库 ID |
| table_id | string | 否 | 相关表 ID(可选) |
| field_id | string | 否 | 相关字段 ID(可选) |
/database/v1/databases/{database_id}/rest/{table}
与同一库的其它入口读写相同的行;错误使用 PostgREST code。
一次批量 POST 最多插入 500 行,单次请求是原子的:任何一行失败,整批回滚。跨请求没有事务;需要一起成功的行应放在一次批量 POST 中。有关联依赖时先查后插,并处理并发变化导致的关联错误。
同一批次按所有行的键的并集补齐缺失值为 null(PostgREST 行为)。发送 Prefer: missing=default 可改用字段默认值;显式 null 仍为 null,没有默认值的必填字段仍必须提供。默认 return=minimal 返回 201、body 为空;发送 Prefer: return=representation 才返回行。
GET /database/v1/databases/{database_id}/rest/{table}
curl -X GET "https://api.deepraxis.ai/database/v1/databases/${DATABASE_ID}/rest/tasks?select=*&order=title.asc&limit=10" \
-H "Authorization: Bearer $PRAXIS_API_KEY"Success; write bodies require Prefer: return=representation
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].id | string | Row identifier of 1–64 characters from A-Z a-z 0-9 _ -. Generated by the service unless the insert supplied one; it cannot be changed by updates. |
application/vnd.pgrst.object+json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Row identifier of 1–64 characters from A-Z a-z 0-9 _ -. Generated by the service unless the insert supplied one; it cannot be changed by updates. |
Partial range with requested count
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].id | string | Row identifier of 1–64 characters from A-Z a-z 0-9 _ -. Generated by the service unless the insert supplied one; it cannot be changed by updates. |
application/vnd.pgrst.object+json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Row identifier of 1–64 characters from A-Z a-z 0-9 _ -. Generated by the service unless the insert supplied one; it cannot be changed by updates. |
响应示例 — HTTP 200
| 响应头 | 值 |
|---|---|
| content-range | 0-0/* |
| etag | W/"5.1" |
| range-unit | items |
[
{
"id": "rec_3e85a292099340e3",
"version": 1,
"created_at": "2026-10-11T17:41:47.896Z",
"updated_at": "2026-10-11T17:41:47.896Z",
"title": "Write a summary",
"done": false
}
]HEAD /database/v1/databases/{database_id}/rest/{table}
curl --head "https://api.deepraxis.ai/database/v1/databases/${DATABASE_ID}/rest/tasks?select=*" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'prefer: count=exact'Success; write bodies require Prefer: return=representation
未声明响应体。
Partial range with requested count
未声明响应体。
响应示例 — HTTP 200
| 响应头 | 值 |
|---|---|
| content-range | 0-0/1 |
| preference-applied | count=exact |
| etag | W/"5.1" |
| range-unit | items |
无响应正文。
POST /database/v1/databases/{database_id}/rest/{table}
curl -X POST "https://api.deepraxis.ai/database/v1/databases/${DATABASE_ID}/rest/tasks" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'prefer: return=representation' \
-H "Content-Type: application/json" \
-d '{"title":"Write a summary","done":false}'Success (201). With the default return=minimal the body is empty; Prefer: return=representation returns rows.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].id | string | Row identifier of 1–64 characters from A-Z a-z 0-9 _ -. Generated by the service unless the insert supplied one; it cannot be changed by updates. |
application/vnd.pgrst.object+json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Row identifier of 1–64 characters from A-Z a-z 0-9 _ -. Generated by the service unless the insert supplied one; it cannot be changed by updates. |
响应示例 — HTTP 201
| 响应头 | 值 |
|---|---|
| content-range | 0-0/* |
| preference-applied | return=representation |
| range-unit | items |
[
{
"id": "rec_3e85a292099340e3",
"version": 1,
"created_at": "2026-10-11T17:41:47.896Z",
"updated_at": "2026-10-11T17:41:47.896Z",
"title": "Write a summary",
"done": false
}
]PATCH /database/v1/databases/{database_id}/rest/{table}
curl -X PATCH "https://api.deepraxis.ai/database/v1/databases/${DATABASE_ID}/rest/tasks?title=eq.Write%20a%20summary" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'prefer: return=representation' \
-H "Content-Type: application/json" \
-d '{"done":true}'Success; write bodies require Prefer: return=representation
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].id | string | Row identifier of 1–64 characters from A-Z a-z 0-9 _ -. Generated by the service unless the insert supplied one; it cannot be changed by updates. |
application/vnd.pgrst.object+json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Row identifier of 1–64 characters from A-Z a-z 0-9 _ -. Generated by the service unless the insert supplied one; it cannot be changed by updates. |
Success without a body
未声明响应体。
响应示例 — HTTP 200
| 响应头 | 值 |
|---|---|
| content-range | 0-0/* |
| preference-applied | return=representation |
| range-unit | items |
[
{
"id": "rec_3e85a292099340e3",
"version": 2,
"created_at": "2026-10-11T17:41:47.896Z",
"updated_at": "2026-10-11T17:41:48.802Z",
"title": "Write a summary",
"done": true
}
]POST /database/v1/databases/{database_id}/rest/{table}
curl -X POST "https://api.deepraxis.ai/database/v1/databases/${DATABASE_ID}/rest/tasks?on_conflict=title" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'prefer: resolution=merge-duplicates,return=representation' \
-H "Content-Type: application/json" \
-d '{"title":"Write a summary","done":true}'Success (201). With the default return=minimal the body is empty; Prefer: return=representation returns rows.
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].id | string | Row identifier of 1–64 characters from A-Z a-z 0-9 _ -. Generated by the service unless the insert supplied one; it cannot be changed by updates. |
application/vnd.pgrst.object+json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Row identifier of 1–64 characters from A-Z a-z 0-9 _ -. Generated by the service unless the insert supplied one; it cannot be changed by updates. |
响应示例 — HTTP 201
| 响应头 | 值 |
|---|---|
| content-range | 0-0/* |
| preference-applied | resolution=merge-duplicates, return=representation |
| range-unit | items |
[
{
"id": "rec_3e85a292099340e3",
"version": 3,
"created_at": "2026-10-11T17:41:47.896Z",
"updated_at": "2026-10-11T17:41:49.076Z",
"title": "Write a summary",
"done": true
}
]DELETE /database/v1/databases/{database_id}/rest/{table}
curl -X DELETE "https://api.deepraxis.ai/database/v1/databases/${DATABASE_ID}/rest/tasks?title=eq.Write%20a%20summary" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H 'prefer: return=representation'Success; write bodies require Prefer: return=representation
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].id | string | Row identifier of 1–64 characters from A-Z a-z 0-9 _ -. Generated by the service unless the insert supplied one; it cannot be changed by updates. |
application/vnd.pgrst.object+json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Row identifier of 1–64 characters from A-Z a-z 0-9 _ -. Generated by the service unless the insert supplied one; it cannot be changed by updates. |
Success without a body
未声明响应体。
响应示例 — HTTP 200
| 响应头 | 值 |
|---|---|
| content-range | 0-0/* |
| preference-applied | return=representation |
| range-unit | items |
[
{
"id": "rec_3e85a292099340e3",
"version": 3,
"created_at": "2026-10-11T17:41:47.896Z",
"updated_at": "2026-10-11T17:41:49.076Z",
"title": "Write a summary",
"done": true
}
]默认投影、select=、return=representation 与 RPC 行对象只返回 id 和用户字段。系统元数据须显式点名,例如 select=,_version,_created_at,_updated_at;* 不展开它们。可用 _version=eq.3 过滤、order=_created_at.desc 排序,但不可写。未指定 order 时仍按内部创建时间、id 排序。没有同名用户字段时,旧名 created_at/updated_at/version 用于过滤或排序返回 400,details 为 use _created_at(或对应名字),hint 为 system metadata moved to underscore columns。已有下划线用户字段优先,同名系统元数据在该表上不可访问。上方历史响应样例采集于此规则调整前,仍可能包含旧元数据列;当前行形状以本节为准。
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 资源 ID; ^[A-Za-z0-9_-]{1,64}$ |
管理端点返回领域码;两个表端点返回 PostgREST code。HTTP 状态与重试属性如下。
| 领域码 | HTTP | PostgREST code | 可重试 |
|---|---|---|---|
| SINGULAR_MISMATCH | 406 | PGRST116 | 否 |
| AMBIGUOUS_EMBED | 300 | PGRST201 | 否 |
| EMBED_NOT_FOUND | 400 | PGRST200 | 否 |
| INVALID_PREFERENCE | 400 | PGRST122 | 否 |
| QUERY_CANCELED | 500 | 57014 | 否 |
| RANGE_NOT_SATISFIABLE | 416 | PGRST103 | 否 |
| NOT_ACCEPTABLE | 406 | PGRST107 | 否 |
| OPERATOR_TYPE_MISMATCH | 400 | 42883 | 否 |
| DATABASE_NOT_FOUND | 404 | PGRST125 | 否 |
| TABLE_NOT_FOUND | 404 | PGRST205 | 否 |
| FIELD_NOT_FOUND | 400 | 42703 | 否 |
| VALIDATION_FAILED | 400 | 23514 | 否 |
| UNIQUE_VIOLATION | 409 | 23505 | 否 |
| REFERENCE_RESTRICT | 409 | 23503 | 否 |
| FIELD_TYPE_IMMUTABLE | 400 | — | 否 |
| LIMIT_EXCEEDED | 400 | 54000 | 否 |
| UNSUPPORTED | 400 | PGRST127 | 否 |
| INVALID_PARAMS | 400 | PGRST100 | 否 |
| DATABASE_INVALID_STATE | 409 | — | 否 |
| CAPACITY | 503 | — | 是 |
| NOT_IMPLEMENTED | 501 | PGRST127 | 否 |
可重试不表示重复原请求一定成功。例如 57014 应先缩小查询范围或调整过滤条件,再重试。
响应示例 — HTTP 400
{
"code": "FIELD_TYPE_IMMUTABLE",
"message": "field type is immutable",
"details": null,
"hint": null
}响应示例 — HTTP 400
{
"code": "PGRST127",
"message": "operator fts is not supported",
"details": null,
"hint": null
}code、message、details、hint 四个字段始终存在;details 与 hint 可以为 null。
响应示例 — HTTP 501
| 响应头 | 值 |
|---|---|
| x-should-retry | false |
{
"code": "not_implemented",
"message": "auth is not provided by praxis-database"
}这五个服务直接返回 not_implemented;它与错误表中的领域码 NOT_IMPLEMENTED 不同。
保留字段名只有 id;新字段名不能以 _ 开头,这个前缀留给系统元数据。created_at、updated_at、version 可用作普通字段名。datetime 字段可用 "now()" 作为默认值。
details 指出字段或 JSON 路径及实际收到的值,批量校验还包含从 0 开始的行号。值最多显示 80 个字符,不回显整行。hint 给出修正方式,没有建议时为 null。下面是省略第 2 行必填 title 的错误示例:
{
"code": "23514",
"message": "row validation failed",
"details": "row 1: title: required value (got null)",
"hint": "Rows in one insert are filled to the union of their keys with null (PostgREST behavior). Send every key in every row, or send Prefer: missing=default to use field defaults."
}唯一冲突返回 409,例如:
{
"code": "23505",
"message": "unique constraint violated",
"details": "Key (email)=(a@b.c) already exists.",
"hint": null
}用 API Key 作为 Bearer 凭据,通过以下地址管理库与 Secret。Secret 的值只写,任何接口都不会返回。
https://api.deepraxis.ai/vault/v1
| 资源 | 路径 |
|---|---|
| 库 | /vault/v1/vaults |
| Secret | /vault/v1/vaults/{vault_id}/secrets |
| 模板 | /vault/v1/templates |
| 一键授权 | /vault/v1/authorizations |
Secret 可以用名字或 vsec_ 开头的 ID 寻址。列表用 cursor 与 limit 翻页(limit 默认 50,最大 200),返回的 next_cursor 为 null 表示没有后续页。
同一批库也可以通过 Claude 托管智能体的凭据库接口访问:Claude 托管智能体
创建和管理库,检查可用状态,并查询不含 Secret 值的审计事件。
审计事件按时间倒序列出,可用 secret 按名称或 ID 过滤;未知 Secret 返回空列表。limit 默认 50、最大 200;超限或无效 cursor 返回 400 INVALID_PARAMS。事件没有按天自动过期的保留期;归档保留事件,删除库或 Secret 会清除其历史事件,仅保留删除记录。
GET /vault/v1/vaults
| 参数 | 位置 | 说明 |
|---|---|---|
| cursor | query | 上一页返回的 next_cursor。 |
| limit | query | 每页条数。 (默认: 50) (1–200) |
| include_archived | query | 是否包含已归档的条目。 (默认: false) |
application/json
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| data | Vault[] | 是 | 条目数组 |
| data[].id | string | 是 | 对象标识符 |
| data[].type | "vault" | 是 | 对象类型 |
| data[].display_name | string | 是 | 显示名称,1–255 个字符 |
| data[].metadata | object | 是 | 自定义标签最多 16 对,键最长 64 字符,值最长 512 字符 |
| data[].status | "active" / "archived" | 是 | 状态 |
| data[].secret_count | integer | 是 | 有效 Secret 数 |
| data[].needs_reauthorization_count | integer | 是 | 续期失败、需要重新授权的 OAuth Secret 数 |
| data[].created_at | date-time | 是 | 创建时间 |
| data[].updated_at | date-time | 是 | 更新时间 |
| data[].archived_at | date-time / null | 是 | 归档时间;未归档时为 null |
| next_cursor | string / null | 是 | 下一页游标;没有后续时为 null |
缺少或无效的 API Key 返回 401 UNAUTHENTICATED。
| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| INVALID_PARAMS | 400 | 字段、名称、域名、metadata、分页或回跳地址无效;修正请求 | validation_failure | none | 否 |
curl "https://api.deepraxis.ai/vault/v1/vaults" \
-H "Authorization: Bearer $PRAXIS_API_KEY"POST /vault/v1/vaults
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| display_name | string | 是 | 显示名称,1–255 个字符 |
| metadata | object | 否 | 自定义标签最多 16 对,键最长 64 字符,值最长 512 字符 |
application/json
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 对象标识符 |
| type | "vault" | 是 | 对象类型 |
| display_name | string | 是 | 显示名称,1–255 个字符 |
| metadata | object | 是 | 自定义标签最多 16 对,键最长 64 字符,值最长 512 字符 |
| status | "active" / "archived" | 是 | 状态 |
| secret_count | integer | 是 | 有效 Secret 数 |
| needs_reauthorization_count | integer | 是 | 续期失败、需要重新授权的 OAuth Secret 数 |
| created_at | date-time | 是 | 创建时间 |
| updated_at | date-time | 是 | 更新时间 |
| archived_at | date-time / null | 是 | 归档时间;未归档时为 null |
缺少或无效的 API Key 返回 401 UNAUTHENTICATED。
| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| INVALID_PARAMS | 400 | 字段、名称、域名、metadata、分页或回跳地址无效;修正请求 | validation_failure | none | 否 |
curl -X POST "https://api.deepraxis.ai/vault/v1/vaults" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"display_name":"Agent credentials"}'POST /vault/v1/vaults:check
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| vault_ids | string[] | 是 | 要检查的库 ID |
application/json
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| data | object[] | 是 | 条目数组 |
| data[].vault_id | string | 是 | 库 ID |
| data[].status | "ok" / "not_found" / "archived" | 是 | 状态 |
缺少或无效的 API Key 返回 401 UNAUTHENTICATED。
| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| INVALID_PARAMS | 400 | 字段、名称、域名、metadata、分页或回跳地址无效;修正请求 | validation_failure | none | 否 |
curl -X POST "https://api.deepraxis.ai/vault/v1/vaults:check" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"vault_ids\":[\"${VAULT_ID}\"]}"GET /vault/v1/vaults/{vault_id}
| 参数 | 位置 | 说明 |
|---|---|---|
| vault_id | path | 库 ID。 |
application/json
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 对象标识符 |
| type | "vault" | 是 | 对象类型 |
| display_name | string | 是 | 显示名称,1–255 个字符 |
| metadata | object | 是 | 自定义标签最多 16 对,键最长 64 字符,值最长 512 字符 |
| status | "active" / "archived" | 是 | 状态 |
| secret_count | integer | 是 | 有效 Secret 数 |
| needs_reauthorization_count | integer | 是 | 续期失败、需要重新授权的 OAuth Secret 数 |
| created_at | date-time | 是 | 创建时间 |
| updated_at | date-time | 是 | 更新时间 |
| archived_at | date-time / null | 是 | 归档时间;未归档时为 null |
缺少或无效的 API Key 返回 401 UNAUTHENTICATED。
| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| VAULT_NOT_FOUND | 404 | 库不存在或不属于当前账户;检查库 ID | validation_failure | none | 否 |
curl "https://api.deepraxis.ai/vault/v1/vaults/${VAULT_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"POST /vault/v1/vaults/{vault_id}
| 参数 | 位置 | 说明 |
|---|---|---|
| vault_id | path | 库 ID。 |
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| display_name | string | 否 | 显示名称,1–255 个字符 |
| metadata | object | 否 | 按键合并:字符串写入,null 删除,省略的键保留;自定义标签最多 16 对 |
application/json
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 对象标识符 |
| type | "vault" | 是 | 对象类型 |
| display_name | string | 是 | 显示名称,1–255 个字符 |
| metadata | object | 是 | 自定义标签最多 16 对,键最长 64 字符,值最长 512 字符 |
| status | "active" / "archived" | 是 | 状态 |
| secret_count | integer | 是 | 有效 Secret 数 |
| needs_reauthorization_count | integer | 是 | 续期失败、需要重新授权的 OAuth Secret 数 |
| created_at | date-time | 是 | 创建时间 |
| updated_at | date-time | 是 | 更新时间 |
| archived_at | date-time / null | 是 | 归档时间;未归档时为 null |
缺少或无效的 API Key 返回 401 UNAUTHENTICATED。
| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| VAULT_NOT_FOUND | 404 | 库不存在或不属于当前账户;检查库 ID | validation_failure | none | 否 |
| VAULT_INVALID_STATE | 409 | 向已归档的库或 Secret 写入;改用有效资源 | validation_failure | none | 否 |
| INVALID_PARAMS | 400 | 字段、名称、域名、metadata、分页或回跳地址无效;修正请求 | validation_failure | none | 否 |
curl -X POST "https://api.deepraxis.ai/vault/v1/vaults/${VAULT_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"metadata":{"team":"growth"}}'DELETE /vault/v1/vaults/{vault_id}
| 参数 | 位置 | 说明 |
|---|---|---|
| vault_id | path | 库 ID。 |
application/json
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 对象标识符 |
| type | "vault_deleted" | 是 | 对象类型 |
缺少或无效的 API Key 返回 401 UNAUTHENTICATED。
| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| VAULT_NOT_FOUND | 404 | 库不存在或不属于当前账户;检查库 ID | validation_failure | none | 否 |
curl -X DELETE "https://api.deepraxis.ai/vault/v1/vaults/${VAULT_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"POST /vault/v1/vaults/{vault_id}/archive
| 参数 | 位置 | 说明 |
|---|---|---|
| vault_id | path | 库 ID。 |
application/json
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 对象标识符 |
| type | "vault" | 是 | 对象类型 |
| display_name | string | 是 | 显示名称,1–255 个字符 |
| metadata | object | 是 | 自定义标签最多 16 对,键最长 64 字符,值最长 512 字符 |
| status | "active" / "archived" | 是 | 状态 |
| secret_count | integer | 是 | 有效 Secret 数 |
| needs_reauthorization_count | integer | 是 | 续期失败、需要重新授权的 OAuth Secret 数 |
| created_at | date-time | 是 | 创建时间 |
| updated_at | date-time | 是 | 更新时间 |
| archived_at | date-time / null | 是 | 归档时间;未归档时为 null |
缺少或无效的 API Key 返回 401 UNAUTHENTICATED。
| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| VAULT_NOT_FOUND | 404 | 库不存在或不属于当前账户;检查库 ID | validation_failure | none | 否 |
curl -X POST "https://api.deepraxis.ai/vault/v1/vaults/${VAULT_ID}/archive" \
-H "Authorization: Bearer $PRAXIS_API_KEY"GET /vault/v1/vaults/{vault_id}/events
| 参数 | 位置 | 说明 |
|---|---|---|
| vault_id | path | 库 ID。 |
| secret | query | Secret 名称或 vsec_ 开头的 ID。 |
| cursor | query | 上一页返回的 next_cursor。 |
| limit | query | 每页条数。 (默认: 50) (1–200) |
application/json
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| data | VaultEvent[] | 是 | 条目数组 |
| data[].id | uuid | 是 | 对象标识符 |
| data[].type | "vault.created" / "vault.updated" / "vault.archived" / "vault.deleted" / "vault_secret.created" / "vault_secret.updated" / "vault_secret.archived" / "vault_secret.deleted" / "vault_secret.used" / "vault_secret.refreshed" / "vault_secret.refresh_failed" / "vault_authorization.completed" / "vault_authorization.failed" / "vault_authorization.expired" | 是 | 对象类型 |
| data[].secret_id | string / null | 是 | 关联的 Secret ID;未关联时为 null |
| data[].secret_name | string / null | 是 | 关联的 Secret 名称 |
| data[].at | date-time | 是 | 事件或错误发生时间 |
| data[].detail | object / null | 是 | 事件详情,不含 Secret 值;更新事件的 changed 列出变更字段 |
| data[].detail.changed | string[] | 否 | 本次更新的字段名,例如 value、allowed_hosts |
| next_cursor | string / null | 是 | 下一页游标;没有后续时为 null |
缺少或无效的 API Key 返回 401 UNAUTHENTICATED。
| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| VAULT_NOT_FOUND | 404 | 库不存在或不属于当前账户;检查库 ID | validation_failure | none | 否 |
| INVALID_PARAMS | 400 | 字段、名称、域名、metadata、分页或回跳地址无效;修正请求 | validation_failure | none | 否 |
curl "https://api.deepraxis.ai/vault/v1/vaults/${VAULT_ID}/events" \
-H "Authorization: Bearer $PRAXIS_API_KEY"| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 对象标识符 |
| type | "vault" | 是 | 对象类型 |
| display_name | string | 是 | 显示名称,1–255 个字符 |
| metadata | object | 是 | 自定义标签最多 16 对,键最长 64 字符,值最长 512 字符 |
| status | "active" / "archived" | 是 | 状态 |
| secret_count | integer | 是 | 有效 Secret 数 |
| needs_reauthorization_count | integer | 是 | 续期失败、需要重新授权的 OAuth Secret 数 |
| created_at | date-time | 是 | 创建时间 |
| updated_at | date-time | 是 | 更新时间 |
| archived_at | date-time / null | 是 | 归档时间;未归档时为 null |
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| data | Vault[] | 是 | 条目数组 |
| data[].id | string | 是 | 对象标识符 |
| data[].type | "vault" | 是 | 对象类型 |
| data[].display_name | string | 是 | 显示名称,1–255 个字符 |
| data[].metadata | object | 是 | 自定义标签最多 16 对,键最长 64 字符,值最长 512 字符 |
| data[].status | "active" / "archived" | 是 | 状态 |
| data[].secret_count | integer | 是 | 有效 Secret 数 |
| data[].needs_reauthorization_count | integer | 是 | 续期失败、需要重新授权的 OAuth Secret 数 |
| data[].created_at | date-time | 是 | 创建时间 |
| data[].updated_at | date-time | 是 | 更新时间 |
| data[].archived_at | date-time / null | 是 | 归档时间;未归档时为 null |
| next_cursor | string / null | 是 | 下一页游标;没有后续时为 null |
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| id | uuid | 是 | 对象标识符 |
| type | "vault.created" / "vault.updated" / "vault.archived" / "vault.deleted" / "vault_secret.created" / "vault_secret.updated" / "vault_secret.archived" / "vault_secret.deleted" / "vault_secret.used" / "vault_secret.refreshed" / "vault_secret.refresh_failed" / "vault_authorization.completed" / "vault_authorization.failed" / "vault_authorization.expired" | 是 | 对象类型 |
| secret_id | string / null | 是 | 关联的 Secret ID;未关联时为 null |
| secret_name | string / null | 是 | 关联的 Secret 名称 |
| at | date-time | 是 | 事件或错误发生时间 |
| detail | object / null | 是 | 事件详情,不含 Secret 值;更新事件的 changed 列出变更字段 |
| detail.changed | string[] | 否 | 本次更新的字段名,例如 value、allowed_hosts |
添加、导入和更新 Secret;值只写,校验与续期仅用于 OAuth Secret。
导入同名 Secret 只替换值;只有该行自己的 allowed_hosts 才能改变原域名,顶层默认域名不覆盖已有域名。新建行优先使用该行域名,否则使用顶层默认域名。逐行失败在 HTTP 200 的 failed 中返回(包括 SECRET_TOO_LARGE、VAULT_LIMIT_EXCEEDED、INVALID_PARAMS),其它行仍然写入。用非法名称查找 Secret 返回 404 SECRET_NOT_FOUND。
GET /vault/v1/vaults/{vault_id}/secrets
| 参数 | 位置 | 说明 |
|---|---|---|
| vault_id | path | 库 ID。 |
| cursor | query | 上一页返回的 next_cursor。 |
| limit | query | 每页条数。 (默认: 50) (1–200) |
| include_archived | query | 是否包含已归档的条目。 (默认: false) |
application/json
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| data | Secret[] | 是 | 条目数组 |
| data[].id | string | 是 | 对象标识符 |
| data[].type | "vault_secret" | 是 | 对象类型 |
| data[].vault_id | string | 是 | 库 ID |
| data[].name | string | 是 | 名称,库内唯一且不可改;1–128 个大写字母、数字或下划线,以字母或下划线开头 |
| data[].kind | "static" / "oauth" | 是 | static:你填写的值;oauth:授权得到、由平台续期 |
| data[].allowed_hosts | string[] | 是 | 1–16 个域名、公网 IPv4 或 .example.com;不匹配根域名。拒绝 IPv6、单标签主机、localhost、.internal、平台域名及回环/链路本地/私网/CGNAT IPv4;规范化并去重 |
| data[].description | string / null | 是 | 备注;更新时 null 清除,省略则保留 |
| data[].metadata | object | 是 | 自定义标签最多 16 对;source、template 为系统保留键,不占这 16 对且不能由调用方写入 |
| data[].status | "active" / "refreshing" / "refresh_failed" / "archived" | 是 | 状态 |
| data[].oauth | SecretOAuthSummary / null | 是 | OAuth 摘要;kind 为 static 时为 null |
| data[].oauth.expires_at | date-time / null | 是 | 过期时间 |
| data[].oauth.last_refreshed_at | date-time / null | 是 | 最近一次续期时间 |
| data[].oauth.next_refresh_at | date-time / null | 是 | 下次计划续期时间 |
| data[].oauth.scope | string / null | 是 | 授权范围 |
| data[].oauth.last_error | object / null | 是 | 最近一次续期失败 |
| data[].oauth.last_error.code | string | 是 | 稳定的错误码 |
| data[].oauth.last_error.message | string | 是 | 可读的错误说明 |
| data[].oauth.last_error.at | date-time | 是 | 事件或错误发生时间 |
| data[].version | integer | 是 | 值每次变化时递增 |
| data[].last_used_at | date-time / null | 是 | 最近一次被使用的时间 |
| data[].created_at | date-time | 是 | 创建时间 |
| data[].updated_at | date-time | 是 | 更新时间 |
| data[].archived_at | date-time / null | 是 | 归档时间;未归档时为 null |
| next_cursor | string / null | 是 | 下一页游标;没有后续时为 null |
缺少或无效的 API Key 返回 401 UNAUTHENTICATED。
| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| VAULT_NOT_FOUND | 404 | 库不存在或不属于当前账户;检查库 ID | validation_failure | none | 否 |
| INVALID_PARAMS | 400 | 字段、名称、域名、metadata、分页或回跳地址无效;修正请求 | validation_failure | none | 否 |
curl "https://api.deepraxis.ai/vault/v1/vaults/${VAULT_ID}/secrets" \
-H "Authorization: Bearer $PRAXIS_API_KEY"POST /vault/v1/vaults/{vault_id}/secrets
| 参数 | 位置 | 说明 |
|---|---|---|
| vault_id | path | 库 ID。 |
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| name | string | 是 | 名称,库内唯一且不可改;1–128 个大写字母、数字或下划线,以字母或下划线开头 |
| value | string | 是 | Secret 的值,只写,不会返回;最大 16 KiB |
| allowed_hosts | string[] | 是 | 1–16 个域名、公网 IPv4 或 .example.com;不匹配根域名。拒绝 IPv6、单标签主机、localhost、.internal、平台域名及回环/链路本地/私网/CGNAT IPv4;规范化并去重 |
| description | string / null | 否 | 备注;更新时 null 清除,省略则保留 |
| metadata | object | 否 | 自定义标签最多 16 对;source、template 为系统保留键,不占这 16 对且不能由调用方写入 |
| template_id | "github" / "openai" / "anthropic" / "stripe" | 否 | 仅支持 static 模板 ID;记录为 metadata.template |
| kind | "static" | 否 | 只能为 static;OAuth Secret 通过一键授权创建 |
application/json
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 对象标识符 |
| type | "vault_secret" | 是 | 对象类型 |
| vault_id | string | 是 | 库 ID |
| name | string | 是 | 名称,库内唯一且不可改;1–128 个大写字母、数字或下划线,以字母或下划线开头 |
| kind | "static" / "oauth" | 是 | static:你填写的值;oauth:授权得到、由平台续期 |
| allowed_hosts | string[] | 是 | 1–16 个域名、公网 IPv4 或 .example.com;不匹配根域名。拒绝 IPv6、单标签主机、localhost、.internal、平台域名及回环/链路本地/私网/CGNAT IPv4;规范化并去重 |
| description | string / null | 是 | 备注;更新时 null 清除,省略则保留 |
| metadata | object | 是 | 自定义标签最多 16 对;source、template 为系统保留键,不占这 16 对且不能由调用方写入 |
| status | "active" / "refreshing" / "refresh_failed" / "archived" | 是 | 状态 |
| oauth | SecretOAuthSummary / null | 是 | OAuth 摘要;kind 为 static 时为 null |
| oauth.expires_at | date-time / null | 是 | 过期时间 |
| oauth.last_refreshed_at | date-time / null | 是 | 最近一次续期时间 |
| oauth.next_refresh_at | date-time / null | 是 | 下次计划续期时间 |
| oauth.scope | string / null | 是 | 授权范围 |
| oauth.last_error | object / null | 是 | 最近一次续期失败 |
| oauth.last_error.code | string | 是 | 稳定的错误码 |
| oauth.last_error.message | string | 是 | 可读的错误说明 |
| oauth.last_error.at | date-time | 是 | 事件或错误发生时间 |
| version | integer | 是 | 值每次变化时递增 |
| last_used_at | date-time / null | 是 | 最近一次被使用的时间 |
| created_at | date-time | 是 | 创建时间 |
| updated_at | date-time | 是 | 更新时间 |
| archived_at | date-time / null | 是 | 归档时间;未归档时为 null |
缺少或无效的 API Key 返回 401 UNAUTHENTICATED。
| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| VAULT_NOT_FOUND | 404 | 库不存在或不属于当前账户;检查库 ID | validation_failure | none | 否 |
| VAULT_INVALID_STATE | 409 | 向已归档的库或 Secret 写入;改用有效资源 | validation_failure | none | 否 |
| INVALID_PARAMS | 400 | 字段、名称、域名、metadata、分页或回跳地址无效;修正请求 | validation_failure | none | 否 |
| SECRET_CONFLICT | 409 | 创建时名称已占用;更换名称或更新已有 Secret | validation_failure | none | 否 |
| VAULT_LIMIT_EXCEEDED | 400 | 超过有效 Secret 数量上限;先清理不用的 Secret | validation_failure | none | 否 |
| SECRET_TOO_LARGE | 413 | 值超过 16384 字节;缩小值后重试 | validation_failure | none | 否 |
curl -X POST "https://api.deepraxis.ai/vault/v1/vaults/${VAULT_ID}/secrets" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"GITHUB_TOKEN","value":"ghp_example","allowed_hosts":["api.github.com"]}'POST /vault/v1/vaults/{vault_id}/secrets:import
| 参数 | 位置 | 说明 |
|---|---|---|
| vault_id | path | 库 ID。 |
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| lines | ImportLine[] | 否 | 逐行导入的 Secret |
| lines[].name | string | 是 | 名称,库内唯一且不可改;1–128 个大写字母、数字或下划线,以字母或下划线开头 |
| lines[].value | string | 是 | Secret 的值,只写,不会返回;最大 16 KiB |
| lines[].allowed_hosts | string[] | 否 | 新建时用本行域名或导入的默认域名;替换时仅本行显式 allowed_hosts 才会更新域名 |
| dotenv | string | 否 | .env 格式的 KEY=VALUE 文本;与 lines 二选一 |
| allowed_hosts | string[] | 否 | 新建时用本行域名或导入的默认域名;替换时仅本行显式 allowed_hosts 才会更新域名 |
application/json
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| created | string[] | 是 | 新建的 Secret 名称 |
| replaced | string[] | 是 | 被替换的 Secret 名称 |
| failed | object[] | 是 | 失败的行 |
| failed[].line | integer | 是 | 失败行号,从 1 开始 |
| failed[].name | string / null | 是 | 名称,库内唯一且不可改;1–128 个大写字母、数字或下划线,以字母或下划线开头 |
| failed[].code | "VAULT_NOT_FOUND" / "SECRET_NOT_FOUND" / "AUTHORIZATION_NOT_FOUND" / "SECRET_CONFLICT" / "VAULT_INVALID_STATE" / "VAULT_LIMIT_EXCEEDED" / "INVALID_PARAMS" / "SECRET_KIND_MISMATCH" / "VALIDATE_UNSUPPORTED" / "SECRET_TOO_LARGE" / "RATE_LIMITED" / "AUTHORIZATION_EXPIRED" / "OAUTH_DISCOVERY_FAILED" / "OAUTH_REGISTRATION_UNSUPPORTED" / "OAUTH_ISSUER_MISMATCH" / "OAUTH_STATE_INVALID" / "OAUTH_EXCHANGE_FAILED" / "NOT_IMPLEMENTED" | 是 | 稳定的错误码 |
| failed[].message | string | 是 | 可读的错误说明 |
缺少或无效的 API Key 返回 401 UNAUTHENTICATED。
| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| VAULT_NOT_FOUND | 404 | 库不存在或不属于当前账户;检查库 ID | validation_failure | none | 否 |
| VAULT_INVALID_STATE | 409 | 向已归档的库或 Secret 写入;改用有效资源 | validation_failure | none | 否 |
| INVALID_PARAMS | 400 | 字段、名称、域名、metadata、分页或回跳地址无效;修正请求 | validation_failure | none | 否 |
curl -X POST "https://api.deepraxis.ai/vault/v1/vaults/${VAULT_ID}/secrets:import" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"dotenv":"OPENAI_API_KEY=sk-example\nLINEAR_API_KEY=lin_example","allowed_hosts":["api.openai.com","api.linear.app"]}'GET /vault/v1/vaults/{vault_id}/secrets/{secret}
| 参数 | 位置 | 说明 |
|---|---|---|
| vault_id | path | 库 ID。 |
| secret | path | Secret 名称或 vsec_ 开头的 ID。 |
application/json
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 对象标识符 |
| type | "vault_secret" | 是 | 对象类型 |
| vault_id | string | 是 | 库 ID |
| name | string | 是 | 名称,库内唯一且不可改;1–128 个大写字母、数字或下划线,以字母或下划线开头 |
| kind | "static" / "oauth" | 是 | static:你填写的值;oauth:授权得到、由平台续期 |
| allowed_hosts | string[] | 是 | 1–16 个域名、公网 IPv4 或 .example.com;不匹配根域名。拒绝 IPv6、单标签主机、localhost、.internal、平台域名及回环/链路本地/私网/CGNAT IPv4;规范化并去重 |
| description | string / null | 是 | 备注;更新时 null 清除,省略则保留 |
| metadata | object | 是 | 自定义标签最多 16 对;source、template 为系统保留键,不占这 16 对且不能由调用方写入 |
| status | "active" / "refreshing" / "refresh_failed" / "archived" | 是 | 状态 |
| oauth | SecretOAuthSummary / null | 是 | OAuth 摘要;kind 为 static 时为 null |
| oauth.expires_at | date-time / null | 是 | 过期时间 |
| oauth.last_refreshed_at | date-time / null | 是 | 最近一次续期时间 |
| oauth.next_refresh_at | date-time / null | 是 | 下次计划续期时间 |
| oauth.scope | string / null | 是 | 授权范围 |
| oauth.last_error | object / null | 是 | 最近一次续期失败 |
| oauth.last_error.code | string | 是 | 稳定的错误码 |
| oauth.last_error.message | string | 是 | 可读的错误说明 |
| oauth.last_error.at | date-time | 是 | 事件或错误发生时间 |
| version | integer | 是 | 值每次变化时递增 |
| last_used_at | date-time / null | 是 | 最近一次被使用的时间 |
| created_at | date-time | 是 | 创建时间 |
| updated_at | date-time | 是 | 更新时间 |
| archived_at | date-time / null | 是 | 归档时间;未归档时为 null |
缺少或无效的 API Key 返回 401 UNAUTHENTICATED。
| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| VAULT_NOT_FOUND | 404 | 库不存在或不属于当前账户;检查库 ID | validation_failure | none | 否 |
| SECRET_NOT_FOUND | 404 | Secret 不存在,包括用非法名称查找;检查名称或 ID | validation_failure | none | 否 |
curl "https://api.deepraxis.ai/vault/v1/vaults/${VAULT_ID}/secrets/GITHUB_TOKEN" \
-H "Authorization: Bearer $PRAXIS_API_KEY"POST /vault/v1/vaults/{vault_id}/secrets/{secret}
| 参数 | 位置 | 说明 |
|---|---|---|
| vault_id | path | 库 ID。 |
| secret | path | Secret 名称或 vsec_ 开头的 ID。 |
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| value | string | 否 | Secret 的值,只写,不会返回;最大 16 KiB |
| allowed_hosts | string[] | 否 | 1–16 个域名、公网 IPv4 或 .example.com;不匹配根域名。拒绝 IPv6、单标签主机、localhost、.internal、平台域名及回环/链路本地/私网/CGNAT IPv4;规范化并去重 |
| description | string / null | 否 | 备注;更新时 null 清除,省略则保留 |
| metadata | object | 否 | 按键合并:字符串写入,null 删除,省略的键保留;source、template 为保留键 |
application/json
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 对象标识符 |
| type | "vault_secret" | 是 | 对象类型 |
| vault_id | string | 是 | 库 ID |
| name | string | 是 | 名称,库内唯一且不可改;1–128 个大写字母、数字或下划线,以字母或下划线开头 |
| kind | "static" / "oauth" | 是 | static:你填写的值;oauth:授权得到、由平台续期 |
| allowed_hosts | string[] | 是 | 1–16 个域名、公网 IPv4 或 .example.com;不匹配根域名。拒绝 IPv6、单标签主机、localhost、.internal、平台域名及回环/链路本地/私网/CGNAT IPv4;规范化并去重 |
| description | string / null | 是 | 备注;更新时 null 清除,省略则保留 |
| metadata | object | 是 | 自定义标签最多 16 对;source、template 为系统保留键,不占这 16 对且不能由调用方写入 |
| status | "active" / "refreshing" / "refresh_failed" / "archived" | 是 | 状态 |
| oauth | SecretOAuthSummary / null | 是 | OAuth 摘要;kind 为 static 时为 null |
| oauth.expires_at | date-time / null | 是 | 过期时间 |
| oauth.last_refreshed_at | date-time / null | 是 | 最近一次续期时间 |
| oauth.next_refresh_at | date-time / null | 是 | 下次计划续期时间 |
| oauth.scope | string / null | 是 | 授权范围 |
| oauth.last_error | object / null | 是 | 最近一次续期失败 |
| oauth.last_error.code | string | 是 | 稳定的错误码 |
| oauth.last_error.message | string | 是 | 可读的错误说明 |
| oauth.last_error.at | date-time | 是 | 事件或错误发生时间 |
| version | integer | 是 | 值每次变化时递增 |
| last_used_at | date-time / null | 是 | 最近一次被使用的时间 |
| created_at | date-time | 是 | 创建时间 |
| updated_at | date-time | 是 | 更新时间 |
| archived_at | date-time / null | 是 | 归档时间;未归档时为 null |
缺少或无效的 API Key 返回 401 UNAUTHENTICATED。
| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| VAULT_NOT_FOUND | 404 | 库不存在或不属于当前账户;检查库 ID | validation_failure | none | 否 |
| SECRET_NOT_FOUND | 404 | Secret 不存在,包括用非法名称查找;检查名称或 ID | validation_failure | none | 否 |
| VAULT_INVALID_STATE | 409 | 向已归档的库或 Secret 写入;改用有效资源 | validation_failure | none | 否 |
| INVALID_PARAMS | 400 | 字段、名称、域名、metadata、分页或回跳地址无效;修正请求 | validation_failure | none | 否 |
| SECRET_TOO_LARGE | 413 | 值超过 16384 字节;缩小值后重试 | validation_failure | none | 否 |
curl -X POST "https://api.deepraxis.ai/vault/v1/vaults/${VAULT_ID}/secrets/GITHUB_TOKEN" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"value":"ghp_rotated"}'DELETE /vault/v1/vaults/{vault_id}/secrets/{secret}
| 参数 | 位置 | 说明 |
|---|---|---|
| vault_id | path | 库 ID。 |
| secret | path | Secret 名称或 vsec_ 开头的 ID。 |
application/json
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 对象标识符 |
| type | "vault_secret_deleted" | 是 | 对象类型 |
缺少或无效的 API Key 返回 401 UNAUTHENTICATED。
| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| VAULT_NOT_FOUND | 404 | 库不存在或不属于当前账户;检查库 ID | validation_failure | none | 否 |
| SECRET_NOT_FOUND | 404 | Secret 不存在,包括用非法名称查找;检查名称或 ID | validation_failure | none | 否 |
curl -X DELETE "https://api.deepraxis.ai/vault/v1/vaults/${VAULT_ID}/secrets/GITHUB_TOKEN" \
-H "Authorization: Bearer $PRAXIS_API_KEY"POST /vault/v1/vaults/{vault_id}/secrets/{secret}/archive
| 参数 | 位置 | 说明 |
|---|---|---|
| vault_id | path | 库 ID。 |
| secret | path | Secret 名称或 vsec_ 开头的 ID。 |
application/json
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 对象标识符 |
| type | "vault_secret" | 是 | 对象类型 |
| vault_id | string | 是 | 库 ID |
| name | string | 是 | 名称,库内唯一且不可改;1–128 个大写字母、数字或下划线,以字母或下划线开头 |
| kind | "static" / "oauth" | 是 | static:你填写的值;oauth:授权得到、由平台续期 |
| allowed_hosts | string[] | 是 | 1–16 个域名、公网 IPv4 或 .example.com;不匹配根域名。拒绝 IPv6、单标签主机、localhost、.internal、平台域名及回环/链路本地/私网/CGNAT IPv4;规范化并去重 |
| description | string / null | 是 | 备注;更新时 null 清除,省略则保留 |
| metadata | object | 是 | 自定义标签最多 16 对;source、template 为系统保留键,不占这 16 对且不能由调用方写入 |
| status | "active" / "refreshing" / "refresh_failed" / "archived" | 是 | 状态 |
| oauth | SecretOAuthSummary / null | 是 | OAuth 摘要;kind 为 static 时为 null |
| oauth.expires_at | date-time / null | 是 | 过期时间 |
| oauth.last_refreshed_at | date-time / null | 是 | 最近一次续期时间 |
| oauth.next_refresh_at | date-time / null | 是 | 下次计划续期时间 |
| oauth.scope | string / null | 是 | 授权范围 |
| oauth.last_error | object / null | 是 | 最近一次续期失败 |
| oauth.last_error.code | string | 是 | 稳定的错误码 |
| oauth.last_error.message | string | 是 | 可读的错误说明 |
| oauth.last_error.at | date-time | 是 | 事件或错误发生时间 |
| version | integer | 是 | 值每次变化时递增 |
| last_used_at | date-time / null | 是 | 最近一次被使用的时间 |
| created_at | date-time | 是 | 创建时间 |
| updated_at | date-time | 是 | 更新时间 |
| archived_at | date-time / null | 是 | 归档时间;未归档时为 null |
缺少或无效的 API Key 返回 401 UNAUTHENTICATED。
| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| VAULT_NOT_FOUND | 404 | 库不存在或不属于当前账户;检查库 ID | validation_failure | none | 否 |
| SECRET_NOT_FOUND | 404 | Secret 不存在,包括用非法名称查找;检查名称或 ID | validation_failure | none | 否 |
curl -X POST "https://api.deepraxis.ai/vault/v1/vaults/${VAULT_ID}/secrets/GITHUB_TOKEN/archive" \
-H "Authorization: Bearer $PRAXIS_API_KEY"POST /vault/v1/vaults/{vault_id}/secrets/{secret}/validate
| 参数 | 位置 | 说明 |
|---|---|---|
| vault_id | path | 库 ID。 |
| secret | path | Secret 名称或 vsec_ 开头的 ID。 |
application/json
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| type | "vault_secret_validation" | 是 | 对象类型 |
| secret_id | string | 是 | 关联的 Secret ID;未关联时为 null |
| vault_id | string | 是 | 库 ID |
| validated_at | date-time | 是 | 校验时间 |
| has_refresh_token | boolean | 是 | 是否保存了刷新令牌 |
| status | "valid" / "invalid" / "unknown" | 是 | 状态 |
| probe | object | 是 | 探测请求 |
| probe.method | "GET" | 是 | 探测方式,当前为 GET |
| probe.http_response | HttpCapture / null | 是 | HTTP 响应摘要;未收到响应时为 null |
| probe.http_response.status_code | integer | 是 | HTTP 状态码 |
| probe.http_response.content_type | string / null | 是 | 响应内容类型,或 null |
| probe.http_response.body | string | 是 | 已脱敏的响应正文 |
| probe.http_response.body_truncated | boolean | 是 | 正文是否被截断 |
| refresh | object | 是 | 续期结果 |
| refresh.status | "succeeded" / "failed" / "connect_error" / "no_refresh_token" / "skipped" | 是 | 状态 |
| refresh.http_response | HttpCapture / null | 是 | HTTP 响应摘要;未收到响应时为 null |
| refresh.http_response.status_code | integer | 是 | HTTP 状态码 |
| refresh.http_response.content_type | string / null | 是 | 响应内容类型,或 null |
| refresh.http_response.body | string | 是 | 已脱敏的响应正文 |
| refresh.http_response.body_truncated | boolean | 是 | 正文是否被截断 |
缺少或无效的 API Key 返回 401 UNAUTHENTICATED。
| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| VAULT_NOT_FOUND | 404 | 库不存在或不属于当前账户;检查库 ID | validation_failure | none | 否 |
| SECRET_NOT_FOUND | 404 | Secret 不存在,包括用非法名称查找;检查名称或 ID | validation_failure | none | 否 |
| VALIDATE_UNSUPPORTED | 400 | 对 static Secret 校验;校验仅支持 OAuth Secret | validation_failure | none | 否 |
| RATE_LIMITED | 429 | 一分钟内超过授权或校验额度;等待下一窗口 | rate_limit | wait_then_retry | 是 |
仅适用于 OAuth Secret。先完成一键授权,并将返回的 secret_id 设为 OAUTH_SECRET_ID;不要使用 static Secret。
curl -X POST "https://api.deepraxis.ai/vault/v1/vaults/${VAULT_ID}/secrets/${OAUTH_SECRET_ID}/validate" \
-H "Authorization: Bearer $PRAXIS_API_KEY"POST /vault/v1/vaults/{vault_id}/secrets/{secret}/refresh
| 参数 | 位置 | 说明 |
|---|---|---|
| vault_id | path | 库 ID。 |
| secret | path | Secret 名称或 vsec_ 开头的 ID。 |
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| reason | "unauthorized" | 否 | 触发续期的原因 |
application/json
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 对象标识符 |
| type | "vault_secret" | 是 | 对象类型 |
| vault_id | string | 是 | 库 ID |
| name | string | 是 | 名称,库内唯一且不可改;1–128 个大写字母、数字或下划线,以字母或下划线开头 |
| kind | "static" / "oauth" | 是 | static:你填写的值;oauth:授权得到、由平台续期 |
| allowed_hosts | string[] | 是 | 1–16 个域名、公网 IPv4 或 .example.com;不匹配根域名。拒绝 IPv6、单标签主机、localhost、.internal、平台域名及回环/链路本地/私网/CGNAT IPv4;规范化并去重 |
| description | string / null | 是 | 备注;更新时 null 清除,省略则保留 |
| metadata | object | 是 | 自定义标签最多 16 对;source、template 为系统保留键,不占这 16 对且不能由调用方写入 |
| status | "active" / "refreshing" / "refresh_failed" / "archived" | 是 | 状态 |
| oauth | SecretOAuthSummary / null | 是 | OAuth 摘要;kind 为 static 时为 null |
| oauth.expires_at | date-time / null | 是 | 过期时间 |
| oauth.last_refreshed_at | date-time / null | 是 | 最近一次续期时间 |
| oauth.next_refresh_at | date-time / null | 是 | 下次计划续期时间 |
| oauth.scope | string / null | 是 | 授权范围 |
| oauth.last_error | object / null | 是 | 最近一次续期失败 |
| oauth.last_error.code | string | 是 | 稳定的错误码 |
| oauth.last_error.message | string | 是 | 可读的错误说明 |
| oauth.last_error.at | date-time | 是 | 事件或错误发生时间 |
| version | integer | 是 | 值每次变化时递增 |
| last_used_at | date-time / null | 是 | 最近一次被使用的时间 |
| created_at | date-time | 是 | 创建时间 |
| updated_at | date-time | 是 | 更新时间 |
| archived_at | date-time / null | 是 | 归档时间;未归档时为 null |
缺少或无效的 API Key 返回 401 UNAUTHENTICATED。
| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| VAULT_NOT_FOUND | 404 | 库不存在或不属于当前账户;检查库 ID | validation_failure | none | 否 |
| SECRET_NOT_FOUND | 404 | Secret 不存在,包括用非法名称查找;检查名称或 ID | validation_failure | none | 否 |
| VAULT_INVALID_STATE | 409 | 向已归档的库或 Secret 写入;改用有效资源 | validation_failure | none | 否 |
| SECRET_KIND_MISMATCH | 400 | 对 static Secret 续期或执行不匹配种类的操作;使用 OAuth Secret | validation_failure | none | 否 |
| INVALID_PARAMS | 400 | 字段、名称、域名、metadata、分页或回跳地址无效;修正请求 | validation_failure | none | 否 |
仅适用于 OAuth Secret。先完成一键授权,并将返回的 secret_id 设为 OAUTH_SECRET_ID;不要使用 static Secret。
curl -X POST "https://api.deepraxis.ai/vault/v1/vaults/${VAULT_ID}/secrets/${OAUTH_SECRET_ID}/refresh" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"reason":"unauthorized"}'| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 对象标识符 |
| type | "vault_secret" | 是 | 对象类型 |
| vault_id | string | 是 | 库 ID |
| name | string | 是 | 名称,库内唯一且不可改;1–128 个大写字母、数字或下划线,以字母或下划线开头 |
| kind | "static" / "oauth" | 是 | static:你填写的值;oauth:授权得到、由平台续期 |
| allowed_hosts | string[] | 是 | 1–16 个域名、公网 IPv4 或 .example.com;不匹配根域名。拒绝 IPv6、单标签主机、localhost、.internal、平台域名及回环/链路本地/私网/CGNAT IPv4;规范化并去重 |
| description | string / null | 是 | 备注;更新时 null 清除,省略则保留 |
| metadata | object | 是 | 自定义标签最多 16 对;source、template 为系统保留键,不占这 16 对且不能由调用方写入 |
| status | "active" / "refreshing" / "refresh_failed" / "archived" | 是 | 状态 |
| oauth | SecretOAuthSummary / null | 是 | OAuth 摘要;kind 为 static 时为 null |
| oauth.expires_at | date-time / null | 是 | 过期时间 |
| oauth.last_refreshed_at | date-time / null | 是 | 最近一次续期时间 |
| oauth.next_refresh_at | date-time / null | 是 | 下次计划续期时间 |
| oauth.scope | string / null | 是 | 授权范围 |
| oauth.last_error | object / null | 是 | 最近一次续期失败 |
| oauth.last_error.code | string | 是 | 稳定的错误码 |
| oauth.last_error.message | string | 是 | 可读的错误说明 |
| oauth.last_error.at | date-time | 是 | 事件或错误发生时间 |
| version | integer | 是 | 值每次变化时递增 |
| last_used_at | date-time / null | 是 | 最近一次被使用的时间 |
| created_at | date-time | 是 | 创建时间 |
| updated_at | date-time | 是 | 更新时间 |
| archived_at | date-time / null | 是 | 归档时间;未归档时为 null |
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| expires_at | date-time / null | 是 | 过期时间 |
| last_refreshed_at | date-time / null | 是 | 最近一次续期时间 |
| next_refresh_at | date-time / null | 是 | 下次计划续期时间 |
| scope | string / null | 是 | 授权范围 |
| last_error | object / null | 是 | 最近一次续期失败 |
| last_error.code | string | 是 | 稳定的错误码 |
| last_error.message | string | 是 | 可读的错误说明 |
| last_error.at | date-time | 是 | 事件或错误发生时间 |
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| name | string | 是 | 名称,库内唯一且不可改;1–128 个大写字母、数字或下划线,以字母或下划线开头 |
| value | string | 是 | Secret 的值,只写,不会返回;最大 16 KiB |
| allowed_hosts | string[] | 否 | 新建时用本行域名或导入的默认域名;替换时仅本行显式 allowed_hosts 才会更新域名 |
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| created | string[] | 是 | 新建的 Secret 名称 |
| replaced | string[] | 是 | 被替换的 Secret 名称 |
| failed | object[] | 是 | 失败的行 |
| failed[].line | integer | 是 | 失败行号,从 1 开始 |
| failed[].name | string / null | 是 | 名称,库内唯一且不可改;1–128 个大写字母、数字或下划线,以字母或下划线开头 |
| failed[].code | "VAULT_NOT_FOUND" / "SECRET_NOT_FOUND" / "AUTHORIZATION_NOT_FOUND" / "SECRET_CONFLICT" / "VAULT_INVALID_STATE" / "VAULT_LIMIT_EXCEEDED" / "INVALID_PARAMS" / "SECRET_KIND_MISMATCH" / "VALIDATE_UNSUPPORTED" / "SECRET_TOO_LARGE" / "RATE_LIMITED" / "AUTHORIZATION_EXPIRED" / "OAUTH_DISCOVERY_FAILED" / "OAUTH_REGISTRATION_UNSUPPORTED" / "OAUTH_ISSUER_MISMATCH" / "OAUTH_STATE_INVALID" / "OAUTH_EXCHANGE_FAILED" / "NOT_IMPLEMENTED" | 是 | 稳定的错误码 |
| failed[].message | string | 是 | 可读的错误说明 |
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| type | "vault_secret_validation" | 是 | 对象类型 |
| secret_id | string | 是 | 关联的 Secret ID;未关联时为 null |
| vault_id | string | 是 | 库 ID |
| validated_at | date-time | 是 | 校验时间 |
| has_refresh_token | boolean | 是 | 是否保存了刷新令牌 |
| status | "valid" / "invalid" / "unknown" | 是 | 状态 |
| probe | object | 是 | 探测请求 |
| probe.method | "GET" | 是 | 探测方式,当前为 GET |
| probe.http_response | HttpCapture / null | 是 | HTTP 响应摘要;未收到响应时为 null |
| probe.http_response.status_code | integer | 是 | HTTP 状态码 |
| probe.http_response.content_type | string / null | 是 | 响应内容类型,或 null |
| probe.http_response.body | string | 是 | 已脱敏的响应正文 |
| probe.http_response.body_truncated | boolean | 是 | 正文是否被截断 |
| refresh | object | 是 | 续期结果 |
| refresh.status | "succeeded" / "failed" / "connect_error" / "no_refresh_token" / "skipped" | 是 | 状态 |
| refresh.http_response | HttpCapture / null | 是 | HTTP 响应摘要;未收到响应时为 null |
| refresh.http_response.status_code | integer | 是 | HTTP 状态码 |
| refresh.http_response.content_type | string / null | 是 | 响应内容类型,或 null |
| refresh.http_response.body | string | 是 | 已脱敏的响应正文 |
| refresh.http_response.body_truncated | boolean | 是 | 正文是否被截断 |
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| status_code | integer | 是 | HTTP 状态码 |
| content_type | string / null | 是 | 响应内容类型,或 null |
| body | string | 是 | 已脱敏的响应正文 |
| body_truncated | boolean | 是 | 正文是否被截断 |
查询常用服务的模板 ID、Secret 名称、种类和允许域名。
| template_id | kind | 服务 |
|---|---|---|
| github | static | GitHub (api.github.com, uploads.github.com) |
| openai | static | OpenAI |
| anthropic | static | Anthropic |
| stripe | static | Stripe |
| linear | oauth | Linear (CIMD) |
| atlassian | oauth | Atlassian (DCR) |
GET /vault/v1/templates
application/json
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| data | VaultTemplate[] | 是 | 条目数组 |
| data[].id | string | 是 | 对象标识符 |
| data[].display_name | string | 是 | 显示名称,1–255 个字符 |
| data[].kind | "static" / "oauth" | 是 | static:你填写的值;oauth:授权得到、由平台续期 |
| data[].name | string | 是 | 名称,库内唯一且不可改;1–128 个大写字母、数字或下划线,以字母或下划线开头 |
| data[].allowed_hosts | string[] | 是 | 1–16 个域名、公网 IPv4 或 .example.com;不匹配根域名。拒绝 IPv6、单标签主机、localhost、.internal、平台域名及回环/链路本地/私网/CGNAT IPv4;规范化并去重 |
| data[].value_hint | string / null | 是 | 填写提示 |
缺少或无效的 API Key 返回 401 UNAUTHENTICATED。 没有额外的领域错误。
curl "https://api.deepraxis.ai/vault/v1/templates" \
-H "Authorization: Bearer $PRAXIS_API_KEY"| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 对象标识符 |
| display_name | string | 是 | 显示名称,1–255 个字符 |
| kind | "static" / "oauth" | 是 | static:你填写的值;oauth:授权得到、由平台续期 |
| name | string | 是 | 名称,库内唯一且不可改;1–128 个大写字母、数字或下划线,以字母或下划线开头 |
| allowed_hosts | string[] | 是 | 1–16 个域名、公网 IPv4 或 .example.com;不匹配根域名。拒绝 IPv6、单标签主机、localhost、.internal、平台域名及回环/链路本地/私网/CGNAT IPv4;规范化并去重 |
| value_hint | string / null | 是 | 填写提示 |
让用户授权第三方服务,并管理一次性授权链接与回跳地址。
一键授权为支持 OAuth 的服务产生 kind 为 oauth 的 Secret。发起授权后把 connect_url 交给最终用户;用户在确认页同意并在服务方完成授权后,Secret 写入库中,之后由平台续期。确认页、回调与客户端元数据三个地址不需要 API Key。
POST /vault/v1/authorizations
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| vault_id | string | 是 | 库 ID |
| template_id | "linear" / "atlassian" | 否 | 支持授权的模板 ID;与 resource_url 二选一 |
| resource_url | string | 否 | 要授权的资源地址,例如 MCP 服务地址 |
| return_url | string | 否 | 授权结束后回到的地址;须在回跳地址白名单内 |
application/json
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 对象标识符 |
| type | "vault_authorization" | 是 | 对象类型 |
| vault_id | string | 是 | 库 ID |
| status | "pending" / "authorizing" / "completed" / "failed" / "expired" | 是 | 状态 |
| resource | string | 是 | 资源地址 |
| secret_name | string | 是 | 关联的 Secret 名称 |
| connect_url | string | 是 | 交给最终用户打开的确认页,30 分钟内有效、只能使用一次 |
| client_registration | "cimd" / "dcr" / null | 是 | cimd:通过客户端元数据 URL 注册;dcr:动态注册客户端;尚未注册时为 null |
| secret_id | string / null | 是 | 关联的 Secret ID;未关联时为 null |
| error | object / null | 是 | 失败原因 |
| error.code | string | 是 | 稳定的错误码 |
| error.message | string | 是 | 可读的错误说明 |
| expires_at | date-time | 是 | 过期时间 |
| created_at | date-time | 是 | 创建时间 |
| updated_at | date-time | 是 | 更新时间 |
缺少或无效的 API Key 返回 401 UNAUTHENTICATED。
| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| VAULT_NOT_FOUND | 404 | 库不存在或不属于当前账户;检查库 ID | validation_failure | none | 否 |
| VAULT_INVALID_STATE | 409 | 向已归档的库或 Secret 写入;改用有效资源 | validation_failure | none | 否 |
| INVALID_PARAMS | 400 | 字段、名称、域名、metadata、分页或回跳地址无效;修正请求 | validation_failure | none | 否 |
| RATE_LIMITED | 429 | 一分钟内超过授权或校验额度;等待下一窗口 | rate_limit | wait_then_retry | 是 |
| OAUTH_DISCOVERY_FAILED | 400 | 无法发现服务方 OAuth 配置;检查资源地址 | validation_failure | continue_from_problem | 否 |
| OAUTH_REGISTRATION_UNSUPPORTED | 400 | 服务方不接受自动客户端注册;手动添加凭据 | validation_failure | continue_from_problem | 否 |
| OAUTH_ISSUER_MISMATCH | 400 | 授权服务器与预期不一致;重新检查服务地址 | provider_upstream | retry_from_user | 否 |
curl -X POST "https://api.deepraxis.ai/vault/v1/authorizations" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"vault_id\":\"${VAULT_ID}\",\"template_id\":\"linear\"}"GET /vault/v1/authorizations/{authorization_id}
| 参数 | 位置 | 说明 |
|---|---|---|
| authorization_id | path | 授权 ID。 |
application/json
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 对象标识符 |
| type | "vault_authorization" | 是 | 对象类型 |
| vault_id | string | 是 | 库 ID |
| status | "pending" / "authorizing" / "completed" / "failed" / "expired" | 是 | 状态 |
| resource | string | 是 | 资源地址 |
| secret_name | string | 是 | 关联的 Secret 名称 |
| connect_url | string | 是 | 交给最终用户打开的确认页,30 分钟内有效、只能使用一次 |
| client_registration | "cimd" / "dcr" / null | 是 | cimd:通过客户端元数据 URL 注册;dcr:动态注册客户端;尚未注册时为 null |
| secret_id | string / null | 是 | 关联的 Secret ID;未关联时为 null |
| error | object / null | 是 | 失败原因 |
| error.code | string | 是 | 稳定的错误码 |
| error.message | string | 是 | 可读的错误说明 |
| expires_at | date-time | 是 | 过期时间 |
| created_at | date-time | 是 | 创建时间 |
| updated_at | date-time | 是 | 更新时间 |
缺少或无效的 API Key 返回 401 UNAUTHENTICATED。
| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| AUTHORIZATION_NOT_FOUND | 404 | 授权或确认链接不存在;重新发起授权 | validation_failure | none | 否 |
curl "https://api.deepraxis.ai/vault/v1/authorizations/${AUTHORIZATION_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"GET /vault/v1/settings/return_urls
application/json
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| urls | string[] | 是 | https 地址,精确匹配,最多 10 个 |
缺少或无效的 API Key 返回 401 UNAUTHENTICATED。 没有额外的领域错误。
curl "https://api.deepraxis.ai/vault/v1/settings/return_urls" \
-H "Authorization: Bearer $PRAXIS_API_KEY"PUT /vault/v1/settings/return_urls
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| urls | string[] | 是 | https 地址,精确匹配,最多 10 个 |
application/json
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| urls | string[] | 是 | https 地址,精确匹配,最多 10 个 |
缺少或无效的 API Key 返回 401 UNAUTHENTICATED。
| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| INVALID_PARAMS | 400 | 字段、名称、域名、metadata、分页或回跳地址无效;修正请求 | validation_failure | none | 否 |
curl -X PUT "https://api.deepraxis.ai/vault/v1/settings/return_urls" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"urls":["https://app.example.com/connected"]}'GET /vault/v1/authorizations/callback · 无需 API Key
| 参数 | 位置 | 说明 |
|---|---|---|
| code | query | 服务方返回的授权码。 |
| state | query | 发起授权时产生的一次性状态值。 |
| error | query | 服务方拒绝授权时返回的错误。 |
| iss | query | 服务方声明的授权服务器地址。 |
text/html
浏览器显示的确认页或结果页。
通过 Location 响应头跳转到服务方授权页或已允许的回跳地址。
| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| OAUTH_STATE_INVALID | 400 | 回调 state 缺失、无效或重放;重新发起授权 | validation_failure | none | 否 |
| OAUTH_ISSUER_MISMATCH | 400 | 授权服务器与预期不一致;重新检查服务地址 | provider_upstream | retry_from_user | 否 |
| OAUTH_EXCHANGE_FAILED | 502 | 服务方拒绝授权码换令牌;重新授权 | provider_upstream | retry_from_user | 否 |
| AUTHORIZATION_EXPIRED | 410 | 授权链接超过 30 分钟或已使用;重新发起授权 | validation_failure | retry_from_user | 否 |
设置了 return_url 时返回 302;未设置时返回 HTTP 200 结果页。
curl "https://api.deepraxis.ai/vault/v1/authorizations/callback"GET /vault/v1/oauth/client.json · 无需 API Key
application/json
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| client_id | string | 是 | 客户端元数据 URL |
| client_name | string | 是 | 客户端显示名称 |
| redirect_uris | string[] | 是 | 允许的 OAuth 回调地址 |
| token_endpoint_auth_method | "none" | 是 | 令牌端点认证方式 |
| grant_types | "authorization_code" / "refresh_token"[] | 否 | 支持的授权类型 |
| response_types | "code"[] | 否 | 支持的授权响应类型 |
没有额外的领域错误。
curl "https://api.deepraxis.ai/vault/v1/oauth/client.json"GET /vault/v1/connect/{token} · 无需 API Key
| 参数 | 位置 | 说明 |
|---|---|---|
| token | path | connect_url 中的一次性令牌。 |
text/html
浏览器显示的确认页或结果页。
text/html
浏览器显示的确认页或结果页。
| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| AUTHORIZATION_NOT_FOUND | 404 | 授权或确认链接不存在;重新发起授权 | validation_failure | none | 否 |
| AUTHORIZATION_EXPIRED | 410 | 授权链接超过 30 分钟或已使用;重新发起授权 | validation_failure | retry_from_user | 否 |
无效链接返回 404;过期或已使用的链接返回 410,均为 HTML 页面。
curl "https://api.deepraxis.ai/vault/v1/connect/${TOKEN}"POST /vault/v1/connect/{token}/continue · 无需 API Key
| 参数 | 位置 | 说明 |
|---|---|---|
| token | path | connect_url 中的一次性令牌。 |
通过 Location 响应头跳转到服务方授权页或已允许的回跳地址。
| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| AUTHORIZATION_NOT_FOUND | 404 | 授权或确认链接不存在;重新发起授权 | validation_failure | none | 否 |
| AUTHORIZATION_EXPIRED | 410 | 授权链接超过 30 分钟或已使用;重新发起授权 | validation_failure | retry_from_user | 否 |
| OAUTH_DISCOVERY_FAILED | 400 | 无法发现服务方 OAuth 配置;检查资源地址 | validation_failure | continue_from_problem | 否 |
curl -X POST "https://api.deepraxis.ai/vault/v1/connect/${TOKEN}/continue"POST /vault/v1/connect/{token}/deny · 无需 API Key
| 参数 | 位置 | 说明 |
|---|---|---|
| token | path | connect_url 中的一次性令牌。 |
text/html
浏览器显示的确认页或结果页。
通过 Location 响应头跳转到服务方授权页或已允许的回跳地址。
| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| AUTHORIZATION_NOT_FOUND | 404 | 授权或确认链接不存在;重新发起授权 | validation_failure | none | 否 |
| AUTHORIZATION_EXPIRED | 410 | 授权链接超过 30 分钟或已使用;重新发起授权 | validation_failure | retry_from_user | 否 |
设置了 return_url 时返回 302;未设置时返回 HTTP 200 结果页。
curl -X POST "https://api.deepraxis.ai/vault/v1/connect/${TOKEN}/deny"| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 对象标识符 |
| type | "vault_authorization" | 是 | 对象类型 |
| vault_id | string | 是 | 库 ID |
| status | "pending" / "authorizing" / "completed" / "failed" / "expired" | 是 | 状态 |
| resource | string | 是 | 资源地址 |
| secret_name | string | 是 | 关联的 Secret 名称 |
| connect_url | string | 是 | 交给最终用户打开的确认页,30 分钟内有效、只能使用一次 |
| client_registration | "cimd" / "dcr" / null | 是 | cimd:通过客户端元数据 URL 注册;dcr:动态注册客户端;尚未注册时为 null |
| secret_id | string / null | 是 | 关联的 Secret ID;未关联时为 null |
| error | object / null | 是 | 失败原因 |
| error.code | string | 是 | 稳定的错误码 |
| error.message | string | 是 | 可读的错误说明 |
| expires_at | date-time | 是 | 过期时间 |
| created_at | date-time | 是 | 创建时间 |
| updated_at | date-time | 是 | 更新时间 |
| 字段 | 类型 / 枚举 | 必填 | 说明 |
|---|---|---|---|
| urls | string[] | 是 | https 地址,精确匹配,最多 10 个 |
错误响应体统一为下面的形状;code 是稳定的错误码,message 给人读。
{
"request_id": "req_example",
"error": {
"code": "SECRET_CONFLICT",
"message": "A secret named GITHUB_TOKEN already exists",
"kind": "validation_failure",
"recovery": "none",
"retryable": false
}
}错误体包含 request_id,可用于定位请求。兼容接口使用下列错误形状;409 的类型为 conflict_error,不可重试的错误带 x-should-retry: false。
{
"type": "error",
"error": {
"type": "conflict_error",
"message": "A credential with this name already exists"
},
"request_id": "req_example"
}| 错误码 | HTTP | 含义、触发条件与处理 | kind | recovery | 可重试 |
|---|---|---|---|---|---|
| VAULT_NOT_FOUND | 404 | 库不存在或不属于当前账户;检查库 ID | validation_failure | none | 否 |
| SECRET_NOT_FOUND | 404 | Secret 不存在,包括用非法名称查找;检查名称或 ID | validation_failure | none | 否 |
| AUTHORIZATION_NOT_FOUND | 404 | 授权或确认链接不存在;重新发起授权 | validation_failure | none | 否 |
| SECRET_CONFLICT | 409 | 创建时名称已占用;更换名称或更新已有 Secret | validation_failure | none | 否 |
| VAULT_INVALID_STATE | 409 | 向已归档的库或 Secret 写入;改用有效资源 | validation_failure | none | 否 |
| VAULT_LIMIT_EXCEEDED | 400 | 超过有效 Secret 数量上限;先清理不用的 Secret | validation_failure | none | 否 |
| INVALID_PARAMS | 400 | 字段、名称、域名、metadata、分页或回跳地址无效;修正请求 | validation_failure | none | 否 |
| SECRET_KIND_MISMATCH | 400 | 对 static Secret 续期或执行不匹配种类的操作;使用 OAuth Secret | validation_failure | none | 否 |
| VALIDATE_UNSUPPORTED | 400 | 对 static Secret 校验;校验仅支持 OAuth Secret | validation_failure | none | 否 |
| SECRET_TOO_LARGE | 413 | 值超过 16384 字节;缩小值后重试 | validation_failure | none | 否 |
| RATE_LIMITED | 429 | 一分钟内超过授权或校验额度;等待下一窗口 | rate_limit | wait_then_retry | 是 |
| AUTHORIZATION_EXPIRED | 410 | 授权链接超过 30 分钟或已使用;重新发起授权 | validation_failure | retry_from_user | 否 |
| OAUTH_DISCOVERY_FAILED | 400 | 无法发现服务方 OAuth 配置;检查资源地址 | validation_failure | continue_from_problem | 否 |
| OAUTH_REGISTRATION_UNSUPPORTED | 400 | 服务方不接受自动客户端注册;手动添加凭据 | validation_failure | continue_from_problem | 否 |
| OAUTH_ISSUER_MISMATCH | 400 | 授权服务器与预期不一致;重新检查服务地址 | provider_upstream | retry_from_user | 否 |
| OAUTH_STATE_INVALID | 400 | 回调 state 缺失、无效或重放;重新发起授权 | validation_failure | none | 否 |
| OAUTH_EXCHANGE_FAILED | 502 | 服务方拒绝授权码换令牌;重新授权 | provider_upstream | retry_from_user | 否 |
| NOT_IMPLEMENTED | 501 | 功能尚不支持;使用文档列出的替代方式 | execution_failed | none | 否 |