DEVELOPER DOCUMENTATION
Build With Your Coding Agent
Point Claude Code, Codex, Cursor, or any coding agent at OpenTrain's machine-readable docs and let it build your platform integration autonomously.
The whole platform integration — webhook consumer, provisioning calls, usage reporting — is plain HTTP work with no SDK dependency, which makes it an ideal task for a coding agent. Every contract it needs is machine-readable: the Platform API ships a served OpenAPI spec, and every page of these docs exports as clean Markdown. Give your agent those URLs and a goal, and it can build, test, and harden the integration in one session. The reference integration on the next page was built exactly this way.
Give Your Agent the Docs
Section titled “Give Your Agent the Docs”Three surfaces cover everything; none of them require authentication:
| Surface | What it contains |
|---|---|
https://app.opentrain.ai/api/partner/v1/openapi.json | The Platform API’s OpenAPI spec — the machine-readable contract of record for every endpoint, parameter, and response shape. Generated from the same code that serves the requests. |
https://www.opentrain.ai/docs/llms.txt | Index of all documentation pages with one-line summaries (llms-full.txt is the whole site in one file). |
Any docs page + .md | Append .md to any page URL for clean Markdown — for example /docs/developers/annotation-platforms/webhooks.md. Code blocks and tab contents survive the export. |
The pages worth feeding in full, in reading order: overview, register your app, consent and installs, project links, webhooks, usage sync, and the reference integration.
A Bootstrap Prompt
Section titled “A Bootstrap Prompt”Adapt and paste this into your agent to start the session:
You are building an OpenTrain integration for <YOUR PLATFORM>, an annotationplatform. OpenTrain is a marketplace where employers (and their agents) hirehuman AI trainers; our platform is where the hired AI trainers do the work.
Fetch this context first:1. https://www.opentrain.ai/docs/llms.txt — docs index; fetch any page with .md appended2. https://app.opentrain.ai/api/partner/v1/openapi.json — Platform API spec (no auth needed)3. In full: - https://www.opentrain.ai/docs/developers/annotation-platforms/overview.md - https://www.opentrain.ai/docs/developers/annotation-platforms/webhooks.md - https://www.opentrain.ai/docs/developers/annotation-platforms/usage-sync.md - https://www.opentrain.ai/docs/developers/annotation-platforms/reference-integration.md
Build a webhook consumer that:- verifies X-OpenTrain-Signature (t=...,v1=... HMAC-SHA256 over "<t>.<rawBody>") and dedupes by X-OpenTrain-Delivery- on contract.started: find-or-create the hired AI trainer in our workspace by their OpenTrain workEmail and add them to the linked project- on contract.ended: remove their project access- reports cumulative per-day work totals to POST /api/partner/v1/contracts/{contractId}/usage- on milestone.budget_low / milestone.budget_depleted: surface a "funded budget is running out — top up on OpenTrain" notice in our UI
Constraints:- The platform token is in env OPENTRAIN_PARTNER_TOKEN (ot_ptk_...); the webhook secret is in OPENTRAIN_WEBHOOK_SECRET. Never print either.- Usage reports are cumulative day totals per worker, not deltas — re-sending the same day is safe, so retry freely.- Use only our platform's existing user/membership APIs on our side.Optional: Let Your Agent Drive the Employer Side
Section titled “Optional: Let Your Agent Drive the Employer Side”Testing the integration end-to-end needs an employer on the other side — someone to post a job, link it to your project, and hire. Your agent can play that role too: the OpenTrain MCP server exposes the employer surface (jobs, proposals, contracts, milestones) as tools, using a separate personal ot_pat_ token from an employer test account. The same surface is available as a CLI and plain HTTP.
Claude Code
claude mcp add opentrain --env OPENTRAIN_PERSONAL_API_TOKEN=ot_pat_... -- npx -y @opentrain-ai/mcpAdd --scope user to make it available in every project. Full setup: Claude Code.
Codex CLI
codex mcp add opentrain --env OPENTRAIN_PERSONAL_API_TOKEN=ot_pat_... -- npx -y @opentrain-ai/mcpOr declare it in ~/.codex/config.toml. Full setup: Codex CLI.
Cursor
.cursor/mcp.json (project) or ~/.cursor/mcp.json (global):
{ "mcpServers": { "opentrain": { "command": "npx", "args": ["-y", "@opentrain-ai/mcp"], "env": { "OPENTRAIN_PERSONAL_API_TOKEN": "ot_pat_..." } } }}Full setup (including keeping the token out of JSON with envFile): Cursor.
Antigravity
~/.gemini/config/mcp_config.json:
{ "mcpServers": { "opentrain": { "command": "npx", "args": ["-y", "@opentrain-ai/mcp"], "env": { "OPENTRAIN_PERSONAL_API_TOKEN": "ot_pat_..." } } }}Full setup: Antigravity.
Grok Build
Reads Claude Code-format .mcp.json at the project root (same mcpServers shape as Cursor above), or use the /mcps modal in-session. Full setup: Grok Build.
GitHub Copilot CLI
Run /mcp add in-session, or edit ~/.copilot/mcp-config.json:
{ "mcpServers": { "opentrain": { "type": "stdio", "command": "npx", "args": ["-y", "@opentrain-ai/mcp"], "env": { "OPENTRAIN_PERSONAL_API_TOKEN": "${OPENTRAIN_PERSONAL_API_TOKEN}" } } }}Full setup: Copilot CLI.
OpenCode
opencode.json — note the key is mcp, the command is an array, and env lives under environment:
{ "$schema": "https://opencode.ai/config.json", "mcp": { "opentrain": { "type": "local", "command": ["npx", "-y", "@opentrain-ai/mcp"], "environment": { "OPENTRAIN_PERSONAL_API_TOKEN": "{env:OPENTRAIN_PERSONAL_API_TOKEN}" }, "enabled": true } }}Full setup: OpenCode.
Aider
Aider has no MCP support — use the CLI instead:
npm install -g @opentrain-ai/cliopentrain auth login --api-key ot_pat_...Then run commands from the chat with /run opentrain ... --json. Full setup: Aider.
Any other MCP agent
Any MCP-capable agent works with the generic mcpServers shape — command: "npx", args: ["-y", "@opentrain-ai/mcp"], token in env. Examples for Claude Desktop and Windsurf: Other MCP Agents.