Default Model
The default model isgpt-5.5. ChappieClient.defaultModel exposes this constant if you want to reference it programmatically:
Listing Available Models
Callmodels() to fetch the server’s current model list. The results are sorted by the server-assigned priority field, so the best available model appears first.
Filtering Models
Pass aChappieModelFilter to narrow the list to models that match your requirements:
ChappieModelFilter accepts any combination of:
Include only models the API accepts for
ChappieResponseRequest. Set this to true for any model you plan to use with send or stream.Filter by input modality string, e.g.
"text". A model is included if its inputModalities array contains this value.Include only models that support (or don’t support) the web search tool.
Include only models that support (or don’t support) parallel tool calls.
Include only models that list the given reasoning effort level in their
supportedReasoningLevels array.Selecting a Model
Change the active model for a client instance at any time. All subsequent turns will use the new model until you change it again.selectModel(_:) is @discardableResult — it returns the new ChappieClientContext snapshot, but you can ignore it if you only need the side effect.
Best Available and Fallback Helpers
Two convenience methods resolve a model from the live list without you having to iterate manually:supportedInAPI: true and inputModality: "text". Pass a custom ChappieModelFilter to change the criteria.
ChappieModel Properties
EachChappieModel in the returned array exposes the following properties:
| Property | Type | Description |
|---|---|---|
slug / id | String | Model identifier used in API requests. id is an alias for slug. |
displayName | String | Human-readable name for display in your UI. |
description | String? | Optional longer description of the model’s strengths. |
supportedInAPI | Bool | Whether the model can be used in ChappieResponseRequest. |
priority | Int | Server-assigned ranking. Higher values appear first in the sorted list. |
contextWindow | Int? | Maximum context size in tokens, if reported by the server. |
supportedReasoningLevels | [String] | Reasoning effort levels the model accepts (e.g. ["minimal", "low", "medium", "high"]). |
supportsSearchTool | Bool | Whether the model can use the web search tool. |
supportsParallelToolCalls | Bool | Whether the model can execute multiple tool calls in a single turn. |
inputModalities | [String] | Input types the model accepts, e.g. ["text"]. |
Checking Usage Limits
CallusageLimits() to fetch a live ChappieUsageLimitSnapshot from the rate-limits endpoint:
ChappieUsageLimitSnapshot has three window fields:
primary—ChappieUsageLimitWindowwithusedPercent,windowMinutes, andresetsAt.secondary— An additional window some plans expose (e.g., a monthly cap alongside an hourly cap).credits—ChappieCreditsSnapshotwithhasCredits,unlimited, andbalance.
.usageLimits(snapshot) event mid-stream during active responses, so you can keep a live counter without an extra network call.
Account and Plan Info
Read account details and the current plan from the locally cached credential:usageLimits() internally and updates the stored credential):
ChappiePlan Values
Plans are represented byChappiePlan, a struct with rawValue and displayName properties. The SDK maps the following raw values to display names:
- Consumer
- Business & Enterprise
rawValue | displayName |
|---|---|
free | Free |
go | Go |
plus | Plus |
pro | Pro |
my_custom_plan → My Custom Plan).
Handling Usage Limit Errors
When a request is rejected because the user has hit their quota, the SDK throwsChappieClientError.usageLimitReached(_:) with a ChappieUsageLimit payload. The payload includes the plan, a reset timestamp, and a human-readable message.
ChappieUsageLimit exposes:
The plan associated with the limit that was reached.
When the quota window resets. Display this to users so they know how long to wait.
The same reset as a countdown in seconds, when available.
A human-readable message from the server describing the limit.
The name of the active limit bucket that was reached (sourced from the
x-codex-active-limit response header).