Skip to main content

gogpu

云主机(CVM)Python SDK:选购、下单、开关机、运维。

Install

pip install gogpu
# 开发中:
# pip install -e .

Quick start

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。

Metadata

Release files for gogpu 0.1.1

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

Source distribution (sdist)

Source distribution for gogpu 0.1.1
File Size Uploaded Provenance Actions
gogpu-0.1.1.tar.gz 8.7 kB Without provenance Details for gogpu-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 19.8 kB

Release files / gogpu-0.1.1.tar.gz

Download URL gogpu-0.1.1.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e2b3c01b48f2273bc530d97c8b2cb75e77bf80f0bf86bc084f2f94c18a59726f
BLAKE2b-256 checksum
How to use checksums
6259047b00ff0ac51eda386359c9b836f091e7bb6f4834c5d6855fae1b8d7437
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.9

Release files / gogpu-0.1.1-py3-none-any.whl

Download URL gogpu-0.1.1-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d71e6e80b7874aef637d1c5e89cd896b0ab443a96bce883f513e9e3b988547db
BLAKE2b-256 checksum
How to use checksums
fdcc801180cd16f7483d7f6146c971d22f496e93cad08c4079467c051e4971a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.9

Security for gogpu 0.1.1

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.1 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