Skip to content
Merged
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
5 changes: 4 additions & 1 deletion src/CodexAcpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ export class CodexAcpClient {
if (!gatewaySettings) throw RequestError.invalidRequest();

const baseUrl = gatewaySettings.baseUrl;
const providerName = typeof gatewaySettings.providerName === "string" && gatewaySettings.providerName.trim().length > 0
? gatewaySettings.providerName
: "User-provided gateway";
const headers: Record<string, string> = {
"X-Client-Feature-ID": "codex",
...gatewaySettings.headers
Expand All @@ -110,7 +113,7 @@ export class CodexAcpClient {
this.gatewayConfig = {
modelProvider: "custom-gateway",
config: {
name: "User-provided gateway",
name: providerName,
base_url: baseUrl,
http_headers: headers,
wire_api: "responses"
Expand Down
3 changes: 2 additions & 1 deletion src/CodexAuthMethod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export interface GatewayAuthRequest extends AuthenticateRequest {
"gateway": {
baseUrl: string;
headers: Record<string, string>;
providerName?: string;
}
};
}
Expand All @@ -59,4 +60,4 @@ export type CodexAuthRequest = ApiKeyAuthRequest | ChatGPTAuthRequest | GatewayA

export function isCodexAuthRequest(request: AuthenticateRequest): request is CodexAuthRequest {
return request.methodId === "api-key" || request.methodId === "chat-gpt" || request.methodId === "gateway";
}
}
Loading