Skip to content
Open
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
7 changes: 7 additions & 0 deletions Taskfile.curl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ tasks:
cmds:
- echo "{{.GREETING}}"
silent: true

model-list:
cmds:
- |
curl -s -X GET "http://localhost:12580/tingly/openai/v1/models" \
-H "Authorization: Bearer {{.TINGLY_BOX_KEY}}" \
-H "Content-Type: application/json"

codex-image-gen:
cmds:
Expand Down
61 changes: 12 additions & 49 deletions frontend/src/types/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,22 @@
*/

// OpenAI format models
export interface ModelDetail {
description?: string;
context?: number;
max_tokens?: number;
max_completion_tokens?: number;
input_modalities?: string[];
output_modalities?: string[];
auth_type?: string;
}

export interface OpenAIModel {
id: string;
object: string;
created: number;
owned_by: string;
description?: string;
context?: number;
max_output?: number;
auth_type?: string;
detail?: ModelDetail;
}

export interface OpenAIModelsResponse {
Expand All @@ -25,53 +32,9 @@ export interface AnthropicModel {
created_at: string;
display_name: string;
type: string;
capabilities?: ModelCapabilities;
max_input_tokens?: number;
max_tokens?: number;
description?: string;
auth_type?: string;
}

export interface ModelCapabilities {
batch: CapabilitySupport;
citations: CapabilitySupport;
code_execution: CapabilitySupport;
context_management?: ContextManagementCapability;
effort?: EffortCapability;
image_input: CapabilitySupport;
pdf_input: CapabilitySupport;
structured_outputs: CapabilitySupport;
thinking?: ThinkingCapability;
}

export interface CapabilitySupport {
supported: boolean;
}

export interface ContextManagementCapability {
supported: boolean;
clear_thinking_20251015?: CapabilitySupport;
clear_tool_uses_20250919?: CapabilitySupport;
compact_20260112?: CapabilitySupport;
}

export interface EffortCapability {
supported: boolean;
low?: CapabilitySupport;
medium?: CapabilitySupport;
high?: CapabilitySupport;
xhigh?: CapabilitySupport;
max?: CapabilitySupport;
}

export interface ThinkingCapability {
supported: boolean;
types?: ThinkingTypes;
}

export interface ThinkingTypes {
adaptive: CapabilitySupport;
enabled: CapabilitySupport;
detail?: ModelDetail;
}

export interface AnthropicModelsResponse {
Expand Down
12 changes: 6 additions & 6 deletions internal/data/provider_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type ModelInfo struct {
ID string `json:"id"`
Description string `json:"description,omitempty"`
Context int `json:"context,omitempty"`
MaxOutput int `json:"max_output,omitempty"`
MaxTokens int `json:"max_tokens,omitempty"`
}

// NamingRules defines the naming conventions for provider IDs
Expand Down Expand Up @@ -734,7 +734,7 @@ func (tm *TemplateManager) findEmbeddedTemplateByProvider(provider *typ.Provider
// using the provider templates. If templates are not available, falls back to
// the global default.
// It checks in order:
// 1. Exact match in Models array (ModelInfo.MaxOutput)
// 1. Exact match in Models array (ModelInfo.MaxTokens)
// 2. ModelCapacities override (for capacity-based limits)
// 3. Global default
func (tm *TemplateManager) GetMaxTokensForModel(provider, model string) int {
Expand All @@ -744,8 +744,8 @@ func (tm *TemplateManager) GetMaxTokensForModel(provider, model string) int {
if tmpl != nil {
// NEW: Check Models array for MaxOutput
for _, m := range tmpl.Models {
if m.ID == model && m.MaxOutput > 0 {
return m.MaxOutput
if m.ID == model && m.MaxTokens > 0 {
return m.MaxTokens
}
}
// Fallback to ModelCapacities (for capacity-based limits)
Expand Down Expand Up @@ -774,8 +774,8 @@ func (tm *TemplateManager) GetMaxTokensForModelByProvider(provider *typ.Provider
if tmpl != nil {
// NEW: Check Models array for MaxOutput
for _, m := range tmpl.Models {
if m.ID == model && m.MaxOutput > 0 {
return m.MaxOutput
if m.ID == model && m.MaxTokens > 0 {
return m.MaxTokens
}
}
// Fallback to ModelCapacities (for capacity-based limits)
Expand Down
Loading