Automatic retry

Rate limits, network blips, and transient 5xx errors happen; most clear within seconds. A bounded retry loop with exponential backoff keeps pipelines stable without hammering the API.

Cura 1T is a research model, not a medical service, and not a substitute for a clinician. Benchmark scores do not establish safety for unsupervised clinical use.

Example

Python
import timefrom openai import OpenAIimport os client = OpenAI(api_key=os.environ["ACTAVA_API_KEY"], base_url="https://inference.actava.ai/v1") def chat_once(messages):    response = client.chat.completions.create(model="actava/cura-soar", messages=messages)    return response.choices[0].message.content def chat(user_input: str, max_attempts: int = 5) -> str | None:    messages = [{"role": "user", "content": user_input}]    for attempt in range(max_attempts):        try:            return chat_once(messages)        except Exception as exc:            # 429 / 5xx / network blips are usually transient — back off and retry.            wait = min(2 ** attempt, 30)            print(f"attempt {attempt + 1}/{max_attempts} failed: {exc} — retrying in {wait}s")            time.sleep(wait)    return None

Notes

  • Retry only transient errors. Back off on 429 and 5xx; don't retry 400/401/404 — those need a code or key fix (see Errors).
  • Streaming: if a stream drops mid-response, re-issue the whole request — partial streams can't be resumed.
  • Idempotency: batch pipelines should key work by your own ids so a retry can't double-process a case.