查询资源
curl --request GET \
--url https://api.chenyu.cn/v1/assets/{asset_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.chenyu.cn/v1/assets/{asset_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.chenyu.cn/v1/assets/{asset_id}', 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.chenyu.cn/v1/assets/{asset_id}",
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.chenyu.cn/v1/assets/{asset_id}"
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.chenyu.cn/v1/assets/{asset_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chenyu.cn/v1/assets/{asset_id}")
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>",
"asset_id": "<string>",
"asset_uri": "<string>",
"url": "<string>",
"signed_url": "<string>",
"media_type": "<string>",
"mime_type": "<string>",
"size_bytes": 123,
"purpose": "<string>",
"persistent": true,
"expires_at": "<string>",
"status": "<string>"
}直接 API 调用
查询资源
查询大模型网关资源状态和访问地址
GET
/
v1
/
assets
/
{asset_id}
查询资源
curl --request GET \
--url https://api.chenyu.cn/v1/assets/{asset_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.chenyu.cn/v1/assets/{asset_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.chenyu.cn/v1/assets/{asset_id}', 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.chenyu.cn/v1/assets/{asset_id}",
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.chenyu.cn/v1/assets/{asset_id}"
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.chenyu.cn/v1/assets/{asset_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chenyu.cn/v1/assets/{asset_id}")
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>",
"asset_id": "<string>",
"asset_uri": "<string>",
"url": "<string>",
"signed_url": "<string>",
"media_type": "<string>",
"mime_type": "<string>",
"size_bytes": 123,
"purpose": "<string>",
"persistent": true,
"expires_at": "<string>",
"status": "<string>"
}查询资源
根据资源 ID 查询资源状态、引用地址和访问地址。资源过期、无权限或审核未通过时,接口会返回 OpenAI 风格错误响应。请求参数
string
required
资源 ID,例如
asset_38d2ff7769fb3b7267039941547e6a78响应参数
string
资源 ID
string
资源 ID,与
id 含义一致string
资源引用地址,提交模型请求时优先使用
string
资源访问地址
string
带签名的临时访问地址
string
资源类型
string
MIME 类型
integer
文件大小,单位字节
string
资源用途
boolean
是否为长期资源
string
临时资源过期时间
string
资源状态
代码示例
import requests
asset_id = "asset_38d2ff7769fb3b7267039941547e6a78"
url = f"https://api.chenyu.cn/v1/assets/{asset_id}"
headers = {"Authorization": "Bearer your_api_key"}
response = requests.get(url, headers=headers)
print(response.json()["asset_uri"])
const axios = require('axios');
const assetId = 'asset_38d2ff7769fb3b7267039941547e6a78';
axios.get(`https://api.chenyu.cn/v1/assets/${assetId}`, {
headers: {
Authorization: 'Bearer your_api_key'
}
}).then((response) => {
console.log(response.data.asset_uri);
});
curl -X GET "https://api.chenyu.cn/v1/assets/asset_38d2ff7769fb3b7267039941547e6a78" \
-H "Authorization: Bearer your_api_key"
响应示例
{
"id": "asset_38d2ff7769fb3b7267039941547e6a78",
"asset_id": "asset_38d2ff7769fb3b7267039941547e6a78",
"asset_uri": "asset://asset_38d2ff7769fb3b7267039941547e6a78",
"url": "https://www.chenyu.team/assets/asset_38d2ff7769fb3b7267039941547e6a78/content",
"content_url": "https://www.chenyu.team/assets/asset_38d2ff7769fb3b7267039941547e6a78/content",
"signed_url": "https://www.chenyu.team/assets/asset_38d2ff7769fb3b7267039941547e6a78/content?expires=1781295600&signature=xxxx",
"media_type": "image",
"mime_type": "image/png",
"size_bytes": 102400,
"purpose": "temp_input",
"persistent": false,
"expires_at": "2026-06-16T12:00:00+08:00",
"status": "confirmed",
"original_filename": "first-frame.png"
}
⌘I