---
title: "Relay one Anthropic Messages request (device only, device.task sessions)"
method: POST
path: "/api/v1/device_sessions/{id}/model"
tags: ["Devices"]
---

# Relay one Anthropic Messages request (device only, device.task sessions)

`POST /api/v1/device_sessions/{id}/model`

## Request

- Base URL: `https://saltapp.ai`
- URL: `https://saltapp.ai/api/v1/device_sessions/{id}/model`
- Auth: API key in header `api-key`

Salt Device 0.3: the local agent inside Salt Device calls this with the DEVICE's own api-key, so no model key sits on a laptop. Allowed only while the session belongs to this device, is `active` or `paused`, and its snapshot carries `device.task` (anything else is 403 `{error: "forbidden"}`). Salt forwards the request to Anthropic with its own key and returns Anthropic's JSON (`id`, `content`, `stop_reason`, `usage`, `model`) unchanged. Nothing about the body or the reply is stored, logged or cached; each successful call is metered per person (see getDeviceModelUsage). The body may be up to 8 MB (screenshots). Errors: 402 `{error: "budget", message}` when the person's monthly allowance is used up, or when the global monthly ceiling is (message "Computer tasks are paused for now. Try again later."); 413 `too_large`; 422 for a model outside the allowlist or a malformed request; 429 over 60 calls a minute per device (Retry-After 60) or `{error: "busy", retry_after}` when the gateway is at its concurrency cap (Retry-After 2; retry, do not hold); 502 `{error: "upstream", upstream_status?, retry_after?}` when Anthropic failed or timed out (Salt gives up after 55 s, inside CloudFront's 60 s origin timeout); 503 `{error: "unavailable"}` when Salt has no model key configured.

## Path parameters

- `id` string, required

## Request body

- object: An Anthropic Messages request. Only these keys are forwarded; any other top-level key (`stream`, `metadata`, `top_k`, a beta flag) is dropped, so a reply is always one JSON.
  - `model` 'claude-sonnet-5-5' | 'claude-haiku-5-5'
  - `system` union: Text, or a list of text blocks.
    - string
    - object[]
  - `messages` object[], required: Anthropic message objects; image blocks (base64 screenshots) ride inside.
  - `tools` object[]
  - `tool_choice` object
  - `max_tokens` integer: Capped at 4096; a larger number is lowered, not refused.

## Response `200`

Anthropic's JSON, as is.

- object

## Other responses

- `400`: The body is not a JSON object.
- `401`: Missing or invalid credentials.
- `402`: This month's computer-task allowance is used up: `{error: "budget", message}`.
- `403`: Not a device key, not this device's session, the session is not active or paused, or its grant has no device.task: `{error: "forbidden"}`.
- `404`: Not found, or the feature is off.
- `413`: The body is over 8 MB: `{error: "too_large"}`.
- `422`: model is not claude-sonnet-5-5 or claude-haiku-5-5, or the request is malformed.
- `429`: Over 60 calls a minute, or the gateway is busy: `{error: "busy", retry_after}`.
- `502`: Upstream failed: `{error: "upstream", upstream_status?, retry_after?}`.
- `503`: Salt has no model key configured: `{error: "unavailable"}`.

---

[API](https://skmtc.dev/saltapp/apis/salt-agent-api.md) · [All operations](https://skmtc.dev/saltapp/apis/salt-agent-api/llms.txt) · [OpenAPI document](https://skmtc.dev/saltapp/apis/salt-agent-api/revisions/a8b8642ab7f8?raw)
