-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtypes.ts
More file actions
96 lines (85 loc) · 1.81 KB
/
types.ts
File metadata and controls
96 lines (85 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/**
* Type definitions for Claude Code Model Router
*/
export interface ModelConfig {
display_name: string;
provider: string;
model_id: string;
base_url: string;
api_key_env: string;
auth_header?: string;
supports_streaming?: boolean;
supports_tools?: boolean;
max_tokens?: number;
context_window?: number;
}
export interface GatewayConfig {
host: string;
port: number;
timeout: number;
enable_logging: boolean;
log_level: string;
}
export interface RouterConfig {
default_model: string;
models: Record<string, ModelConfig>;
aliases: Record<string, string>;
gateway: GatewayConfig;
}
export interface Message {
role: 'user' | 'assistant';
content: string | ContentBlock[];
}
export interface ContentBlock {
type: string;
text?: string;
[key: string]: unknown;
}
export interface MessagesRequest {
model: string;
messages: Message[];
max_tokens?: number;
system?: string | ContentBlock[];
temperature?: number;
top_p?: number;
top_k?: number;
stop_sequences?: string[];
stream?: boolean;
tools?: Tool[];
tool_choice?: Record<string, unknown>;
metadata?: Record<string, unknown>;
[key: string]: unknown;
}
export interface Tool {
name: string;
description: string;
input_schema: Record<string, unknown>;
}
export interface Usage {
input_tokens: number;
output_tokens: number;
cache_creation_input_tokens?: number;
cache_read_input_tokens?: number;
}
export interface MessagesResponse {
id: string;
type: 'message';
role: 'assistant';
content: ContentBlock[];
model: string;
stop_reason: string | null;
stop_sequence: string | null;
usage: Usage;
}
export interface ErrorResponse {
type: 'error';
error: {
type: string;
message: string;
};
}
export interface RouteInfo {
name: string;
config: ModelConfig;
apiKey: string;
}