Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
import type { ProviderWireProtocol } from '@cindy/model-providers';
export type CustomProviderCodexWireProtocol = Extract<
ProviderWireProtocol,
'openai-responses' | 'openai-chat' | 'anthropic-messages' | 'google-generative-ai'
>;
interface CustomProviderWireProtocolOption {
value: CustomProviderCodexWireProtocol;
labelKey: string;
helpKey: string;
defaultRequestPath: string;
}
export const CUSTOM_PROVIDER_CODEX_WIRE_PROTOCOLS = [
{
value: 'openai-responses',
labelKey: 'settings.providers.custom.wireProtocol.responses',
helpKey: 'settings.providers.custom.wireProtocol.responsesHelp',
defaultRequestPath: '/responses',
},
{
value: 'openai-chat',
labelKey: 'settings.providers.custom.wireProtocol.chat',
helpKey: 'settings.providers.custom.wireProtocol.chatHelp',
defaultRequestPath: '/chat/completions',
},
{
value: 'anthropic-messages',
labelKey: 'settings.providers.custom.wireProtocol.anthropic',
helpKey: 'settings.providers.custom.wireProtocol.anthropicHelp',
defaultRequestPath: '/v1/messages',
},
{
value: 'google-generative-ai',
labelKey: 'settings.providers.custom.modelProtocol.google',
helpKey: 'settings.providers.custom.wireProtocol.googleHelp',
defaultRequestPath: '',
},
] as const satisfies readonly CustomProviderWireProtocolOption[];
export function customProviderCodexWireProtocolOption(
protocol: ProviderWireProtocol,
): (typeof CUSTOM_PROVIDER_CODEX_WIRE_PROTOCOLS)[number] {
return CUSTOM_PROVIDER_CODEX_WIRE_PROTOCOLS.find((option) => option.value === protocol)
?? CUSTOM_PROVIDER_CODEX_WIRE_PROTOCOLS[0];
}