> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sqwish.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Keep a model warm

> Keep a model loaded between requests on its own, by its number such as router@4, or
stop. Its own switch must be on: 409 model_off otherwise, and switching it off stops
keep warm too. Switching on loads and probes it first, then holds its first hour, at
most `max_price_usd`. A model kept warm through its family as well takes one warm place
and is billed once. `switch_off` stops keep warm on families or models in the same
step and leaves their switches on, so a request at the limit can swap. Past the
account's limit, 409 warm_limit lists the models still kept warm after that, least
recently used first (`used_at`), each with the keep warms that hold it: its own
(`keep_warm`) and its families' (`families`). A size with no kept-warm place left
answers 503 warm_capacity, unless `switch_off` stops a model of that size. With `adapter`, only while the number names the model the caller
saw: 409 model_changed otherwise, before anything loads.



## OpenAPI

````yaml /openapi.json post /v1/models/{model}/keep-warm
openapi: 3.1.0
info:
  title: DecisionOne workbench
  description: >-
    Native decisions, versioned datasets, adaptation and shared-base deployment.
    Authenticate with `Authorization: Bearer d1_sk_...` when accounts are on. A
    short guide for coding agents is at /llms.txt. Hosted account APIs accept a
    Bearer API key or a browser session. An API key reads its account but can't
    change it: keys, billing and settings change in the console. Browser
    mutations require the configured Origin and X-CSRF-Token from /auth/session.
    Account recovery and history remain available to blocked accounts.
    Waitlisted accounts can read their account summary and model catalogue and
    request early access; private member APIs require admission. Money fields
    ending in _usd are exact decimal strings; never interpret them as integer
    cents. Authenticated customer reads and existing-operation replays share
    read_rpm, and other customer writes except decisions and estimates share
    write_rpm. Exhausted budgets return 429 with Retry-After; unavailable
    admission storage returns 503.
  version: 0.1.0
servers:
  - url: https://console.sqwish.ai
security: []
tags:
  - name: Decisions
    description: Probabilities for questions with fixed outcomes.
  - name: Models
    description: Base models, adapters and named models with versions.
  - name: Families
    description: >-
      Lines of models trained on one dataset, and the switches that let them
      answer calls.
  - name: Datasets
    description: >-
      Validated training examples. A dataset grows in versions, and a version
      never changes.
  - name: Evaluations
    description: Reusable model results on a dataset's fixed evaluation rows.
  - name: Fine-tuning
    description: Training jobs, their events and held-out results.
  - name: Prompt tuning
    description: Better wording for a decision, tested on your rows. Words, not weights.
  - name: Labeling
    description: Teacher labels for real queries, reviewed by you.
  - name: Accounts
    description: Email OTP sign-in, revocable sessions, security and API keys.
  - name: Billing
    description: Exact USD balances, purchases, automatic top-ups and referrals.
  - name: Integrations
    description: Endpoints other tools call, such as Claude Code.
  - name: System
    description: Health and discovery.
