Files
9router/open-sse/executors/opencode.js
decolua bb597cbced refactor(open-sse): source mimo-free/opencode base URL from PROVIDERS
CHAT_URL and opencode buildUrl base now read from PROVIDERS instead of repeating
the literal. Values identical; providers byte-for-byte + gate clean.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-13 20:40:43 +07:00

33 lines
876 B
JavaScript

import { BaseExecutor } from "./base.js";
import { PROVIDERS } from "../config/providers.js";
import { injectReasoningContent } from "../utils/reasoningContentInjector.js";
// Models that use /zen/v1/messages (claude format)
const MESSAGES_MODELS = new Set();
export class OpenCodeExecutor extends BaseExecutor {
constructor() {
super("opencode", PROVIDERS.opencode);
}
transformRequest(model, body) {
return injectReasoningContent({ provider: this.provider, model, body });
}
buildUrl(model) {
const base = this.config.baseUrl;
return MESSAGES_MODELS.has(model)
? `${base}/zen/v1/messages`
: `${base}/zen/v1/chat/completions`;
}
buildHeaders() {
return {
"Content-Type": "application/json",
"Authorization": "Bearer public",
"x-opencode-client": "desktop",
"Accept": "text/event-stream"
};
}
}