Skip to content
Open
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
16 changes: 11 additions & 5 deletions open-sse/executors/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,16 @@ export class GithubExecutor extends BaseExecutor {
async execute(options) {
const { model, log } = options;

// Only use /responses for models that are explicitly known to need it (e.g. gpt codex models)
// and that the /responses endpoint actually serves (excludes Gemini/Claude, see #1062).
if (this.knownCodexModels.has(model) && this.supportsResponsesEndpoint(model)) {
log?.debug("GITHUB", `Using cached /responses route for ${model}`);
const targetFormat = getModelTargetFormat("gh", model);
// Models with targetFormat "openai-responses": route directly to /responses.
// Covers both registry-declared models (GPT-5.x) and runtime-discovered codex
// models. Eliminates one round-trip vs. hitting /chat/completions first.
const shouldUseResponses =
targetFormat === "openai-responses" ||
(this.knownCodexModels.has(model) && this.supportsResponsesEndpoint(model));

if (shouldUseResponses && this.supportsResponsesEndpoint(model)) {
log?.debug("GITHUB", `Using /responses route for ${model}`);
return this.executeWithResponsesEndpoint(options);
}

Expand All @@ -203,7 +209,7 @@ export class GithubExecutor extends BaseExecutor {
// and the response_format-as-system-prompt workaround is unnecessary because
// /v1/messages honors JSON-mode natively. Skip sanitization for the native
// path. Port of decolua/9router#2608.
const isClaudeNative = getModelTargetFormat("gh", model) === "claude";
const isClaudeNative = targetFormat === "claude";

// Sanitize messages before sending to /chat/completions.
// This handles Claude models on GitHub Copilot which reject non-text/image_url
Expand Down
10 changes: 7 additions & 3 deletions open-sse/providers/registry/hcnsec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@ 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: [],
// Live discovery via /v1/models — exposes whatever the key has access to.
// Seed catalog provides offline fallback when discovery fails or returns empty.
models: [
{ id: "gpt-4o", name: "GPT-4o" },
{ id: "gpt-4o-mini", name: "GPT-4o Mini" },
{ id: "gpt-3.5-turbo", name: "GPT-3.5 Turbo" },
],
passthroughModels: true,
modelsFetcher: {
url: "https://api.hcnsec.cn/v1/models",
Expand Down