# \#openai\_compatibility

**URL:** https://discuss.ai.google.dev/tag/openai-compatibility/417.md

[Latest](https://discuss.ai.google.dev/latest.md) · [Categories](https://discuss.ai.google.dev/categories.md) · [Tags](https://discuss.ai.google.dev/tags.md)

---

## [The finish\_reason is 'stop' instead of 'tool\_calls' in OpenAI-compatible endpoint](https://discuss.ai.google.dev/t/the-finish-reason-is-stop-instead-of-tool-calls-in-openai-compatible-endpoint/112704)

<div class="topic-metadata">

**Author:** [@Long\_Peng](https://discuss.ai.google.dev/u/Long_Peng)\
**Replies:** 2\
**Last updated:** [August 17, 2026, 3:48am UTC](https://discuss.ai.google.dev/t/the-finish-reason-is-stop-instead-of-tool-calls-in-openai-compatible-endpoint/112704 "2026-08-17T03:48:44Z")

</div>

Same problem: Open AI API Compatibility

---

## [Same Gemini 3 flash via OpenRouter works; direct Gemini OpenAI-compat API gives unstable / hallucination-like behavior on multi-turn tools](https://discuss.ai.google.dev/t/same-gemini-3-flash-via-openrouter-works-direct-gemini-openai-compat-api-gives-unstable-hallucination-like-behavior-on-multi-turn-tools/142695)

<div class="topic-metadata">

**Author:** [@Areeb\_Ahmad](https://discuss.ai.google.dev/u/Areeb_Ahmad)\
**Replies:** 0\
**Last updated:** [April 28, 2026, 11:03am UTC](https://discuss.ai.google.dev/t/same-gemini-3-flash-via-openrouter-works-direct-gemini-openai-compat-api-gives-unstable-hallucination-like-behavior-on-multi-turn-tools/142695 "2026-04-28T11:03:58Z")

</div>

We use LangChain ChatOpenAI, LangGraph, bind\_tools, and with\_structured\_output with Gemini 3. With OpenRouter (base\_url = OpenRouter, model id like google/gemini-3-flash-preview), multi-turn tool use is stable and behav…

---

## [Using curl to generate images through openAI-compatible mode calls shows 404](https://discuss.ai.google.dev/t/using-curl-to-generate-images-through-openai-compatible-mode-calls-shows-404/113242)

<div class="topic-metadata">

**Author:** [@stillmoon](https://discuss.ai.google.dev/u/stillmoon)\
**Replies:** 6\
**Last updated:** [April 13, 2026, 8:46am UTC](https://discuss.ai.google.dev/t/using-curl-to-generate-images-through-openai-compatible-mode-calls-shows-404/113242 "2026-04-13T08:46:13Z")

</div>

I used the following curl command: curl --location --request POST 'https://generativelanguage.googleapis.com/v1beta/openai/images/generations' \\ --header 'Authorization: Bearer $api\_key' \\ --header 'User-Agent: Apifox/1…

---

## [OpenAI Responses API Compatibility](https://discuss.ai.google.dev/t/openai-responses-api-compatibility/90136)

<div class="topic-metadata">

**Author:** [@EvanZhouDev](https://discuss.ai.google.dev/u/EvanZhouDev)\
**Replies:** 9\
**Last updated:** [March 16, 2026, 9:54am UTC](https://discuss.ai.google.dev/t/openai-responses-api-compatibility/90136 "2026-03-16T09:54:38Z")

</div>

When using the new OpenAI responses API, the Gemini OpenAI Compatible Endpoint, as specified in the OpenAI compatibility section of the documentation, does not work. It gives me an error that says error: 404 status code…

---

## [OpenAI-compat API rejects reasoning\_effort="minimal" for Gemini 3 Flash](https://discuss.ai.google.dev/t/openai-compat-api-rejects-reasoning-effort-minimal-for-gemini-3-flash/118724)

<div class="topic-metadata">

**Author:** [@csekas](https://discuss.ai.google.dev/u/csekas)\
**Replies:** 1\
**Last updated:** [January 27, 2026, 6:24am UTC](https://discuss.ai.google.dev/t/openai-compat-api-rejects-reasoning-effort-minimal-for-gemini-3-flash/118724 "2026-01-27T06:24:41Z")

</div>

Description: When calling the OpenAI compatibility endpoint POST https://generativelanguage.googleapis.com/v1beta/openai/chat/completions with model gemini-3-flash\* and reasoning\_effort: "minimal", the API returns: 400…

---

## [Does Gemini's OpenAI-Compatible Endpoint Support Native Tools Like url\_context?](https://discuss.ai.google.dev/t/does-geminis-openai-compatible-endpoint-support-native-tools-like-url-context/112091)

<div class="topic-metadata">

**Author:** [@Hatsunix](https://discuss.ai.google.dev/u/Hatsunix)\
**Replies:** 1\
**Last updated:** [January 5, 2026, 3:03pm UTC](https://discuss.ai.google.dev/t/does-geminis-openai-compatible-endpoint-support-native-tools-like-url-context/112091 "2026-01-05T15:03:48Z")

</div>

Hi everyone, I’m working with the Gemini API and trying to integrate it using the OpenAI-compatible endpoint (https://generativelanguage.googleapis.com/v1beta/openai/). I understand that it supports standard function ca…

---

## [Gemini 3 Preview (OpenAI-compatible) rejects reasoning\_effort: "medium" — works with low and high](https://discuss.ai.google.dev/t/gemini-3-preview-openai-compatible-rejects-reasoning-effort-medium-works-with-low-and-high/112648)

<div class="topic-metadata">

**Author:** [@csekas](https://discuss.ai.google.dev/u/csekas)\
**Replies:** 4\
**Last updated:** [December 29, 2025, 12:23pm UTC](https://discuss.ai.google.dev/t/gemini-3-preview-openai-compatible-rejects-reasoning-effort-medium-works-with-low-and-high/112648 "2025-12-29T12:23:15Z")

</div>

Starting today, requests to Gemini 3 Preview using the OpenAI compatibility interface fail when reasoning\_effort (thinking level) is set to "medium". The same request succeeds with "low" and "high". This appears to be a…

---

## [Error in handling Google Gemini API error responses – breaks OpenAI compatibility in openai-php/client](https://discuss.ai.google.dev/t/error-in-handling-google-gemini-api-error-responses-breaks-openai-compatibility-in-openai-php-client/112322)

<div class="topic-metadata">

**Author:** [@KARO](https://discuss.ai.google.dev/u/KARO)\
**Replies:** 0\
**Last updated:** [December 16, 2025, 3:59pm UTC](https://discuss.ai.google.dev/t/error-in-handling-google-gemini-api-error-responses-breaks-openai-compatibility-in-openai-php-client/112322 "2025-12-16T15:59:01Z")

</div>

The community PHP client openai-php/client crashes with Undefined array key “choices” warning in CreateResponse.php when Gemini returns an error response (e.g., invalid parameters). Gemini’s error format differs from Ope…

---

## [\`quality\` in OpenAi compatibility is not applied in generate images?](https://discuss.ai.google.dev/t/quality-in-openai-compatibility-is-not-applied-in-generate-images/110290)

<div class="topic-metadata">

**Author:** [@stillmoon](https://discuss.ai.google.dev/u/stillmoon)\
**Replies:** 7\
**Last updated:** [December 2, 2025, 7:24am UTC](https://discuss.ai.google.dev/t/quality-in-openai-compatibility-is-not-applied-in-generate-images/110290 "2025-12-02T07:24:59Z")

</div>

When I use the OpenAI-compatible mode to edit images(image to image), the quality parameter doesn’t seem to work? According to OpenAI’s parameter description: quality string or null Optional Defaults to auto The quali…

---

## [When will OpenAI Endpoints feature native batch requests?](https://discuss.ai.google.dev/t/when-will-openai-endpoints-feature-native-batch-requests/109736)

<div class="topic-metadata">

**Author:** [@Akshat\_Diwedi](https://discuss.ai.google.dev/u/Akshat_Diwedi)\
**Replies:** 0\
**Last updated:** [November 18, 2025, 3:41pm UTC](https://discuss.ai.google.dev/t/when-will-openai-endpoints-feature-native-batch-requests/109736 "2025-11-18T15:41:01Z")

</div>

Hi there team google :waving\_hand::waving\_hand:. hope you are doing great guys actually i need to get some info about the openai api compatibility. can you please add native batch processing on that api ?? guys please …

---

## [Structured output Optional fields don't work in OpenAI SDK compatibility mode](https://discuss.ai.google.dev/t/structured-output-optional-fields-dont-work-in-openai-sdk-compatibility-mode/82329)

<div class="topic-metadata">

**Author:** [@Hayk\_Harutyunyan](https://discuss.ai.google.dev/u/Hayk_Harutyunyan)\
**Replies:** 3\
**Last updated:** [November 10, 2025, 3:39pm UTC](https://discuss.ai.google.dev/t/structured-output-optional-fields-dont-work-in-openai-sdk-compatibility-mode/82329 "2025-11-10T15:39:54Z")

</div>

If I submit a model like the below as response\_format to OpenAI structured output it won’t complain. The same isn’t the case with Gemini’s OpenAI endpoint https://generativelanguage.googleapis.com/v1beta/openai/ , which …

---

## [Does openai API support google search grounding?](https://discuss.ai.google.dev/t/does-openai-api-support-google-search-grounding/107542)

<div class="topic-metadata">

**Author:** [@Erki\_Ehtla](https://discuss.ai.google.dev/u/Erki_Ehtla)\
**Replies:** 1\
**Last updated:** [October 16, 2025, 9:47am UTC](https://discuss.ai.google.dev/t/does-openai-api-support-google-search-grounding/107542 "2025-10-16T09:47:01Z")

</div>

I see that the tools element is supported in the openai API, but the docs only mention function calling. When I add “tools”: \[ {“google\_search”: {}} \] to my payload, I get Invalid JSON payload received. Unknown nam…

---

## [Does Gemini 2.5 Pro Computer Use model support OpenAI-compatible API calls?](https://discuss.ai.google.dev/t/does-gemini-2-5-pro-computer-use-model-support-openai-compatible-api-calls/107379)

<div class="topic-metadata">

**Author:** [@zhe\_wang](https://discuss.ai.google.dev/u/zhe_wang)\
**Replies:** 1\
**Last updated:** [October 15, 2025, 11:28am UTC](https://discuss.ai.google.dev/t/does-gemini-2-5-pro-computer-use-model-support-openai-compatible-api-calls/107379 "2025-10-15T11:28:54Z")

</div>

I am currently exploring the capabilities of the new Gemini 2.5 Pro Computer Use Model，I tried to call the Gemini 2.5 Pro Computer Use model using the OpenAI-compatible API format, but it failed. Is this feature not supp…

---

## [Gemini OpenAI-compatible endpoint + LangChain return Error 400](https://discuss.ai.google.dev/t/gemini-openai-compatible-endpoint-langchain-return-error-400/106596)

<div class="topic-metadata">

**Author:** [@skorphil](https://discuss.ai.google.dev/u/skorphil)\
**Replies:** 1\
**Last updated:** [October 6, 2025, 7:40pm UTC](https://discuss.ai.google.dev/t/gemini-openai-compatible-endpoint-langchain-return-error-400/106596 "2025-10-06T19:40:08Z")

</div>

Hi, i’m getting { "error": { "code": 400, "message": "\\\* GenerateContentRequest.contents: contents is not specified\\\\n", "status": "INVALID\_ARGUMENT" } } When trying to use LangChain with Chat…

---

## [OpenAI SDK Compatibility suddenly stopped working](https://discuss.ai.google.dev/t/openai-sdk-compatibility-suddenly-stopped-working/104345)

<div class="topic-metadata">

**Author:** [@victor\_bodacious](https://discuss.ai.google.dev/u/victor_bodacious)\
**Replies:** 3\
**Last updated:** [September 26, 2025, 11:36pm UTC](https://discuss.ai.google.dev/t/openai-sdk-compatibility-suddenly-stopped-working/104345 "2025-09-26T23:36:40Z")

</div>

I had some functions using the OpenAI SDK compatibility with gemini-2.5-pro and it was working fine until lunch time when without no code change, redeployment, or anything at all in terms of code, it stopped working and …

---

## [OpenAI Compatibility API does not support message.refusal field set to null](https://discuss.ai.google.dev/t/openai-compatibility-api-does-not-support-message-refusal-field-set-to-null/100010)

<div class="topic-metadata">

**Author:** [@flowring\_luyiourwong](https://discuss.ai.google.dev/u/flowring_luyiourwong)\
**Replies:** 7\
**Last updated:** [September 12, 2025, 9:46am UTC](https://discuss.ai.google.dev/t/openai-compatibility-api-does-not-support-message-refusal-field-set-to-null/100010 "2025-09-12T09:46:53Z")

</div>

When using the Gemini OpenAI Compatibility API, if a message object contains a refusal field with the value null, Gemini returns a 400 Value is not a string: null error. Example request: { "messages" : \[ { …

---

## [Is there a github repo for gemini OpenAI compatibility sdk?](https://discuss.ai.google.dev/t/is-there-a-github-repo-for-gemini-openai-compatibility-sdk/99362)

<div class="topic-metadata">

**Author:** [@Potato](https://discuss.ai.google.dev/u/Potato)\
**Replies:** 0\
**Last updated:** [August 22, 2025, 6:33pm UTC](https://discuss.ai.google.dev/t/is-there-a-github-repo-for-gemini-openai-compatibility-sdk/99362 "2025-08-22T18:33:45Z")

</div>

Hello, I would like to know is there a github repo for the gemini OpenAI compatibility sdk? For javascript particularly. I want to checkout the source code for the response object mapping between the native google sdk v…

---

## [Question with "Usage" in OpenAI compatibility](https://discuss.ai.google.dev/t/question-with-usage-in-openai-compatibility/98760)

<div class="topic-metadata">

**Author:** [@Potato](https://discuss.ai.google.dev/u/Potato)\
**Replies:** 3\
**Last updated:** [August 22, 2025, 6:41am UTC](https://discuss.ai.google.dev/t/question-with-usage-in-openai-compatibility/98760 "2025-08-22T06:41:17Z")

</div>

Hi, I’m using the Gemini 2.5 Pro model with OpenAI compatibility for my project. The openai node sdk version I am using is 5.12.2 I am trying to use the usage object to approximate cost per request but I am seeing some…

---

## [How quickly are new models supported in the Gemini OpenAI compatibility library?](https://discuss.ai.google.dev/t/how-quickly-are-new-models-supported-in-the-gemini-openai-compatibility-library/96305)

<div class="topic-metadata">

**Author:** [@Devanshu\_Mahapatra](https://discuss.ai.google.dev/u/Devanshu_Mahapatra)\
**Replies:** 3\
**Last updated:** [August 11, 2025, 11:13am UTC](https://discuss.ai.google.dev/t/how-quickly-are-new-models-supported-in-the-gemini-openai-compatibility-library/96305 "2025-08-11T11:13:51Z")

</div>

I had a question - When new models are released, how quickly can we use them via openAI compatibility method?

---

## [Regression bug in 2.5 family: no model response when limiting output tokens](https://discuss.ai.google.dev/t/regression-bug-in-2-5-family-no-model-response-when-limiting-output-tokens/96462)

<div class="topic-metadata">

**Author:** [@DanielKucal](https://discuss.ai.google.dev/u/DanielKucal)\
**Replies:** 1\
**Last updated:** [August 2, 2025, 3:09pm UTC](https://discuss.ai.google.dev/t/regression-bug-in-2-5-family-no-model-response-when-limiting-output-tokens/96462 "2025-08-02T15:09:45Z")

</div>

When limiting output tokens for Gemini 2.5 family models, the API response lacks the most important thing - the model response. Gemini 2.5 Pro/Flash danielkucal@DK ~ % curl -X POST \\ 'https://generativelanguage.googl…

---

## [OpenAI API compatibility and logprobs](https://discuss.ai.google.dev/t/openai-api-compatibility-and-logprobs/94970)

<div class="topic-metadata">

**Author:** [@Jiri\_Podivin](https://discuss.ai.google.dev/u/Jiri_Podivin)\
**Replies:** 4\
**Last updated:** [August 1, 2025, 12:03am UTC](https://discuss.ai.google.dev/t/openai-api-compatibility-and-logprobs/94970 "2025-08-01T00:03:18Z")

</div>

When I try to use OpenAI API with Gemini, for example with: result = await client.chat.completions.create( messages=\[ { "role": "user", "content": …

---

## [400 Error "Request contains an invalid argument" when calling v1beta/openai/chat/completions from AI Studio Build Environment](https://discuss.ai.google.dev/t/400-error-request-contains-an-invalid-argument-when-calling-v1beta-openai-chat-completions-from-ai-studio-build-environment/95759)

<div class="topic-metadata">

**Author:** [@Ystone](https://discuss.ai.google.dev/u/Ystone)\
**Replies:** 7\
**Last updated:** [July 29, 2025, 7:39pm UTC](https://discuss.ai.google.dev/t/400-error-request-contains-an-invalid-argument-when-calling-v1beta-openai-chat-completions-from-ai-studio-build-environment/95759 "2025-07-29T19:39:01Z")

</div>

Hello everyone, I’m encountering an issue when trying to use the OpenAI-compatible Chat Completions endpoint from within the AI Studio Build environment. Objective: My goal is to call the v1beta/openai/chat/completion…

---

## [How to specify SafetySettings via OpenAI Python SDK](https://discuss.ai.google.dev/t/how-to-specify-safetysettings-via-openai-python-sdk/95667)

<div class="topic-metadata">

**Author:** [@nfsmaniac](https://discuss.ai.google.dev/u/nfsmaniac)\
**Replies:** 0\
**Last updated:** [July 26, 2025, 9:45pm UTC](https://discuss.ai.google.dev/t/how-to-specify-safetysettings-via-openai-python-sdk/95667 "2025-07-26T21:45:36Z")

</div>

As per: OpenAI compatibility | Gemini API | Google AI for Developers It can be specified a safety\_settings field. However, all of my, and all of those provided by Gemini 2.5 Pro (w/ Search Grounding & w/ Code Execut…

---

## [OpenAI client compatibility for the Batch API](https://discuss.ai.google.dev/t/openai-client-compatibility-for-the-batch-api/95102)

<div class="topic-metadata">

**Author:** [@cdrini](https://discuss.ai.google.dev/u/cdrini)\
**Replies:** 0\
**Last updated:** [July 22, 2025, 12:22pm UTC](https://discuss.ai.google.dev/t/openai-client-compatibility-for-the-batch-api/95102 "2025-07-22T12:22:02Z")

</div>

Both the OpenAI client and the Google genai clients have very similar interfaces for managing batches: # Create file uploaded\_file = client.files.upload( file='my-batch-requests.jsonl', config=types.UploadFile…

---

## [Open AI structured outputs not working](https://discuss.ai.google.dev/t/open-ai-structured-outputs-not-working/94322)

<div class="topic-metadata">

**Author:** [@NeilSanghrajka](https://discuss.ai.google.dev/u/NeilSanghrajka)\
**Replies:** 1\
**Last updated:** [July 21, 2025, 6:46am UTC](https://discuss.ai.google.dev/t/open-ai-structured-outputs-not-working/94322 "2025-07-21T06:46:35Z")

</div>

Your docs are outdated and I am unable to generate structured outputs using Gemini open ai compatiblity. There is no property called chat on openai.beta anymore. Please fix this immediately This is the official document…

---

## [Oh, Google, please, please fulfill this request!](https://discuss.ai.google.dev/t/oh-google-please-please-fulfill-this-request/94107)

<div class="topic-metadata">

**Author:** [@Suparva](https://discuss.ai.google.dev/u/Suparva)\
**Replies:** 1\
**Last updated:** [July 17, 2025, 9:49am UTC](https://discuss.ai.google.dev/t/oh-google-please-please-fulfill-this-request/94107 "2025-07-17T09:49:47Z")

</div>

I would like Gemini models to support reading document files (such as PDF, CSV, and TXT) using the OpenAI SDK. I previously raised a similar issue, and even a Google member responded, but no progress has been made. I r…

---

## [OpenAI compatibility for labels](https://discuss.ai.google.dev/t/openai-compatibility-for-labels/91871)

<div class="topic-metadata">

**Author:** [@lvqier](https://discuss.ai.google.dev/u/lvqier)\
**Replies:** 6\
**Last updated:** [July 9, 2025, 7:28am UTC](https://discuss.ai.google.dev/t/openai-compatibility-for-labels/91871 "2025-07-09T07:28:12Z")

</div>

Hi there, I what to add custom metadata for cost accounting via OpenAI compatibility API. I would like to know if the metadata field defined in the OpenAI compatibility API has the same effect as the labels field as defi…

---

## [Gemini OpenAI compatibility: Does it support the "stream\_options" parameter?](https://discuss.ai.google.dev/t/gemini-openai-compatibility-does-it-support-the-stream-options-parameter/92785)

<div class="topic-metadata">

**Author:** [@hayaoki827](https://discuss.ai.google.dev/u/hayaoki827)\
**Replies:** 1\
**Last updated:** [July 8, 2025, 5:05am UTC](https://discuss.ai.google.dev/t/gemini-openai-compatibility-does-it-support-the-stream-options-parameter/92785 "2025-07-08T05:05:14Z")

</div>

Hello everyone, I’m currently using the Gemini API through the OpenAI compatibility endpoint, and it’s been great for a smooth transition. I have a specific question regarding streaming responses. In the OpenAI Chat Co…

---

## [OpenAI compatibility for pdf file](https://discuss.ai.google.dev/t/openai-compatibility-for-pdf-file/77388)

<div class="topic-metadata">

**Author:** [@Ngyn\_An](https://discuss.ai.google.dev/u/Ngyn_An)\
**Replies:** 6\
**Last updated:** [June 19, 2025, 5:09am UTC](https://discuss.ai.google.dev/t/openai-compatibility-for-pdf-file/77388 "2025-06-19T05:09:50Z")

</div>

Hello folk, I’m trying to work with PDF files using the OpenAI with Gemini API, but I’m having difficulty understanding how to properly implement this. Could someone please explain: How to upload and process PDF files …

---

## [More audio file type support in (openai-compatible) api?](https://discuss.ai.google.dev/t/more-audio-file-type-support-in-openai-compatible-api/77438)

<div class="topic-metadata">

**Author:** [@Sirui\_Lu](https://discuss.ai.google.dev/u/Sirui_Lu)\
**Replies:** 4\
**Last updated:** [June 13, 2025, 5:09am UTC](https://discuss.ai.google.dev/t/more-audio-file-type-support-in-openai-compatible-api/77438 "2025-06-13T05:09:29Z")

</div>

i am trying to use audio in the openai compatible api: however i get: openai.BadRequestError: Error code: 400 - \[{‘error’: {‘code’: 400, ‘message’: ‘Invalid audio format “m4a” for audio generation. Valid formats are: \[…

[Next page](https://discuss.ai.google.dev/tag/openai-compatibility/417.md?match_all_tags=true&page=1&tags%5B%5D=openai_compatibility)
