bug: long thinking / blocking with gemini provider

Resolved 💬 11 comments Opened Apr 22, 2025 by qcname Closed Sep 3, 2025
💡 Likely answer: A maintainer (tibo-openai, collaborator) responded on this thread — see the highlighted reply below.

What version of Codex is running?

_No response_

Which model were you using?

_No response_

What platform is your computer?

_No response_

What steps can reproduce the bug?

!Image

What is the expected behavior?

_No response_

What do you see instead?

_No response_

Additional information

_No response_

View original on GitHub ↗

11 Comments

qcname · 1 year ago

I use curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=my_api_key" \
-H 'Content-Type: application/json' \
-X POST \
-d '{
"contents": [{
"parts":[{"text": "Explain how AI works"}]
}]
}'
There can be results, but codex has been waiting for 313s.

When I switched to deepseek, there was no waiting at all, no thinking time, and no results.

tibo-openai collaborator · 1 year ago

Not sure, but if you can consistently repro please add more details. Also will accept a PR for a fix here!

xtbwqtq · 1 year ago
Not sure, but if you can consistently repro please add more details. Also will accept a PR for a fix here!

i have the same problem,i thing this is a bug

xtbwqtq · 1 year ago

<img width="569" alt="Image" src="https://github.com/user-attachments/assets/86610a0a-dce1-4c75-88ad-372205f0271f" />

that‘s ok:

<img width="617" alt="Image" src="https://github.com/user-attachments/assets/74283d5a-15f6-44e8-ae99-77c408ae9b0b" />

but:

<img width="887" alt="Image" src="https://github.com/user-attachments/assets/9522cdb1-3677-4e8f-a2da-69b1a9239a3e" />

dnakov contributor · 1 year ago

Just a note related to this:
After https://github.com/openai/codex/pull/563 "Thinking" could mean that it's waiting for the rate limit backoff. Don't think this was the case here as this is before the PR, but something to keep an eye out after

qcname · 1 year ago

!Image
When I use the OpenRouter model, there can be results, whether it is a paid deepseek-v3 or a free model (see the picture above). Although the previous situation still occurs, I will use OpenRouter in the future

qcname · 1 year ago
<img alt="Image" width="569" src="https://private-user-images.githubusercontent.com/146714110/436326173-86610a0a-dce1-4c75-88ad-372205f0271f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDUzOTI3NjIsIm5iZiI6MTc0NTM5MjQ2MiwicGF0aCI6Ii8xNDY3MTQxMTAvNDM2MzI2MTczLTg2NjEwYTBhLWRjZTEtNGM3NS04OGFkLTM3MjIwNWYwMjcxZi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwNDIzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDQyM1QwNzE0MjJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0zODVjYWMyYTRkNzhjYTgzOGRlNDZkOTkwZjkzMWQ3NzVjZWUzYWIxYmYzYWMxMDVjZDQ0ZTFkYTBhYzdjNGY2JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.kEk4JjrL3ueWNjNQ-BzVasWORuHgmLWYX_pBBwACqmc"> that‘s ok: <img alt="Image" width="617" src="https://private-user-images.githubusercontent.com/146714110/436326303-74283d5a-15f6-44e8-ae99-77c408ae9b0b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDUzOTI3NjIsIm5iZiI6MTc0NTM5MjQ2MiwicGF0aCI6Ii8xNDY3MTQxMTAvNDM2MzI2MzAzLTc0MjgzZDVhLTE1ZjYtNDRlOC1hZTk5LTc3YzQwOGFlOWIwYi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwNDIzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDQyM1QwNzE0MjJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1mZGVmNGVjYTljMzA1NDExMzBlMmEzNDRmOThlYjgyMjNiMmVlMWUwNWI5YmM1MjRjZDc0ODVmYmQ0NmQzYzc5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9._j_sn5NiIdz--utCPqkm7SxVEu2U6YE22y6sj-rJqJU"> but: <img alt="Image" width="887" src="https://private-user-images.githubusercontent.com/146714110/436326770-9522cdb1-3677-4e8f-a2da-69b1a9239a3e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDUzOTI3NjIsIm5iZiI6MTc0NTM5MjQ2MiwicGF0aCI6Ii8xNDY3MTQxMTAvNDM2MzI2NzcwLTk1MjJjZGIxLTM2NzctNGU4Zi1hMmRhLTY5YjFhOTIzOWEzZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwNDIzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDQyM1QwNzE0MjJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01ZmU3ZDA3ZGYzNjc2MmZjY2YxMzBhYTk1NDBhNzZlNGI4ZjkzZDNiODAxMDBiMjllMjA5NGFlN2IzODE5MjhjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.kRsk8isFTcU_bpECqbqU_MG6KYlXvFAw7YVPE4tWpiM">

You can try openrouter.

qcname · 1 year ago

I have to add some details, I am really confused, the previous use of openrouter's 【codex -p openrouter -m google/gemini-2.0-flash-exp: free】 has results, right? But trying some of the rest of the models provided by openrouter will not work. My detailed process is: go to the official website of openrouter to get the api-key, and export OPENROUTER_API_KEY. The remaining models are sent just after I enter, no thinking, no answer. Why in the end.

!Image

!Image

!Image

But when I used gemini's API_KEY to do it, it kept getting stuck.

!Image

What a big bug.

qcname · 1 year ago

!Image
Well now there is nothing, no thought process at all, no output, why on earth is it pai

qcname · 1 year ago
Not sure, but if you can consistently repro please add more details. Also will accept a PR for a fix here!

Can you take a look at this bug?

tibo-openai collaborator · 10 months ago

Closing this as out of date, please re-file an issue if still relevant, thanks!