3a74b75217
LM Studio / llama.cpp-style servers report the context window in tokens but the prompt size in characters, e.g. "maximum context length is 65536 tokens. However, you requested 65536 output tokens and your prompt contains 77409 characters". When a provider profile's default_max_tokens equals the model's context window, the very first request asks for the whole window as output and the server returns a hard HTTP 400 — even on a trivial "hi". parse_available_output_tokens_from_error did not recognise this phrasing, so the overflow was misrouted to the prompt-too-long/compression path (which can't help when the input already fits) instead of the output-cap reduction + retry path. Detect the "requested N output tokens" form, estimate the input from the character count (~3 chars/token, conservative so the retried cap stays inside the window), and return the available output budget so the existing retry logic shrinks max_tokens and succeeds.