Gemini API - Gemini 4 - logprobs - model migration - AI agents
3 min lectura

Gemini 4 does not support logprobs: prevent a 400 during migration

A reply in the official forum says Gemini 3.x and 4 do not support logprobs. Audit model-dependent scoring before switching an app or agent workflow.

Gemini 4 does not support logprobs: prevent a 400 during migration

Your classifier routes uncertain requests to a human by looking at token probabilities. You switch its model ID to Gemini 4 and get a 400 response: “Logprobs is not enabled for this model.” In Google's official Gemini developer forum, a developer reported that behavior on November 20, 2026 for Hydrogen, Argon, Carbon, and Neon. A reply said this is expected: logprobs are not supported on Gemini 3.x or 4. If your product needs that output, migrating models takes more than changing a string.

What the error actually changes

logprobs reports probabilities associated with generated tokens. Teams may use them to inspect outputs, compare candidates, or decide when an answer needs human review. The forum report reproduces the 400 with responseLogprobs: true and logprobs: 5 in generateContent. The reply confirms the support limit, but gives no return date or automatic migration path. The Gemini API release notes we checked do not yet document this point.

Gemini 4 can still generate text. What fails is the request for a signal your decision logic may require. Asking the model to write a numerical “confidence score” is not a drop-in substitute for token probabilities.

Find the dependency before release

Search your application, wrappers, and configuration for these options. Run this from your repository root:

rg -n 'responseLogprobs|response_logprobs|logprobs' .

Inspect classifiers, evaluation jobs, and automatic actions first. Where probabilities are required, reject known unsupported configurations before sending a request. This JavaScript guard blocks Gemini 3.x and 4 with logprobs; it does not certify other models:

function requireLogprobsSupport(model, needsLogprobs) {
  if (needsLogprobs && /^gemini-(3|4)([.-]|$)/.test(model)) {
    throw new Error(model + ' does not support logprobs; choose a verified alternative');
  }
}
requireLogprobsSupport('gemini-4-neon', true);

This is a local configuration check, not a live Gemini test. Production code should maintain capabilities by exact model version and verify them against current documentation and a minimal request from your own account. If you move to another model or provider, check how its score is defined and recalibrate thresholds on labeled examples. Reusing an old threshold without measurement can silently change how many cases a human reviews.

When the 400 is already in production

  1. Identify the model and API route that return the error. Reduce it to a request without private customer data.
  2. If the feature never consumed probabilities, remove the logprobs request flag and rerun the functional tests.
  3. If the feature does require them, pause automatic decisions and route cases to human review until you have a documented, tested compatible model.
  4. Record the model change and test the whole decision path before re-enabling it.

The actionable lesson is to audit a capability dependency before a Gemini 4 migration. We did not make a live request with Gemini credentials for this article. The observed error is the developer's public report; the support statement comes from the reply in Google's forum. There is no published promise that support will return.

Comentarios

Aún no hay comentarios. Sé el primero.

Deja un comentario