diff --git a/models/spring-ai-azure-openai/pom.xml b/models/spring-ai-azure-openai/pom.xml
index 88ca45867cf..bc4733e7095 100644
--- a/models/spring-ai-azure-openai/pom.xml
+++ b/models/spring-ai-azure-openai/pom.xml
@@ -83,6 +83,13 @@
micrometer-observation-test
test
+
+
+ com.azure
+ azure-core-http-okhttp
+ 1.12.11
+ test
+
diff --git a/models/spring-ai-azure-openai/src/test/java/org/springframework/ai/azure/openai/AzureOpenAiAudioTranscriptionModelIT.java b/models/spring-ai-azure-openai/src/test/java/org/springframework/ai/azure/openai/AzureOpenAiAudioTranscriptionModelIT.java
index 85e0a54b360..abad2ee928d 100644
--- a/models/spring-ai-azure-openai/src/test/java/org/springframework/ai/azure/openai/AzureOpenAiAudioTranscriptionModelIT.java
+++ b/models/spring-ai-azure-openai/src/test/java/org/springframework/ai/azure/openai/AzureOpenAiAudioTranscriptionModelIT.java
@@ -1,3 +1,4 @@
+
/*
* Copyright 2023-2024 the original author or authors.
*
@@ -16,9 +17,13 @@
package org.springframework.ai.azure.openai;
+import java.util.concurrent.TimeUnit;
+
import com.azure.ai.openai.OpenAIClient;
import com.azure.ai.openai.OpenAIClientBuilder;
import com.azure.core.credential.AzureKeyCredential;
+import com.azure.core.http.okhttp.OkHttpAsyncHttpClientBuilder;
+import okhttp3.OkHttpClient;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariables;
@@ -91,8 +96,16 @@ public OpenAIClient openAIClient() {
// System.out.println("API Key: " + apiKey);
// System.out.println("Endpoint: " + endpoint);
+ int readTimeout = 120;
+ int writeTimeout = 120;
+
+ // OkHttp client with long timeouts
+ OkHttpClient okHttpClient = new OkHttpClient.Builder().readTimeout(readTimeout, TimeUnit.SECONDS)
+ .callTimeout(writeTimeout, TimeUnit.SECONDS)
+ .build();
- return new OpenAIClientBuilder().credential(new AzureKeyCredential(apiKey))
+ return new OpenAIClientBuilder().httpClient(new OkHttpAsyncHttpClientBuilder(okHttpClient).build())
+ .credential(new AzureKeyCredential(apiKey))
.endpoint(endpoint)
// .serviceVersion(OpenAIServiceVersion.V2024_02_15_PREVIEW)
.buildClient();