package
A module used for interacting with the GitHub Copilot API.
npm install @vscode/copilot-apiGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Estimated unpacked size across 1 packages.
101.1 kB
Includes dependencies.
A module used for interacting with the GitHub Copilot API.
With npm:
npm install @vscode/copilot-apiWith yarn:
yarn add @vscode/copilot-apiimport { CAPIClient, RequestType } from '@vscode/copilot-api';
// Create a new client instance
const client = new CAPIClient(editorDetails, license, optionalFetcherService);
// Update domains (if needed)
const domainChanges = client.updateDomains(copilotToken, enterpriseUrlConfig);
// Make requests
const response = await client.makeRequest(fetchOptions, RequestType.ChatCompletions);RequestType.CopilotToken - Get Copilot tokenRequestType.ChatCompletions - Chat completionsRequestType.RemoteAgent - Remote agent requestsRequestType.Embeddings - EmbeddingsRequestType.Models - Available modelsRequestType.CCAModelsList - Get available models for Copilot coding agentRequestType.Chunks - Code chunksRequestType.EmbeddingsCodeSearch - Embeddings code searchRequestType.ListSkills - List available skillsRequestType.SearchSkill - Search skillsRequestType.ContentExclusion - Content exclusionRequestType.Telemetry - TelemetryRequestType.CopilotUserInfo - User infoRequestType.OriginTracker - Origin trackingThe package is built using esbuild to create a single platform-neutral ESM module that works in both Node.js and web environments:
# Build for production (minified)
npm run build
# Build for development (unminified)
npm run build:dev
# Clean build artifacts
npm run cleandist/index.js - Platform-neutral ESM builddist/index.d.ts - TypeScript declarationsThe package is configured with a simplified ESM export structure:
{
"exports": {
"import": "./dist/index.js",
"types": "./dist/index.d.ts"
}
}This project uses Vitest for testing. Run tests with:
# Run tests once
npm test
# Run tests in watch mode
npm run test:watchmicrosoft1es
npmjs@microsoft.com