Metadata-Version: 2.4
Name: bunnyscholar
Version: 0.1.0
Summary: BunnyScholar 开放平台官方 Python SDK —— 学术改写（降重）与拟人改写（降 AI / Humanizer）API。
Project-URL: Homepage, https://bunnyscholar.cn
Project-URL: Documentation, https://bunnyscholar.cn/developer/docs
Project-URL: Repository, https://github.com/bunnyscholar/bunnyscholar-sdk
Project-URL: Issues, https://github.com/bunnyscholar/bunnyscholar-sdk/issues
Author-email: BunnyScholar <support@bunnyscholar.com>
License: MIT
License-File: LICENSE
Keywords: academic-rewrite,ai-detection,bunnyscholar,cnki,humanizer,paraphrase,turnitin,论文降重,降AI
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Text Processing :: Linguistic
Requires-Python: >=3.8
Description-Content-Type: text/markdown

<a name="top"></a>

# bunnyscholar (Python SDK)

**简体中文 | [English](#english)**

[![PyPI](https://img.shields.io/pypi/v/bunnyscholar.svg)](https://pypi.org/project/bunnyscholar/)
[![License](https://img.shields.io/badge/License-MIT-16a34a)](./LICENSE)

[**BunnyScholar 开放平台**](https://bunnyscholar.cn/developer) 官方 Python SDK。用几行代码接入 **学术改写（降重）** 与 **拟人改写（降 AI / Humanizer）** 能力。仅依赖 Python 标准库，无第三方依赖。

🔗 [官网](https://bunnyscholar.cn) · [开发者控制台](https://bunnyscholar.cn/developer) · [API 文档](https://bunnyscholar.cn/developer/docs) · [获取 API Key](https://bunnyscholar.cn/developer/keys) · [定价](https://bunnyscholar.cn/developer/pricing) · [Agent Skill](https://github.com/bunnyscholar/bunnyscholar-api-skill)

> **个人用户**（想直接给自己的论文降重 / 降 AI，不写代码）请移步官网在线使用 → [**bunnyscholar.cn**](https://bunnyscholar.cn) · [会员套餐](https://bunnyscholar.cn/setmeal)。本 SDK 面向开发者。

## 安装

```bash
pip install bunnyscholar
```

## 快速开始

```python
import os
from bunnyscholar import BunnyScholar

client = BunnyScholar(api_key=os.environ["BUNNYSCHOLAR_API_KEY"])

# 学术改写 / 降重
rewrite = client.academic_rewrite(
    "本研究旨在探讨人工智能在学术写作中的应用与影响。",
    language="zh_CN",
    quality="medium",  # low | medium | high
)
print(rewrite.text)          # 改写后的文本
print(rewrite.usage.amount)  # 本次扣费（元）

# 拟人改写 / 降 AI
humanized = client.humanize(
    "这段文字由 AI 生成，需要降低 AI 味以通过检测。",
    language="zh_CN",
    platform="cnki",  # cnki | wanfang | weipu | gezida | daya | turnitin ...
)
print(humanized.text)
```

## API

### `BunnyScholar(api_key, base_url="https://bunnyscholar.cn", timeout=60.0)`

[在控制台创建 API Key](https://bunnyscholar.cn/developer/keys)。

### `client.academic_rewrite(text, language="zh_CN", quality="low", personal_terms=None) -> Result`

[学术改写 / 降重](https://bunnyscholar.cn/developer/docs)。`text` 长度 10–2000 字符；`language` 支持 `zh_CN` `zh_TW` `en` `ja` `ko` `fr` `es` `de` `it` `ru` `ms`；`quality` 为 `low`/`medium`/`high`。

### `client.humanize(text, language="zh_CN", platform=None, need_plagiarism_reduction=False, personal_terms=None) -> Result`

[拟人改写 / 降 AI](https://bunnyscholar.cn/developer/docs)。`text` 长度 20–500 字符；`language` 为 `zh_CN`/`en`。

两个方法都返回 `Result(text, usage)`，`usage` 为 `Usage(currency, amount, unit_price, billable_units, chars_in)`。

## 错误处理

非 2xx 响应抛出 `BunnyScholarError(status, code, details)`：

```python
from bunnyscholar import BunnyScholar, BunnyScholarError

try:
    client.academic_rewrite("……")
except BunnyScholarError as err:
    # 例如 402 insufficient_balance / 429 rate_limit_exceeded / 403 INVALID_API_KEY
    print(err.status, err.code)
```

## 计费与限流

按输入字符数计费（元 / 千字），实时价见 [定价页](https://bunnyscholar.cn/developer/pricing)，余额可在 [充值页](https://bunnyscholar.cn/developer/recharge) 补充。单 Key 默认约 1800 次 / 60 秒，请对 `429` 做退避重试。

## 相关链接

[官网](https://bunnyscholar.cn) · [开发者文档](https://bunnyscholar.cn/developer/docs) · [Node.js SDK](https://www.npmjs.com/package/@bunnyscholar/sdk) · [Agent Skill](https://github.com/bunnyscholar/bunnyscholar-api-skill) · [服务条款](https://bunnyscholar.cn/terms) · support@bunnyscholar.com

## License

[MIT](./LICENSE)

---

<a name="english"></a>

# bunnyscholar (Python SDK, English)

**[简体中文](#top) | English**

Official Python SDK for the [**BunnyScholar Open Platform**](https://bunnyscholar.cn/developer) — **academic rewrite (paraphrasing)** and **AI humanizer**. Standard-library only, no third-party dependencies.

🔗 [Homepage](https://bunnyscholar.cn) · [Developer console](https://bunnyscholar.cn/developer) · [API docs](https://bunnyscholar.cn/developer/docs) · [Get an API key](https://bunnyscholar.cn/developer/keys) · [Pricing](https://bunnyscholar.cn/developer/pricing)

```bash
pip install bunnyscholar
```

```python
from bunnyscholar import BunnyScholar

client = BunnyScholar(api_key="sk-xxxx")

rewrite = client.academic_rewrite("…", language="zh_CN", quality="medium")
print(rewrite.text, rewrite.usage.amount)

humanized = client.humanize("…", language="zh_CN", platform="turnitin")
print(humanized.text)
```

- `academic_rewrite(text, language, quality, personal_terms)` — paraphrase / plagiarism reduction. `text` 10–2000 chars; 11 languages; `quality` = `low`/`medium`/`high`.
- `humanize(text, language, platform, need_plagiarism_reduction, personal_terms)` — AI humanizer. `text` 20–500 chars; `language` = `zh_CN`/`en`.

Non-2xx responses raise `BunnyScholarError(status, code, details)`. Billed per input character — see [pricing](https://bunnyscholar.cn/developer/pricing).

Links: [Homepage](https://bunnyscholar.cn) · [Docs](https://bunnyscholar.cn/developer/docs) · [Node.js SDK](https://www.npmjs.com/package/@bunnyscholar/sdk) · [Agent Skill](https://github.com/bunnyscholar/bunnyscholar-api-skill) · support@bunnyscholar.com

## License

[MIT](./LICENSE)