Provider (BYOK)
Scope: SessionRpc (per-session operations tied to a Session) For an overview of RPC and the list of all RPC pages, see RPC.// provider: get endpoint info for the provider the session uses (experimental)
// Used when calling the LLM backend directly in a BYOK (Bring Your Own Key) setup
use Revolution\Copilot\Types\Rpc\ProviderGetEndpointRequest;
$endpoint = $session->rpc()->provider()->getEndpoint();
// $endpoint->baseUrl - Base URL to pass to the LLM client library
// $endpoint->type - Provider type (openai, anthropic, etc.)
// $endpoint->headers - HTTP headers to include in requests
// $endpoint->apiKey - Credentials (nullable)
// $endpoint->sessionToken - Short-lived session credentials (nullable)
// $endpoint->wireApi - Provider-specific wire API (nullable)
// Get the provider configuration status of the selected model (doesn't validate credentials or contact the provider) (experimental)
$status = $session->rpc()->provider()->getStatus();
// $status->hasCustomProvider - Whether a custom provider is used instead of GitHub authentication
// Get the endpoint for a specific model
$endpoint = $session->rpc()->provider()->getEndpoint(
new ProviderGetEndpointRequest(model: 'gpt-5')
);
// provider: update the provider connection settings within the session (experimental)
$session->rpc()->provider()->updateProvider([
'provider' => ['name' => 'example', 'baseUrl' => 'https://example.com/v1'],
]);
// provider: update one model in the session, identified by provider and id (experimental)
$session->rpc()->provider()->updateModel([
'model' => ['provider' => 'example', 'id' => 'model', 'maxOutputTokens' => 4096],
]);
// Neither changes the saved configuration or other models.
// updateProvider keeps the existing credential and doesn't accept credentials or custom headers.
// You can also pass SessionProviderUpdateProviderRequest / SessionProviderUpdateModelRequest instead of an array.
// provider: withdraw host-managed models from the BYOK registry (experimental)
$result = $session->rpc()->provider()->withdraw(['models' => ['provider/model']]);
// $result->withdrawn, $result->providersRemoved, $result->modelDeselected