Metadata-Version: 2.5
Name: gogpu
Version: 0.1.1
Summary: Python SDK for GoGPU / 捷智算 cloud GPU instances (create, start, stop, reboot, delete).
Project-URL: Homepage, https://api.gogpu.net
Project-URL: Documentation, https://pypi.org/project/gogpu/
Author: GoGPU
License: MIT
License-File: LICENSE
Keywords: cloud,cvm,gogpu,gpu,sdk
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.9
Requires-Dist: httpx>=0.27
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Description-Content-Type: text/markdown

# gogpu

云主机（CVM）Python SDK：选购、下单、开关机、运维。

## Install

```bash
pip install gogpu
# 开发中：
# pip install -e .
```

## Quick start

```python
from gogpu import Client

client = Client(api_key="ak-xxxxxxxx")  # 默认 https://api.gogpu.net

# 1) 可购买资源（charging 必填语义，默认 hour）
offers = client.instances.list_offers(page=1, page_size=20, charging="hour")
good_id = offers["list"][0]["id"]

# 2) 下单 + 余额支付
result = client.instances.create_and_pay(
    good_id=good_id,
    charging="hour",
    image_id=28,       # 来自 list_os_images / 控制台
    image_type=3,      # 3=系统镜像
    pay_type=1,
)

# 3) 已购实例生命周期
vms = client.instances.list(page=1, page_size=10)
vm_id = vms["list"][0]["id"]
client.instances.start(vm_id)
client.instances.stop(vm_id)
client.instances.reboot(vm_id)
client.instances.get_ssh_password(vm_id)
```

## 云主机方法一览

| 类别 | 方法 |
|---|---|
| 选购 | `list_offers` `get_offer` `list_gpu_types` `list_regions` `list_os_images` `list_public_images` `list_usable_images` |
| 订单 | `create` `pay` `create_and_pay` `renew` |
| 实例 | `list` `get` `statistics` `list_instance_gpu_types` `list_cluster` |
| 电源 | `start` `stop` `reboot` `delete` `reset_system` `convert_cardless` `stop_cardless` `convert_charging` |
| 配置 | `edit` `change_password` `change_renew` `change_reserve_disk` `expand` `get_expand_amount` `get_refund_amount` `refund` |
| 凭据 | `get_ssh_password` `get_vnc_password` `get_rdp_password` `get_jupyter_password` `get_vscode_password` `generate_key` `download_key` |
| 运维 | `list_ports` `list_default_ports` `update_ports` `get_monitor` `take_screenshot` `create_image` `get_software_config` |

常量见 `gogpu.resources.instances`（如 `STATUS_RUNNING`、`ORDER_TYPE_CVM`）。

## Auth

- `api_key` → 请求头 `x-api-key`
- `token` → 请求头 `x-token`（JWT）

## Response

接口统一 `{code, data, msg}`。`code==0` 时方法返回 `data`，否则抛 `GoGPUAPIError`。
