> ## Documentation Index
> Fetch the complete documentation index at: https://biznetgio.creations.ren/llms.txt
> Use this file to discover all available pages before exploring further.

# NEO GPU (Pulumi)

> Pulumi resources and functions for NEO GPU instances

NEO GPU rents NVIDIA H200 instances (`/neo-gpus` API group), billed by subscription cycle or on-demand (hourly). Exactly one billing mode must be set - validation fails otherwise.

<Info>
  Every create places a **real paid order**. On-demand instances accumulate hourly charges until deleted.
</Info>

## `biznetgio:index:GpuInstance`

<Tabs>
  <Tab title="TypeScript">
    ```typescript theme={null}
    import * as biznetgio from "@shirasakaren/biznetgio";

    const products = biznetgio.gpuProductsOutput();

    const keypair = new biznetgio.GpuKeypair("gpu-key", {
      name: "gpu-key",
    });

    const gpu = new biznetgio.GpuInstance("gpu-1", {
      productId: products.products[0].productId,
      selectOs: "ubuntu-22",
      keypairId: keypair.keypairId,
      serviceName: "neo-gpu-1",
      sshAndConsoleUser: "root",
      consolePassword: "s3cretP4ssw0rd",
      payWithCreditCard: true,
      subscription: { cycle: "m" },
      // one-shot actions (change value to fire):
      // rebuildTrigger: "rebuild-1",
      // reserveAdditionalHoursTrigger: "reserve-1",
    });
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import pulumi
    import pulumi_biznetgio

    products = pulumi_biznetgio.gpu_products()

    keypair = pulumi_biznetgio.GpuKeypair(
        "gpu-key",
        name="gpu-key",
    )

    gpu = pulumi_biznetgio.GpuInstance(
        "gpu-1",
        product_id=products.products[0].product_id,
        select_os="ubuntu-22",
        keypair_id=keypair.keypair_id,
        service_name="neo-gpu-1",
        ssh_and_console_user="root",
        console_password="s3cretP4ssw0rd",
        pay_with_credit_card=True,
        subscription=pulumi_biznetgio.GpuInstanceSubscriptionArgs(cycle="m"),
        # rebuild_trigger="rebuild-1",
        # reserve_additional_hours_trigger="reserve-1",
    )
    ```
  </Tab>

  <Tab title="Go">
    ```go theme={null}
    package main

    import (
        biznetgio "github.com/shirasakaren/pulumi-biznetgio/sdk/go/pulumi-biznetgio"
        "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )

    func main() {
        pulumi.Run(func(ctx *pulumi.Context) error {
            products, err := biznetgio.GpuProducts(ctx, &biznetgio.GpuProductsArgs{})
            if err != nil {
                return err
            }

            keypair, err := biznetgio.NewGpuKeypair(ctx, "gpu-key", &biznetgio.GpuKeypairArgs{
                Name: pulumi.String("gpu-key"),
            })
            if err != nil {
                return err
            }

            gpu, err := biznetgio.NewGpuInstance(ctx, "gpu-1", &biznetgio.GpuInstanceArgs{
                ProductId:         pulumi.Int(products.Products[0].ProductId),
                SelectOs:          pulumi.String("ubuntu-22"),
                KeypairId:         keypair.KeypairId,
                ServiceName:       pulumi.String("neo-gpu-1"),
                SshAndConsoleUser: pulumi.String("root"),
                ConsolePassword:   pulumi.String("s3cretP4ssw0rd"),
                PayWithCreditCard: pulumi.Bool(true),
                Subscription: &biznetgio.GpuInstanceSubscriptionArgs{
                    Cycle: pulumi.String("m"),
                },
                // RebuildTrigger:                  pulumi.String("rebuild-1"),
                // ReserveAdditionalHoursTrigger:   pulumi.String("reserve-1"),
            })
            if err != nil {
                return err
            }

            ctx.Export("gpuStatus", gpu.Status)
            return nil
        })
    }
    ```
  </Tab>

  <Tab title=".NET">
    ```csharp theme={null}
    using System;
    using System.Collections.Generic;
    using Pulumi;
    using Shirasakaren.Biznetgio;

    return await Deployment.RunAsync(() =>
    {
        var products = GpuProducts.Invoke();

        var keypair = new GpuKeypair("gpu-key", new GpuKeypairArgs
        {
            Name = "gpu-key",
        });

        var gpu = new GpuInstance("gpu-1", new GpuInstanceArgs
        {
            ProductId = products.Apply(p => p.Products[0].ProductId),
            SelectOs = "ubuntu-22",
            KeypairId = keypair.KeypairId,
            ServiceName = "neo-gpu-1",
            SshAndConsoleUser = "root",
            ConsolePassword = "s3cretP4ssw0rd",
            PayWithCreditCard = true,
            Subscription = new GpuInstanceSubscriptionArgs { Cycle = "m" },
            // RebuildTrigger = "rebuild-1",
            // ReserveAdditionalHoursTrigger = "reserve-1",
        });

        return new Dictionary<string, object?>
        {
            ["gpuStatus"] = gpu.Status,
        };
    });
    ```
  </Tab>

  <Tab title="Java">
    ```java theme={null}
    package demo;

    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import ren.shirasaka.biznetgio.ren.shirasaka_biznetgio.*;
    import ren.shirasaka.biznetgio.ren.shirasaka_biznetgio.outputs.GpuSubscriptionArgs;

    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }

        private static void stack(Context ctx) {
            var products = BiznetgioFunctions.gpuProducts();

            var keypair = new GpuKeypair("gpu-key",
                GpuKeypairArgs.builder()
                    .name("gpu-key")
                    .build());

            var gpu = new GpuInstance("gpu-1",
                GpuInstanceArgs.builder()
                    .productId(products.applyValue(p -> p.products().get(0).productId()))
                    .selectOs("ubuntu-22")
                    .keypairId(keypair.keypairId())
                    .serviceName("neo-gpu-1")
                    .sshAndConsoleUser("root")
                    .consolePassword("s3cretP4ssw0rd")
                    .payWithCreditCard(true)
                    .subscription(GpuSubscriptionArgs.builder().cycle("m").build())
                    // .rebuildTrigger("rebuild-1")
                    // .reserveAdditionalHoursTrigger("reserve-1")
                    .build());

            ctx.export("gpuStatus", gpu.status());
        }
    }
    ```
  </Tab>

  <Tab title="YAML">
    ```yaml theme={null}
    resources:
      gpu:
        type: biznetgio:index:GpuInstance
        properties:
          productId: ${products[0].productId}
          selectOs: ubuntu-22
          keypairId: ${keypair.keypairId}
          serviceName: neo-gpu-1
          sshAndConsoleUser: root
          consolePassword: s3cretP4ssw0rd
          payWithCreditCard: true
          subscription:
            cycle: m
    ```
  </Tab>
</Tabs>

Hourly billing instead of `subscription`:

<Tabs>
  <Tab title="TypeScript">
    ```typescript theme={null}
    onDemand: { additionalHours: 0 },
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    on_demand=pulumi_biznetgio.GpuInstanceOnDemandArgs(additional_hours=0),
    ```
  </Tab>

  <Tab title="Go">
    ```go theme={null}
    OnDemand: &biznetgio.GpuInstanceOnDemandArgs{
        AdditionalHours: pulumi.Int(0),
    },
    ```
  </Tab>

  <Tab title=".NET">
    ```csharp theme={null}
    OnDemand = new GpuInstanceOnDemandArgs { AdditionalHours = 0 },
    ```
  </Tab>

  <Tab title="Java">
    ```java theme={null}
    .onDemand(GpuOnDemandArgs.builder().additionalHours(0).build())
    ```
  </Tab>

  <Tab title="YAML">
    ```yaml theme={null}
    onDemand:
      additionalHours: 0
    ```
  </Tab>
</Tabs>

| Input                           | Type           | Required | Notes                                    |
| ------------------------------- | -------------- | -------- | ---------------------------------------- |
| `productId`                     | int64          | yes      | from `gpuProducts`                       |
| `selectOs`                      | string         | yes      | from the product's select-OS catalog     |
| `keypairId`                     | int64          | yes      | from `GpuKeypair`                        |
| `sshAndConsoleUser`             | string         | yes      |                                          |
| `consolePassword`               | string, secret | yes      |                                          |
| `serviceName`                   | string         | no       | create-only                              |
| `promocode`                     | string         | no       |                                          |
| `payWithCreditCard`             | bool           | no       | default `true`                           |
| `subscription`                  | object         | one-of   | `{ cycle: "m" \| "a" }`                  |
| `onDemand`                      | object         | one-of   | `{ additionalHours?: number }` default 0 |
| `rebuildTrigger`                | string         | no       | one-shot destructive OS reinstall        |
| `reserveAdditionalHoursTrigger` | string         | no       | one-shot: reserves additional hour(s)    |

Outputs: `status`, `orderId`, `raw` (secret, redacted). Import with the numeric account id.

## `biznetgio:index:GpuKeypair`

<Tabs>
  <Tab title="TypeScript">
    ```typescript theme={null}
    const keypair = new biznetgio.GpuKeypair("gpu-key", {
      name: "gpu-key",
    });
    export const privateKey = keypair.privateKey;
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    keypair = pulumi_biznetgio.GpuKeypair(
        "gpu-key",
        name="gpu-key",
    )
    pulumi.export("privateKey", keypair.private_key)
    ```
  </Tab>

  <Tab title="Go">
    ```go theme={null}
    keypair, err := biznetgio.NewGpuKeypair(ctx, "gpu-key", &biznetgio.GpuKeypairArgs{
        Name: pulumi.String("gpu-key"),
    })
    ctx.Export("privateKey", keypair.PrivateKey)
    ```
  </Tab>

  <Tab title=".NET">
    ```csharp theme={null}
    var keypair = new GpuKeypair("gpu-key", new GpuKeypairArgs
    {
        Name = "gpu-key",
    });
    // keypair.PrivateKey
    ```
  </Tab>

  <Tab title="Java">
    ```java theme={null}
    var keypair = new GpuKeypair("gpu-key",
        GpuKeypairArgs.builder()
            .name("gpu-key")
            .build());
    ctx.export("privateKey", keypair.privateKey());
    ```
  </Tab>

  <Tab title="YAML">
    ```yaml theme={null}
    keypair:
      type: biznetgio:index:GpuKeypair
      properties:
        name: gpu-key
    ```
  </Tab>
</Tabs>

Input `name`; outputs `publicKey`, `privateKey` (secret - returned only at creation), `raw` (secret). No update.

## Functions

### `biznetgio:index:gpuProducts`

No arguments. Returns `products`: `productId`, `name`, `description`, `categoryName`, `flavors` (`flavorId`, `name`, `raw`), `raw` (secret).

### `biznetgio:index:gpuConsole`

Argument `accountId` (string). Returns `url` (secret) and `raw` (secret). **Side-effecting:** each call mints a new one-time console session - do not use it inside plan diffing.

### `biznetgio:index:gpuGraph`

Arguments `accountId` (string), `timeframe` (optional, default `hour`; `hour` / `day` / `week` / `month` / `year`). Returns `graph` and `raw` (secret) from `GET /neo-gpus/accounts/{id}/graph-monitor`.
