跳转到主要内容
GET
/
v3
/
enterprise
/
consumption
/
daily
获取每日使用量
curl --request GET \
  --url https://api.devin.ai/v3/enterprise/consumption/daily \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.devin.ai/v3/enterprise/consumption/daily"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.devin.ai/v3/enterprise/consumption/daily', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.devin.ai/v3/enterprise/consumption/daily",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.devin.ai/v3/enterprise/consumption/daily"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.devin.ai/v3/enterprise/consumption/daily")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.devin.ai/v3/enterprise/consumption/daily")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "consumption_by_date": [
    {
      "acus": 123,
      "acus_by_product": {
        "cascade": 123,
        "devin": 123,
        "terminal": 123,
        "review": 123
      },
      "date": 123
    }
  ],
  "total_acus": 123
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

产品级别拆分

响应中的每个日期条目都包含一个 acus_by_product 对象,它将 ACU 的总消耗按产品维度拆分为 devincascadeterminal。这使你能够查看每天在各产品之间的消耗分布情况。当某个产品的产品级数据不可用时,其值会默认为 0.0

权限

需要具备企业级别 ViewAccountConsumption 权限的服务用户。

授权

Authorization
string
header
必填

服务用户凭据(前缀:cog_)

查询参数

time_before
integer | null
time_after
integer | null

响应

成功响应

consumption_by_date
ConsumptionByDateResponse · object[]
必填
total_acus
number
必填