Cite.Provider.TypeSafe (Cite v0.1.0)

Copy Markdown View Source

TypeSafe System One over HTTP (POST /v1/systemone).

Options

For Cite.client/2:

  • :api_key - Required. The TypeSafe API key.

  • :model (String.t/0) - The Jev model that answers. The default value is "jev-1.13.0".

  • :base_url (String.t/0) - The API's base URL. The default value is "https://api.typesafe.ai".

  • :max_retry_delay (non_neg_integer/0) - Milliseconds: the cap on any one retry wait, Retry-After included. The default value is 30000.

  • :req_options - Merged into the Req client last; a test passes plug: {Req.Test, name}. A :retry_delay needs its own :retry, because the adapter's retry sets delays itself. The default value is [].

Retries

Rate limits (429), overloads (529), server errors (500–504), and connection failures are retried up to three times, honouring Retry-After, with any one wait capped at max_retry_delay (30 seconds by default). Timeouts are not retried: a 120-second call retried is eight minutes, and a slow success would be billed twice.

The size cap

A request over the model's token cap comes back as a 400 whose body names the failure: {"detail": {"error_type": "max_tokens_exceeded"}}. This provider reports it as :request_too_large, the error on which Cite.judge/4 halves round-1 windows. That name is observed behaviour, checked against the live API on 2026-09-26; TypeSafe's docs do not list it. If TypeSafe renames it, oversized windows will be recorded as bad requests instead of halved.

Summary

Types

error()

@type error() ::
  :request_too_large
  | :unauthorized
  | :server_error
  | {:bad_request, String.t()}
  | {:malformed_reply, String.t()}
  | {:rate_limited, non_neg_integer() | nil}
  | {:api_error, pos_integer(), String.t()}
  | {:request_error, Exception.t()}

t()

@type t() :: %Cite.Provider.TypeSafe{http_client: Req.Request.t(), model: String.t()}