Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion open-sse/executors/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,26 @@ export class GithubExecutor extends BaseExecutor {
}

buildUrl(model, stream, urlIndex = 0) {
const targetFormat = getModelTargetFormat("gh", model);

// Claude models: route to Copilot's Anthropic-native /v1/messages shim — the
// only Copilot endpoint that surfaces prompt-cache token counts for Claude
// and avoids a lossy round-trip of tool_use/tool_result/thinking content
// blocks through the OpenAI shape. Driven by the registry's per-model
// targetFormat (see registry/github.js), which chatCore also uses to
// translate the request to Claude shape before the executor ever sees it.
// Port of decolua/9router#2608.
if (getModelTargetFormat("gh", model) === "claude" && this.config.messagesUrl) {
if (targetFormat === "claude" && this.config.messagesUrl) {
return this.config.messagesUrl;
}

// OpenAI Responses models: route to Copilot's /responses endpoint, which
// serves newer GPT models and provides the correct response format for
// models marked with targetFormat: "openai-responses" in the registry.
if (targetFormat === "openai-responses" && this.config.responsesUrl) {
return this.config.responsesUrl;
}

return this.config.baseUrl;
}

Expand Down
13 changes: 10 additions & 3 deletions open-sse/providers/registry/hcnsec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,16 @@ export default {
scheme: "bearer",
},
},
// Live discovery only — /v1/models exposes whatever the key has access to.
// Empty seed catalog; passthroughModels allows any model id.
models: [],
// Seed catalog — offline fallback when live /v1/models fetch fails.
// Typical models available on HCNSEC platform (exact catalog varies by API key).
// Live discovery via modelsFetcher provides the real-time list.
models: [
{ id: "gpt-4o", name: "GPT-4o" },
{ id: "gpt-4o-mini", name: "GPT-4o Mini" },
{ id: "claude-sonnet-4.5", name: "Claude Sonnet 4.5" },
{ id: "deepseek-v3", name: "DeepSeek V3" },
{ id: "glm-5", name: "GLM 5" },
],
passthroughModels: true,
modelsFetcher: {
url: "https://api.hcnsec.cn/v1/models",
Expand Down