ChappieClient instance owns a private transcript — an ordered list of messages that grows with each turn. When you call send(_:) or response(_:), the client automatically prepends harness context, incorporates any compacted context summary, adds your new message, sends the full transcript to the model, then records the assistant reply. You don’t need to track message history yourself. The thread ID that ties the conversation together on the server is also managed automatically and persists for the lifetime of the client instance.
Sending a Single Message
The simplest way to get a reply issend(_:), which appends one user message to the transcript and returns the model’s text response.
ChappieInputMessage directly when you need to use something other than a plain user message, or when you want to set per-message options:
fastMode: true sets reasoning effort to .low, which reduces latency at the cost of reasoning depth. It is shorthand for setting ChappieMessageOptions(fastMode: true).
Building Multi-Turn Requests
UseChappieResponseRequest when you need precise control over the transcript, such as when you’re replaying a saved conversation or constructing a custom context window.
When you call
client.response(_:), the client records the resulting assistant turn into its internal transcript. Subsequent calls to send(_:) will see all previously recorded turns. For most use cases, response(_:) is what you want.Constructing Input Messages
ChappieInputMessage provides factory methods for every message role the API accepts:
Per-Message Response Options
Every user message can carryChappieMessageOptions, which override the client-level defaults for that single turn. The most common use is ChappieResponseOptions:
Reasoning Effort
ChappieReasoningEffort controls how deeply the model reasons before responding:
Service Tier
ChappieServiceTier selects the infrastructure tier for a request:
Enabling Web Search
SetenableSearchTool: true on a ChappieResponseOptions to let the model fetch live web results before responding. The default search tool type is web_search_preview.
Attaching Images
Include image attachments on any user message by passing an array ofChappieInputAttachment values:
detail string to the .imageURL(_:detail:) factory if the API endpoint supports detail-level hints.
Concurrency and Turn Serialisation
ChappieClient serialises turns internally. If you call send(_:) or response(_:) concurrently on the same instance, the second call waits until the first has finished and its transcript has been recorded. This keeps the transcript consistent without any locking on your side.
However, concurrent turns on the same client do share the same transcript. If you need two independent, simultaneous conversations — for example, a background summarisation task running in parallel with a foreground chat — create two separate client instances: