> ## Documentation Index
> Fetch the complete documentation index at: https://chenyu.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 查询资源

> 查询大模型网关资源状态和访问地址

# 查询资源

根据资源 ID 查询资源状态、引用地址和访问地址。资源过期、无权限或审核未通过时，接口会返回 OpenAI 风格错误响应。

## 请求参数

<ParamField path="asset_id" type="string" required>
  资源 ID，例如 `asset_38d2ff7769fb3b7267039941547e6a78`
</ParamField>

## 响应参数

<ResponseField name="id" type="string">
  资源 ID
</ResponseField>

<ResponseField name="asset_id" type="string">
  资源 ID，与 `id` 含义一致
</ResponseField>

<ResponseField name="asset_uri" type="string">
  资源引用地址，提交模型请求时优先使用
</ResponseField>

<ResponseField name="url" type="string">
  资源访问地址
</ResponseField>

<ResponseField name="signed_url" type="string">
  带签名的临时访问地址
</ResponseField>

<ResponseField name="media_type" type="string">
  资源类型
</ResponseField>

<ResponseField name="mime_type" type="string">
  MIME 类型
</ResponseField>

<ResponseField name="size_bytes" type="integer">
  文件大小，单位字节
</ResponseField>

<ResponseField name="purpose" type="string">
  资源用途
</ResponseField>

<ResponseField name="persistent" type="boolean">
  是否为长期资源
</ResponseField>

<ResponseField name="expires_at" type="string">
  临时资源过期时间
</ResponseField>

<ResponseField name="status" type="string">
  资源状态
</ResponseField>

## 代码示例

<CodeGroup>
  ```python Python theme={null}
  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"])
  ```

  ```javascript JavaScript theme={null}
  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 cURL theme={null}
  curl -X GET "https://api.chenyu.cn/v1/assets/asset_38d2ff7769fb3b7267039941547e6a78" \
    -H "Authorization: Bearer your_api_key"
  ```
</CodeGroup>

## 响应示例

```json theme={null}
{
  "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"
}
```
