Manage platform BYOK providers
Use the native CLI to manage platform providers that use your own provider key. Bring your own key (BYOK) providers include model metadata, pricing, and a write-only credential. You can create, read, update, price, recheck, disable, and switch them. A credential upload uses the dedicated credential workflow. See the model-provider API routes. For a Project's provider drafts, see Manage project BYOK provider metadata.
View deployment-managed bindings
Sign in to the web app with a platform session. Open Platform settings, enter your tenant ID under Deployment-managed BYOK bindings, and select Load bindings. The list shows the responding Projects service's startup copy and revision. It shows enabled and disabled BYOK references as Managed by deployment. To refresh the copy, select Load bindings again.
Before you begin
Use the Agentweaver CLI with a configured Gateway, Broker, API audience, and tenant. See Configure a target.
Your account needs current PlatformAdmin authority. Sign in with the projects.admin scope:
agentweaver auth login --scope projects.adminThe API checks your current authority for every request. These commands use an unbound identity. They ignore AGENTWEAVER_PROJECT_ID and AGENTWEAVER_RUN_ID and reject --project-id and --run-id.
Set pricing for a platform provider Draft
Open Platform settings and find the provider under Model providers. A Draft with no rate-card link shows Pricing required. Select Set pricing to open its pricing editor. The open action reads the current Draft and does not save metadata or prices. If the provider changed, the page refreshes the list instead of opening the stale provider.
Choose one of these actions:
- Save manual prices records exact input and output rates with a source URL.
- Use a saved rate card attaches an existing rate-card ID and version.
The two values form one rate-card link. A card with only one value or with malformed values shows Pricing status unavailable. Use Edit to correct the provider metadata and choose explicit pricing values before saving.
After a save, the page reads the provider list again and shows the saved rate-card ID and version. The provider becomes Available through the provider and credential checks.
Add a provider draft
Enter the provider's metadata. Use
openai,azure, oranthropicfor the provider type. Give the base URL as an HTTPS URL. For Azure, use the resource host without an API path. Add--rate-card-idand--rate-card-versiontogether when the runtime rate card exists.powershell$displayName = Read-Host "Provider display name" $providerType = Read-Host "Provider type: openai, azure, or anthropic" $providerBaseUrl = Read-Host "Provider HTTPS base URL" $deployment = Read-Host "Model deployment" $addOperationId = [guid]::NewGuid().ToString() agentweaver platform byok add ` --name $displayName ` --type $providerType ` --base-url $providerBaseUrl ` --model $deployment ` --operation-id $addOperationIdSave the
providerIdandrevisionfrom the JSON response. The API generates the provider ID. The display name can change.
Read and update provider metadata
List provider drafts and copy the provider ID:
powershellagentweaver platform byok listlistreads every page and returns oneprovidersarray. Use theproviderIdfield in later commands.Read the current provider metadata and revision:
powershell$providerId = Read-Host "Provider ID from list or add response" agentweaver platform byok show $providerIdPass
--credential-statusto read the provider's credential state and both revisions without returning key bytes:powershellagentweaver platform byok show $providerId --credential-statusThe command returns
scope,projectId(nullfor platform providers),providerId,providerRevision,state(not_set,enabled,disabled,pending, orquarantined), andcredentialRevision.Pass
--operation-id <uuid>instead of--credential-statusto read one credential operation's status without resending key material:powershellagentweaver platform byok show $providerId --operation-id $operationIdUse
agentweaver project byok show $providerId --project-id $projectId --operation-id $operationIdfor a project provider. The command returnsoperationId,scope,projectId,providerId,status(pending,publication_pending,published,quarantined,cancelled,disable_pending, ordisabled),providerRevision, andhasCredential, and exits0for any valid status.Enter the full metadata for the new revision. Copy optional values from
showwhen you want to keep them. If you omit--wire-api,--azure-api-version,--reasoning-effort, or--prompt-capacity-tokens, the update clears those values. Omitting the rate-card pair clears an existing attachment. Specify both options to keep or replace the attachment.powershell$expectedRevision = Read-Host "Current revision from show" $displayName = Read-Host "Provider display name" $providerType = Read-Host "Provider type: openai, azure, or anthropic" $providerBaseUrl = Read-Host "Provider HTTPS base URL" $deployment = Read-Host "Model deployment" $updateOperationId = [guid]::NewGuid().ToString() agentweaver platform byok update $providerId ` --expected-revision $expectedRevision ` --name $displayName ` --type $providerType ` --base-url $providerBaseUrl ` --model $deployment ` --operation-id $updateOperationId
The update response keeps the same providerId and shows the new name and revision. The name is display text, not a provider key.
Save and attach a runtime rate card
Search authenticated Azure Retail prices for a selected Project:
agentweaver project byok prices `
--project-id $projectId `
--region eastus `
--search gpt-4.1Use the selected meter IDs and expected USD-per-million values to build the version-1 Azure Retail rate-card request. To save a complete manual envelope instead, prepare its runtimeRateCardSchemaVersion, rateCard, and provenance fields. Save either file with its exact ID and version:
agentweaver platform byok save-prices $rateCardId $rateCardVersion `
--source azure-retail `
--input .\azure-rate-card.jsonUse --source manual for a manual envelope. The CLI sends the file unchanged, prints the validated receipt, and exits with code 1 for a conflict or failed pricing operation. A manual sourceUrl must be an HTTPS URL without user information, a query string, or a fragment.
Attach the exact returned ID and version to an add or update command. On an update, omit both options only when you intend to clear the attachment.
Set, recheck, or disable a credential
To upload or rotate a UTF-8 API key from redirected stdin (up to 8,192 bytes after stripping one final LF or CRLF):
$operationId = [guid]::NewGuid().ToString()
$apiKey | agentweaver platform byok set-key $providerId `
--from-stdin `
--expected-revision $providerRevision `
--operation-id $operationIdThe CLI checks the provider revision and confirms the operation ID is unused before reading stdin. If the upload response is lost, it checks operation status without resending the key.
Use the current provider and credential revisions for keyless maintenance:
agentweaver platform byok recheck-key $providerId `
--expected-revision $providerRevision `
--expected-credential-revision $credentialRevision `
--operation-id ([guid]::NewGuid().ToString())
agentweaver platform byok disable-key $providerId `
--expected-revision $providerRevision `
--expected-credential-revision $credentialRevision `
--operation-id ([guid]::NewGuid().ToString())recheck-key verifies the saved Vault version and current pricing attachment. It does not upload a key or create a Vault version. disable-key disables the credential slot and returns the provider to Draft. A quarantined or publication-pending receipt exits with code 1.
To cancel a pending credential operation without resending key material or passing revision options, pass --cancel with the original --operation-id:
agentweaver platform byok disable-key $providerId `
--operation-id $operationId `
--cancelCancellation returns cancelled when the operation is cancelled, or published without credentialVersion or configurationHash if the write already completed. If the server returns HTTP 409 or an uncertain outcome, check the operation status with agentweaver platform byok show $providerId --operation-id $operationId.
Activate or deactivate the platform default
Read platform byok list and use its settingsRevision. To switch new runs to an Available provider:
agentweaver platform byok activate $providerId `
--expected-revision $providerRevision `
--expected-settings-revision $settingsRevisionTo restore hosted Copilot as the platform default:
agentweaver platform byok deactivate `
--expected-settings-revision $settingsRevisionThe settings revision changes after a switch. Use the new value for the next switch. Accepted runs keep their saved selections.
Recover from a write result
If a write returns a conflict, read the current provider with show. Review its current revision and metadata before you create a new update. Use the current revision and a new operation ID for that update.
If the write result is uncertain or the CLI cancels the write, repeat the same command with the same operation ID and the same fields. The API replays the original write. Do not reuse that operation ID with changed fields.
If list or show reports model_provider_draft_metadata_requires_update, use the provider ID and revision from the error with update. Supply complete corrected metadata. The API does not return the rejected metadata.
Remove a provider through the API
Provider removal is an API operation. The native CLI does not expose a remove command. Send DELETE to the platform or project provider item route with a new UUID and the provider's current revision:
{
"operationId": "11111111-1111-4111-8111-111111111111",
"expectedRevision": 7
}Projects commits the exact request before Broker starts work. A 202 response means the removal is pending. Repeat the same request with the same operation ID and expected revision after an uncertain result. After Broker disables the slot and Projects records the terminal revision, the exact replay returns 204.
If the removed provider is the active platform default, acceptance restores hosted Copilot for new runs in the same transaction. Project defaults and task overrides retain their values. Runs accepted before removal retain their exact provider, key, and price pins.
Import model bindings as drafts
Import a model bindings file created by models byok plan --overlay-output. The command creates a platform Draft for each binding and returns its exact reference, providerId, creation revision, and operation ID. The Draft does not contain a key or price. Import does not activate a provider or remove a deployment binding.
The target Gateway must support authorized target context and provider reference reservations. Your account needs current unbound PlatformAdmin authority and the projects.admin scope. The Projects service must allow new reference reservations.
Keep the original bindings file and choose a new private context-file path. Obtain the intended installation ID from the installation owner through a trusted independent channel. The ID is a lowercase UUID.
In PowerShell, replace the paths and trusted ID, and capture the context:
powershell$file = 'C:\path\bindings.json' $context = 'C:\path\import-context.json' $trustedInstallationId = '<trusted-installation-id>' agentweaver models byok import-context --output $context if ($LASTEXITCODE -ne 0) { throw 'The target context was not saved.' } $capturedInstallationId = (Get-Content -Raw -LiteralPath $context -ErrorAction Stop | ConvertFrom-Json -ErrorAction Stop).installationId if ($capturedInstallationId -cne $trustedInstallationId) { throw 'The routed installation differs from the intended installation.' } $digest = (Get-FileHash -LiteralPath $file -Algorithm SHA256).Hash.ToLowerInvariant() $digestSave the displayed digest, the original context file, the bindings file, and the target options. Append the same target options to both commands. Run the import:
powershellagentweaver models byok import --model-bindings $file --file-sha256 $digest --expected-context $context
The CLI validates the complete file before creating a Draft. The output lists confirmed Drafts in completed and reports the first stopped row in stop. An unknown outcome means the write result needs recovery. Keep the original context, bindings file, digest, account, and target options. Retry the same command. The owner returns the original receipt and the CLI continues.
If the context file or digest is lost or uncertain, stop and reconcile with the original installation. Do not replace the context with a new capture to recover an uncertain write. A changed context, digest, or file is a new import attempt. A reference already reserved by another operation returns reference_conflict.
For incorrect metadata on a confirmed Draft, read its current revision and use platform byok update with complete corrected metadata and a new operation ID. Recover unknown rows first. To import remaining rows, make a new bindings file without confirmed references and with matching model rates, then calculate its new digest.
Check provider host egress requests
When you save a platform or project BYOK provider draft, Projects records an immutable host request for the saved HTTPS host on TCP port 443 and relays it to Environment. Environment stores an immutable receipt with state requested. Saving a provider does not approve egress, change network policy, or make the provider Available.
Each provider response includes an egress object with host, port, destinationState, canApprove, and deliveryStatus:
pending: Projects recorded the host request and has not yet received an Environment receipt.delivered: Environment confirmed the exact receipt;destinationStateisrequested.failed: Environment permanently rejected the request or returned a mismatched receipt.unavailable: Environment is unreachable or returned no status for the current revision; the saved provider metadata is still returned.
Historical operation replays return the saved metadata without egress.
Platform administrators with unbound PlatformAdmin authority can list current requested provider hosts at GET /api/v1/platform/egress/destinations. The endpoint pages receipts in stable order, omits hosts that are no longer on the provider's current revision, and returns 503 with no cursor advance when Projects proof is unavailable.
Next step
For command syntax, metadata fields, and API error behavior, see the Agentweaver CLI guide.
