{
 "openapi": "3.1.0",
 "info": {
  "title": "Great Work Labs API",
  "version": "1.0.0",
  "description": "Small models for specific jobs, a fraction of a cent per call. Docs: https://labs.greatwork.company/docs",
  "contact": {
   "email": "hello@greatwork.company"
  }
 },
 "servers": [
  {
   "url": "https://labs.greatwork.company/v1"
  }
 ],
 "security": [
  {
   "bearer": []
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer",
    "description": "API key (gwl_...)"
   }
  },
  "schemas": {
   "Usage": {
    "type": "object",
    "properties": {
     "units": {
      "type": "integer"
     },
     "unit": {
      "type": "string"
     },
     "cost_usd": {
      "type": "string",
      "description": "Exact cost as a decimal string"
     },
     "cost_micros": {
      "type": "integer"
     }
    }
   },
   "Error": {
    "type": "object",
    "properties": {
     "error": {
      "type": "object",
      "properties": {
       "type": {
        "type": "string"
       },
       "code": {
        "type": "string"
       },
       "message": {
        "type": "string"
       },
       "param": {
        "type": "string"
       },
       "docs_url": {
        "type": "string"
       },
       "request_id": {
        "type": "string"
       }
      },
      "required": [
       "type",
       "code",
       "message"
      ]
     }
    }
   },
   "LingoRequest": {
    "type": "object",
    "title": "lingo-1 request",
    "description": "Language detection. $0.02 per 1,000 texts.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "lingo-1",
       "lingo"
      ]
     },
     "input": {
      "oneOf": [
       {
        "type": "string"
       },
       {
        "type": "array",
        "items": {
         "type": "string"
        },
        "maxItems": 64
       }
      ],
      "description": "A string, or an array of up to 64 strings to run as a batch."
     },
     "top_k": {
      "type": "integer",
      "minimum": 1,
      "maximum": 10,
      "default": 3,
      "description": "How many candidate languages to return."
     },
     "only": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "Restrict answers to these languages (ISO 639-1 like `en`, or FLORES codes like `eng_Latn`)."
     }
    },
    "required": [
     "model",
     "input"
    ],
    "additionalProperties": false
   },
   "LingoOutput": {
    "type": "object",
    "title": "lingo-1 output",
    "properties": {
     "language": {
      "description": "string. Best guess as an ISO 639 code (`en`, `es`, `zh`), or the 3-letter code when no 2-letter code exists."
     },
     "name": {
      "description": "string. English name of the language."
     },
     "script": {
      "description": "string. ISO 15924 script code (`Latn`, `Cyrl`, `Hani`)."
     },
     "code": {
      "description": "string. FLORES-200 code, language plus script (`eng_Latn`)."
     },
     "score": {
      "description": "number. Confidence, 0 to 1."
     },
     "candidates": {
      "description": "object[]. Top guesses with `language`, `name`, `code` and `score`."
     }
    }
   },
   "ToneRequest": {
    "type": "object",
    "title": "tone-1 request",
    "description": "Sentiment analysis. $0.02 per 1,000 texts.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "tone-1",
       "tone"
      ]
     },
     "input": {
      "oneOf": [
       {
        "type": "string"
       },
       {
        "type": "array",
        "items": {
         "type": "string"
        },
        "maxItems": 64
       }
      ],
      "description": "A string, or an array of up to 64 strings to run as a batch."
     }
    },
    "required": [
     "model",
     "input"
    ],
    "additionalProperties": false
   },
   "ToneOutput": {
    "type": "object",
    "title": "tone-1 output",
    "properties": {
     "label": {
      "description": "string. `positive`, `neutral` or `negative`."
     },
     "score": {
      "description": "number. Confidence in `label`, 0 to 1."
     },
     "polarity": {
      "description": "number. P(positive) minus P(negative), from -1 to 1."
     },
     "labels": {
      "description": "object[]. All three labels with scores."
     }
    }
   },
   "MoodRequest": {
    "type": "object",
    "title": "mood-1 request",
    "description": "Emotion detection. $0.02 per 1,000 texts.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "mood-1",
       "mood"
      ]
     },
     "input": {
      "oneOf": [
       {
        "type": "string"
       },
       {
        "type": "array",
        "items": {
         "type": "string"
        },
        "maxItems": 64
       }
      ],
      "description": "A string, or an array of up to 64 strings to run as a batch."
     },
     "all": {
      "type": "boolean",
      "default": false,
      "description": "Return scores for all 28 labels, not just the detected ones."
     }
    },
    "required": [
     "model",
     "input"
    ],
    "additionalProperties": false
   },
   "MoodOutput": {
    "type": "object",
    "title": "mood-1 output",
    "properties": {
     "emotions": {
      "description": "object[]. Detected emotions (score above the label's tuned threshold), strongest first: `label`, `score`."
     },
     "top": {
      "description": "string. The strongest emotion, `neutral` when nothing stands out."
     },
     "basic": {
      "description": "object. Scores for the six basic emotions: anger, disgust, fear, joy, sadness, surprise."
     },
     "scores": {
      "description": "object. All 28 scores (only with `all: true`)."
     }
    }
   },
   "SpotRequest": {
    "type": "object",
    "title": "spot-1 request",
    "description": "Named entity recognition. $0.02 per 1,000 texts.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "spot-1",
       "spot"
      ]
     },
     "input": {
      "oneOf": [
       {
        "type": "string"
       },
       {
        "type": "array",
        "items": {
         "type": "string"
        },
        "maxItems": 64
       }
      ],
      "description": "A string, or an array of up to 64 strings to run as a batch."
     },
     "types": {
      "type": "array",
      "items": {
       "type": "string",
       "enum": [
        "person",
        "organization",
        "location",
        "date"
       ]
      },
      "description": "Only return these entity types."
     },
     "threshold": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "default": 0.5,
      "description": "Score at or above which an entity is returned."
     }
    },
    "required": [
     "model",
     "input"
    ],
    "additionalProperties": false
   },
   "SpotOutput": {
    "type": "object",
    "title": "spot-1 output",
    "properties": {
     "spans": {
      "description": "object[]. Entities in order: `type`, `text`, `start`, `end` (character offsets, end exclusive), `score`."
     },
     "counts": {
      "description": "object. How many of each type."
     }
    }
   },
   "SortRequest": {
    "type": "object",
    "title": "sort-1 request",
    "description": "Zero-shot classification. $0.01 per 1,000 label checks.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "sort-1",
       "sort"
      ]
     },
     "input": {
      "oneOf": [
       {
        "type": "string"
       },
       {
        "type": "array",
        "items": {
         "type": "string"
        },
        "maxItems": 32
       }
      ],
      "description": "A string, or an array of up to 32 strings. Only the first 2,000 characters are read."
     },
     "labels": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "2 to 20 candidate labels, in plain words."
     },
     "multi_label": {
      "type": "boolean",
      "default": false,
      "description": "Score each label on its own (several can be true) instead of picking one."
     },
     "template": {
      "type": "string",
      "default": "This example is {label}.",
      "description": "Sentence the model checks for each label. `{label}` is replaced. Try \"The user wants to {label}.\" for intents."
     }
    },
    "required": [
     "model",
     "input",
     "labels"
    ],
    "additionalProperties": false
   },
   "SortOutput": {
    "type": "object",
    "title": "sort-1 output",
    "properties": {
     "label": {
      "description": "string. Best label."
     },
     "score": {
      "description": "number. Its score, 0 to 1."
     },
     "labels": {
      "description": "object[]. Every label with its score, best first."
     }
    }
   },
   "TopicRequest": {
    "type": "object",
    "title": "topic-1 request",
    "description": "Topic and format classification. $0.02 per 1,000 texts.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "topic-1",
       "topic"
      ]
     },
     "input": {
      "oneOf": [
       {
        "type": "string"
       },
       {
        "type": "array",
        "items": {
         "type": "string"
        },
        "maxItems": 64
       }
      ],
      "description": "Page text (not a URL), a string or an array of up to 64. The first ~2,000 characters decide the labels."
     }
    },
    "required": [
     "model",
     "input"
    ],
    "additionalProperties": false
   },
   "TopicOutput": {
    "type": "object",
    "title": "topic-1 output",
    "properties": {
     "topic": {
      "description": "object. Best topic: `label`, `score`."
     },
     "format": {
      "description": "object. Best format: `label`, `score`."
     },
     "topics": {
      "description": "object[]. Top 5 topics with scores."
     },
     "formats": {
      "description": "object[]. Top 5 formats with scores."
     }
    }
   },
   "RouteRequest": {
    "type": "object",
    "title": "route-1 request",
    "description": "Prompt task and complexity. $0.02 per 1,000 texts.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "route-1",
       "route"
      ]
     },
     "input": {
      "oneOf": [
       {
        "type": "string"
       },
       {
        "type": "array",
        "items": {
         "type": "string"
        },
        "maxItems": 64
       }
      ],
      "description": "A prompt, or an array of up to 64. The first 512 tokens are read."
     }
    },
    "required": [
     "model",
     "input"
    ],
    "additionalProperties": false
   },
   "RouteOutput": {
    "type": "object",
    "title": "route-1 output",
    "properties": {
     "task": {
      "description": "string. Most likely task: open_qa, closed_qa, summarization, text_generation, code_generation, chatbot, classification, rewrite, brainstorming, extraction or other."
     },
     "task_score": {
      "description": "number. Its score, 0 to 1."
     },
     "tasks": {
      "description": "object[]. Top 3 tasks with scores."
     },
     "complexity": {
      "description": "number. Overall difficulty, 0 to 1. Averages run near 0.2; pick thresholds from your own traffic."
     },
     "dimensions": {
      "description": "object. creativity, reasoning, contextual_knowledge, domain_knowledge, constraints, each 0 to 1."
     }
    }
   },
   "SieveRequest": {
    "type": "object",
    "title": "sieve-1 request",
    "description": "Toxicity detection. $0.02 per 1,000 texts.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "sieve-1",
       "sieve"
      ]
     },
     "input": {
      "oneOf": [
       {
        "type": "string"
       },
       {
        "type": "array",
        "items": {
         "type": "string"
        },
        "maxItems": 64
       }
      ],
      "description": "A string, or an array of up to 64 strings to run as a batch."
     },
     "threshold": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "default": 0.5,
      "description": "Score at or above which a label counts as flagged (non-English text scores lower; try 0.35 for multilingual communities)."
     }
    },
    "required": [
     "model",
     "input"
    ],
    "additionalProperties": false
   },
   "SieveOutput": {
    "type": "object",
    "title": "sieve-1 output",
    "properties": {
     "flagged": {
      "description": "boolean. True when any label is at or above `threshold`."
     },
     "labels": {
      "description": "string[]. Labels at or above `threshold`."
     },
     "scores": {
      "description": "object. toxicity, severe_toxicity, obscene, threat, insult, identity_attack, sexual_explicit, each 0 to 1."
     }
    }
   },
   "WardenRequest": {
    "type": "object",
    "title": "warden-1 request",
    "description": "Content safety policy check. $0.03 per 1,000 texts.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "warden-1",
       "warden"
      ]
     },
     "input": {
      "oneOf": [
       {
        "type": "string"
       },
       {
        "type": "array",
        "items": {
         "type": "string"
        },
        "maxItems": 32
       }
      ],
      "description": "The user prompt (string or array of up to 32)."
     },
     "response": {
      "type": "string",
      "description": "Your model's reply to the prompt. When present, Warden judges the reply in the context of the prompt."
     },
     "threshold": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "default": 0.5,
      "description": "Score at or above which the text is flagged unsafe."
     }
    },
    "required": [
     "model",
     "input"
    ],
    "additionalProperties": false
   },
   "WardenOutput": {
    "type": "object",
    "title": "warden-1 output",
    "properties": {
     "flagged": {
      "description": "boolean. True when `unsafe` is at or above `threshold`."
     },
     "unsafe": {
      "description": "number. Probability the text breaks the policy, 0 to 1."
     },
     "categories": {
      "description": "string[]. Categories over their tuned thresholds (only when flagged)."
     },
     "scores": {
      "description": "object. Raw score for each category."
     }
    }
   },
   "MoatRequest": {
    "type": "object",
    "title": "moat-1 request",
    "description": "Prompt injection detection. $0.02 per 1,000 texts.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "moat-1",
       "moat"
      ]
     },
     "input": {
      "oneOf": [
       {
        "type": "string"
       },
       {
        "type": "array",
        "items": {
         "type": "string"
        },
        "maxItems": 64
       }
      ],
      "description": "Text to check (a string or array of up to 64): a user message, a retrieved chunk, a tool result."
     },
     "threshold": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "default": 0.5,
      "description": "Score at or above which the text counts as an injection. Use 0.8 to 0.95 to scan every retrieved chunk with few false alarms, 0.2 to 0.3 to send anything suspicious to review."
     }
    },
    "required": [
     "model",
     "input"
    ],
    "additionalProperties": false
   },
   "MoatOutput": {
    "type": "object",
    "title": "moat-1 output",
    "properties": {
     "injection": {
      "description": "boolean. True when `score` is at or above `threshold`."
     },
     "score": {
      "description": "number. Probability of an injection, 0 to 1 (the highest chunk for long texts)."
     }
    }
   },
   "VeilRequest": {
    "type": "object",
    "title": "veil-1 request",
    "description": "PII detection and redaction. $0.02 per 1,000 texts.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "veil-1",
       "veil"
      ]
     },
     "input": {
      "oneOf": [
       {
        "type": "string"
       },
       {
        "type": "array",
        "items": {
         "type": "string"
        },
        "maxItems": 64
       }
      ],
      "description": "A string, or an array of up to 64 strings to run as a batch."
     },
     "redact": {
      "type": "string",
      "enum": [
       "none",
       "type",
       "mask",
       "numbered"
      ],
      "default": "type",
      "description": "How to rewrite the text: `type` gives [EMAIL], `mask` gives ████, `numbered` gives [PERSON_1], `none` skips the rewrite."
     },
     "types": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "Only detect these types (e.g. `[\"email\", \"phone\", \"credit_card\"]`)."
     },
     "threshold": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "default": 0.5,
      "description": "Score at or above which a span is returned."
     }
    },
    "required": [
     "model",
     "input"
    ],
    "additionalProperties": false
   },
   "VeilOutput": {
    "type": "object",
    "title": "veil-1 output",
    "properties": {
     "redacted": {
      "description": "string. The text with every span replaced (unless `redact: \"none\"`)."
     },
     "spans": {
      "description": "object[]. `type`, `text`, `start`, `end`, `score` for each piece of personal data."
     },
     "counts": {
      "description": "object. How many of each type."
     }
    }
   },
   "BaitRequest": {
    "type": "object",
    "title": "bait-1 request",
    "description": "Phishing, scam and spam detection. $0.04 per 1,000 texts.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "bait-1",
       "bait"
      ]
     },
     "input": {
      "oneOf": [
       {
        "type": "string"
       },
       {
        "type": "array",
        "items": {
         "type": "string"
        },
        "maxItems": 64
       }
      ],
      "description": "The message text (string or array of up to 64). Subject and body together work best."
     },
     "threshold": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "default": 0.5,
      "description": "Score at or above which a message counts as unwanted (raise to 0.8 or 0.9 for fewer false alarms)."
     }
    },
    "required": [
     "model",
     "input"
    ],
    "additionalProperties": false
   },
   "BaitOutput": {
    "type": "object",
    "title": "bait-1 output",
    "properties": {
     "label": {
      "description": "string. `legitimate`, `spam` or `fraud`."
     },
     "unwanted": {
      "description": "number. P(spam) + P(fraud), 0 to 1."
     },
     "flagged": {
      "description": "boolean. True when `unwanted` is at or above `threshold`."
     },
     "scores": {
      "description": "object. legitimate, spam, fraud."
     }
    }
   },
   "GroundRequest": {
    "type": "object",
    "title": "ground-1 request",
    "description": "Grounding check (hallucination detection). $0.04 per 1,000 sentences.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "ground-1",
       "ground"
      ]
     },
     "input": {
      "type": "string",
      "description": "The answer or claim to check (a string, up to 8,000 characters)."
     },
     "context": {
      "type": "string",
      "description": "The source text the answer should be based on (up to 8,000 characters)."
     },
     "threshold": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "default": 0.5,
      "description": "Score at or above which a sentence counts as supported."
     }
    },
    "required": [
     "model",
     "input",
     "context"
    ],
    "additionalProperties": false
   },
   "GroundOutput": {
    "type": "object",
    "title": "ground-1 output",
    "properties": {
     "supported": {
      "description": "boolean. True when every sentence is supported."
     },
     "score": {
      "description": "number. Support score of the weakest sentence, 0 to 1."
     },
     "sentences": {
      "description": "object[]. Each sentence: `text`, `score`, `supported`."
     }
    }
   },
   "AtlasRequest": {
    "type": "object",
    "title": "atlas-1 request",
    "description": "Text embeddings. $0.005 per 1,000 texts.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "atlas-1",
       "atlas"
      ]
     },
     "input": {
      "oneOf": [
       {
        "type": "string"
       },
       {
        "type": "array",
        "items": {
         "type": "string"
        },
        "maxItems": 128
       }
      ],
      "description": "A string, or an array of up to 128 strings. Texts over about 2,000 characters are truncated: split long documents first."
     },
     "kind": {
      "type": "string",
      "enum": [
       "passage",
       "query"
      ],
      "default": "passage",
      "description": "`query` for search queries, `passage` for the documents you search over."
     }
    },
    "required": [
     "model",
     "input"
    ],
    "additionalProperties": false
   },
   "AtlasOutput": {
    "type": "object",
    "title": "atlas-1 output",
    "properties": {
     "embedding": {
      "description": "number[]. 384 floats, L2-normalized (dot product = cosine similarity)."
     },
     "dims": {
      "description": "integer. 384."
     }
    }
   },
   "LadderRequest": {
    "type": "object",
    "title": "ladder-1 request",
    "description": "Reranking. $0.01 per 1,000 documents.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "ladder-1",
       "ladder"
      ]
     },
     "input": {
      "type": "string",
      "description": "The query (a string)."
     },
     "documents": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "1 to 100 candidate texts. Each is read up to about 1,500 characters."
     },
     "top_n": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100,
      "description": "Return only the best N."
     },
     "return_documents": {
      "type": "boolean",
      "default": false,
      "description": "Include each document's text in the results."
     }
    },
    "required": [
     "model",
     "input",
     "documents"
    ],
    "additionalProperties": false
   },
   "LadderOutput": {
    "type": "object",
    "title": "ladder-1 output",
    "properties": {
     "results": {
      "description": "object[]. Best first: `index` (position in `documents`), `score` (0 to 1), and `document` with `return_documents`."
     }
    }
   },
   "PluckRequest": {
    "type": "object",
    "title": "pluck-1 request",
    "description": "Keyphrase extraction. $0.03 per 1,000 texts.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "pluck-1",
       "pluck"
      ]
     },
     "input": {
      "oneOf": [
       {
        "type": "string"
       },
       {
        "type": "array",
        "items": {
         "type": "string"
        },
        "maxItems": 16
       }
      ],
      "description": "A string or array of up to 16 (up to 8,000 characters each)."
     },
     "top_k": {
      "type": "integer",
      "minimum": 1,
      "maximum": 30,
      "default": 8,
      "description": "How many phrases to return."
     },
     "diversity": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "default": 0.3,
      "description": "0 for the most relevant phrases, 1 for the most varied."
     }
    },
    "required": [
     "model",
     "input"
    ],
    "additionalProperties": false
   },
   "PluckOutput": {
    "type": "object",
    "title": "pluck-1 output",
    "properties": {
     "keyphrases": {
      "description": "object[]. `text` and `score` (relevance to the whole text), in pick order."
     }
    }
   },
   "GlyphRequest": {
    "type": "object",
    "title": "glyph-1 request",
    "description": "Emoji suggestions. $0.01 per 1,000 texts.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "glyph-1",
       "glyph"
      ]
     },
     "input": {
      "oneOf": [
       {
        "type": "string"
       },
       {
        "type": "array",
        "items": {
         "type": "string"
        },
        "maxItems": 64
       }
      ],
      "description": "A short text (string or array of up to 64). The first 1,000 characters are read."
     },
     "top_k": {
      "type": "integer",
      "minimum": 1,
      "maximum": 20,
      "default": 5,
      "description": "How many emoji to return."
     }
    },
    "required": [
     "model",
     "input"
    ],
    "additionalProperties": false
   },
   "GlyphOutput": {
    "type": "object",
    "title": "glyph-1 output",
    "properties": {
     "emojis": {
      "description": "object[]. `emoji`, `name`, `score`, best first."
     }
    }
   },
   "CommaRequest": {
    "type": "object",
    "title": "comma-1 request",
    "description": "Punctuation and capitalization. $0.02 per 1,000 texts.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "comma-1",
       "comma"
      ]
     },
     "input": {
      "oneOf": [
       {
        "type": "string"
       },
       {
        "type": "array",
        "items": {
         "type": "string"
        },
        "maxItems": 64
       }
      ],
      "description": "A string, or an array of up to 64 strings to run as a batch."
     }
    },
    "required": [
     "model",
     "input"
    ],
    "additionalProperties": false
   },
   "CommaOutput": {
    "type": "object",
    "title": "comma-1 output",
    "properties": {
     "text": {
      "description": "string. The text with punctuation and casing restored."
     },
     "changes": {
      "description": "integer. How many words changed."
     }
    }
   },
   "BriefRequest": {
    "type": "object",
    "title": "brief-1 request",
    "description": "Summarization. $0.30 per 1,000 summaries.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "brief-1",
       "brief"
      ]
     },
     "input": {
      "oneOf": [
       {
        "type": "string"
       },
       {
        "type": "array",
        "items": {
         "type": "string"
        },
        "maxItems": 8
       }
      ],
      "description": "A string or array of up to 8 (up to 6,000 characters each; longer texts are cut)."
     },
     "length": {
      "type": "string",
      "enum": [
       "short",
       "medium",
       "long"
      ],
      "default": "medium",
      "description": "Summary length: short (one sentence), medium (a paragraph) or long."
     }
    },
    "required": [
     "model",
     "input"
    ],
    "additionalProperties": false
   },
   "BriefOutput": {
    "type": "object",
    "title": "brief-1 output",
    "properties": {
     "summary": {
      "description": "string. The summary."
     }
    }
   },
   "MoldRequest": {
    "type": "object",
    "title": "mold-1 request",
    "description": "Structured extraction (JSON from text). $0.40 per 1,000 texts.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "mold-1",
       "mold"
      ]
     },
     "input": {
      "oneOf": [
       {
        "type": "string"
       },
       {
        "type": "array",
        "items": {
         "type": "string"
        },
        "maxItems": 8
       }
      ],
      "description": "The text to read (string or array of up to 8, up to 6,000 characters each)."
     },
     "schema": {
      "type": "object",
      "description": "JSON Schema with `\"type\": \"object\"` and `properties`. Strings, numbers, integers, booleans, enums, arrays and nested objects work."
     },
     "instructions": {
      "type": "string",
      "description": "Extra guidance, e.g. \"amounts in cents\" or \"use the billing address, not shipping\"."
     }
    },
    "required": [
     "model",
     "input",
     "schema"
    ],
    "additionalProperties": false
   },
   "MoldOutput": {
    "type": "object",
    "title": "mold-1 output",
    "properties": {
     "data": {
      "description": "object. An object matching your schema. Fields the text doesn't mention are null."
     }
    }
   },
   "HeadlineRequest": {
    "type": "object",
    "title": "headline-1 request",
    "description": "Title and description writing. $0.20 per 1,000 texts.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "headline-1",
       "headline"
      ]
     },
     "input": {
      "oneOf": [
       {
        "type": "string"
       },
       {
        "type": "array",
        "items": {
         "type": "string"
        },
        "maxItems": 8
       }
      ],
      "description": "The text to title (string or array of up to 8, up to 6,000 characters each)."
     },
     "style": {
      "type": "string",
      "description": "Optional style note, e.g. \"sentence case, under 6 words\" or \"like a changelog entry\"."
     }
    },
    "required": [
     "model",
     "input"
    ],
    "additionalProperties": false
   },
   "HeadlineOutput": {
    "type": "object",
    "title": "headline-1 output",
    "properties": {
     "title": {
      "description": "string. The title (90 characters max)."
     },
     "description": {
      "description": "string. One sentence (220 characters max)."
     },
     "slug": {
      "description": "string. URL slug from the title."
     }
    }
   },
   "ScribeRequest": {
    "type": "object",
    "title": "scribe-1 request",
    "description": "Speech to text. $0.001 per minute.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "scribe-1",
       "scribe"
      ]
     },
     "input": {
      "type": "string",
      "description": "An audio or video file: an https URL, a data URL, or a file in a multipart upload. MP3, WAV, M4A, OGG, FLAC, WebM, MP4 and more, up to 25 MB and 5 minutes."
     },
     "language": {
      "type": "string",
      "description": "Language of the speech (`en`, `es`, `ja`...). Detected when omitted; setting it is faster and more accurate."
     },
     "task": {
      "type": "string",
      "enum": [
       "transcribe",
       "translate"
      ],
      "default": "transcribe",
      "description": "`translate` writes English text for speech in any language."
     },
     "timestamps": {
      "type": "string",
      "enum": [
       "word",
       "none"
      ],
      "default": "word",
      "description": "`none` skips word timing (faster)."
     }
    },
    "required": [
     "model",
     "input"
    ],
    "additionalProperties": false
   },
   "ScribeOutput": {
    "type": "object",
    "title": "scribe-1 output",
    "properties": {
     "text": {
      "description": "string. The full transcript."
     },
     "language": {
      "description": "string. Spoken language (ISO 639-1), detected unless you set it."
     },
     "language_score": {
      "description": "number. Confidence in the detected language (only when detected)."
     },
     "duration": {
      "description": "number. Audio length in seconds."
     },
     "words": {
      "description": "object[]. `text`, `start`, `end` (seconds) for each word."
     },
     "segments": {
      "description": "object[]. Sentence-sized segments with `text`, `start`, `end`, ready for subtitles."
     }
    }
   },
   "PrismRequest": {
    "type": "object",
    "title": "prism-1 request",
    "description": "Image tagging and image embeddings. $0.10 per 1,000 images.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "prism-1",
       "prism"
      ]
     },
     "input": {
      "type": "string",
      "description": "An image: an https URL, a data URL (`data:image/png;base64,...`), or a file in a multipart upload. JPEG, PNG, WebP, GIF, AVIF or TIFF, up to 10 MB."
     },
     "labels": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "2 to 50 labels to score. Plain nouns work best (\"a dog\", \"a cat\")."
     },
     "template": {
      "type": "string",
      "default": "a photo of {label}",
      "description": "Sentence each label is placed in."
     },
     "embed": {
      "type": "boolean",
      "default": false,
      "description": "Return the image's 512-number embedding."
     },
     "texts": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "Text queries to embed into the same space (for image search), up to 100."
     }
    },
    "required": [
     "model",
     "input"
    ],
    "additionalProperties": false
   },
   "PrismOutput": {
    "type": "object",
    "title": "prism-1 output",
    "properties": {
     "label": {
      "description": "string. Best label (when `labels` is sent)."
     },
     "score": {
      "description": "number. Its probability among your labels."
     },
     "labels": {
      "description": "object[]. Every label with `score` and raw `similarity`."
     },
     "embedding": {
      "description": "number[]. 512 floats, normalized (with `embed: true`)."
     },
     "text_embeddings": {
      "description": "number[][]. One vector per entry in `texts`."
     }
    }
   },
   "InkRequest": {
    "type": "object",
    "title": "ink-1 request",
    "description": "Text recognition (OCR). $0.50 per 1,000 images.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "ink-1",
       "ink"
      ]
     },
     "input": {
      "type": "string",
      "description": "An image: an https URL, a data URL (`data:image/png;base64,...`), or a file in a multipart upload. JPEG, PNG, WebP, GIF, AVIF or TIFF, up to 10 MB."
     },
     "min_confidence": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "default": 0.5,
      "description": "Drop lines below this confidence."
     }
    },
    "required": [
     "model",
     "input"
    ],
    "additionalProperties": false
   },
   "InkOutput": {
    "type": "object",
    "title": "ink-1 output",
    "properties": {
     "text": {
      "description": "string. All text, lines in reading order."
     },
     "lines": {
      "description": "object[]. `text`, `score`, `box` {x, y, width, height} in pixels."
     }
    }
   },
   "ScoutRequest": {
    "type": "object",
    "title": "scout-1 request",
    "description": "Object detection. $0.30 per 1,000 images.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "scout-1",
       "scout"
      ]
     },
     "input": {
      "type": "string",
      "description": "An image: an https URL, a data URL (`data:image/png;base64,...`), or a file in a multipart upload. JPEG, PNG, WebP, GIF, AVIF or TIFF, up to 10 MB."
     },
     "threshold": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "default": 0.7,
      "description": "Score at or above which an object is returned."
     },
     "labels": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "Only return these labels (COCO names like `person`, `car`, `dog`, `bottle`)."
     }
    },
    "required": [
     "model",
     "input"
    ],
    "additionalProperties": false
   },
   "ScoutOutput": {
    "type": "object",
    "title": "scout-1 output",
    "properties": {
     "objects": {
      "description": "object[]. `label`, `score`, `box` {x, y, width, height} in pixels, best first."
     },
     "counts": {
      "description": "object. Objects per label."
     }
    }
   },
   "CutoutRequest": {
    "type": "object",
    "title": "cutout-1 request",
    "description": "Background removal. $2.00 per 1,000 images.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "cutout-1",
       "cutout"
      ]
     },
     "input": {
      "type": "string",
      "description": "An image: an https URL, a data URL (`data:image/png;base64,...`), or a file in a multipart upload. JPEG, PNG, WebP, GIF, AVIF or TIFF, up to 10 MB."
     },
     "format": {
      "type": "string",
      "enum": [
       "png",
       "mask"
      ],
      "default": "png",
      "description": "`png` for the cutout with transparency, `mask` for the alpha mask."
     }
    },
    "required": [
     "model",
     "input"
    ],
    "additionalProperties": false
   },
   "CutoutOutput": {
    "type": "object",
    "title": "cutout-1 output",
    "properties": {
     "image": {
      "description": "string. PNG as a data URL."
     },
     "foreground": {
      "description": "number. Share of the image kept, 0 to 1."
     },
     "width": {
      "description": "integer. Output width (long side up to 2,048 px)."
     },
     "height": {
      "description": "integer. Output height."
     }
    }
   },
   "CurtainRequest": {
    "type": "object",
    "title": "curtain-1 request",
    "description": "NSFW image detection. $0.10 per 1,000 images.",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "curtain-1",
       "curtain"
      ]
     },
     "input": {
      "type": "string",
      "description": "An image: an https URL, a data URL (`data:image/png;base64,...`), or a file in a multipart upload. JPEG, PNG, WebP, GIF, AVIF or TIFF, up to 10 MB."
     },
     "threshold": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "default": 0.5,
      "description": "Score at or above which an image counts as NSFW."
     }
    },
    "required": [
     "model",
     "input"
    ],
    "additionalProperties": false
   },
   "CurtainOutput": {
    "type": "object",
    "title": "curtain-1 output",
    "properties": {
     "nsfw": {
      "description": "boolean. True when `score` is at or above `threshold`."
     },
     "score": {
      "description": "number. Probability the image is NSFW, 0 to 1."
     }
    }
   }
  }
 },
 "paths": {
  "/run": {
   "post": {
    "operationId": "run",
    "summary": "Run a model",
    "description": "Same body shape for every model: model, input, options.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "oneOf": [
         {
          "$ref": "#/components/schemas/LingoRequest"
         },
         {
          "$ref": "#/components/schemas/ToneRequest"
         },
         {
          "$ref": "#/components/schemas/MoodRequest"
         },
         {
          "$ref": "#/components/schemas/SpotRequest"
         },
         {
          "$ref": "#/components/schemas/SortRequest"
         },
         {
          "$ref": "#/components/schemas/TopicRequest"
         },
         {
          "$ref": "#/components/schemas/RouteRequest"
         },
         {
          "$ref": "#/components/schemas/SieveRequest"
         },
         {
          "$ref": "#/components/schemas/WardenRequest"
         },
         {
          "$ref": "#/components/schemas/MoatRequest"
         },
         {
          "$ref": "#/components/schemas/VeilRequest"
         },
         {
          "$ref": "#/components/schemas/BaitRequest"
         },
         {
          "$ref": "#/components/schemas/GroundRequest"
         },
         {
          "$ref": "#/components/schemas/AtlasRequest"
         },
         {
          "$ref": "#/components/schemas/LadderRequest"
         },
         {
          "$ref": "#/components/schemas/PluckRequest"
         },
         {
          "$ref": "#/components/schemas/GlyphRequest"
         },
         {
          "$ref": "#/components/schemas/CommaRequest"
         },
         {
          "$ref": "#/components/schemas/BriefRequest"
         },
         {
          "$ref": "#/components/schemas/MoldRequest"
         },
         {
          "$ref": "#/components/schemas/HeadlineRequest"
         },
         {
          "$ref": "#/components/schemas/ScribeRequest"
         },
         {
          "$ref": "#/components/schemas/PrismRequest"
         },
         {
          "$ref": "#/components/schemas/InkRequest"
         },
         {
          "$ref": "#/components/schemas/ScoutRequest"
         },
         {
          "$ref": "#/components/schemas/CutoutRequest"
         },
         {
          "$ref": "#/components/schemas/CurtainRequest"
         }
        ],
        "discriminator": {
         "propertyName": "model"
        }
       }
      },
      "multipart/form-data": {
       "schema": {
        "type": "object",
        "properties": {
         "model": {
          "type": "string"
         },
         "input": {
          "type": "string",
          "format": "binary"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Model output",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "id": {
           "type": "string"
          },
          "object": {
           "const": "run"
          },
          "model": {
           "type": "string"
          },
          "created": {
           "type": "integer"
          },
          "output": {
           "oneOf": [
            {
             "$ref": "#/components/schemas/LingoOutput"
            },
            {
             "$ref": "#/components/schemas/ToneOutput"
            },
            {
             "$ref": "#/components/schemas/MoodOutput"
            },
            {
             "$ref": "#/components/schemas/SpotOutput"
            },
            {
             "$ref": "#/components/schemas/SortOutput"
            },
            {
             "$ref": "#/components/schemas/TopicOutput"
            },
            {
             "$ref": "#/components/schemas/RouteOutput"
            },
            {
             "$ref": "#/components/schemas/SieveOutput"
            },
            {
             "$ref": "#/components/schemas/WardenOutput"
            },
            {
             "$ref": "#/components/schemas/MoatOutput"
            },
            {
             "$ref": "#/components/schemas/VeilOutput"
            },
            {
             "$ref": "#/components/schemas/BaitOutput"
            },
            {
             "$ref": "#/components/schemas/GroundOutput"
            },
            {
             "$ref": "#/components/schemas/AtlasOutput"
            },
            {
             "$ref": "#/components/schemas/LadderOutput"
            },
            {
             "$ref": "#/components/schemas/PluckOutput"
            },
            {
             "$ref": "#/components/schemas/GlyphOutput"
            },
            {
             "$ref": "#/components/schemas/CommaOutput"
            },
            {
             "$ref": "#/components/schemas/BriefOutput"
            },
            {
             "$ref": "#/components/schemas/MoldOutput"
            },
            {
             "$ref": "#/components/schemas/HeadlineOutput"
            },
            {
             "$ref": "#/components/schemas/ScribeOutput"
            },
            {
             "$ref": "#/components/schemas/PrismOutput"
            },
            {
             "$ref": "#/components/schemas/InkOutput"
            },
            {
             "$ref": "#/components/schemas/ScoutOutput"
            },
            {
             "$ref": "#/components/schemas/CutoutOutput"
            },
            {
             "$ref": "#/components/schemas/CurtainOutput"
            }
           ]
          },
          "usage": {
           "$ref": "#/components/schemas/Usage"
          },
          "latency_ms": {
           "type": "integer"
          }
         }
        }
       }
      }
     },
     "default": {
      "description": "Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/estimate": {
   "post": {
    "operationId": "estimate",
    "summary": "Most a call can cost, without running it",
    "security": [],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "object"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Estimate"
     }
    }
   }
  },
  "/models": {
   "get": {
    "operationId": "listModels",
    "summary": "List models",
    "security": [],
    "responses": {
     "200": {
      "description": "Models"
     }
    }
   }
  },
  "/models/{id}": {
   "get": {
    "operationId": "getModel",
    "summary": "Model details with examples",
    "security": [],
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Model"
     }
    }
   }
  },
  "/account": {
   "get": {
    "operationId": "account",
    "summary": "Balance, caps and auto top-up",
    "responses": {
     "200": {
      "description": "Account"
     }
    }
   }
  },
  "/usage": {
   "get": {
    "operationId": "usage",
    "summary": "Usage per day and model",
    "parameters": [
     {
      "name": "days",
      "in": "query",
      "schema": {
       "type": "integer",
       "maximum": 90
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Usage"
     }
    }
   }
  },
  "/runs": {
   "get": {
    "operationId": "listRuns",
    "summary": "Recent calls (metadata)",
    "parameters": [
     {
      "name": "limit",
      "in": "query",
      "schema": {
       "type": "integer",
       "maximum": 200
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Runs"
     }
    }
   }
  },
  "/embeddings": {
   "post": {
    "operationId": "embeddings",
    "summary": "OpenAI-compatible embeddings (atlas-1)",
    "responses": {
     "200": {
      "description": "OpenAI embeddings response"
     }
    }
   }
  },
  "/moderations": {
   "post": {
    "operationId": "moderations",
    "summary": "OpenAI-compatible moderations (warden-1)",
    "responses": {
     "200": {
      "description": "OpenAI moderations response"
     }
    }
   }
  },
  "/audio/transcriptions": {
   "post": {
    "operationId": "transcriptions",
    "summary": "OpenAI-compatible transcriptions (scribe-1)",
    "responses": {
     "200": {
      "description": "OpenAI transcription response"
     }
    }
   }
  },
  "/rerank": {
   "post": {
    "operationId": "rerank",
    "summary": "Cohere/Jina-compatible rerank (ladder-1)",
    "responses": {
     "200": {
      "description": "Rerank results"
     }
    }
   }
  }
 }
}