Skip to main content
Reproduce with a minimal request using the same address, token, and model, then restore application parameters one at a time. Errors and retries explains status codes; this page covers cross-interface problems.

Frequently asked questions

Can I just replace an official SDK’s Base URL? That is usually the starting point for supported endpoints using the same protocol. Also set the model explicitly and inspect hidden resource calls in frameworks. The migration checklist covers related changes. Why not use one output parser for every endpoint? Chat uses choices, Responses uses output, Claude uses content blocks, Gemini uses candidates, and media can return bytes or tasks. Share HTTP error handling, but distinguish business completion and extraction by protocol. Can I retry immediately after disconnection? First determine whether the request may have been accepted and whether you received partial output or a task ID. Query known tasks first. Handle uncertain results according to your application’s duplicate-risk policy. This site does not promise a universal idempotency key. Do passing local example tests prove model availability? No. Fixtures test client protocol handling and failure paths. Actual access, model capabilities, generation quality, and encrypted-state replay require target-service acceptance.

Provide useful diagnostic information

Share non-sensitive details with the deployment maintainer: time and timezone, endpoint and method, model, SDK version, HTTP status, completion status, gateway request ID when available, a redacted minimal parameter structure, and expected versus actual behavior. Exclude tokens, cookies, signed URLs, complete media, and private user content. Keep reproductions small to limit requests. 阅读中文

Multimodal and parameter compatibility

Request lifecycle questions

Does Stop always stop the server task? Client abort means it stops waiting or reading. It does not prove upstream work stopped, tasks were canceled, or charges cannot occur. Closing SSE is not a universal cancellation API. Query known task IDs first; the project also lacks a general Responses cancel endpoint. Why do copied official examples call failing extra endpoints? Inspect SDK defaults, uploads, history retrieval, and retries. responses.create, Chat, Files, and Interactions are different resources. Use documented endpoints and the migration checklist. Why does a sent parameter have no effect? Check SDK serialization, DTO representation, converter mapping, channel overrides/filtering, and upstream support separately. Add parameters one at a time to a minimal request and retain non-sensitive diagnostics. See parameter filtering.

Tool policy and JSON questions

Tool control example · JSON validation example

Gemini tools return text but no evidence

Enabling a built-in tool allows model use; it does not force execution for every prompt. Inspect groundingMetadata, urlContextMetadata, or codeExecutionResult for the chosen tool. If your workflow requires tool use, stop when evidence is absent. Do not silently present a direct answer as searched, retrieved, or executed.

Search citations point to the wrong characters

Gemini grounding segment offsets refer to UTF-8 bytes in the original part, with endIndex exclusive. Chinese and emoji expose mistakes from using JavaScript string slicing or joining parts first. Preserve partIndex and source ordering; validate byte boundaries and groundingChunkIndices before rendering. The built-in example does this for one non-streaming candidate.

URL retrieval fails or code execution reports an error

Check each URL retrieval status; a paywall, unsafe URL, different redirected URL, or missing metadata is not confirmed access. Code execution can fail or time out while the response remains HTTP 200. Inspect outcome and matching code/result parts. The example stops on any failed execution and never runs generated code locally. Custom function results belong to the function-calling loop, not codeExecutionResult.

A newer Gemini SDK example uses an unsupported route or loses tool state

Choose generateContent-compatible examples, not Interactions or Files management calls. Use camelCase native JSON keys; copying Python snake_case wire payloads may lose fields in the gateway DTO. Original response metadata can survive while newer unknown request fields are dropped on replay. Confirm the actual DTO and channel before enabling multi-turn tool combinations; see native tool scope.