> ## 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.

# Roboflow plugin

> Read workspaces, projects, versions and trained models, create projects, upload images, and run model inference on the serverless host with Roboflow.

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

Find your key under **Account, Roboflow Keys**, or in the workspace settings. It goes in `Authorization: Bearer`, which the docs call the recommended transport; the `api_key` query parameter still works but puts the key in URLs and logs, so the plugin never uses it.

**Two hosts, two contracts:**

* **`api.roboflow.com`** for management: workspaces, projects, versions, models and image upload.
* **`serverless.roboflow.com`** for inference. It is the Inference server's interface, not the Platform API's, with image URLs in the `image` query parameter and base64 images in the raw form body. Other options are query parameters.

Things to know before you rely on a response:

* **`account.get` returns `200` whether or not your key works.** With no key it still answers a welcome message and instructions, so a successful status proves nothing. Only `workspace` appears for a valid key, and that is what the plugin's `authenticated` field reports. Reading the `200` as a success is the easiest mistake to make here.
* **An inference model ID is `project/version`.** Take it from `models.list`'s `url`, which is exactly what `infer` expects. A model not tied to a version is `workspace/model` and splits the same way; the plugin rejects an ID with no separator rather than sending a request that cannot resolve.
* **`infer` is billed per image.** It is marked `write` for that reason and is never retried. The prediction payload is the Inference server's and differs by task: a detection model returns boxes in `predictions`, single-label classification returns class scores in an array, multi-label classification returns a class-keyed object, and semantic segmentation returns a mask object. Instance segmentation adds `points` to each prediction.
* **A duplicate image upload is a success.** `images.upload` answers `duplicate: true` with the existing image's `id` and adds nothing. That is not a failure, and treating it as one would drop a valid image ID.
* **`images.upload` accepts a project slug or a workspace/project ID.** Both use `/dataset/{project}/upload` with the project slug. The API key selects the workspace.
* **`annotation` is a shared label group.** Projects in the same group share classes, so reusing one is how a second project starts from an existing label set. `anomaly-detection` additionally needs the feature turned on and a group no other project type uses.
* **`license` is required on a public plan.** `Private` is what keeps a project private; any other value publishes it on Universe, and a public plan cannot create a private project at all.
* **`versions` come back newest first**, and `version.generating` tells you whether the version is still being built — a `progress` under 1 means the image count is not final.

**What you get:**

* 10 typed API operations

## Setup

**1. Install**

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

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

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

```bash bun theme={null}
bun add corsair @corsair-dev/roboflow 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 { roboflow } from '@corsair-dev/roboflow';

export const corsair = createCorsair({
	plugins: [
		roboflow(),
	],
	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)
>
> No setup required yet. When you make your first request as a tenant, Corsair prompts for the API key.
>
> ```ts theme={null}
> roboflow()
> ```
>
> 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: 'roboflow',
	tenantId: 'acme',
});
// redirect the user's browser to connectUrl
```

## Example API calls

**List a project's trained models**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.roboflow.api.models.list({ workspace: 'roboflow', project: 'chess-sample-4ckfl' });
```

**Run a model on an image**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.roboflow.api.infer({ modelId: 'chess-sample-4ckfl/3', image: 'https://example.com/board.jpg', confidence: 0.5 });
```

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

## What's next

> [card] [API reference](https://docs.corsair.dev/plugins/roboflow/api.md)
>
> Every `roboflow.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.