Estimator
Public pricing estimator endpoint, including request validation, fallback estimates, rate limits, and error states.
Endpoint
POST https://api.nexgate.app/estimatorThe estimator endpoint accepts a short conversation about a use case and returns an OpenAI-style non-streaming completion with model and cost guidance.
Note
This endpoint is intended for estimates, not billing records. Actual request cost is calculated from provider-reported usage on /api/v1/chat/completions.
Authentication
This endpoint is public. NexGate applies an IP rate limit.
Rate limit
| Limit | Value |
|---|---|
| Window | 1 hour |
| Requests | 20 per IP |
| Response header | Retry-After on 429 |
Request body
messagesarrayrequiredConversation messages. Must contain at most 10 messages.
messages[].rolestringrequiredMust be user, assistant, or system.
messages[].contentstringrequiredMessage content up to 2,000 characters.
Example
curl https://api.nexgate.app/estimator \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"role": "user",
"content": "I am building a support chatbot with 800 messages per day."
}
]
}'const response = await fetch("https://api.nexgate.app/estimator", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
messages: [
{
role: "user",
content: "I am building a support chatbot with 800 messages per day.",
},
],
}),
});
const estimate = await response.json();Success response
The response matches an OpenAI-compatible completion shape.
{
"choices": [
{
"message": {
"role": "assistant",
"content": "Estimated from your use case: use gpt-5.4-mini. At about 800 requests/day with ~1100 tokens/request, monthly cost is ~$14.52 (26.4M tokens). Recommended pack: Builder $25. Integration: set base_url=\"https://api.nexgate.app/v1\" and use your ng- API key. Adjust requests/day in the calculator for an exact scenario."
}
}
]
}Fallback behavior
If the estimator is temporarily unavailable or returns an error, NexGate returns a deterministic estimate instead of failing, so you always get a usable number back.
The fallback uses these hints:
| Hint | Effect |
|---|---|
Numbers near users, requests, messages, chats, or calls | Estimate daily request volume |
code | Higher input/output token estimate |
document or analysis | Higher input token estimate |
extraction | Lower output token estimate |
cheap or high volume | Recommend llama-4-scout |
reason or complex | Recommend gpt-5.5 |
| No strong hint | Recommend gpt-5.4-mini |
Tip
Include expected requests per day and whether the workload is chat, coding, extraction, document analysis, or reasoning-heavy for a more useful estimate.
Error responses
| Status | Response | When |
|---|---|---|
400 | { "error": "Invalid request: messages array required" } | Missing messages |
400 | { "error": "Maximum conversation length reached" } | More than 10 messages |
400 | { "error": "Invalid message item" } | Message is not an object |
400 | { "error": "Invalid message role" } | Role is not user, assistant, or system |
400 | { "error": "Invalid message content" } | Content is not a string or exceeds 2,000 characters |
413 | Parser error | Request body exceeds 64KB |
429 | { "error": "Too many requests. Please try again later." } | IP rate limit exceeded |
504 | { "error": "Estimator timed out" } | Internal estimator call exceeds 120 seconds |
500 | { "error": "Internal server error" } | Unexpected server error |