# mc1903/ps-openai architecture

> Architecture diagram of the GitHub repository mc1903/ps-openai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mc1903/ps-openai
- Repository: https://github.com/mc1903/ps-openai

## Overview

PS-OpenAI is a PowerShell module for managing an OpenAI account. Its visible capabilities cover API keys, users and invites, account usage and billing, and models. The README identifies the module and its purpose, but no source excerpts were provided, so internal calls, API transfers, and environment-variable usage cannot be verified; the graph shows only the documented user-to-module relationship.

Main entry points: [`PS-OpenAI.psm1`](https://github.com/mc1903/ps-openai/blob/main/PS-OpenAI.psm1) (PS-OpenAI Module)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["API Key Management"]
  node_list_keys["List API Keys"]
  node_create_key["Create API Key"]
  node_remove_key["Remove API Key"]
end

subgraph group_people["User Management"]
  node_list_users["List Users"]
  node_create_user["Create User<br/>[New-OpenAIUser.ps1]"]
  node_remove_user["Remove User"]
  node_set_role["Set User Role"]
  node_remove_invite["Remove Invite"]
end

subgraph group_account["Account Insights"]
  node_api_status["API Status"]
  node_billing["Billing"]
  node_credit_grants["Credit Grants"]
  node_subscription["Subscription"]
  node_usage["Usage"]
end

subgraph group_models["Model Discovery"]
  node_get_model["Get Model"]
  node_list_models["List Models"]
end

node_user(("PowerShell User"))
node_module["PS-OpenAI Module<br/>[PS-OpenAI.psm1]"]

node_user -->|"uses"| node_module

click node_module "https://github.com/mc1903/ps-openai/blob/main/PS-OpenAI.psm1"
click node_list_keys "https://github.com/mc1903/ps-openai/blob/main/Src/Public/Get-OpenAIAPIKeys.ps1"
click node_create_key "https://github.com/mc1903/ps-openai/blob/main/Src/Public/New-OpenAIAPIKey.ps1"
click node_remove_key "https://github.com/mc1903/ps-openai/blob/main/Src/Public/Remove-OpenAIAPIKey.ps1"
click node_list_users "https://github.com/mc1903/ps-openai/blob/main/Src/Public/Get-OpenAIUsers.ps1"
click node_create_user "https://github.com/mc1903/ps-openai/blob/main/Src/Public/New-OpenAIUser.ps1"
click node_remove_user "https://github.com/mc1903/ps-openai/blob/main/Src/Public/Remove-OpenAIUser.ps1"
click node_set_role "https://github.com/mc1903/ps-openai/blob/main/Src/Public/Set-OpenAIUserRole.ps1"
click node_remove_invite "https://github.com/mc1903/ps-openai/blob/main/Src/Public/Remove-OpenAIInvite.ps1"
click node_api_status "https://github.com/mc1903/ps-openai/blob/main/Src/Public/Get-OpenAIAPIStatus.ps1"
click node_billing "https://github.com/mc1903/ps-openai/blob/main/Src/Public/Get-OpenAIBilling.ps1"
click node_credit_grants "https://github.com/mc1903/ps-openai/blob/main/Src/Public/Get-OpenAICreditGrants.ps1"
click node_subscription "https://github.com/mc1903/ps-openai/blob/main/Src/Public/Get-OpenAISubscription.ps1"
click node_usage "https://github.com/mc1903/ps-openai/blob/main/Src/Public/Get-OpenAIUsage.ps1"
click node_get_model "https://github.com/mc1903/ps-openai/blob/main/Src/Public/Get-OpenAIModel.ps1"
click node_list_models "https://github.com/mc1903/ps-openai/blob/main/Src/Public/Get-OpenAIModels.ps1"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_list_keys,node_create_key,node_remove_key,node_user toneBlue
class node_list_users,node_create_user,node_remove_user,node_set_role,node_remove_invite toneAmber
class node_api_status,node_billing,node_credit_grants,node_subscription,node_usage toneMint
class node_get_model,node_list_models toneRose
class node_module toneTeal
```

## Components

### API Key Management

- [List API Keys](https://github.com/mc1903/ps-openai/blob/main/Src/Public/Get-OpenAIAPIKeys.ps1): `Src/Public/Get-OpenAIAPIKeys.ps1`
- [Create API Key](https://github.com/mc1903/ps-openai/blob/main/Src/Public/New-OpenAIAPIKey.ps1): `Src/Public/New-OpenAIAPIKey.ps1`
- [Remove API Key](https://github.com/mc1903/ps-openai/blob/main/Src/Public/Remove-OpenAIAPIKey.ps1): `Src/Public/Remove-OpenAIAPIKey.ps1`

### User Management

- [List Users](https://github.com/mc1903/ps-openai/blob/main/Src/Public/Get-OpenAIUsers.ps1): `Src/Public/Get-OpenAIUsers.ps1`
- [Create User](https://github.com/mc1903/ps-openai/blob/main/Src/Public/New-OpenAIUser.ps1): `Src/Public/New-OpenAIUser.ps1`
- [Remove User](https://github.com/mc1903/ps-openai/blob/main/Src/Public/Remove-OpenAIUser.ps1): `Src/Public/Remove-OpenAIUser.ps1`
- [Set User Role](https://github.com/mc1903/ps-openai/blob/main/Src/Public/Set-OpenAIUserRole.ps1): `Src/Public/Set-OpenAIUserRole.ps1`
- [Remove Invite](https://github.com/mc1903/ps-openai/blob/main/Src/Public/Remove-OpenAIInvite.ps1): `Src/Public/Remove-OpenAIInvite.ps1`

### Account Insights

- [API Status](https://github.com/mc1903/ps-openai/blob/main/Src/Public/Get-OpenAIAPIStatus.ps1): `Src/Public/Get-OpenAIAPIStatus.ps1`
- [Billing](https://github.com/mc1903/ps-openai/blob/main/Src/Public/Get-OpenAIBilling.ps1): `Src/Public/Get-OpenAIBilling.ps1`
- [Credit Grants](https://github.com/mc1903/ps-openai/blob/main/Src/Public/Get-OpenAICreditGrants.ps1): `Src/Public/Get-OpenAICreditGrants.ps1`
- [Subscription](https://github.com/mc1903/ps-openai/blob/main/Src/Public/Get-OpenAISubscription.ps1): `Src/Public/Get-OpenAISubscription.ps1`
- [Usage](https://github.com/mc1903/ps-openai/blob/main/Src/Public/Get-OpenAIUsage.ps1): `Src/Public/Get-OpenAIUsage.ps1`

### Model Discovery

- [Get Model](https://github.com/mc1903/ps-openai/blob/main/Src/Public/Get-OpenAIModel.ps1): `Src/Public/Get-OpenAIModel.ps1`
- [List Models](https://github.com/mc1903/ps-openai/blob/main/Src/Public/Get-OpenAIModels.ps1): `Src/Public/Get-OpenAIModels.ps1`

### Other components

- **PowerShell User**
- [PS-OpenAI Module](https://github.com/mc1903/ps-openai/blob/main/PS-OpenAI.psm1): `PS-OpenAI.psm1`

## Connections

- PowerShell User → PS-OpenAI Module: uses (evidence: `README.md`)
