19. 开发者参考
通过真实执行验证的公开契约from Xurcroh import Xurcroh
with Xurcroh(
cluster={"endpoint": "local://cpu"},
model_path={"tiny": "/models/tiny"},
) as client:
response = client.chat.completions.create(
model="tiny",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
API 接口
Xurcroh 和 AsyncXurcroh 提供 .chat.completions.create、.images.generate/.images.edit 和 .videos.generate。响应包含 choices/messages/deltas、用量以及执行元数据。参数涵盖采样、最大 token 数、流式、超时、取消 ID、种子以及各模态的输入。
model_path 接受一个路径或具名定义。集群 worker 支持端点、SSH、GPU 元数据、标签、分组、提供方、资源以及凭据环境变量引用。未知的模型和不兼容的设置会尽可能在执行之前失败。
源码地图与错误
python/Xurcroh:稳定的公开门面。python/xurcroh/runtime:真实的本地/远程执行与生命周期。python/xurcroh/shards:编译器、清单和严格加载器。crates:协议、密码学和 QUIC。native/cuda:内存与掩码。apps/web-manual:独立的文档。
错误派生自 XurcrohError:配置、模型查找/加载、能力、集群、协议、认证、分片、超时、取消以及客户端已关闭。当适配器不可用时,没有任何方法会返回模拟的能力。