codex icon indicating copy to clipboard operation
codex copied to clipboard

Supporting Azure OpenAI

Open monuminu opened this issue 1 year ago • 11 comments

Supporting Azure OpenAI

monuminu avatar Apr 16 '25 17:04 monuminu

LiteLLM potentially might help https://docs.litellm.ai/docs/

ralzinov avatar Apr 16 '25 17:04 ralzinov

We should be able to bake in Azure OpenAI support directly from the openai package — likely just a few lines of changes.

import { AzureOpenAI, OpenAI } from "openai";

I might take a stab at it later today, or wire it up through GitHub agent mode if I get the chance.

nikhil-pandey avatar Apr 16 '25 18:04 nikhil-pandey

I asked codex this question on it's own repo - and it says you should be able to set two ENV vars to redirect it:

 • Set OPENAI_BASE_URL to your Azure OpenAI endpoint (e.g. https://<your‑resource>.openai.azure.com)
 • Set OPENAI_API_KEY (or codex config set apiKey …) to your Azure API key

I haven't given it a try yet though.

rgregg avatar Apr 16 '25 20:04 rgregg

I asked codex this question on it's own repo - and it says you should be able to set two ENV vars to redirect it:

 • Set OPENAI_BASE_URL to your Azure OpenAI endpoint (e.g. https://<your‑resource>.openai.azure.com)
 • Set OPENAI_API_KEY (or codex config set apiKey …) to your Azure API key

I haven't given it a try yet though.

Deployment name for the model will also be required for AOAI

guygregory avatar Apr 16 '25 20:04 guygregory

Please also consider implementing azure_ad_token (or the like) so that enterprises don’t have to communicate and manage AOAI API keys.

Reference

SeaDude avatar Apr 16 '25 21:04 SeaDude

Working on it - https://github.com/openai/codex/pull/92

thegovind avatar Apr 16 '25 22:04 thegovind

Following, if someone successfully gets it running please update this thread. thank you x 1000000.

surim0n avatar Apr 17 '25 12:04 surim0n

It would be a godsend if you supported the GH copilot api similar to how vscode utilizes models. GH copilot also has a generous free tier and is well utilized in Enterprises.

The GH OpenAi api is a slight variant on the generic OpenAI api. More information and how litellm supported it available at https://github.com/BerriAI/litellm/issues/6564

cavanaug avatar Apr 23 '25 04:04 cavanaug

PR is being worked on in #769

jslitzkerttcu avatar May 07 '25 14:05 jslitzkerttcu

Looks like the PR for this was merged, but this does not have Entra support right? #1056 covers Entra and has a PR #1062 ready to go for that.

robotdad avatar May 21 '25 17:05 robotdad

Azure OpenAI already supports the Azure OpenAI Responses API. This should be supported in Codex CLI.

doggy8088 avatar May 26 '25 14:05 doggy8088