跳转到内容
EN

组织 API

(待译)

Organization holds the tenant’s own records: its members, feedback, usage, costs, charges and usage events. Concepts follow GitHub org members for the membership list and FOCUS 1.3 for the usage records. The org chart — departments, jobs, ladders, positions, assignments, specs and OKRs — is the workforce face at /workforce/v1 (ADR-191). Start with GET /organization/v1/members.

基础地址

https://api.deepraxis.com/organization/v1

接入

curl
curl "https://api.deepraxis.com/organization/v1/costs?starting_at=2026-09-26T00:00:00Z&ending_at=2026-09-27T00:00:00Z&bucket_width=1d&group_by=ServiceName" \
  -H "Authorization: Bearer $PRAXIS_API_KEY"
Python
import os

import requests

opts = dict(
    base_url="https://api.deepraxis.com/organization/v1",
    api_key=os.environ["PRAXIS_API_KEY"],
)

# /organization 是我们自己的组织用量形状,直接发 HTTP 请求(Bearer 认证)
resp = requests.get(
    f"{opts['base_url']}/costs?starting_at=2026-09-26T00:00:00Z&ending_at=2026-09-27T00:00:00Z&bucket_width=1d&group_by=ServiceName",
    headers={"Authorization": f"Bearer {opts['api_key']}"},
)
print(resp.status_code, resp.json())
TypeScript


const opts = {
  baseURL: "https://api.deepraxis.com/organization/v1",
  apiKey: process.env.PRAXIS_API_KEY,
};

// /organization 是我们自己的组织用量形状,直接发 HTTP 请求(Bearer 认证)
const resp = await fetch(`${opts.baseURL}/costs?starting_at=2026-09-26T00:00:00Z&ending_at=2026-09-27T00:00:00Z&bucket_width=1d&group_by=ServiceName`, {
  headers: { Authorization: `Bearer ${opts.apiKey}` },
});
console.log(resp.status, await resp.json());

事实与边界

事实说明
组织由 Key 决定调用方的 API Key 解析出唯一的组织;路径里没有组织 ID,组织的任何有效 API Key 都可读本域
只覆盖实际扣费统计组织实际被扣的费用,按结算币种(人民币 CNY 或美元 USD)计;组织的赠送额度先于现金被扣,也在其中
字段名按 FOCUS 1.3BilledCost、ServiceName、ConsumedQuantity 等列名与 FOCUS 1.3 规范逐字一致
时间一律 UTC窗口边界与时间桶都是 UTC ISO 8601;桶对齐到整点或自然日
查询窗口上限 93 天查询费用 / 查询用量 / 用量事件一次最多查 93 天;更久的账用费用明细导出,它按天在服务端分页
分页是不透明游标列表带 has_more 与 next_page;把 next_page 原样放进 page 参数取下一页

金额都是十进制字符串(如 "0.001234"),币种见同一行的 BillingCurrency(CNY 或 USD);不要用浮点数相加——对账请按字符串精确十进制求和,且不同币种不要相加。

这里只统计从资金账户以美元扣费的用量;Credits 余额不在这个域。鉴权方式见鉴权。

端点

方法路径说明支持
GET/v1/members列出组织成员● 支持
GET/v1/costs查询费用● 支持
GET/v1/usage查询用量● 支持
GET/v1/events列出用量事件● 支持
GET/v1/events/{id}查看单个用量事件● 支持
GET/v1/charges导出费用明细● 支持

与官方的差异

  • 聚合信封照 OpenAI organization usage/costs、分桶与 estimated 标记照 AWS GetCostAndUsage、列名按 FOCUS 1.3、明细导出照 Vercel charges 的 JSONL。只给原始事实:占比、环比、前 N 名等派生视图不在本域,请在调用方自行计算。

参数与字段的权威定义以本站 /meta/v1/openapi.yaml 公开的规范与 FOCUS 1.3 规范为准。

错误按 problem+json 格式返回,参见错误;额度与响应头参见限流。