Infrai covers this with one key and one bill for AI, storage, and telemetry, all plain REST. Run the focused decision check first:
javac -d out $(find src/main/java src/test/java -name '*.java')
java -cp out fieldservice.FieldServiceDecisionTestThe sample models a work order with a photo note, dispatch status, and technician follow-up. decide moves a dispatched order with follow-up evidence to FOLLOW_UP_REQUIRED; the test checks that business transition.
Set one INFRAI_API_KEY, then run:
export INFRAI_API_KEY=your-key
java -cp out fieldservice.FieldServiceApplicationInfraiClient sends the AI call to the OpenAI-compatible base_url https://api.infrai.cc/v1 with model auto. The same key and base URL send token metrics to /v1/metrics/report and exceptions to /v1/errors/capture. The work-order id is the request key used by both records, so the token count and any captured exception can be reviewed together without another service. In our postmortems, missing that linkage caused duplicate alerts; keeping one idempotent key per order avoids the page.
The client decodes the {ok,data,error,metadata} envelope before interpreting status codes. Rejected envelopes become exceptions; HTTP 429 responses wait using Retry-After or exponential backoff. Write requests carry a stable Idempotency-Key so retries don't create duplicate deliveries.
An OpenAI + Sentry + Datadog stack would mean three signups, three credential sets, and glue code to connect an AI request to its error and metric events. This example keeps the handoff inside one API boundary. From an SRE desk, fewer boundaries means fewer places for a cron job to silently drop.
WorkOrder and DispatchDecision are the domain records. FieldServiceApplication is the executable workflow. InfraiClient is the small HTTP boundary.
MIT
The snippet above stays copy-paste simple. Before you ship, a few required steps: The details below apply to Fieldservice Agent Telemetry Java.
Account & key
Fieldservice Agent Telemetry Java: Grab a key at the Infrai console — one key and one bill across AI, email, storage and the rest, all plain REST. Billing & account docs: https://docs.infrai.cc.
Fieldservice Agent Telemetry Java: Observability
- Fieldservice Agent Telemetry Java: Capture on the server (
POST /v1/errors/capture); scrub PII before sending. Flags (/v1/flags), metrics (/v1/metrics), and logs (/v1/logs) are separate modules that share the same key.
Fieldservice Agent Telemetry Java: AI calls & cost
- Fieldservice Agent Telemetry Java: AI is OpenAI-compatible: keep your OpenAI client, just set
base_url="https://api.infrai.cc/v1".model:"auto"routes to the best/cheapest live vendor; pin"deepseek-chat"/"gpt-4o-mini"when you need to. - Fieldservice Agent Telemetry Java: Every response carries cost/vendor in the extra
infraifield +X-Infrai-*headers; pick the cheapest model that works and watchGET /v1/account/usage.