Contextwaise

Contextwaise is in early access: API keys and the dashboard open at launch. Join the waitlist to get yours first.

Docs · Errors and limits›
API reference

Errors and limits

Errors are rare and always explicit: a status code, a stable error code, and a message that says what to fix.

Error format#

Every error response has the same shape:

422 Unprocessable Entity
{
  "error": {
    "code": "invalid_request",
    "message": "`candidates` must be a non-empty array."
  }
}

Branch on code, which is stable. The message is written for humans and may change.

Status codes#

StatusCodeMeaningWhat to do
400invalid_jsonThe body isn't valid JSON.Fix the serialization.
400invalid_bodyThe body isn't a JSON object.Send an object.
401invalid_api_keyThe key is missing, wrong or revoked.Check CONTEXTWAISE_API_KEY.
422invalid_requestA field is missing or out of range.The message names the field.
429rate_limitedYour plan's requests per minute are used.Send your original context; retry after Retry-After seconds.
429quota_exceededFree plan only: the one-time 1M free tokens are used.Send your original context; upgrade to Pro or Scale in Billing.
500internal_errorSomething went wrong on our side.Send your original context; retry later.
503scoring_unavailableContextwaise is having trouble judging relevance right now.Send your original context; retry after Retry-After seconds.
Note
Contextwaise never cuts context on a guess: when relevance can't be judged, you get a 503 instead of a weaker result (see When scoring is unavailable).

Handling errors#

In production, every error has the same answer: send your original context and carry on. Contextwaise optimizes a request; it should never block one. The fail-open helper does exactly this, including for timeouts and network errors.

400, 401 and 422 point to a bug or a configuration problem: log them, so they get fixed instead of silently costing you savings.

Request limits#

LimitValue
query length8,000 characters
Candidates per request500
Candidate text length60,000 characters
Candidate id length80 characters (longer ids are cut)
budget200 to 200,000 tokens (values outside are clamped)
models for routing2 to 10, each in the catalog or priced in Settings → Models
conversation id1 to 128 characters: letters, digits, _ - . :

Plan limits#

Optimize requests and agent SDK scoring calls share one per-minute limit per organization, across all its keys: 60 on Free, 1,000 on Pro, 3,000 on Scale. Free stops once its 1M free context tokens are used: they are a one-time allowance to try Contextwaise, and don't renew. Pro and Scale keep running past their monthly allowance, with extra tokens billed. Both return 429; the rate limit adds Retry-After. The agent SDK handles it for you: it passes cleaned outputs whole and retries 30 seconds later.

Apart from budget, requests beyond these limits return 422 with the field and limit in the message. For larger inputs, split them across candidates: Contextwaise decides item by item, so finer items also give finer cuts.