I used gemini-2.5-flash with C# Microsoft.Extensions.AI.OpenAI and it works without any problem.
But with gemini-3-flash-preview, it does not work. Here is reproducible code snippet:
var endpointUri = new Uri("https://generativelanguage.googleapis.com/v1beta/openai");
var apiKey = "[YOUR API KEY]";
var model = "gemini-2.5-flash"; // or "gemini-3-flash-preview"
var nativeClient = new OpenAIClient(
new System.ClientModel.ApiKeyCredential(apiKey ),
new OpenAIClientOptions() { Endpoint = endpointUri });
var chatClient = nativeClient
.GetChatClient(model)
.AsIChatClient()
.AsBuilder()
.UseFunctionInvocation(loggerFactory: null, configure: (functionInvokingClient) =>
{
functionInvokingClient.MaximumIterationsPerRequest = 999;
functionInvokingClient.IncludeDetailedErrors = true;
})
.Build();
var chatOptions = new ChatOptions()
{
ToolMode = ChatToolMode.Auto,
Tools = new List<AITool>()
{
AIFunctionFactory.Create(GetCurrentTime),
AIFunctionFactory.Create(Add),
},
RawRepresentationFactory = _ =>
{
return new OpenAI.Chat.ChatCompletionOptions()
{
ReasoningEffortLevel = new OpenAI.Chat.ChatReasoningEffortLevel("none"), // "none" works for 2.5 flash and 3 flash, but "minimal" makes 400 Bad Request error on gemini 3 flash. Document says 3 flash only support minimal,low,medium,high (https://ai.google.dev/gemini-api/docs/openai#thinking)
};
}
};
[Description("Get current date and time.")]
DateTime GetCurrentTime()
{
Console.WriteLine("[TOOL] GetCurrentTime");
return DateTime.Now;
}
[Description("Get sum of integer a and b.")]
int Add(int a, int b)
{
Console.WriteLine("[TOOL] Add");
return a + b;
}
var userMessage = new ChatMessage(ChatRole.User, "Get current time. Then get value of 1 + 1 by using Add tool. Do these simultaniously.");
Console.WriteLine($"User : {userMessage.Text}");
// with gemini 2.5 flash, it works without any problem. but gemini 3 flash throws 400 Bad Request error on function invocation (it seems that it can generate function call, but throw error when process function response.).
var response = await chatClient.GetResponseAsync(userMessage, options: chatOptions);
Console.WriteLine($"Agent : {response.Text}");
First problem is that when using “minimal” for reasoning effort, gemini-3-flash-preview throws 400 bad request error. It is unexpected behaviour to its document : https://ai.google.dev/gemini-api/docs/openai#thinking
Second problem is that gemini-3-flash-preview throws 400 bad request error when processing function response on FunctionInvocationChatClient.
Any ideas? Thanks.