paths:
  /v1/models/{model}/keep-warm:
    post:
      tags:
        - Models
      summary: Keep a model warm
      description: >-
        Keep a model loaded between requests on its own, by its number such as
        router@4, or

        stop. Its own switch must be on: 409 model_off otherwise, and switching
        it off stops

        keep warm too. Switching on loads and probes it first, then holds its
        first hour, at

        most `max_price_usd`. A model kept warm through its family as well takes
        one warm place

        and is billed once. `switch_off` stops keep warm on families or models
        in the same

        step and leaves their switches on, so a request at the limit can swap.
        Past the

        account's limit, 409 warm_limit lists the models still kept warm after
        that, least

        recently used first (`used_at`), each with the keep warms that hold it:
        its own

        (`keep_warm`) and its families' (`families`). A size with no kept-warm
        place left

        answers 503 warm_capacity, unless `switch_off` stops a model of that
        size. With `adapter`, only while the number names the model the caller

        saw: 409 model_changed otherwise, before anything loads.
      operationId: keepModelWarm
      parameters:
        - name: model
          in: path
          required: true
          schema:
            type: string
            title: Model
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ModelKeepWarm'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                properties:
                  id:
                    type: string
                    title: Id
                  status:
                    type: string
                    title: Status
                  evaluation_key:
                    type: string
                    title: Evaluation Key
                  name:
                    type: string
                    title: Name
                  description:
                    type: string
                    title: Description
                  family:
                    type: string
                    title: Family
                  size_order:
                    type: integer
                    title: Size Order
                  kind:
                    type: string
                    title: Kind
                  lora:
                    anyOf:
                      - type: string
                      - type: 'null'
                    title: Lora
                  metrics:
                    anyOf:
                      - additionalProperties: true
                        type: object
                      - type: 'null'
                    title: Metrics
                  max_prompt_tokens:
                    type: integer
                    title: Max Prompt Tokens
                  max_questions:
                    type: integer
                    title: Max Questions
                  calibration:
                    type: string
                    title: Calibration
                  availability_reason:
                    type: string
                    title: Availability Reason
                    description: >-
                      Why it can't answer now: no_engine (its pool has no engine
                      right now), not_served (this server doesn't serve it), or,
                      for an adapter, base_mismatch, engine_unconfigured or
                      engine_changed.
                  available:
                    type: boolean
                    title: Available
                  access_requested:
                    type: boolean
                    title: Access Requested
                  adapter_capacity:
                    anyOf:
                      - $ref: '#/components/schemas/AdapterCapacity'
                      - type: 'null'
                  created_at:
                    type: number
                    title: Created At
                  deleted_at:
                    type: number
                    title: Deleted At
                    description: >-
                      When its owner deleted it. A deleted model answers and
                      runs nothing.
                  discarded_at:
                    type: number
                    title: Discarded At
                    description: >-
                      When a rollback of its family discarded it. A discarded
                      model answers and runs nothing.
                  on_at:
                    anyOf:
                      - type: number
                      - type: 'null'
                    title: On At
                    description: >-
                      When its own switch went on: it answers calls to its
                      number, such as router@4. Null while it is off.
                  keep_warm:
                    type: boolean
                    title: Keep Warm
                    description: >-
                      Whether it is kept warm on its own switch. A family's keep
                      warm doesn't set it: see keep_warm_window.
                  keep_warm_window:
                    anyOf:
                      - $ref: '#/components/schemas/KeepWarmWindow'
                      - type: 'null'
                    description: >-
                      The hour of keep warm being billed for it, through its
                      family or its own switch, or null when nothing is billed.
                  keep_warm_stopped_at:
                    anyOf:
                      - type: number
                      - type: 'null'
                    title: Keep Warm Stopped At
                    description: >-
                      When its own keep warm switched off because the next hour
                      couldn't be reserved, while it stays off. Otherwise null.
                  used_at:
                    anyOf:
                      - type: number
                      - type: 'null'
                    title: Used At
                    description: >-
                      Its idle clock: the latest of its last production call by
                      an API key that named it, its last evaluation that named
                      it, and when it was switched on.
                  switches_off_at:
                    anyOf:
                      - type: number
                      - type: 'null'
                    title: Switches Off At
                    description: >-
                      When idling switches it off unless it's used. Null while
                      it is off or kept warm on its own switch, and when idling
                      never switches anything off. A family's is also null while
                      it serves no model.
                  off_reason:
                    anyOf:
                      - type: string
                        enum:
                          - owner
                          - idle
                      - type: 'null'
                    title: Off Reason
                    description: >-
                      Why it is off: owner when it was switched off by hand,
                      idle when nothing used it for too long. Null otherwise.
                  off_at:
                    anyOf:
                      - type: number
                      - type: 'null'
                    title: Off At
                    description: When it went off, with off_reason. Null otherwise.
                  job_id:
                    type: string
                    title: Job Id
                  model_name:
                    anyOf:
                      - type: string
                      - type: 'null'
                    title: Model Name
                  version:
                    type: integer
                    title: Version
                  parent:
                    anyOf:
                      - type: string
                      - type: 'null'
                    title: Parent
                  residency:
                    $ref: '#/components/schemas/Residency'
                  state:
                    anyOf:
                      - type: string
                        enum:
                          - loaded
                          - loading
                          - asleep
                      - type: 'null'
                    title: State
                  decision_price_nano:
                    anyOf:
                      - type: string
                      - type: 'null'
                    title: Decision Price Nano
                    description: >-
                      Exact integer string of nano-USD per billed input token
                      from the current billing policy. Zero means free; null
                      means unpriced.
                  base:
                    type: string
                    title: Base
                    description: 'An adapter''s base model id: the base whose prices it pays.'
                  evaluation_set:
                    anyOf:
                      - $ref: '#/components/schemas/EvaluationSet'
                      - type: 'null'
                  request_latency:
                    $ref: '#/components/schemas/RequestLatency'
                type: object
                required:
                  - id
                  - status
                  - evaluation_key
                title: Model
                description: A base, an early-access catalogue entry, or a trained adapter.
        4XX:
          description: >-
            Client error. On a 422, `error.details` lists each field that
            failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        5XX:
          description: Server error. A 503 names what is not running on this server.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    ModelKeepWarm:
      properties:
        enabled:
          type: boolean
          title: Enabled
        max_price_usd:
          anyOf:
            - type: string
              pattern: ^\d{1,9}(\.\d{1,9})?$
            - type: 'null'
          title: Max Price Usd
          description: >-
            The most you agree to pay for the first hour, which switching keep
            warm on holds, in USD, such as the price you were shown. If it costs
            more when it is admitted, it is refused with price_changed and
            nothing is held.
        adapter:
          type: string
          maxLength: 140
          title: Adapter
          description: >-
            The id of the model the caller saw: refused unless the model called
            is still that one.
        switch_off:
          items:
            type: string
          type: array
          maxItems: 20
          title: Switch Off
          description: >-
            Families, such as router, and models, such as router@2, whose keep
            warm stops in the same step, to make room when the account is at its
            limit (warm_limit) or the model's size has no kept-warm place left
            (warm_capacity). Their switches stay on.
      additionalProperties: false
      type: object
      required:
        - enabled
      title: ModelKeepWarm
    AdapterCapacity:
      properties:
        max_rank:
          type: integer
          title: Max Rank
        slots:
          anyOf:
            - type: integer
            - type: 'null'
          title: Slots
      type: object
      required:
        - max_rank
        - slots
      title: AdapterCapacity
    KeepWarmWindow:
      properties:
        started_at:
          type: number
          title: Started At
        ends_at:
          type: number
          title: Ends At
          description: When this hour's hold ends and the next is reserved.
        reserved_usd:
          type: string
          title: Reserved Usd
          description: >-
            The hour's fee held, as exact USD. The minutes used are charged when
            the hour rolls over or keep warm is switched off.
      type: object
      required:
        - started_at
        - ends_at
        - reserved_usd
      title: KeepWarmWindow
    Residency:
      properties:
        state:
          type: string
          enum:
            - hot
            - cold
          title: State
        pinned:
          type: boolean
          title: Pinned
      type: object
      required:
        - state
        - pinned
      title: Residency
    EvaluationSet:
      properties:
        dataset:
          $ref: '#/components/schemas/EvaluationDataset'
        training_examples:
          anyOf:
            - type: integer
            - type: 'null'
          title: Training Examples
        validation_examples:
          anyOf:
            - type: integer
            - type: 'null'
          title: Validation Examples
        remembered_examples:
          anyOf:
            - type: integer
            - type: 'null'
          title: Remembered Examples
      type: object
      required:
        - dataset
        - training_examples
        - validation_examples
        - remembered_examples
      title: EvaluationSet
    RequestLatency:
      properties:
        median_ms:
          anyOf:
            - type: number
            - type: 'null'
          title: Median Ms
        samples:
          type: integer
          title: Samples
        median_is_lower_bound:
          type: boolean
          title: Median Is Lower Bound
        start:
          type: string
          title: Start
        end:
          type: string
          title: End
      type: object
      required:
        - median_ms
        - samples
        - median_is_lower_bound
        - start
        - end
      title: RequestLatency
    ErrorResponse:
      description: >-
        The body of every error. app.failure() builds it; this model documents
        it.
      properties:
        error:
          $ref: '#/components/schemas/ErrorBody'
      required:
        - error
      title: ErrorResponse
      type: object
    EvaluationDataset:
      properties:
        id:
          type: string
          title: Id
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        archived_at:
          anyOf:
            - type: number
            - type: 'null'
          title: Archived At
        deleted:
          type: boolean
          title: Deleted
          description: True once you deleted it.
      type: object
      required:
        - id
        - name
        - archived_at
        - deleted
      title: EvaluationDataset
    ErrorBody:
      properties:
        code:
          description: A stable code to branch on, such as invalid_request.
          title: Code
          type: string
        message:
          description: What went wrong and what to change, in plain words.
          title: Message
          type: string
        retryable:
          description: >-
            True when another attempt may succeed; it does not prove that no
            work was done. Respect Retry-After when present. Only operations
            that support Idempotency-Key replay a prior result, including
            /v1/decide for 24 hours.
          title: Retryable
          type: boolean
        request_id:
          description: Also sent as X-Request-ID. Quote it in bug reports.
          title: Request Id
          type: string
        details:
          anyOf:
            - items:
                $ref: '#/components/schemas/ErrorDetail'
              type: array
            - type: 'null'
          default: null
          description: On validation errors, one entry for each field that failed.
          title: Details
      required:
        - code
        - message
        - retryable
        - request_id
      title: ErrorBody
      type: object
    ErrorDetail:
      properties:
        path:
          description: Where the problem is, such as ["body", "decisions", 0, "outcomes"].
          items:
            anyOf:
              - type: string
              - type: integer
          title: Path
          type: array
        message:
          title: Message
          type: string
        type:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Type
      required:
        - path
        - message
      title: ErrorDetail
      type: object
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: d1_sk_...
      description: Create an API key in the console. Required when accounts are enabled.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.