Improve Azure OpenAI BYOK provider configuration - #45610
Conversation
Added new environment variables for model provider configuration, including bearer token, wire API, and Azure-specific settings.
Updated environment variable documentation for using custom models in GitHub Copilot CLI. Added Azure-specific variables and corrected formatting issues.
|
Thanks for opening this pull request! A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines. |
|
Hello, without any context I'm unable to process this PR for review—please feel free to comment here if this has been closed in error, and provide more context. Thank you |
|
Hey I have updated the above comment about the changes made in the doc and focusing on which issue. |
subatoi
left a comment
There was a problem hiding this comment.
Thank you, @Aditi16-ctrl—the issue in question hasn't been approved for a community contribution, but if/when it is, I'll try to include this contribution if possible
Unnecessary note
hubwriter
left a comment
There was a problem hiding this comment.
Thanks for putting this together! I checked the changes against the Copilot CLI source. A few things look great, and there's one correctness issue worth fixing before merge.
Verified correct against the code:
- Shortening the Azure
COPILOT_PROVIDER_BASE_URLto the resource origin (https://YOUR-RESOURCE-NAME.openai.azure.com) is right — the runtime derives the/openai/...path itself from the origin. COPILOT_PROVIDER_AZURE_API_VERSION,COPILOT_PROVIDER_MAX_PROMPT_TOKENS, andCOPILOT_PROVIDER_MAX_OUTPUT_TOKENSdescriptions match the runtime behavior. AddingCOPILOT_PROVIDER_BEARER_TOKENandCOPILOT_PROVIDER_WIRE_APIis a good addition.
Needs a fix:
COPILOT_PROVIDER_MODEL_IDandCOPILOT_PROVIDER_WIRE_MODELare described the wrong way round (in the table, the Azure shell example, and the new subsection). In the code,WIRE_MODELis what routes the Azure request (the deployment name) andMODEL_IDis the well-known model used for capabilities/token limits. See the inline comments for the exact swap.
Minor / formatting:
- A blank line was removed before the config table, and there's a missing blank line before the new
### Azure-specific environment variablesheading — both affect rendering. Details inline.
Left the specifics as inline comments. Happy to help verify once updated.
| | `COPILOT_PROVIDER_MODEL_ID` | Azure only | The Azure OpenAI deployment name used to route requests. | | ||
| | `COPILOT_PROVIDER_WIRE_MODEL` | Azure only | The underlying model name associated with the deployment. | |
There was a problem hiding this comment.
The descriptions for these two variables appear to be swapped relative to how the CLI actually uses them.
In the runtime, COPILOT_PROVIDER_WIRE_MODEL is the model name sent on the wire to the provider — for Azure this becomes the value in the /deployments/{model} path, i.e. the deployment name that routes the request. COPILOT_PROVIDER_MODEL_ID is the well-known model ID used to select model capabilities and token limits (both default to COPILOT_MODEL).
The CLI's own --help text describes them as:
COPILOT_PROVIDER_MODEL_ID: "well-known model ID used for agent configuration and token limits. Defaults to COPILOT_MODEL."COPILOT_PROVIDER_WIRE_MODEL: "model name sent to the provider API for inference. Defaults to COPILOT_MODEL."
So the descriptions should be flipped:
COPILOT_PROVIDER_MODEL_ID→ the well-known model name used to identify capabilities/token limits (e.g.gpt-4o).COPILOT_PROVIDER_WIRE_MODEL→ the Azure deployment name that requests are routed through.
Minor: these two variables aren't strictly "Azure only" — they apply to any BYOK provider (they default to COPILOT_MODEL), though they're most relevant for Azure where the deployment name differs from the model name. Consider "No" with an Azure note, or keeping "Azure only" if that's the intended scope for the article.
|
|
||
| You configure your model provider by setting environment variables before starting {% data variables.copilot.copilot_cli_short %}. | ||
|
|
||
| | Environment variable | Required | Description | |
There was a problem hiding this comment.
This change removed the blank line between the intro sentence and the table. Markdown tables need a blank line before them to render as a table — without it the table row may be absorbed into the preceding paragraph. Please restore the blank line here:
You configure your model provider by setting environment variables before starting {% data variables.copilot.copilot_cli_short %}.
| Environment variable | Required | Description || export COPILOT_PROVIDER_MODEL_ID=YOUR-DEPLOYMENT-NAME | ||
| export COPILOT_PROVIDER_WIRE_MODEL=YOUR-MODEL-NAME |
There was a problem hiding this comment.
Same swap as in the table above — these two values are reversed. Based on the runtime behavior, COPILOT_PROVIDER_WIRE_MODEL is what routes the Azure request (the deployment name), and COPILOT_PROVIDER_MODEL_ID is the well-known model identity used for capabilities/token limits. So this example should be:
export COPILOT_PROVIDER_MODEL_ID=YOUR-MODEL-NAME
export COPILOT_PROVIDER_WIRE_MODEL=YOUR-DEPLOYMENT-NAMEAnd correspondingly COPILOT_MODEL=YOUR-DEPLOYMENT-NAME — please double-check the intended value here too, since COPILOT_MODEL is the model identifier the CLI resolves against and both MODEL_ID/WIRE_MODEL fall back to it. The placeholder descriptions below (YOUR-DEPLOYMENT-NAME / YOUR-MODEL-NAME) will need to line up with whichever assignment they belong to once the swap is fixed.
| * `YOUR-MODEL-NAME`: the underlying model associated with the deployment (for example, `gpt-4o`) | ||
| * `YOUR-AZURE-API-VERSION`: the Azure OpenAI API version | ||
| * `YOUR-AZURE-API-KEY`: your Azure OpenAI API key | ||
| ### Azure-specific environment variables |
There was a problem hiding this comment.
There's no blank line between the placeholder bullet list above and this ### heading, so it will not render as a heading (it will be treated as part of the preceding list/paragraph). Please add a blank line before it:
* `YOUR-AZURE-API-KEY`: your Azure OpenAI API key
### Azure-specific environment variablesAlso, once the MODEL_ID / WIRE_MODEL descriptions are corrected, note that this subsection largely repeats the two rows now added to the main table above — consider whether both are needed, or keep just one to avoid the descriptions drifting out of sync.
How to review these changes 👓Thank you for your contribution. To review these changes, choose one of the following options: A Hubber will need to deploy your changes internally to review. Table of review linksNote: Please update the URL for your staging server or codespace. The table shows the files in the
Key: fpt: Free, Pro, Team; ghec: GitHub Enterprise Cloud; ghes: GitHub Enterprise Server 🤖 This comment is automatically generated. |
|
Thanks very much for opening this, @Aditi16-ctrl — this is a helpful improvement to the BYOK docs, and it closes out most of what was raised in #44864. 🙏 I verified the changes against the Copilot CLI source. The good news: shortening the Azure One correctness item to fix before merge: the descriptions of I've left the specifics as inline review comments. Once those are addressed I think this is good to go — thanks again for the contribution! |
Why:
The BYOK documentation for GitHub Copilot CLI was missing several supported environment variables and contained an incorrect Azure provider base URL format. These updates improve the completeness and accuracy of the documentation and simplify the Azure configuration by removing the deployment-name dependency from the base URL.
Closes:
Closes #44864
What's being changed (if available, include any code snippets, screenshots, or gifs):
"https://YOUR-RESOURCE-NAME.openai.azure.com/openai/deployments/YOUR-DEPLOYMENT-NAME"
to:
"https://YOUR-RESOURCE-NAME.openai.azure.com"
Check off the following:
Additional context:
This PR directly addresses the documentation updates requested in #44864.
I made the requested changes to the affected BYOK documentation and raised this PR for review. If additional context is needed to process the PR, please feel free to comment here and I will provide it.