Skip to content

[FEAT] - Support Azure OpenAI in addition to OpenAI #112

@tfenster

Description

@tfenster

What you'd like to see

I would like to use Azure OpenAI instead of pure OpenAI

Why you'd like to see it

That would allow me to use cagent in more contexts as Azure OpenAI has some of the bells and whistles expected in a corporate context

Workarounds?

no

Additional context

If I try to call my Azure OpenAI endpoint using the existing openai provider, I would do something like this

models:
  cloud-gpt-4o:
    provider: openai
    model: gpt-4o
    base_url: https://openai-testtf.openai.azure.com/openai/deployments/gpt-4o

But this causes an error 404

Image

The reason most likely is that Azure OpenAI expects a version query parameter. E.g. a POST to https://openai-testtf.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2025-01-01-preview works, whereas a POST to https://openai-testtf.openai.azure.com/openai/deployments/gpt-4o/chat/completions also causes a 404.

The OpenAI client library used in cagent (if I understand the code correctly) seems to also support Azure OpenAI, but with different methods, see e.g. https://github.com/sashabaranov/go-openai/blob/8e5611cc5efdc2533b80e5667b69741c3fad875c/README.md?plain=1#L617-L618

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions