获取费用仪表盘数据

获取 /api/v1/projects/{id}/ 费用/ 仪表盘

通过业务流程引擎返回聚合的费用和令牌使用数据。项目范围由路由 ID 路径参数承载,而组织则派生自该项目。

路径参数

  • id 字符串 必需

    项目 ID

查询参数

  • period 字符串

    时间段(例如 7d、30d、90d)

  • Workspace_id 字符串

    按工作区筛选

响应

  • 不支持或格式不正确的API版本、所选已发布合约中不可用的操作或不可接受的表示形式(包括不支持的媒体类型参数或排除的 SSE)。现有的身份验证、授权和速率限制失败优先。

    隐藏响应属性 显示响应属性 对象
    • badRequestDetail 对象

      标准错误模式定义的可选验证详细信息; API协商错误不会发出此字段。

      隐藏 BadRequestDetail 属性 显示 BadRequestDetail 属性 对象
      • 字段 大量[对象]

        验证失败的字段。

        隐藏字段属性 显示字段属性 对象

        字段及其验证失败。

        • 描述 字符串 必需

          人类可读的验证失败。

        • 字段 字符串 必需

          无效请求字段的名称或路径。

    • 详细信息 字符串 必需

      人类可读的错误详细信息。

    • 错误 整型 必需

      HTTP status code.

    • 错误代码 字符串 必需

      机器可读的错误代码。

    • 参数 array[string]

      与错误相关的请求参数名称;不应用时省略。

    • 原因 字符串 必需

      HTTP状态原因短语。

    隐藏响应属性 显示响应属性 对象
    • badRequestDetail 对象

      标准错误模式定义的可选验证详细信息; API协商错误不会发出此字段。

      隐藏 BadRequestDetail 属性 显示 BadRequestDetail 属性 对象
      • 字段 大量[对象]

        验证失败的字段。

        隐藏字段属性 显示字段属性 对象

        字段及其验证失败。

        • 描述 字符串 必需

          人类可读的验证失败。

        • 字段 字符串 必需

          无效请求字段的名称或路径。

    • 详细信息 字符串 必需

      人类可读的错误详细信息。

    • 错误 整型 必需

      HTTP status code.

    • 错误代码 字符串 必需

      机器可读的错误代码。

    • 参数 array[string]

      与错误相关的请求参数名称;不应用时省略。

    • 原因 字符串 必需

      HTTP状态原因短语。

  • 200

    正常

    隐藏响应属性 显示响应属性 对象
    • by_model 大量[对象]
      隐藏 by_model 属性 显示 by_model 属性 对象
      • call_count 整型
      • 模型 字符串
      • 百分比 数字
      • total_cost_usd 数字
      • total_tokens 整型
    • by_workspace 大量[对象]
      隐藏 by_workspace 属性 显示 by_workspace 属性 对象
      • call_count 整型
      • 百分比 数字
      • total_cost_usd 数字
      • total_tokens 整型
      • Workspace_id 字符串
    • daily_trend 大量[对象]
      Hide daily_trend attributes 显示 daily_trend 属性 对象
      • call_count 整型
      • 日期 字符串
      • total_cost_usd 数字
      • total_tokens 整型
    • Success 布尔
    • 总结 对象
      隐藏摘要属性 显示摘要属性 对象
      • total_completion_tokens 整型
      • total_cost_usd 数字
      • total_llm_calls 整型
      • total_prompt_tokens 整型
      • total_tokens 整型
      • unpriced_llm_calls 整型
    隐藏响应属性 显示响应属性 对象
    • by_model 大量[对象]
      隐藏 by_model 属性 显示 by_model 属性 对象
      • call_count 整型
      • 模型 字符串
      • 百分比 数字
      • total_cost_usd 数字
      • total_tokens 整型
    • by_workspace 大量[对象]
      隐藏 by_workspace 属性 显示 by_workspace 属性 对象
      • call_count 整型
      • 百分比 数字
      • total_cost_usd 数字
      • total_tokens 整型
      • Workspace_id 字符串
    • daily_trend 大量[对象]
      Hide daily_trend attributes 显示 daily_trend 属性 对象
      • call_count 整型
      • 日期 字符串
      • total_cost_usd 数字
      • total_tokens 整型
    • Success 布尔
    • 总结 对象
      隐藏摘要属性 显示摘要属性 对象
      • total_completion_tokens 整型
      • total_cost_usd 数字
      • total_llm_calls 整型
      • total_prompt_tokens 整型
      • total_tokens 整型
      • unpriced_llm_calls 整型
  • Bad Request

    隐藏响应属性 显示响应属性 对象
    • 代码 字符串
    • 错误 字符串
    • Success 布尔
    隐藏响应属性 显示响应属性 对象
    • 代码 字符串
    • 错误 字符串
    • Success 布尔
  • Unauthorized

    隐藏响应属性 显示响应属性 对象
    • 代码 字符串
    • 错误 字符串
    • Success 布尔
    隐藏响应属性 显示响应属性 对象
    • 代码 字符串
    • 错误 字符串
    • Success 布尔
  • 内部服务器错误

    隐藏响应属性 显示响应属性 对象
    • 代码 字符串
    • 错误 字符串
    • Success 布尔
    隐藏响应属性 显示响应属性 对象
    • 代码 字符串
    • 错误 字符串
    • Success 布尔
  • 错误网关

    隐藏响应属性 显示响应属性 对象
    • 代码 字符串
    • 错误 字符串
    • Success 布尔
    隐藏响应属性 显示响应属性 对象
    • 代码 字符串
    • 错误 字符串
    • Success 布尔
GET /api/v1/projects/{id}/ 费用/ 仪表盘
curl \
 --request GET 'https://agentengine.mongodb.com/api/v1/projects/{id}/cost/dashboard' \
 --header "Authorization: $API_KEY"
响应示例 (406)
{
  "detail": "This operation is not available in API version 2026-09-20-preview.",
  "error": 406,
  "errorCode": "OPERATION_NOT_IN_API_VERSION",
  "parameters": [
    "Accept"
  ],
  "reason": "Not Acceptable"
}
{
  "detail": "This operation supports text/event-stream, which the Accept header excludes. Remove unsupported media-type parameters or accept this type with a positive q value.",
  "error": 406,
  "errorCode": "UNACCEPTABLE_MEDIA_TYPE",
  "parameters": [
    "Accept"
  ],
  "reason": "Not Acceptable"
}
{
  "detail": "The requested API version is not supported. Supported versions: 2026-09-20-preview.",
  "error": 406,
  "errorCode": "UNSUPPORTED_API_VERSION",
  "parameters": [
    "Accept"
  ],
  "reason": "Not Acceptable"
}
响应示例 (406)
{
  "detail": "This operation is not available in API version 2026-09-20-preview.",
  "error": 406,
  "errorCode": "OPERATION_NOT_IN_API_VERSION",
  "parameters": [
    "Accept"
  ],
  "reason": "Not Acceptable"
}
响应示例 (200)
{
  "by_model": [
    {
      "call_count": 42,
      "model": "string",
      "percentage": 42.0,
      "total_cost_usd": 42.0,
      "total_tokens": 42
    }
  ],
  "by_workspace": [
    {
      "call_count": 42,
      "percentage": 42.0,
      "total_cost_usd": 42.0,
      "total_tokens": 42,
      "workspace_id": "string"
    }
  ],
  "daily_trend": [
    {
      "call_count": 42,
      "date": "string",
      "total_cost_usd": 42.0,
      "total_tokens": 42
    }
  ],
  "success": true,
  "summary": {
    "total_completion_tokens": 42,
    "total_cost_usd": 42.0,
    "total_llm_calls": 42,
    "total_prompt_tokens": 42,
    "total_tokens": 42,
    "unpriced_llm_calls": 42
  }
}
响应示例 (200)
{
  "by_model": [
    {
      "call_count": 42,
      "model": "string",
      "percentage": 42.0,
      "total_cost_usd": 42.0,
      "total_tokens": 42
    }
  ],
  "by_workspace": [
    {
      "call_count": 42,
      "percentage": 42.0,
      "total_cost_usd": 42.0,
      "total_tokens": 42,
      "workspace_id": "string"
    }
  ],
  "daily_trend": [
    {
      "call_count": 42,
      "date": "string",
      "total_cost_usd": 42.0,
      "total_tokens": 42
    }
  ],
  "success": true,
  "summary": {
    "total_completion_tokens": 42,
    "total_cost_usd": 42.0,
    "total_llm_calls": 42,
    "total_prompt_tokens": 42,
    "total_tokens": 42,
    "unpriced_llm_calls": 42
  }
}
响应示例 (400)
{
  "code": "string",
  "error": "string",
  "success": true
}
响应示例 (400)
{
  "code": "string",
  "error": "string",
  "success": true
}
响应示例 (401)
{
  "code": "string",
  "error": "string",
  "success": true
}
响应示例 (401)
{
  "code": "string",
  "error": "string",
  "success": true
}
响应示例 (500)
{
  "code": "string",
  "error": "string",
  "success": true
}
响应示例 (500)
{
  "code": "string",
  "error": "string",
  "success": true
}
响应示例 (502)
{
  "code": "string",
  "error": "string",
  "success": true
}
响应示例 (502)
{
  "code": "string",
  "error": "string",
  "success": true
}