Skip to main content

suanlinfang-sdk

算邻坊(suanlinfang.cn)开放 API 的 Python 客户端,覆盖四条产品线:

产品 能力 计费口径
STT 语音识别 短音频同步转写 + 2 小时长音频异步任务(22 种中文方言自动识别、热词纠错) 约 0.5 元/小时,按实际时长
TTS 语音合成 21 种音色、短文本同步 + 20 万字长文本异步任务(wav/mp3) 约 2 元/万字符
OCR 文字识别 单图同步(标准/精准双档位、精准档支持自定义 prompt)+ 500 页 PDF 异步任务 约 0.5~1.5 分/页
智能决策 类型化判断(choice/noul/score),返回校准概率 约 2 元/百万输入 token

安装

pip install suanlinfang-sdk

快速开始

from suanlinfang import SuanlinfangClient

client = SuanlinfangClient(api_key="nk-xxxx")   # 控制台创建:https://suanlinfang.cn/consume-web/api-keys.html

# 语音转文字(≤3 分钟短音频,公网 URL)
result = client.stt.transcribe_url("https://example.com/audio.wav")
print(result.text)

# 文字转语音
result = client.tts.synthesize("你好,算邻坊", speaker="suwan", audio_format="mp3")
print(result.url)                                # 现签下载链接,1 小时内有效

# 图片文字识别
result = client.ocr.recognize_url("https://example.com/img.png", tier="standard")
print(result.words)

# 智能决策
result = client.decision.decide(
    state="订单金额 4980 元,物流显示签收但用户否认收货",
    questions={"severity": {"type": "score", "criteria": ["轻微", "一般", "严重"]}},
)
print(result.answers)

长音频/长文本/PDF 走异步任务三步流:submit_task → get_task 轮询 → 终态取结果,状态机 queued/running/success/failed,终态保留 72 小时。

配置

变量 作用 默认
SUANLINFANG_API_KEY API Key(nk- 前缀),构造参数优先于此 —
SUANLINFANG_BASE_URL API 地址覆盖(联调用) https://suanlinfang.cn/v1
  • 新用户注册即赠 ¥10 体验金:https://suanlinfang.cn
  • 错误统一为 SuanlinfangApiError(含 status_code / code / request_id / retryable);5xx 自动退避重试,超时不自动重试(防重复计费)

Metadata

Release files for suanlinfang-sdk 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 suanlinfang-sdk 0.1.0
File Size Uploaded Provenance Actions
suanlinfang_sdk-0.1.0.tar.gz 11.7 kB Without provenance Details for suanlinfang_sdk-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 25.3 kB

Release files / suanlinfang_sdk-0.1.0.tar.gz

Download URL suanlinfang_sdk-0.1.0.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
be2c2e53eab0eb11599c4474d23fb2f6ee40aa1b716729363a7909800791e673
BLAKE2b-256 checksum
How to use checksums
7a27a4a8c5f2587736e37cd4df7fef3353ef2c205aed0cad134ab27905fc28b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.9

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

Download URL suanlinfang_sdk-0.1.0-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4968972a720a69ea59a7ac98c4599429346f5bced553ea5a7ec747721872a24c
BLAKE2b-256 checksum
How to use checksums
a01e91cbfde589024583dd6dad335cd329db4d0e1d0c5087c9275a87d3ad0f4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.9

Security for suanlinfang-sdk 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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