Skip to content

URLs ending in cognitiveservices.azure.com are silently not considered Azure URLs #469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
StefanLobbenmeierObjego opened this issue May 12, 2025 · 1 comment · May be fixed by #470
Open
Labels
bug Something isn't working

Comments

@StefanLobbenmeierObjego
Copy link

StefanLobbenmeierObjego commented May 12, 2025

I can connect to my model using curl like this:

curl -X POST "https://stefa-censored-swedencentral.cognitiveservices.azure.com/openai/responses?api-version=2025-03-01-preview" \
 -H "Content-Type: application/json" \
 -H "Authorization: Bearer $AZURE_API_KEY" \
 -d '{
     "model": "o4-mini",
     "input": "This is a test"
 }'

Can we also add this URL to the isAzureEndpoint Util?

@JvmSynthetic
internal fun isAzureEndpoint(baseUrl: String): Boolean {
// Azure Endpoint should be in the format of `https://<region>.openai.azure.com`.
// Or `https://<region>.azure-api.net` for Azure OpenAI Management URL.
val trimmedBaseUrl = baseUrl.trim().trimEnd('/')
return trimmedBaseUrl.endsWith(".openai.azure.com", true) ||
trimmedBaseUrl.endsWith(".azure-api.net", true)
}

StefanLobbenmeierObjego added a commit to StefanLobbenmeierObjego/openai-java that referenced this issue May 12, 2025
@StefanLobbenmeierObjego
Copy link
Author

As a workaround in case anyone else runs into this, it seems using the same hostname but with openai.azure.com instead also works via curl and then this library also has the correct behaviour

This alos works:

curl -X POST "https://stefa-censored-swedencentral.openai.azure.com/openai/responses?api-version=2025-03-01-preview" \
 -H "Content-Type: application/json" \
 -H "Authorization: Bearer $AZURE_API_KEY" \
 -d '{
     "model": "o4-mini",
     "input": "This is a test"
 }'

@TomerAberbach TomerAberbach changed the title URLs ending in cognitiveservices.azure.com should also be considered azure endpoints URLs ending in cognitiveservices.azure.com are silently not considered Azure URLs May 14, 2025
@TomerAberbach TomerAberbach added the bug Something isn't working label May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants