# AI use cases for Subpool (gesta-run/subpool)

Repo: [gesta-run/subpool](https://github.com/gesta-run/subpool) | Use cases: 4 | Page: https://dedupedai.com/use-cases/gesta-run-subpool/

Subpool is a self-hosted Go control plane that pools authorized AI subscription and API accounts and issues employee-specific keys behind one OpenAI-compatible API.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Pool team AI subscriptions behind one employee endpoint: https://dedupedai.com/use-cases/gesta-run-subpool/pool-team-ai-subscriptions/
- Route each employee's Codex through the shared pool: https://dedupedai.com/use-cases/gesta-run-subpool/route-codex-through-subpool/
- Limit, expire, or revoke an employee's access to pooled accounts: https://dedupedai.com/use-cases/gesta-run-subpool/limit-or-revoke-employee-access/
- Track token use and quota per employee key: https://dedupedai.com/use-cases/gesta-run-subpool/track-token-use-and-quota-per-key/

## How to pool team AI subscriptions behind one employee endpoint with Subpool

Repo: [gesta-run/subpool](https://github.com/gesta-run/subpool) | Difficulty: Intermediate | Time: 45 minutes | Basis: From the README

Self-host a control plane that gives each employee a key across shared provider accounts.

**Who it is for:** An IT or platform administrator whose team holds several AI subscription or API accounts and needs to hand out access without sharing one login.

**The problem:** Separate subscriptions are hard to track, and employees each need access to capacity they can use without owning the upstream account.

**The outcome:** A running Subpool instance where accounts are grouped into a pool and each employee has a dedicated API key for that pool.

### Steps

1. Run `cp .env.example .env`, then replace every `replace-with-*` value using `openssl rand -base64 32` and `openssl rand -hex 32`.
2. Run `docker compose up -d` to start Subpool from the published image.
3. Open http://localhost:8081 and sign in with the administrator credentials from `.env`.
4. In Accounts, connect a Codex, GitHub Copilot, Google Antigravity, or OpenAI-compatible account.
5. Create a pool, add the connected account to it, then create an employee API key for the pool.

### Prompt to paste into your agent

```text
Using the gesta-run/subpool repository, set up a local Subpool instance by following its quick start, then report the console URL and the API URL. Expected output: both URLs responding, with the console reachable at http://localhost:8081. Verify that `docker compose ps` shows the Subpool service running before reporting success.
```

### Caveat

Subpool stores no prompts, responses, or source code, but you must back up PostgreSQL together with SUBPOOL_CREDENTIAL_KEY and SUBPOOL_API_KEY_HMAC_KEY or encrypted credentials cannot be recovered.

Risk, account pooling: Sharing subscription capacity across employees can breach a provider's terms, so connect only accounts you are authorized to manage.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/gesta-run-subpool/pool-team-ai-subscriptions/

## How to route each employee's Codex through the shared pool with Subpool

Repo: [gesta-run/subpool](https://github.com/gesta-run/subpool) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Point a developer's Codex configuration at Subpool using their employee API key.

**Who it is for:** A developer whose team uses Codex and has been issued an employee API key from a running Subpool instance.

**The problem:** Codex on each machine normally connects directly to a provider, so the team cannot route work through shared capacity.

**The outcome:** Codex sends requests to Subpool's /v1 endpoint with the employee key and uses pooled capacity.

### Steps

1. In the Subpool console, create an employee API key for the pool and copy it.
2. Create the `.codex` directory and `config.toml` file in your home directory if they do not exist.
3. Add the `model_provider = "subpool"` settings and the `[model_providers.subpool]` block, setting `base_url` to your Subpool URL followed by `/v1` and `experimental_bearer_token` to your employee key.
4. Save the file, then restart Codex so the new provider and WebSocket settings load.

### Prompt to paste into your agent

```text
Using the gesta-run/subpool repository, update the user-level Codex config file at <config path> so the subpool provider points to <Subpool URL>/v1 with the employee key supplied by <admin>. Expected output: a valid config.toml containing the [model_providers.subpool] table. Verify that the file parses as TOML and that base_url ends in /v1 before reporting success.
```

### Caveat

Subscription accounts use a dedicated upstream WebSocket while GitHub Copilot and OpenAI-compatible accounts use the HTTP/SSE bridge, so behavior differs by account type.

Risk, credentials: The employee API key is stored in plain text in config.toml, so restrict access to that file on the user's machine.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/gesta-run-subpool/route-codex-through-subpool/

## How to limit, expire, or revoke an employee's access to pooled accounts with Subpool

Repo: [gesta-run/subpool](https://github.com/gesta-run/subpool) | Difficulty: Intermediate | Time: 45 minutes | Basis: From the README

Cap rate, set an expiry, or cut off one employee's key without touching others.

**Who it is for:** An administrator who needs to restrict heavy use, end a contractor's access, or remove a departing employee from shared capacity.

**The problem:** Shared AI capacity needs per-person controls so one person's usage or departure does not affect the whole team.

**The outcome:** The affected employee key is rate-limited, set to expire, or revoked, and the key-to-account assignments remain visible for review.

### Steps

1. Sign in to the Subpool console at http://localhost:8081 with the administrator credentials.
2. Open the pool and select the employee API key you want to change.
3. Set the rate limit or expiry for that key, or revoke it if access must end.
4. Review the key-to-account assignments shown for that key to confirm which accounts it used.

### Prompt to paste into your agent

```text
Using the gesta-run/subpool console at <console URL>, review the employee key for <employee name> and report its current rate limit, expiry, and assigned accounts. Expected output: a short summary listing those three items. Verify the values against the console before changing anything, and do not revoke the key unless the administrator confirms.
```

### Caveat

The README describes these controls in general terms, so confirm the exact console labels for rate limits and expiry on your version before relying on them in a process.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/gesta-run-subpool/limit-or-revoke-employee-access/

## How to track token use and quota per employee key with Subpool

Repo: [gesta-run/subpool](https://github.com/gesta-run/subpool) | Difficulty: Intermediate | Time: 45 minutes | Basis: From the README

Review aggregate token telemetry and remaining subscription capacity for each key.

**Who it is for:** A team lead or finance-minded administrator who needs to see how shared AI capacity is being consumed.

**The problem:** Without per-key numbers, the team cannot tell which employees use the pool or how much subscription quota remains.

**The outcome:** A per-key view of input and output tokens and a current reading of remaining subscription capacity and reset timing.

### Steps

1. Open the Accounts view in the Subpool console and check each account's remaining subscription capacity and reset availability.
2. Review the aggregate input and output token telemetry shown for each employee API key.
3. Run `curl http://localhost:8080/metrics` to read the Prometheus metrics endpoint on the employee API listener. (inferred, check the README)
4. Note that token figures use provider-native units, so compare them only within the same provider.

### Prompt to paste into your agent

```text
Using the gesta-run/subpool repository, query the metrics endpoint at <Subpool API URL>/metrics and list the request counters and token-related series you find. Expected output: a short table of metric names and current values. Verify that each metric name appears in the response body before reporting it.
```

### Caveat

Telemetry is aggregate and in provider-native units, so it does not show per-request content and should not be treated as a cross-provider cost figure.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/gesta-run-subpool/track-token-use-and-quota-per-key/
