NexGate
API reference

Estimator

Public pricing estimator endpoint, including request validation, fallback estimates, rate limits, and error states.

Endpoint

POST https://api.nexgate.app/estimator

The 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

LimitValue
Window1 hour
Requests20 per IP
Response headerRetry-After on 429

Request body

messagesarrayrequired

Conversation messages. Must contain at most 10 messages.

messages[].rolestringrequired

Must be user, assistant, or system.

messages[].contentstringrequired

Message 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:

HintEffect
Numbers near users, requests, messages, chats, or callsEstimate daily request volume
codeHigher input/output token estimate
document or analysisHigher input token estimate
extractionLower output token estimate
cheap or high volumeRecommend llama-4-scout
reason or complexRecommend gpt-5.5
No strong hintRecommend 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

StatusResponseWhen
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
413Parser errorRequest 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

On this page