Skip to content

Commit ba120a8

Browse files
committed
feat(api): Implement custom provider API integration
- Add CustomHandler for handling custom provider API requests - Add custom provider types and interfaces in shared/api.ts - Support streaming and non-streaming responses - Add token usage tracking and path-based response parsing - Add custom provider to buildApiHandler factory - Update API interfaces to support custom provider options
1 parent 9d2b0a3 commit ba120a8

File tree

3 files changed

+485
-3
lines changed

3 files changed

+485
-3
lines changed

src/api/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { MistralHandler } from "./providers/mistral"
1515
import { VsCodeLmHandler } from "./providers/vscode-lm"
1616
import { ApiStream } from "./transform/stream"
1717
import { UnboundHandler } from "./providers/unbound"
18+
import { CustomHandler } from "./providers/custom"
1819

1920
export interface SingleCompletionHandler {
2021
completePrompt(prompt: string): Promise<string>
@@ -56,6 +57,8 @@ export function buildApiHandler(configuration: ApiConfiguration): ApiHandler {
5657
return new MistralHandler(options)
5758
case "unbound":
5859
return new UnboundHandler(options)
60+
case "custom":
61+
return new CustomHandler(options) as unknown as ApiHandler // Type assertion since CustomHandler is compatible through transformation
5962
default:
6063
return new AnthropicHandler(options)
6164
}

0 commit comments

Comments
 (0)