---
title: "Look up or estimate a battery charger's output specs from a free-text description (AI)"
method: POST
path: "/api/chargers/estimate"
tags: ["generators"]
---

# Look up or estimate a battery charger's output specs from a free-text description (AI)

`POST /api/chargers/estimate`

## Request

- Base URL: `https://voltplan.app`
- URL: `https://voltplan.app/api/chargers/estimate`
- Auth: none declared

Used by the wireframe editor's add-charger dialog. Calls the external OpenRouter chat-completions API (https://openrouter.ai) with the model configured server-side in `OPENROUTER_CHARGER_ASSISTANT_MODEL`, falling back to `OPENROUTER_LOAD_ASSISTANT_MODEL`; 20 s timeout. The optional power-source context sharpens the estimate. 20 requests per hour per client IP (counted separately from `/api/loads/estimate`). The client IP is the first `X-Forwarded-For` entry, else `X-Real-IP`, else one shared `unknown` bucket; counters are kept in memory per server instance and per route. No CORS headers.

## Request body

- ChargerEstimateRequest
  - `description` string, required: Free-text description; the length is checked after trimming.
  - `powerSourceName` string: Connected power source; trimmed, cut to 80 characters, used as context.
  - `powerSourceWatt` number: Rated power of the connected source in W; ignored unless a positive finite number.

## Response `200`

Parsed estimate.

- ChargerEstimate: AI estimate of a charger (mirrors `ChargerEstimate` in src/lib/chargerAssistantPrompt.ts).
  - `name` string, required
  - `watt` number, required: Maximum continuous output power in W.
  - `amps` number: Rated output current in A.
  - `voltageOut` 12 | 24 | 48: Battery-side nominal voltage in V.
  - `note` string

## Other responses

- `400`: Body is not valid JSON, or description (trimmed) is missing, not a string, or outside 2–300 characters.
- `422`: The model did not recognize the description as a charger (empty name or watt ≤ 0).
- `429`: More than 20 requests within one hour from this client IP.
- `502`: No model configured, OpenRouter failed or timed out, or its reply contained no parseable JSON object.

---

[API](https://skmtc.dev/voltplan/apis/voltplan-api.md) · [All operations](https://skmtc.dev/voltplan/apis/voltplan-api/llms.txt) · [OpenAPI document](https://skmtc.dev/voltplan/apis/voltplan-api/revisions/575b86a7af92?raw)
