@@ -26,6 +26,7 @@ import (
2626 "github.com/charmbracelet/crush/internal/log"
2727 "github.com/charmbracelet/crush/internal/lsp"
2828 "github.com/charmbracelet/crush/internal/message"
29+ "github.com/charmbracelet/crush/internal/oauth/copilot"
2930 "github.com/charmbracelet/crush/internal/permission"
3031 "github.com/charmbracelet/crush/internal/session"
3132 "golang.org/x/sync/errgroup"
@@ -582,15 +583,23 @@ func (c *coordinator) buildOpenrouterProvider(_, apiKey string, headers map[stri
582583 return openrouter.New(opts...)
583584}
584585
585−func (c *coordinator) buildOpenaiCompatProvider(baseURL, apiKey string, headers map[string]string, extraBody map[string]any) (fantasy.Provider, error) {
586+func (c *coordinator) buildOpenaiCompatProvider(baseURL, apiKey string, headers map[string]string, extraBody map[string]any, providerID string) (fantasy.Provider, error) {
586587 opts := []openaicompat.Option{
587588 openaicompat.WithBaseURL(baseURL),
588589 openaicompat.WithAPIKey(apiKey),
589590 }
590− if c.cfg.Options.Debug {
591− httpClient := log.NewHTTPClient()
591+
592+ // Set HTTP client based on provider and debug mode.
593+ var httpClient *http.Client
594+ if providerID == string(catwalk.InferenceProviderCopilot) {
595+ httpClient = copilot.NewClient(c.cfg.Options.Debug)
596+ } else if c.cfg.Options.Debug {
597+ httpClient = log.NewHTTPClient()
598+ }
599+ if httpClient != nil {
592600 opts = append(opts, openaicompat.WithHTTPClient(httpClient))
593601 }
602+
594603 if len(headers) > 0 {
595604 opts = append(opts, openaicompat.WithHeaders(headers))
596605 }
@@ -745,7 +754,7 @@ func (c *coordinator) buildProvider(providerCfg config.ProviderConfig, model con
745754 }
746755 providerCfg.ExtraBody["tool_stream"] = true
747756 }
748− return c.buildOpenaiCompatProvider(baseURL, apiKey, headers, providerCfg.ExtraBody)
757+ return c.buildOpenaiCompatProvider(baseURL, apiKey, headers, providerCfg.ExtraBody, providerCfg.ID)
749758 case hyper.Name:
750759 return c.buildHyperProvider(baseURL, apiKey)
751760 default: