MCPcopy
hub / github.com/ericc-ch/copilot-api / copilotHeaders

Function copilotHeaders

src/lib/api-config.ts:20–37  ·  view source on GitHub ↗
(state: State, vision: boolean = false)

Source from the content-addressed store, hash-verified

18 "https://api.githubcopilot.com"
19 : `https://api.${state.accountType}.githubcopilot.com`
20export const copilotHeaders = (state: State, vision: boolean = false) => {
21 const headers: Record<string, string> = {
22 Authorization: `Bearer ${state.copilotToken}`,
23 "content-type": standardHeaders()["content-type"],
24 "copilot-integration-id": "vscode-chat",
25 "editor-version": `vscode/${state.vsCodeVersion}`,
26 "editor-plugin-version": EDITOR_PLUGIN_VERSION,
27 "user-agent": USER_AGENT,
28 "openai-intent": "conversation-panel",
29 "x-github-api-version": API_VERSION,
30 "x-request-id": randomUUID(),
31 "x-vscode-user-agent-library-version": "electron-fetch",
32 }
33
34 if (vision) headers["copilot-vision-request"] = "true"
35
36 return headers
37}
38
39export const GITHUB_API_BASE_URL = "https://api.github.com"
40export const githubHeaders = (state: State) => ({

Callers 3

getModelsFunction · 0.90
createEmbeddingsFunction · 0.90
createChatCompletionsFunction · 0.90

Calls 1

standardHeadersFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…