亿创 Generation CLI
yc 是现有 ad-matrix generation API 的轻量命令行封装。它不保存模型列表,
也不理解任何模型的专属参数;模型 ID 和完整请求 JSON 会直接发送给服务端。
因此,只要新模型继续使用现有 generation API,CLI 就不需要更新或重新发布。
安装
从仓库安装:
pip install ./clients/python
发布到 Python 包仓库后可使用:
pip install admatrix-client
安装后会提供 yc 命令。
配置环境
CLI 不保存 API Key。调用前设置服务地址和个人 API Key:
export YC_BASE_URL="https://example.test"
export YC_API_KEY="your-api-key"
测试环境和正式环境使用同一个安装包,只需切换 YC_BASE_URL。也可以用一次性的
--base-url 覆盖环境变量:
yc --base-url "https://another.example" models
API Key 只能通过 YC_API_KEY 提供,不支持命令行参数,避免它进入命令历史和进程列表。
查看当前模型
yc models
模型来自服务端当前 registry,CLI 中没有模型 ID 白名单。
提交并等待结果
--data 是现有 GenerateRequest 的完整 JSON:
yc generate seedance-2-0 \
--data '{"input":{"prompt":"一只在月球散步的猫"},"request_num":1}' \
--wait
CLI 只提交一次 generation 请求。拿到 gen_id 后,--wait 默认每 2 秒查询一次
status;任务进入 completed 后,输出包含 outputs、结果 URL 或失败原因的完整 JSON。
默认最长等待 1800 秒,可调整:
yc generate seedance-2-0 \
--data @request.json \
--wait \
--poll-interval 3 \
--wait-timeout 3600
轮询间隔和最长等待都必须是有限且大于 0 的秒数。
超时只会停止本地轮询,不会取消服务端任务。
JSON 输入方式
内联 JSON:
yc generate MODEL_ID --data '{"input":{"prompt":"hello"}}'
从文件读取:
yc generate MODEL_ID --data @request.json
从标准输入读取,适合 Codex 或脚本:
printf '%s' '{"input":{"prompt":"hello"}}' | yc generate MODEL_ID --data - --wait
CLI 会透传整个 JSON 对象,所以 provider_id、dry_run、ga_info、
callback_url 等现有通用字段不需要额外 CLI 参数。
查询已有任务
只查询一次:
yc status MODEL_ID GENERATION_ID
持续轮询最终结果:
yc wait MODEL_ID GENERATION_ID --poll-interval 2 --wait-timeout 1800
输出与退出状态
- 成功响应以 JSON 输出到 stdout,保持服务端的
code/detail/data结构。 - 配置、输入、网络、API 或超时错误以 JSON 输出到 stderr。
- 成功退出码为
0,运行时/API 错误为1,配置或输入错误为2。 - 服务端即使返回 HTTP 200,只要业务
code非 0,CLI 仍按失败处理。 - CLI 不跟随 HTTP 重定向,避免把 API Key 转发到其他地址;请直接配置最终服务地址。
本期边界
本包不提供本地文件上传、结果自动下载、模型 Schema 校验、API Key 创建或持久化。 这些能力不影响它作为 generation API 通用调用器使用。
Metadata
Release files for admatrix-client 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| admatrix_client-0.1.1.tar.gz | 12.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| admatrix_client-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.4 kB
Release files / admatrix_client-0.1.1.tar.gz
| Download URL | admatrix_client-0.1.1.tar.gz |
|---|---|
| Size | 12.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c30eb28dec996a2c6e9d30f89bfef8a4a75f499427c13a9ffaa5257156da2d48
|
|
BLAKE2b-256 checksum How to use checksums |
c23391ce58a07be53e666ab41bdee4d40686e3c53cefad0137536fd66b4e4bb7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / admatrix_client-0.1.1-py3-none-any.whl
| Download URL | admatrix_client-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
02031386a3ff0d63a4ac2b1341757b21b918847b0b99613eafd12b4ee1a8007d
|
|
BLAKE2b-256 checksum How to use checksums |
29053713dfe6c3ddca2432ff3f17253ae8d1cb4ee9772e958fd11e7ec8b575b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Security for admatrix-client 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.