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

# Gamma plugin

> Generate presentations with Gamma - start a generation from text or a multi-page outline, follow it to completion, read and export the finished gamma, and browse the workspace's themes and folders.

Use **Gamma** through Corsair: one client, typed API calls.

Create an API key in Gamma under Account settings, API keys. It is sent in the `X-API-KEY` header.

Things to know before you call:

* **Two generation routes, and they are not interchangeable.** `agent.generate` runs Gamma 5 from a single brief and is the one to use for a new presentation, document or social post. `generations.create` is the Classic path: it is the only one that takes a `pages` array for a multi-page gamma or site, and the only one that publishes with `publish: true`. A Classic body carries either `inputText` or `pages`, never both, and the plugin refuses a body with neither.
* **A generation is asynchronous.** Both creates return a `generationId` at once, and a poll answers `pending` until it is `completed` or `failed` (which carries an `error`). A completed Classic generation carries `gammaId` and `gammaUrl` at the top level; an agent generation nests them under `gamma`, next to the agent's `result.summary`. Spends credits.
* **`exportUrl` is a credential.** The download link works for anyone holding it, for about a week, and Gamma's own docs say to treat it as a secret. The plugin never logs it; `generations.get` and `exports.get` report only whether one arrived.
* **`png` exports are archives.** A PNG export is a zip of one image per card, not a single file, and `pptx` and `pdf` match their own formats.
* **Archiving is not deleting.** `gammas.archive` is idempotent and reversible from the Gamma app, so it is a write rather than a destructive call. `gammas.delete` is permanent and needs a workspace admin role.
* **A 403 has several meanings.** A web app URL slug sent where a file ID belongs, a workspace below Pro on the analytics routes, a key owner without the permission, or, on the agent routes, a workspace out of credits (`code: insufficient_credits`, which the plugin reports as `isQuotaError`; Classic routes answer `402` for that). The `code` says which; `individual_analytics_required` is the analytics case.
* **A 429 can be a job cap, not a rate.** Gamma adds `code: workspace_concurrency_limit_exceeded` when a Free workspace already has too many pending jobs started with an API key, and sends `Retry-After`. The plugin retries both, honouring the header.
* **Credits are reported per generation.** A completed `generations.get` carries `credits.deducted` and `credits.remaining`, which is how you see what a run cost.
* **No webhooks.** Gamma does not push; poll the generation until it is `completed` or `failed`.

**What you get:**

* 12 typed API operations

## Setup

**1. Install**

```bash npm theme={null}
npm install corsair @corsair-dev/gamma better-sqlite3
npm install --save-dev @types/better-sqlite3
```

```bash yarn theme={null}
yarn add corsair @corsair-dev/gamma better-sqlite3
yarn add --dev @types/better-sqlite3
```

```bash pnpm theme={null}
pnpm install corsair @corsair-dev/gamma better-sqlite3
pnpm install --save-dev @types/better-sqlite3
```

```bash bun theme={null}
bun add corsair @corsair-dev/gamma better-sqlite3
bun add --dev @types/better-sqlite3
```

**2. Add the plugin**

```ts corsair.ts theme={null}
import Database from 'better-sqlite3';
import { createCorsair } from 'corsair';
import { gamma } from '@corsair-dev/gamma';

export const corsair = createCorsair({
	plugins: [
		gamma(),
	],
	database: new Database('corsair.db'),
	kek: process.env.CORSAIR_KEK!,
	multiTenancy: true,
	hub: {
		projectApiKey: process.env.CORSAIR_API_KEY!,
		signingSecret: process.env.CORSAIR_SIGNING_SECRET!,
	},
});
```

With `multiTenancy: true`, scope calls with `corsair.withTenant(id)`. See [Quick start](https://docs.corsair.dev/quick-start.md) for KEK + Hub keys, and [Multi-tenancy](https://docs.corsair.dev/concepts/multi-tenancy.md) for account isolation.

**3. Choose authentication**

> [tab] API Key (Recommended)
>
> Store the Gamma API key before the first call: `pnpm corsair setup --plugin=gamma --tenant=acme api_key=<your-key>` (leave out `--tenant` without `multiTenancy`), or pass it as `key` in the plugin options. With Hub, each tenant enters their own key on the connect page. See [API key auth](https://docs.corsair.dev/concepts/api-key).
>
> ```ts theme={null}
> gamma()
> ```
>
> More: [API Key](https://docs.corsair.dev/concepts/api-key)

**4. Connect a tenant**

Mint a connect link and send the tenant to it. Hub hosts the page and delivers the result to your app — see [Connect / OAuth](https://docs.corsair.dev/management/connect).

```ts theme={null}
const { connectUrl } = await corsair.manage.connect.createLink({
	plugin: 'gamma',
	tenantId: 'acme',
});
// redirect the user's browser to connectUrl
```

## Example API calls

**Search your gammas**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.gamma.api.gammas.search({ q: 'quarterly review', limit: 10 });
```

**Generate a presentation from a brief**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.gamma.api.agent.generate({ prompt: 'A ten-slide deck about renewable energy for a finance audience' });
```

See the full list on the [API](https://docs.corsair.dev/plugins/gamma/api.md) page.

## What's next

> [card] [API reference](https://docs.corsair.dev/plugins/gamma/api.md)
>
> Every `gamma.api.*` operation with input and output types.

> [card] [Connect / OAuth](https://docs.corsair.dev/management/connect)
>
> createLink, Hub delivery, and tenant connect flows.

> [card] [Use with agents](https://docs.corsair.dev/mcp-adapters/mcp-adapters)
>
> Expose this plugin's operations as MCP tools.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.