GitHub Copilot: auto-enable models, fix gpt-5 API, normalize tool call IDs

- Auto-enable all models after /login via POST /models/{model}/policy
- Use openai-responses API for gpt-5/o3/o4 models (not accessible via completions)
- Normalize tool call IDs when switching between github-copilot models with different APIs
  (fixes #198: openai-responses generates 450+ char IDs with special chars that break other models)
- Update README with streamlined GitHub Copilot docs
This commit is contained in:
Mario Zechner 2025-12-15 20:03:51 +01:00
parent 16c8861842
commit c5543f7586
7 changed files with 216 additions and 127 deletions

View file

@ -317,10 +317,13 @@ async function loadModelsDevData(): Promise<Model<any>[]> {
if (m.tool_call !== true) continue;
if (m.status === "deprecated") continue;
// gpt-5 models require responses API, others use completions
const needsResponsesApi = modelId.startsWith("gpt-5");
const copilotModel: Model<any> = {
id: modelId,
name: m.name || modelId,
api: "openai-completions",
api: needsResponsesApi ? "openai-responses" : "openai-completions",
provider: "github-copilot",
baseUrl: "https://api.individual.githubcopilot.com",
reasoning: m.reasoning === true,
@ -334,11 +337,14 @@ async function loadModelsDevData(): Promise<Model<any>[]> {
contextWindow: m.limit?.context || 128000,
maxTokens: m.limit?.output || 8192,
headers: { ...COPILOT_STATIC_HEADERS },
compat: {
supportsStore: false,
supportsDeveloperRole: false,
supportsReasoningEffort: false,
},
// compat only applies to openai-completions
...(needsResponsesApi ? {} : {
compat: {
supportsStore: false,
supportsDeveloperRole: false,
supportsReasoningEffort: false,
},
}),
};
models.push(copilotModel);