curl --request GET \
--url https://api.example.com/portal/api/usage \
--cookie gproxy_session=import requests
url = "https://api.example.com/portal/api/usage"
headers = {"cookie": "gproxy_session="}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {cookie: 'gproxy_session='}};
fetch('https://api.example.com/portal/api/usage', 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.example.com/portal/api/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_COOKIE => "gproxy_session=",
]);
$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.example.com/portal/api/usage"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("cookie", "gproxy_session=")
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.example.com/portal/api/usage")
.header("cookie", "gproxy_session=")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/portal/api/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["cookie"] = 'gproxy_session='
response = http.request(request)
puts response.read_body{
"fromMs": 123,
"groups": [
{
"key": "<string>",
"summary": {
"averageOutputTps": 123,
"cacheCreation": [
{
"tokens": 1,
"ttlSeconds": 1
}
],
"cacheCreationTokens": 1,
"cachedInputTokens": 1,
"cost": "<string>",
"currency": "<string>",
"inputTokens": 1,
"outputTokens": 1,
"quantities": {},
"reasoningTokens": 1,
"requests": 1,
"scanned": 1,
"truncated": true
}
}
],
"summary": {
"averageOutputTps": 123,
"cacheCreation": [
{
"tokens": 1,
"ttlSeconds": 1
}
],
"cacheCreationTokens": 1,
"cachedInputTokens": 1,
"cost": "<string>",
"currency": "<string>",
"inputTokens": 1,
"outputTokens": 1,
"quantities": {},
"reasoningTokens": 1,
"requests": 1,
"scanned": 1,
"truncated": true
},
"toMs": 123,
"trend": [
{
"endMs": 123,
"startMs": 123,
"summary": {
"averageOutputTps": 123,
"cacheCreation": [
{
"tokens": 1,
"ttlSeconds": 1
}
],
"cacheCreationTokens": 1,
"cachedInputTokens": 1,
"cost": "<string>",
"currency": "<string>",
"inputTokens": 1,
"outputTokens": 1,
"quantities": {},
"reasoningTokens": 1,
"requests": 1,
"scanned": 1,
"truncated": true
}
}
]
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}GET /portal/api/usage
curl --request GET \
--url https://api.example.com/portal/api/usage \
--cookie gproxy_session=import requests
url = "https://api.example.com/portal/api/usage"
headers = {"cookie": "gproxy_session="}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {cookie: 'gproxy_session='}};
fetch('https://api.example.com/portal/api/usage', 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.example.com/portal/api/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_COOKIE => "gproxy_session=",
]);
$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.example.com/portal/api/usage"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("cookie", "gproxy_session=")
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.example.com/portal/api/usage")
.header("cookie", "gproxy_session=")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/portal/api/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["cookie"] = 'gproxy_session='
response = http.request(request)
puts response.read_body{
"fromMs": 123,
"groups": [
{
"key": "<string>",
"summary": {
"averageOutputTps": 123,
"cacheCreation": [
{
"tokens": 1,
"ttlSeconds": 1
}
],
"cacheCreationTokens": 1,
"cachedInputTokens": 1,
"cost": "<string>",
"currency": "<string>",
"inputTokens": 1,
"outputTokens": 1,
"quantities": {},
"reasoningTokens": 1,
"requests": 1,
"scanned": 1,
"truncated": true
}
}
],
"summary": {
"averageOutputTps": 123,
"cacheCreation": [
{
"tokens": 1,
"ttlSeconds": 1
}
],
"cacheCreationTokens": 1,
"cachedInputTokens": 1,
"cost": "<string>",
"currency": "<string>",
"inputTokens": 1,
"outputTokens": 1,
"quantities": {},
"reasoningTokens": 1,
"requests": 1,
"scanned": 1,
"truncated": true
},
"toMs": 123,
"trend": [
{
"endMs": 123,
"startMs": 123,
"summary": {
"averageOutputTps": 123,
"cacheCreation": [
{
"tokens": 1,
"ttlSeconds": 1
}
],
"cacheCreationTokens": 1,
"cachedInputTokens": 1,
"cost": "<string>",
"currency": "<string>",
"inputTokens": 1,
"outputTokens": 1,
"quantities": {},
"reasoningTokens": 1,
"requests": 1,
"scanned": 1,
"truncated": true
}
}
]
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}授权
查询参数
One of the caller's own keys. A key that is not theirs matches nothing, because the user filter is applied as well.
Bucket width for the trend. Absent means no trend is computed; present
requires toMs, and without fromMs the buckets start at the first
matching record.
Admin surface only: the share of one credential's attempts. A portal
refuses it for the same reason it refuses groupBy: credential —
credential ids are the operator's, not the caller's.
Inclusive lower bound on startedAtMs.
Absent means no grouped cut is computed.
user, apiKey, operation Admin surface only: the share of one upstream provider's attempts. A portal refuses it, because it never shows a caller provider ids.
Exclusive upper bound.
Ignored. See the type note.
响应
Success
The caller's own usage over the requested range.