Skip to main content
TroopyDocs
Open Troopy
Troopy

API reference / Account

Set an AI plan's model

Sets the model and the effort that teammates use on this plan when they pick none, from GET /ai-plans/{plan}/models. Send either or both. Null goes back to the default of the plan's CLI. On a plan with an API key, null takes the model that Troopy picks from the list of its provider at the next round. A teammate's own model and effort come first (PATCH /agents/{handle}). A new model that doesn't take the effort goes back to its default effort. Needs an owner or admin.

patch/api/v1/ai-plans/{plan}

Authorization

HeaderAuthorization: Bearer <API key>
Or the headerX-API-Key: <API key>
API keyMake one in Troopy under Settings > API keys. It acts as you, in its workspace.

Other ways to call it

CLItroopy ai plans set-model
MCP tooltroopy_update_ai_plan
Rate limit30 calls in 60 seconds, for each key
RetriesSend an Idempotency-Key header. A retry with the same key gets the first answer back, and the operation runs one time.

Path parameters

plan*string

An AI plan's id, from GET /ai-plans

Body

application/json
modelstring | null

One of the plan's models (GET /ai-plans/{plan}/models). Null lets the plan's CLI pick

effortenum<string> | null

One of the efforts that the model takes. Null uses the model's default

lowmediumhighxhighmax

Response

200 · application/json
data*array<object>
17 properties
provider*enum<string>

The AI plan the organization's teammates run on

claudechatgptgeminigrokcopilotopenrouterzaikimiminimaxqwenanthropicopenaicursor

method*enum<string> | null

How the plan signs in: an API key; a code to approve on the provider's site (device_code); or signing in at the provider's site and pasting back the code it shows (paste_code). Null when Troopy can't connect the plan yet

api_keydevice_codepaste_code

status*enum<string>

pending: waiting for someone to approve userCode at verificationUrl (device_code), or to sign in at verificationUrl and send the code back (paste_code)

nonependingconnectedfailed

userCode*string | null

The code to enter at verificationUrl. Shown to owners and admins only

verificationUrl*string | null
expiresAt*string | null

When userCode stops working

keyHint*string | null

The last four characters of the API key in use

connectedAt*string | null
error*string | null

Why the last attempt failed, in words to show people

limitedUntil*string | null

Out of usage until then: teammates use the next plan down the list meanwhile

lapsedAt*string | null

Since when the sign-in lapsed and the plan's CLI couldn't renew it. Sign the plan in again (POST /computer/connection). Null while the sign-in is fresh

id*string

An AI plan's id, from GET /ai-plans

label*string | null

What people call it, like Work

name*string

How Troopy shows it: the provider's name, with the label or a number when there are several of one provider

isDefault*boolean

The plan teammates start on. The others are fallbacks, tried in order when one is out of usage

model*string | null

The model of teammates that pick none, from GET /ai-plans/{plan}/models. Null: the plan's CLI picks

effort*enum<string> | null

The effort of teammates that pick none, on this plan's model. Null: the model's default

lowmediumhighxhighmax

Errors

400 invalid_inputFix the field named in detail. Each operation's schema is in /api/v1/openapi.json.
401 unauthorizedSend an API key as `Authorization: Bearer tr_live_...`. Create one in Troopy under Settings.
403 forbiddenThe key lacks a scope this operation needs, or its owner lacks the role. detail says which; create a key with the scope, or ask an organization owner or admin.
404 not_foundCheck the path and any id in it. Every operation is listed in /api/v1/openapi.json.
409 conflictThis Idempotency-Key was used for a different request, or that request is still running. Use a new key for a new request.
429 rate_limitedWait the number of seconds in Retry-After, then retry.