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 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:
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
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: