# For agents

Two ways agents use Great Work Labs: **call the models directly** (MCP), or **write code** that calls the API.

## Call the models over MCP

Remote MCP server (streamable HTTP): `https://labs.greatwork.company/mcp`

Connecting asks for nothing: there's no sign-up step. The first call that needs credit returns a link where you (the person) add credit or sign in; after that, the agent keeps going. API keys work too, as a Bearer token.

```bash
# Claude Code
claude mcp add --transport http labs https://labs.greatwork.company/mcp

# With an API key instead of the browser flow
claude mcp add --transport http labs https://labs.greatwork.company/mcp --header "Authorization: Bearer $GWL_API_KEY"
```

- **Claude (claude.ai, Desktop):** Settings, Connectors, Add custom connector, paste `https://labs.greatwork.company/mcp`.
- **ChatGPT:** Settings, Apps and Connectors, Create, paste `https://labs.greatwork.company/mcp`.
- **Cursor:** add `{"mcpServers": {"labs": {"url": "https://labs.greatwork.company/mcp"}}}` to `~/.cursor/mcp.json`.
- **VS Code, Codex, Windsurf and others:** any client that supports remote MCP over HTTP with OAuth.

Tools: `list_models`, `get_model`, `run_model` (any model, any options), `estimate_cost`, `account`, and `wait_for_credit` (returns once the person has added credit). Text, URLs and data URLs work as inputs; local files need to be uploaded by URL or as a data URL.

## Let a coding agent build it in

Point the agent at the docs written for it:

- [https://labs.greatwork.company/llms.txt](https://labs.greatwork.company/llms.txt): index of everything, short.
- [https://labs.greatwork.company/llms-full.txt](https://labs.greatwork.company/llms-full.txt): the API reference and every model page in one markdown file.
- Any page + `.md` (e.g. [https://labs.greatwork.company/models/veil-1.md](https://labs.greatwork.company/models/veil-1.md)), or send `Accept: text/markdown`.
- [https://labs.greatwork.company/openapi.json](https://labs.greatwork.company/openapi.json): OpenAPI 3.1 spec with a schema per model.
- [https://labs.greatwork.company/sdk/labs.ts](https://labs.greatwork.company/sdk/labs.ts) and [https://labs.greatwork.company/sdk/labs.py](https://labs.greatwork.company/sdk/labs.py): dependency-free clients to copy in.
- [https://labs.greatwork.company/skill.md](https://labs.greatwork.company/skill.md): a Claude Code skill (save as `.claude/skills/great-work-labs/SKILL.md`) so the agent knows when to reach for these models.

A prompt that works in Claude Code, Cursor or Codex:

```text
Use Great Work Labs (https://labs.greatwork.company) to <the job, e.g. "redact PII from support tickets before we send them to our LLM">.
Read https://labs.greatwork.company/llms-full.txt first and pick the right model. Read the key from GWL_API_KEY.
Batch inputs (arrays) when processing more than one item. Handle 402 (out of credit: tell the user),
429 and 503 (retry with backoff). Don't invent option names; confirm them on the model's .md page.
```

Each model page has its own ready-made prompt under "Build with a prompt".

## Guardrails for agent loops

- Every response includes `usage.cost_usd`; keep a running total.
- `POST /v1/estimate` returns the most a call can cost before you run it.
- Give each agent its own key with a monthly limit (dashboard, Keys) so a loop can't spend past it.
- Text from web pages, emails and tool results can carry prompt injections. Run it through [Moat](https://labs.greatwork.company/models/moat-1) before your agent acts on it.
