What we design around your workflow
A first model API call is simple. A product needs more: answers that stream, output your code can parse, a bill that tracks usage, a plan for when a provider retires a model, and proof a prompt edit broke nothing. We engineer it like any other external dependency, such as a payment provider.
Feature design
Pick the tasks a model should handle, define each one's input and output, and decide where a person reviews.
Streaming interface
Show text as it is generated, with stop, retry, and partial-result handling on screen.
Provider gateway
Send every call through one internal interface with adapters for OpenAI, Anthropic, Google, and self-hosted models.
Cost and limit controls
Track tokens per feature and user, enforce budgets, reuse repeated work, and stay inside rate limits.
Prompt versioning
Version prompts and model settings like code, and score each change on a test set before release.
Start with features whose output you can check
Early wins come from tasks with a clear right answer or a person in the loop: a reply draft someone edits, a thread summary, ticket tags, fields pulled from free text, or a vague search turned into a structured query. Each feature gets a defined input, a JSON schema for its output, and validation in code before anything is saved or shown. Where a provider offers schema-constrained output we use it, while still checking values and catching refusals, which may not follow the schema.
Human-edited drafts
Let the model propose text the user accepts, changes, or discards.
Schema-checked output
Validate every structured response in code, retrying or falling back on failure.
Streaming by default
Render tokens as they arrive, and let users stop a response going nowhere.
Primary sources
- OpenAI: Structured model outputsStructured Outputs follow a supplied JSON Schema, unlike JSON mode; refusals may not follow it.
Put every model provider behind one interface
Providers release and retire models regularly, and price and quality shift between them. Your application calls one internal interface; adapters translate requests for OpenAI, Anthropic, Google, or a self-hosted model, and each feature names its model in configuration. Prompts and settings are versioned for rollback. Limits need planning: OpenAI sets them in requests and tokens per minute for each organization and project, advises retrying with exponential backoff and random jitter, and counts failed requests toward the limit. A fallback model covers outages.
Configuration, not code
Move a feature to another model by changing settings, once it passes the same tests.
Graceful fallbacks
Fail over to a second model, a cached result, or a non-AI path when a call times out.
Retries that respect limits
Queue and retry with jitter, honoring Retry-After headers rather than hammering a busy API.
Primary sources
- OpenAI: Rate limitsLimits apply per organization and project; retry with backoff and jitter, as failed requests count too.
Test quality and attacks before every release
Each feature gets a test set of realistic inputs with agreed acceptable outputs, and every prompt edit, model swap, or provider change runs against it before release. The runs also record tokens and latency, so a change that doubles cost is caught like one that lowers quality. Attack cases belong in the set too. OWASP's prompt injection guidance says it is unclear whether fool-proof prevention exists, so we limit what a manipulated response could do: output is escaped before display, never executed, and suggested actions pass normal permission checks.
Agreed pass criteria
Write cases from production-like data, with acceptance rules the product owner approves.
Cost in the same report
Compare tokens, latency, and quality side by side for each candidate change.
Untrusted by default
Treat user text, uploaded files, and model output as data, never as instructions or code.
Primary sources
- OWASP GenAI Security Project: LLM01:2025 Prompt InjectionDefines direct and indirect prompt injection and mitigations such as output validation and least privilege.
Check each provider's data terms before sending anything
Providers treat API data differently, and terms vary by plan. OpenAI states that API data is not used for training unless you opt in, that abuse monitoring logs are kept up to 30 days by default, and that zero data retention needs its approval. Anthropic states it does not train on inputs or outputs from its commercial products, including the API, by default. Google's Gemini API terms let content sent to unpaid services improve its products and be read by human reviewers, so real data belongs on paid services. Confirm your obligations with counsel.
Minimum data per call
Send only the fields a feature needs, masking names, emails, and account numbers where possible.
Paid tiers for real data
Keep customer data off free tiers whose terms allow training or human review.
Your own logs
Store prompts and responses in your systems under retention you set.
Primary sources
- OpenAI: Data controls in the OpenAI platformAPI data is not used for training unless you opt in; abuse monitoring logs are retained by default.
- Anthropic Privacy Center: Is my data used for model training?Anthropic does not train on inputs or outputs from commercial products, including the API, by default.
- Google: Gemini API Additional Terms of ServiceUnpaid services may use content to improve products, with human review; paid services do not.
Realistic limits and operator controls
Plausible errors pass validation
Schema checks catch malformed output, not believable wrong answers, so consequential features keep a person involved.
Providers change underneath you
Models are updated and retired on each provider's schedule, so tests and fallbacks need ongoing care.
Large models are slower
Streaming hides some waiting, but features needing instant results may suit a small model or none.
Frequently asked questions
Can you add ChatGPT to our app without rebuilding it?
Usually, yes. The integration runs in your backend as a service your app calls, keeping the API key on the server and the model swappable.
Will OpenAI or other providers train on our data?
OpenAI and Anthropic state that API data is not used for training by default; Google's terms let content sent to unpaid Gemini API services improve its products. We check current terms for your provider and plan.
How do you keep API costs under control?
Token budgets per feature and user, smaller models for simple jobs such as tagging, reuse of repeated work, tighter prompts, and spending alerts.
Can we switch from OpenAI to Claude or Gemini later?
Yes. Switching means enabling another adapter, rerunning the test set on the new model, and changing configuration once it passes.
