This repository has been archived on 2026-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
ollie-core/backend/copilot.go

23 lines
592 B
Go

package backend
import (
"net/url"
)
// NewCopilot returns an OpenAI-compatible backend configured for the GitHub
// Copilot chat completions API. token is a short-lived Copilot bearer token.
func NewCopilot(token string) (*OpenAIBackend, error) {
u, _ := url.Parse("https://api.githubcopilot.com")
return &OpenAIBackend{
name: "copilot",
baseURL: u,
apiKey: token,
client: SharedClient("copilot:" + u.String()),
pathPrefix: "/",
extraHeaders: map[string]string{
"Openai-Intent": "conversation-edits",
"User-Agent": "opencode/local",
},
}, nil
}