获取项目
查询单个项目
GET
/
v1
/
admin
/
organizations
/
projects
/
{pid}
查询单个项目
curl --request GET \
--url https://api.moonshot.cn/v1/admin/organizations/projects/{pid} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.moonshot.cn/v1/admin/organizations/projects/{pid}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.moonshot.cn/v1/admin/organizations/projects/{pid}', 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.moonshot.cn/v1/admin/organizations/projects/{pid}",
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.moonshot.cn/v1/admin/organizations/projects/{pid}"
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.moonshot.cn/v1/admin/organizations/projects/{pid}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.moonshot.cn/v1/admin/organizations/projects/{pid}")
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{
"id": "<string>",
"name": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"archived_at": "2023-11-07T05:31:56Z",
"daily_consume_limit": 1,
"monthly_consume_limit": 1,
"max_token_per_minute": 1
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}本接口要求 Admin Key 具备
org:read 作用域。授权
Authorization 请求头携带 Admin API secret 作为 Bearer 令牌,格式为 Bearer sk-admin-***。Admin Key 可在「控制台 → 组织管理 → Admin API Keys」创建。
路径参数
项目 ID。
响应
项目详情。
项目 ID。
项目名称。
项目创建时间。
项目描述。
归档时间;未归档为 null。
日支出限额(毫分)。按 Asia/Shanghai 自然日累计重置;超出预算不阻断调用、超出部分仍计费(预算用于支出管理与占比展示,非强制刹车)。null 表示未设置(不限),0 表示预算为 0(仅展示超支)。
必填范围:
x >= 0月支出限额(毫分)。按 Asia/Shanghai 自然月累计重置;超出预算不阻断调用、超出部分仍计费(预算用于支出管理与占比展示,非强制刹车)。null 表示未设置(不限),0 表示预算为 0(仅展示超支)。
必填范围:
x >= 0项目级每分钟 token 上限(TPM);null 表示清除项目级覆盖、继承组织速率限制配置(非完全不限速)。
必填范围:
x >= 0此页面对您有帮助吗?
⌘I
查询单个项目
curl --request GET \
--url https://api.moonshot.cn/v1/admin/organizations/projects/{pid} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.moonshot.cn/v1/admin/organizations/projects/{pid}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.moonshot.cn/v1/admin/organizations/projects/{pid}', 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.moonshot.cn/v1/admin/organizations/projects/{pid}",
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.moonshot.cn/v1/admin/organizations/projects/{pid}"
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.moonshot.cn/v1/admin/organizations/projects/{pid}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.moonshot.cn/v1/admin/organizations/projects/{pid}")
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{
"id": "<string>",
"name": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"archived_at": "2023-11-07T05:31:56Z",
"daily_consume_limit": 1,
"monthly_consume_limit": 1,
"max_token_per_minute": 1
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}