Skip to main content

GMI Sandbox SDK Usage

Install

Configure

Use environment variables or pass values directly. To get an API key, log in to https://console.gmicloud.ai/, click API keys, select compute, and click Create API key.
GMI_SANDBOX_IDC_NAME is optional. Leave it unset to use your organization’s default IDC. Set it only when you want requests to target a non-default IDC:

Create a client

You can also pass credentials explicitly:

Create and use a sandbox

If you already have a sandbox ID:

Files

download() returns bytes and can also write to a destination path.

Commands

You can refresh or cancel a running execution:

Templates

Creating a template requires an idempotency key:

Product specifications

Errors

The SDK raises typed exceptions for HTTP failures:
  • BadRequestError
  • AuthenticationError
  • PermissionDeniedError
  • NotFoundError
  • ConflictError
  • RateLimitError
  • ServerError
Example: