You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Adding support for Claude Models via Azure AI Foundry #97
Now Antropic models are available via azure too, but the function is unable to communicate with the model
Details
This is following the different URL Format of Chat Completions i.e. /v1/messages
curl -X POST "https://<my_resource_name>.openai.azure.com/anthropic/v1/messages" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $AZURE_API_KEY" \
-H "anthropic-version:2023-06-01" \
-d '{
"messages" : [
{
"role": "user",
"content": "I am going to Paris, what should I see?"
},
{
"role": "assistant",
"content": "Paris, the capital of France, is known for its stunning architecture, tpwers and buildings."
},
{
"role": "user",
"content": "What is so great about #1?"
}
],
"max_completion_tokens" : 2048,
"temperature" : 1,
"thinking" : {
"type": "disabled"
},
"model": "claude4"
}'
or
from anthropic import AnthropicFoundry
endpoint = "https://<my_resource_name>.openai.azure.com/anthropic"
deployment_name = "claude4"
api_key = "<your-api-key>"
client = AnthropicFoundry(
api_key=api_key,
base_url=endpoint
)
message = client.messages.create(
model=deployment_name,
messages=[
{"role": "user", "content": "What is the capital of France?"}
],
max_tokens=1024,
)
print(message.content)
What have you tried?
But when i am using this function it is giving error like this: Error: Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource.
But when using Pure Python and Anthropic SDK, it is working just fine, CURL Command is giving the same issue.
can you please help in implemementing this for Anthropic SDK as well ?
Thank you
If anyone encounters this in future or dev want to take some insights, the following code is working perfectly for this :
Mainly the change is instead of using api-key, it uses x-api-key and different method of parsing it's output events
Azure Anthropic Pipeline
A pipeline for interacting with Anthropic Claude models on Azure AI Foundry (endpoint /v1/messages).
Converts Anthropic-style responses/SSE into OpenAI-style format for compatibility with OpenWebUI.
Activity
shivamkainth commentedon Nov 20, 2025
If anyone encounters this in future or dev want to take some insights, the following code is working perfectly for this :
Mainly the change is instead of using api-key, it uses x-api-key and different method of parsing it's output events
Azure Anthropic Pipeline
A pipeline for interacting with Anthropic Claude models on Azure AI Foundry (endpoint
/v1/messages).Converts Anthropic-style responses/SSE into OpenAI-style format for compatibility with OpenWebUI.
owndev commentedon Nov 25, 2025
Thanks for your example. It's definitely useful for anyone wanting to use Anthropic models.
I won't be implementing it in my pipeline because I don't want to make adjustments for every model that has a different URL or format.