Skip to main content

novusai — NovusAI 推理服务 Python SDK

NovusAI 网络的官方 Python 客户端。零第三方依赖(纯标准库),走 NovusAI 自有协议(/api/chat)。

安装

pip install novusai

本地源码安装:pip install .(项目根目录)。

快速开始

  1. 打开 https://www.t-cab.net →「新建 ID」→ 生成 API key(nvk- 前缀,永不过期可撤销);
  2. 你的节点/程序贡献推理与容量获得贡献值(CP),API 调用按实耗扣减 CP(输入 0.01 / 输出 0.04 CP/百 token)。
from novusai import Client

client = Client(api_key="nvk-...")  # 或环境变量 NOVUSAI_API_KEY

result = client.chat("帮我总结这段日志")
print(result["response"])

带进度回调(模型加载/推理阶段):

result = client.chat(
    "跨节点推理测试",
    on_progress=lambda task: print(task["stage_label"]),
)

非阻塞 + 手动轮询:

submitted = client.chat_async("你好")
task = client.poll(submitted["task_id"])  # status: processing/done/failed

API

方法 说明
Client(api_key=None, base_url="https://www.t-cab.net", timeout=30, task_timeout=360) 缺省从 NOVUSAI_API_KEY 读 key
chat(prompt, mode="default", on_progress=None) -> dict 阻塞直到完成,返回 {success, response, ...}
chat_async(prompt, mode="default") -> dict 返回 {task_id, status, stage, poll_url}
poll(task_id) -> dict 轮询任务态;done 携带 result
usage(registration_id, days=7, include_ids=None) -> dict 用量/消耗聚合(注册 ID 见页面贡献区;include_ids 支持本人历史 ID 聚合)

错误

异常 HTTP 含义
AuthenticationError 401 key 无效或已撤销
InsufficientBalance 402 贡献值(CP)≤0,预检拒绝——先让节点上线积累贡献
RateLimited 429 限速(60s 窗口 6 次),retry_after_s 给出等待秒数
TaskFailed — 任务 failed 或推理产出为空

所有异常继承 NovusAIError(status_code / payload 属性保留服务端原始响应)。

Metadata

Release files for novusai 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for novusai 0.1.0
File Size Uploaded Provenance
novusai-0.1.0.tar.gz 106.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for novusai 0.1.0
File Interpreter ABI Platform
novusai-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 112.3 kB

Release files / novusai-0.1.0.tar.gz

Download URL novusai-0.1.0.tar.gz
Size 106.0 kB
Tags Source
SHA-256 checksum
How to use checksums
14fb9cbb38ae0392b5af23056880f5fe66509d78933a861414d42f20434bfa3d
BLAKE2b-256 checksum
How to use checksums
e681c97158f13850c00a99e2392aa4e9f63b58303ea0082aa62c9e0b469e02c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / novusai-0.1.0-py3-none-any.whl

Download URL novusai-0.1.0-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
686a3ccf69dc48f82b5e573ea71c82b715ea3c71b24d7105b5fac01aabf9ebad
BLAKE2b-256 checksum
How to use checksums
0a85b413ce85e2d2a867ec199423ac9d9a818751d575e96990c33ef18f4f5690
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for novusai 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page