terra-models

Run Terra API health models over connected user data to return wellness insights.

Updated Sep 2, 2026
One-click install
npx skills add https://github.com/tryterra/agent-skills --skill terra-models-tryterra
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: terra-models
Source: https://github.com/tryterra/agent-skills/tree/main/skills/terra-models
Command: npx skills add https://github.com/tryterra/agent-skills --skill terra-models-tryterra

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building against the Terra API Models endpoints involves per-model response shapes, non-obvious result semantics (unsupported devices return HTTP 200, not errors), and per-run billing that charges even for failed runs. This Skill gives an AI agent the exact guidance needed to call the models correctly and interpret results without wasting credits. ## Core Features & Use Cases - Model catalog and run workflow: Covers the three generally-available models (sleep_window, cycle_phase_tracker, graph_impute), the GET /v2/models and GET /v2/models/run endpoints, authentication headers, and the extra table parameter Smart Fill requires. - Result-handling guidance: Explains how to distinguish unsupported-device responses (HTTP 200 with unsupported: true) from genuine 4xx/5xx errors, handle no_data cases, and read per-model fields like reported vs computed in Smart Fill output. - Pricing and boundaries: Documents the $0.01 per-run credit model, the 30-day run log retention, and the boundary with the Unified API for connecting users. - Use Case: You are building a sleep-coaching feature and need to call GET /v2/models/run?model=sleep_window for a connected user, then correctly render the recommended bedtime, consistency score, and top recommendation while handling users whose devices are unsupported. ## Quick Start Ask your agent to run the Terra API sleep_window model for a connected user over a date range and explain how to handle an unsupported-device response.

Frequently Asked Questions about terra-models

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run a Terra API model for a connected user?

Call GET https://api.tryterra.co/v2/models/run with query params model, user_id, start_time, and end_time, plus x-api-key and dev-id headers. The user must first be connected through the Terra Unified API, and each run costs one credit.

What models are available in the Terra API Models product?

Three models are generally available: sleep_window (recommended sleep schedule and consistency score), cycle_phase_tracker (per-day menstrual cycle phase with detected onsets and fertile windows), and graph_impute (Smart Fill, which reconstructs metrics a device did not record).

Why does a Terra model run return HTTP 200 with no insight?

An unsupported device or provider returns HTTP 200 with unsupported: true and an unsupported_reason instead of an insight; this is a normal outcome, not an error. Genuine failures return 4xx or 5xx as RFC 7807 problem+json, and both cases still bill a credit.

Does graph_impute require extra parameters?

Yes, graph_impute (Smart Fill) requires a table parameter set to one of sleeps, dailies, or activities. Without it the endpoint returns a 400 rather than choosing a table, and each returned field is marked reported or computed to distinguish recorded from reconstructed values.

How much does a Terra API model run cost?

Each model run costs $0.01, drawn from your plan's monthly credit allowance. One run is one model over one user for one date range, and unsupported or errored runs are still metered, so validate inputs before running.

When should I use Terra Models instead of the Unified API?

Use Models when you need a discrete on-demand insight from a single call, such as a sleep schedule or cycle phase. Connecting users, webhooks, and historical data retrieval belong to the Unified API, which is a separate integration surface.