> ## Documentation Index
> Fetch the complete documentation index at: https://kawax.biz/llms.txt
> Use this file to discover all available pages before exploring further.

# Provider (BYOK)

> Use SessionRpc in Laravel Copilot SDK to work with a per-session provider (BYOK).

## 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](https://kawax.biz/en/packages/laravel-copilot-sdk/rpc.md).

```php theme={null}
// 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
```


## Related topics

- [RPC (Remote Procedure Call)](https://kawax.biz/en/packages/laravel-copilot-sdk/rpc.md)
- [Custom providers](https://kawax.biz/en/packages/laravel-copilot-sdk/custom-providers.md)
- [Authentication - GitHub Copilot SDK for Laravel](https://kawax.biz/en/packages/laravel-copilot-sdk/auth.md)
- [Service providers](https://kawax.biz/en/service-providers.md)
- [Deferred Service Providers](https://kawax.biz/en/advanced/deferred-provider.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.