The default model is one OpenAI shut down on 2026-10-23

A brass key hangs in the lock of a wooden door, a torn blank pad lies on the floor, and a newer key rests on a small shelf.

Retired model Reported

A chat interface for talking to a database in plain language, which fits as many of the schema's tables into the prompt as the model's limit allows.

≈ 180,000 tokens per 1,000 calls, prompt tokens not served from the cache when a long question changes the table list estimate

Estimates, not measurements. Every figure on this page is an estimate from reading the code, not a measurement of the app in use.

Repository
sqlchat/sqlchat
Commit audited
85af0b4
leanprompt version
0.1.0-dev.15
Audit date
Status
The maintainers have been told about this audit; no response yet.
Maintainers
the issue
How it ran
Unattended audit: nobody was asked during the run, so priority, volume and prices were left open; the questions for the owner are listed at the end.

leanprompt read the code at commit 85af0b4 and found 2 places where its LLM calls could use fewer tokens, plus 4 other problems, not scored. Static score: 92 of 100 (an estimate from the findings). The code may have changed since.

Findings

  1. LP-PC-02 Stable content first, without hurting meaning

    src/utils/openai.ts:27 · severity medium · saves prefill · how often is assumed

    What happens. The number of tables put in the system prompt is decided by a budget that starts from the length of the current question (line 27, test at line 48). A longer question leaves room for fewer tables, so for a large schema the system prompt is different on different turns: tables the model saw earlier disappear, and the cached prefix (system prompt, then history) does not match.

    The change. Spend the table budget without the current question (use a fixed share of max_token), so the system prompt is the same for the whole conversation.

    Why it helps. The system prompt is the first thing in every request; when it changes, the history after it cannot be read from the cache, and the model sees a different set of tables from turn to turn.

    Estimate about 180k prompt tokens per 1,000 calls not served from cache

    Assumptions. 1 in 10 calls hits a schema larger than the budget and changes the table list; about 1,800 tokens of prefix lost each time

    How often. how many selected schemas exceed half of the model's max_token budget (only those lose tables, and so vary)

  2. LP-PD-02 Say each instruction once

    src/components/ConversationView/index.tsx:194 · severity low · saves prefill

    What happens. The question is saved to the message list before the history is read back, so the history loop already contains it; the code then pushes the same question again as the last message. Every request ends with the same user message twice.

    The change. Build the history from the list as it was before the question was added (or skip the message whose id is userMessage.id in the loop at line 174).

    Why it helps. Every call sends the newest question twice and counts it twice against the history budget, so a little less history fits.

    Estimate about 60k prompt tokens per 1,000 calls (60-token question)

    Assumptions. an average question of about 60 tokens; every call goes through this path

Other problems the audit found

Problems read in the code that cost no tokens of their own, such as a cost meter or an error path. Not scored.

  1. Default and listed models were shut down on 2026-10-23

    src/store/setting.ts:13 · LP-GE-13 Default to a model the provider still serves · severity high

    What happens. The default model is gpt-3.5-turbo (setting.ts:13, and getModel returns it when no name is sent, model.ts:67-69). gpt-4 and gpt-4-turbo, also offered in the settings (OpenAIApiConfigView.tsx), have the same shutdown date. OpenAI's deprecations page lists gpt-3.5-turbo, gpt-4 and gpt-4-turbo as shut down on Oct 23, 2026 (replacements gpt-5.6-terra and gpt-5.6-sol).

    The change. Change the default and the list in setting.ts, model.ts and OpenAIApiConfigView.tsx to models OpenAI still serves; keep the per-model cost_per_call table in step.

    To check. A request with the default settings against api.openai.com returns 200, not model_not_found.

  2. A cut-off answer is stored as complete

    src/pages/api/chat.ts:146 · LP-GE-12 Read the finish reason before using an answer · severity medium

    What happens. The stream parser forwards delta.content and never reads finish_reason, and the request sets no max_tokens. An answer that stops for length is marked DONE (ConversationView/index.tsx:276) and sent back as history on the next turn.

    The change. Read choices[0].finish_reason; on length, mark the message so the user sees it was cut.

    To check. Force a small max_tokens on a test endpoint: the message shows a cut-off marker instead of DONE.

  3. Stream is never closed when the provider sends no [DONE]

    src/pages/api/chat.ts:140

    What happens. controller.close() is only reached on a [DONE] event, so providers that omit it leave the client hanging in LOADING.

    The change. Close the controller after the for-await loop ends.

    Already reported. Issue #176 open; fix PR #186 (octo-patch) was closed by the maintainer on 2026-09-17 without a comment. https://github.com/sqlchat/sqlchat/issues/176

  4. Quota is a flat per-call cost, charged before generation

    src/pages/api/usage.ts:29

    What happens. addUsage adds model.cost_per_call regardless of tokens, and chat.ts:161-167 charges it before the stream is read. There is no token meter, so LP-GE-11 (cache tokens) does not apply; a design choice, not a bug.

    The change. No change needed; note only: if a token-based quota is wanted later, meter prompt, cached and output tokens from the stream's usage field.

The maintainers’ response

No response from the maintainers yet.

How this was made

The llm-call-audit skill read the code and wrote findings.json; nothing was run against the project’s providers. The full audit page is what leanprompt report --html writes from the same findings.

Corrections and takedown: email info@podwarden.com or open an issue.