The model dropdown in CometAPI’s Next.js chat tutorial tells you what the next request will use. It does not tell you which route was requested for an answer already in the conversation.
If you are adapting that sample into a chat where people switch CometAPI models, I would attach the requested model ID to each assistant turn—not use the current dropdown as a label for the conversation’s history.
What the sample actually keeps
In the tutorial’s Core Project Code, Message has only role and content. The selected model lives in separate component state. sendMessage sends that model alongside the conversation to /api/chat; the server’s Route Handler forwards payload.model to CometAPI’s /v1/chat/completions endpoint.
The new assistant placeholder has an empty content string and no model field. The message renderer labels every answer Assistant. The selector is disabled while a response is loading, which prevents switching through that control mid-stream, but does not preserve the selection on completed turns.
That leaves a specific gap: once you change the dropdown, the stored messages alone cannot establish the requested route for an earlier answer. This is a static observation about the published sample, not a claim about a deployed CometAPI product or evidence that users have been confused.
Preserve the request choice, not just the current choice
My suggested change is a small application-level provenance record:
- At submission, snapshot the selected CometAPI model ID and associate it with the request and its assistant turn.
- Keep that value on the turn as streamed text arrives. Render a label such as Requested route:
<model ID>, rather than deriving old labels from current selector state. - Keep this UI metadata separate from the API message projection: construct the outgoing conversation from
roleandcontent, with the selectedmodelstill at request level as in the tutorial. - If you later load older turns that lack route metadata, show Requested route unknown. Do not backfill them with whichever model is selected now.
“Requested route” is deliberately narrower than “verified model version.” Saving the browser’s selection records application intent; it does not independently prove which underlying version served the request or what happened in an added fallback system. If you later collect authoritative serving metadata, keep that separate from the requested ID.
Make switching understandable without resetting the chat
The sample builds outgoing from the existing messages plus the new user message. A model switch therefore changes the next request’s route while retaining the earlier conversation in its payload. It is not a clean, independent comparison session.
A short hint beside the selector could say: Applies to the next reply; previous conversation stays in context. Per-answer route labels then describe history, while the selector describes the next action. That costs some interface space and extra turn metadata; it is a design tradeoff, not a measured usability improvement.
Before shipping the adaptation, I would use this acceptance check:
- Request an answer through one configured CometAPI route and confirm its stored route label.
- Change the selector. The first answer’s label must stay unchanged.
- Submit through a second configured route. The new answer should carry the second route’s label, with the earlier answer still attributed to the first requested route.
- Exercise a failed request. A route label must not make an empty or partial failed turn look like a completed answer.
Those are proposed checks, not reported test results. The decision is about preserving the meaning of CometAPI’s per-request routing in this tutorial’s UI—not ranking its example models or changing its server allowlist.
Source: CometAPI, How to Build a Multi-Model AI Chat App with Next.js and CometAPI, published August 25, 2026; source snapshot fetched September 10, 2026. The observations above are limited to Step 4 and the displayed client code.