ai

package module
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const NonVisionToolImagePlaceholder = "(tool image omitted: model does not support images)"
View Source
const NonVisionUserImagePlaceholder = "(image omitted: model does not support images)"

Variables

View Source
var Models = map[Provider]map[string]Model[API]{
	ProviderOpenAI: {
		"gpt-4": {
			ID:        "gpt-4",
			Name:      "GPT-4",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: false,
			Input:     []string{"text"},
			Cost: Cost{
				Input:      decimal.MustParse("30"),
				Output:     decimal.MustParse("60"),
				CacheRead:  decimal.MustParse("0"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 8192,
			MaxTokens:     8192,
		},
		"gpt-4-turbo": {
			ID:        "gpt-4-turbo",
			Name:      "GPT-4 Turbo",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: false,
			Input:     []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("10"),
				Output:     decimal.MustParse("30"),
				CacheRead:  decimal.MustParse("0"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 128000,
			MaxTokens:     4096,
		},
		"gpt-4.1": {
			ID:        "gpt-4.1",
			Name:      "GPT-4.1",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: false,
			Input:     []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("2"),
				Output:     decimal.MustParse("8"),
				CacheRead:  decimal.MustParse("0.5"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 1047576,
			MaxTokens:     32768,
		},
		"gpt-4.1-mini": {
			ID:        "gpt-4.1-mini",
			Name:      "GPT-4.1 mini",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: false,
			Input:     []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("0.4"),
				Output:     decimal.MustParse("1.6"),
				CacheRead:  decimal.MustParse("0.1"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 1047576,
			MaxTokens:     32768,
		},
		"gpt-4.1-nano": {
			ID:        "gpt-4.1-nano",
			Name:      "GPT-4.1 nano",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: false,
			Input:     []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("0.1"),
				Output:     decimal.MustParse("0.4"),
				CacheRead:  decimal.MustParse("0.03"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 1047576,
			MaxTokens:     32768,
		},
		"gpt-4o": {
			ID:        "gpt-4o",
			Name:      "GPT-4o",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: false,
			Input:     []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("2.5"),
				Output:     decimal.MustParse("10"),
				CacheRead:  decimal.MustParse("1.25"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 128000,
			MaxTokens:     16384,
		},
		"gpt-4o-2024-05-13": {
			ID:        "gpt-4o-2024-05-13",
			Name:      "GPT-4o (2024-05-13)",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: false,
			Input:     []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("5"),
				Output:     decimal.MustParse("15"),
				CacheRead:  decimal.MustParse("0"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 128000,
			MaxTokens:     4096,
		},
		"gpt-4o-2024-08-06": {
			ID:        "gpt-4o-2024-08-06",
			Name:      "GPT-4o (2024-08-06)",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: false,
			Input:     []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("2.5"),
				Output:     decimal.MustParse("10"),
				CacheRead:  decimal.MustParse("1.25"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 128000,
			MaxTokens:     16384,
		},
		"gpt-4o-2024-11-20": {
			ID:        "gpt-4o-2024-11-20",
			Name:      "GPT-4o (2024-11-20)",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: false,
			Input:     []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("2.5"),
				Output:     decimal.MustParse("10"),
				CacheRead:  decimal.MustParse("1.25"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 128000,
			MaxTokens:     16384,
		},
		"gpt-4o-mini": {
			ID:        "gpt-4o-mini",
			Name:      "GPT-4o mini",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: false,
			Input:     []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("0.15"),
				Output:     decimal.MustParse("0.6"),
				CacheRead:  decimal.MustParse("0.08"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 128000,
			MaxTokens:     16384,
		},
		"gpt-5": {
			ID:        "gpt-5",
			Name:      "GPT-5",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			ThinkingLevelMap: ThinkingLevelMap{
				ThinkingLevelOff: nil,
			},
			Input: []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("1.25"),
				Output:     decimal.MustParse("10"),
				CacheRead:  decimal.MustParse("0.125"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 400000,
			MaxTokens:     128000,
		},
		"gpt-5-chat-latest": {
			ID:        "gpt-5-chat-latest",
			Name:      "GPT-5 Chat Latest",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: false,
			ThinkingLevelMap: ThinkingLevelMap{
				ThinkingLevelOff: nil,
			},
			Input: []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("1.25"),
				Output:     decimal.MustParse("10"),
				CacheRead:  decimal.MustParse("0.125"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 128000,
			MaxTokens:     16384,
		},
		"gpt-5-codex": {
			ID:        "gpt-5-codex",
			Name:      "GPT-5-Codex",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			ThinkingLevelMap: ThinkingLevelMap{
				ThinkingLevelOff: nil,
			},
			Input: []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("1.25"),
				Output:     decimal.MustParse("10"),
				CacheRead:  decimal.MustParse("0.125"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 400000,
			MaxTokens:     128000,
		},
		"gpt-5-mini": {
			ID:        "gpt-5-mini",
			Name:      "GPT-5 Mini",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			ThinkingLevelMap: ThinkingLevelMap{
				ThinkingLevelOff: nil,
			},
			Input: []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("0.25"),
				Output:     decimal.MustParse("2"),
				CacheRead:  decimal.MustParse("0.025"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 400000,
			MaxTokens:     128000,
		},
		"gpt-5-nano": {
			ID:        "gpt-5-nano",
			Name:      "GPT-5 Nano",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			ThinkingLevelMap: ThinkingLevelMap{
				ThinkingLevelOff: nil,
			},
			Input: []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("0.05"),
				Output:     decimal.MustParse("0.4"),
				CacheRead:  decimal.MustParse("0.005"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 400000,
			MaxTokens:     128000,
		},
		"gpt-5-pro": {
			ID:        "gpt-5-pro",
			Name:      "GPT-5 Pro",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			ThinkingLevelMap: ThinkingLevelMap{
				ThinkingLevelOff: nil,
			},
			Input: []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("15"),
				Output:     decimal.MustParse("120"),
				CacheRead:  decimal.MustParse("0"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 400000,
			MaxTokens:     272000,
		},
		"gpt-5.1": {
			ID:        "gpt-5.1",
			Name:      "GPT-5.1",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			ThinkingLevelMap: ThinkingLevelMap{
				ThinkingLevelOff: nil,
			},
			Input: []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("1.25"),
				Output:     decimal.MustParse("10"),
				CacheRead:  decimal.MustParse("0.13"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 400000,
			MaxTokens:     128000,
		},
		"gpt-5.1-chat-latest": {
			ID:        "gpt-5.1-chat-latest",
			Name:      "GPT-5.1 Chat",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			ThinkingLevelMap: ThinkingLevelMap{
				ThinkingLevelOff: nil,
			},
			Input: []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("1.25"),
				Output:     decimal.MustParse("10"),
				CacheRead:  decimal.MustParse("0.125"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 128000,
			MaxTokens:     16384,
		},
		"gpt-5.1-codex": {
			ID:        "gpt-5.1-codex",
			Name:      "GPT-5.1 Codex",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			ThinkingLevelMap: ThinkingLevelMap{
				ThinkingLevelOff: nil,
			},
			Input: []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("1.25"),
				Output:     decimal.MustParse("10"),
				CacheRead:  decimal.MustParse("0.125"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 400000,
			MaxTokens:     128000,
		},
		"gpt-5.1-codex-max": {
			ID:        "gpt-5.1-codex-max",
			Name:      "GPT-5.1 Codex Max",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			ThinkingLevelMap: ThinkingLevelMap{
				ThinkingLevelOff: nil,
			},
			Input: []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("1.25"),
				Output:     decimal.MustParse("10"),
				CacheRead:  decimal.MustParse("0.125"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 400000,
			MaxTokens:     128000,
		},
		"gpt-5.1-codex-mini": {
			ID:        "gpt-5.1-codex-mini",
			Name:      "GPT-5.1 Codex mini",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			ThinkingLevelMap: ThinkingLevelMap{
				ThinkingLevelOff: nil,
			},
			Input: []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("0.25"),
				Output:     decimal.MustParse("2"),
				CacheRead:  decimal.MustParse("0.025"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 400000,
			MaxTokens:     128000,
		},
		"gpt-5.2": {
			ID:        "gpt-5.2",
			Name:      "GPT-5.2",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			ThinkingLevelMap: ThinkingLevelMap{
				ThinkingLevelOff:   nil,
				ThinkingLevelXHigh: modelThinkingLevel("xhigh"),
			},
			Input: []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("1.75"),
				Output:     decimal.MustParse("14"),
				CacheRead:  decimal.MustParse("0.175"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 400000,
			MaxTokens:     128000,
		},
		"gpt-5.2-chat-latest": {
			ID:        "gpt-5.2-chat-latest",
			Name:      "GPT-5.2 Chat",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			ThinkingLevelMap: ThinkingLevelMap{
				ThinkingLevelOff:   nil,
				ThinkingLevelXHigh: modelThinkingLevel("xhigh"),
			},
			Input: []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("1.75"),
				Output:     decimal.MustParse("14"),
				CacheRead:  decimal.MustParse("0.175"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 128000,
			MaxTokens:     16384,
		},
		"gpt-5.2-codex": {
			ID:        "gpt-5.2-codex",
			Name:      "GPT-5.2 Codex",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			ThinkingLevelMap: ThinkingLevelMap{
				ThinkingLevelOff:   nil,
				ThinkingLevelXHigh: modelThinkingLevel("xhigh"),
			},
			Input: []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("1.75"),
				Output:     decimal.MustParse("14"),
				CacheRead:  decimal.MustParse("0.175"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 400000,
			MaxTokens:     128000,
		},
		"gpt-5.2-pro": {
			ID:        "gpt-5.2-pro",
			Name:      "GPT-5.2 Pro",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			ThinkingLevelMap: ThinkingLevelMap{
				ThinkingLevelOff:   nil,
				ThinkingLevelXHigh: modelThinkingLevel("xhigh"),
			},
			Input: []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("21"),
				Output:     decimal.MustParse("168"),
				CacheRead:  decimal.MustParse("0"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 400000,
			MaxTokens:     128000,
		},
		"gpt-5.3-chat-latest": {
			ID:        "gpt-5.3-chat-latest",
			Name:      "GPT-5.3 Chat (latest)",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: false,
			ThinkingLevelMap: ThinkingLevelMap{
				ThinkingLevelOff:   nil,
				ThinkingLevelXHigh: modelThinkingLevel("xhigh"),
			},
			Input: []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("1.75"),
				Output:     decimal.MustParse("14"),
				CacheRead:  decimal.MustParse("0.175"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 128000,
			MaxTokens:     16384,
		},
		"gpt-5.3-codex": {
			ID:        "gpt-5.3-codex",
			Name:      "GPT-5.3 Codex",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			ThinkingLevelMap: ThinkingLevelMap{
				ThinkingLevelOff:   nil,
				ThinkingLevelXHigh: modelThinkingLevel("xhigh"),
			},
			Input: []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("1.75"),
				Output:     decimal.MustParse("14"),
				CacheRead:  decimal.MustParse("0.175"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 400000,
			MaxTokens:     128000,
		},
		"gpt-5.3-codex-spark": {
			ID:        "gpt-5.3-codex-spark",
			Name:      "GPT-5.3 Codex Spark",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			ThinkingLevelMap: ThinkingLevelMap{
				ThinkingLevelOff:   nil,
				ThinkingLevelXHigh: modelThinkingLevel("xhigh"),
			},
			Input: []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("1.75"),
				Output:     decimal.MustParse("14"),
				CacheRead:  decimal.MustParse("0.175"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 128000,
			MaxTokens:     32000,
		},
		"gpt-5.4": {
			ID:        "gpt-5.4",
			Name:      "GPT-5.4",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			ThinkingLevelMap: ThinkingLevelMap{
				ThinkingLevelOff:   nil,
				ThinkingLevelXHigh: modelThinkingLevel("xhigh"),
			},
			Input: []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("2.5"),
				Output:     decimal.MustParse("15"),
				CacheRead:  decimal.MustParse("0.25"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 272000,
			MaxTokens:     128000,
		},
		"gpt-5.4-mini": {
			ID:        "gpt-5.4-mini",
			Name:      "GPT-5.4 mini",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			ThinkingLevelMap: ThinkingLevelMap{
				ThinkingLevelOff:   nil,
				ThinkingLevelXHigh: modelThinkingLevel("xhigh"),
			},
			Input: []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("0.75"),
				Output:     decimal.MustParse("4.5"),
				CacheRead:  decimal.MustParse("0.075"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 400000,
			MaxTokens:     128000,
		},
		"gpt-5.4-nano": {
			ID:        "gpt-5.4-nano",
			Name:      "GPT-5.4 nano",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			ThinkingLevelMap: ThinkingLevelMap{
				ThinkingLevelOff:   nil,
				ThinkingLevelXHigh: modelThinkingLevel("xhigh"),
			},
			Input: []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("0.2"),
				Output:     decimal.MustParse("1.25"),
				CacheRead:  decimal.MustParse("0.02"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 400000,
			MaxTokens:     128000,
		},
		"gpt-5.4-pro": {
			ID:        "gpt-5.4-pro",
			Name:      "GPT-5.4 Pro",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			ThinkingLevelMap: ThinkingLevelMap{
				ThinkingLevelOff:   nil,
				ThinkingLevelXHigh: modelThinkingLevel("xhigh"),
			},
			Input: []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("30"),
				Output:     decimal.MustParse("180"),
				CacheRead:  decimal.MustParse("0"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 1050000,
			MaxTokens:     128000,
		},
		"gpt-5.5": {
			ID:        "gpt-5.5",
			Name:      "GPT-5.5",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			ThinkingLevelMap: ThinkingLevelMap{
				ThinkingLevelOff:   nil,
				ThinkingLevelXHigh: modelThinkingLevel("xhigh"),
			},
			Input: []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("5"),
				Output:     decimal.MustParse("30"),
				CacheRead:  decimal.MustParse("0.5"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 272000,
			MaxTokens:     128000,
		},
		"gpt-5.5-pro": {
			ID:        "gpt-5.5-pro",
			Name:      "GPT-5.5 Pro",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			ThinkingLevelMap: ThinkingLevelMap{
				ThinkingLevelOff:   nil,
				ThinkingLevelXHigh: modelThinkingLevel("xhigh"),
			},
			Input: []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("30"),
				Output:     decimal.MustParse("180"),
				CacheRead:  decimal.MustParse("0"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 1050000,
			MaxTokens:     128000,
		},
		"o1": {
			ID:        "o1",
			Name:      "o1",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			Input:     []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("15"),
				Output:     decimal.MustParse("60"),
				CacheRead:  decimal.MustParse("7.5"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 200000,
			MaxTokens:     100000,
		},
		"o1-pro": {
			ID:        "o1-pro",
			Name:      "o1-pro",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			Input:     []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("150"),
				Output:     decimal.MustParse("600"),
				CacheRead:  decimal.MustParse("0"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 200000,
			MaxTokens:     100000,
		},
		"o3": {
			ID:        "o3",
			Name:      "o3",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			Input:     []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("2"),
				Output:     decimal.MustParse("8"),
				CacheRead:  decimal.MustParse("0.5"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 200000,
			MaxTokens:     100000,
		},
		"o3-deep-research": {
			ID:        "o3-deep-research",
			Name:      "o3-deep-research",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			Input:     []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("10"),
				Output:     decimal.MustParse("40"),
				CacheRead:  decimal.MustParse("2.5"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 200000,
			MaxTokens:     100000,
		},
		"o3-mini": {
			ID:        "o3-mini",
			Name:      "o3-mini",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			Input:     []string{"text"},
			Cost: Cost{
				Input:      decimal.MustParse("1.1"),
				Output:     decimal.MustParse("4.4"),
				CacheRead:  decimal.MustParse("0.55"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 200000,
			MaxTokens:     100000,
		},
		"o3-pro": {
			ID:        "o3-pro",
			Name:      "o3-pro",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			Input:     []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("20"),
				Output:     decimal.MustParse("80"),
				CacheRead:  decimal.MustParse("0"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 200000,
			MaxTokens:     100000,
		},
		"o4-mini": {
			ID:        "o4-mini",
			Name:      "o4-mini",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			Input:     []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("1.1"),
				Output:     decimal.MustParse("4.4"),
				CacheRead:  decimal.MustParse("0.28"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 200000,
			MaxTokens:     100000,
		},
		"o4-mini-deep-research": {
			ID:        "o4-mini-deep-research",
			Name:      "o4-mini-deep-research",
			API:       APIOpenAIResponses,
			Provider:  ProviderOpenAI,
			BaseURL:   "https://api.openai.com/v1",
			Reasoning: true,
			Input:     []string{"text", "image"},
			Cost: Cost{
				Input:      decimal.MustParse("2"),
				Output:     decimal.MustParse("8"),
				CacheRead:  decimal.MustParse("0.5"),
				CacheWrite: decimal.MustParse("0"),
			},
			ContextWindow: 200000,
			MaxTokens:     100000,
		},
	},
}
View Source
var OpenAIToolCallProviders = map[Provider]struct{}{
	ProviderOpenAI: {},
}

Functions

func BuildOpenAIResponsesParams

func BuildOpenAIResponsesParams(
	model Model[API],
	modelContext ModelContext,
	options *OpenAIResponseOptions,
) (responses.ResponseNewParams, error)

func CleanupSessionResources

func CleanupSessionResources(sessionID *string) error

func ClearApiProviders

func ClearApiProviders()

func ConvertResponsesMessages

func ConvertResponsesMessages(model Model[API], modelContext ModelContext, providers map[Provider]struct{}, options ConvertResponseMessagesOptions) (responses.ResponseInputParam, error)

func ConvertResponsesTools

func ConvertResponsesTools(
	tools []*Tool,
	options *ConvertResponsesToolsOptions,
) ([]responses.ToolUnionParam, error)

func CreateOpenAIResponsesClient

func CreateOpenAIResponsesClient(
	model Model[API],
	modelContext ModelContext,
	apiKey *string,
	optionHeaders *map[string]string,
	sessionID *string,
) (openai.Client, error)

func EncodeTextSignatureV1

func EncodeTextSignatureV1(id string, phase *TextSignaturePhase) string

func ModelsAreEqual

func ModelsAreEqual[TApi API](a *Model[TApi], b *Model[TApi]) bool

func RegisterApiProvider

func RegisterApiProvider[TApi API](provider ApiProvider[TApi, StreamOptions], sourceID *string)

func RegisterSessionResourceCleanup

func RegisterSessionResourceCleanup(cleanup SessionResourceCleanup) func()

func UnregisterApiProvider

func UnregisterApiProvider(sourceID string)

func ValidateToolArguments

func ValidateToolArguments(tool Tool, toolCall ToolCall) (any, error)

ValidateToolArguments validates tool call arguments against the tool's JSON schema.

func ValidateToolCall

func ValidateToolCall(tools []*Tool, toolCall ToolCall) (any, error)

ValidateToolCall finds a tool by name and validates the tool call arguments against its schema.

Types

type API

type API string
const (
	APIOpenAIResponses API = "openai-responses"
)

func (API) IsKnown

func (a API) IsKnown() bool

type ApiProvider

type ApiProvider[TApi API, TOptions any] struct {
	Api          TApi
	Stream       StreamFunction[TApi, TOptions]
	StreamSimple StreamFunction[TApi, SimpleStreamOptions]
}

type ApiProviderInternal

type ApiProviderInternal struct {
	Api          API
	Stream       ApiStreamFunction
	StreamSimple ApiStreamSimpleFunction
}

func GetApiProvider

func GetApiProvider(api API) (ApiProviderInternal, bool)

func GetApiProviders

func GetApiProviders() []ApiProviderInternal

func ResolveAPIProvider

func ResolveAPIProvider(api API) (ApiProviderInternal, error)

type ApiStreamFunction

type ApiStreamFunction func(
	Model Model[API],
	ModelContext ModelContext,
	Options *StreamOptions,
) (*AssistantMessageEventStream, error)

type ApiStreamSimpleFunction

type ApiStreamSimpleFunction func(
	model Model[API],
	ModelContext ModelContext,
	options *SimpleStreamOptions,
) (*AssistantMessageEventStream, error)

type AssistantContent

type AssistantContent interface {
	// contains filtered or unexported methods
}

type AssistantMessage

type AssistantMessage struct {
	Role          Role                         `json:"role"`
	Content       []AssistantContent           `json:"content"`
	Api           API                          `json:"api"`
	Provider      Provider                     `json:"provider"`
	Model         string                       `json:"model"`
	ResponseModel *string                      `json:"responseModel,omitempty"`
	ResponseID    *string                      `json:"responseId,omitempty"`
	Diagnostics   []AssistantMessageDiagnostic `json:"diagnostics,omitempty"`
	Usage         Usage                        `json:"usage"`
	StopReason    StopReason                   `json:"stopReason"`
	ErrorMessage  string                       `json:"errorMessage,omitempty"`
	Timestamp     int64                        `json:"timestamp"` // Unix timestamp in milliseconds
}

func Complete

func Complete(model Model[API], modelContext ModelContext, options *StreamOptions) (AssistantMessage, error)

func CompleteSimple

func CompleteSimple(model Model[API], modelContext ModelContext, options *SimpleStreamOptions) (AssistantMessage, error)

func (AssistantMessage) AgentMessageType

func (AssistantMessage) AgentMessageType() string

type AssistantMessageDiagnostic

type AssistantMessageDiagnostic struct {
	Type      string               `json:"type"`
	Timestamp int64                `json:"timestamp"`
	Error     *DiagnosticErrorInfo `json:"error,omitempty"`
	Details   any                  `json:"details,omitempty"`
}

type AssistantMessageEvent

type AssistantMessageEvent interface {
	EventType() string
}

type AssistantMessageEventStream

type AssistantMessageEventStream struct {
	// contains filtered or unexported fields
}

func NewAssistantMessageEventStream

func NewAssistantMessageEventStream(buffer int) *AssistantMessageEventStream

func Stream

func Stream(model Model[API], modelContext ModelContext, options *StreamOptions) (*AssistantMessageEventStream, error)

func StreamOpenAIResponse

func StreamOpenAIResponse(ctx context.Context, model Model[API], modelContext ModelContext, options *OpenAIResponseOptions) (*AssistantMessageEventStream, error)

func StreamSimple

func StreamSimple(model Model[API], modelContext ModelContext, options *SimpleStreamOptions) (*AssistantMessageEventStream, error)

func StreamSimpleOpenAIResponses

func StreamSimpleOpenAIResponses(model Model[API], modelContext ModelContext, options *SimpleStreamOptions) (*AssistantMessageEventStream, error)

func (*AssistantMessageEventStream) End

func (s *AssistantMessageEventStream) End(err error)

func (*AssistantMessageEventStream) Events

func (*AssistantMessageEventStream) Push

func (*AssistantMessageEventStream) Result

type AssistantMessageEventType

type AssistantMessageEventType string
const (
	AssistantMessageEventText  AssistantMessageEventType = "text"
	AssistantMessageEventDone  AssistantMessageEventType = "done"
	AssistantMessageEventError AssistantMessageEventType = "error"
)

type CacheRetention

type CacheRetention string
const (
	CacheRetentionNone  CacheRetention = "none"
	CacheRetentionShort CacheRetention = "short"
	CacheRetentionLong  CacheRetention = "long"
)

func ResolveCacheRetention

func ResolveCacheRetention(cacheRetention CacheRetention) CacheRetention

type ContentType

type ContentType string
const (
	ContentTypeText     ContentType = "text"
	ContentTypeThinking ContentType = "thinking"
	ContentTypeImage    ContentType = "image"
	ContentTypeToolCall ContentType = "toolCall"
)

type ConvertResponseMessagesOptions

type ConvertResponseMessagesOptions struct {
	IncludeSystemPrompt *bool `json:"includeSystemPrompt,omitempty"`
}

type ConvertResponsesToolsOptions

type ConvertResponsesToolsOptions struct {
	Strict *bool
}

type Cost

type Cost struct {
	Input      decimal.Decimal
	Output     decimal.Decimal
	CacheRead  decimal.Decimal
	CacheWrite decimal.Decimal
	Total      decimal.Decimal
}

type DiagnosticErrorInfo

type DiagnosticErrorInfo struct {
	Name    *string `json:"name,omitempty"`
	Message string  `json:"message"`
	Stack   *string `json:"stack,omitempty"`
	Code    any     `json:"code,omitempty"`
}

type DoneEvent

type DoneEvent struct {
	Type    string           `json:"type"`
	Reason  StopReason       `json:"reason"`
	Message AssistantMessage `json:"message"`
}

func (DoneEvent) EventType

func (DoneEvent) EventType() string

type ErrorEvent

type ErrorEvent struct {
	Type    string           `json:"type"`
	Reason  StopReason       `json:"reason"`
	Message AssistantMessage `json:"message"`
}

func (ErrorEvent) EventType

func (ErrorEvent) EventType() string

type EventStream

type EventStream[T any, R any] struct {
	// contains filtered or unexported fields
}

func NewEventStream

func NewEventStream[T any, R any](
	buffer int,
	isComplete func(T) bool,
	extractResult func(T) R,
) *EventStream[T, R]

func (*EventStream[T, R]) End

func (s *EventStream[T, R]) End(result R)

func (*EventStream[T, R]) Events

func (s *EventStream[T, R]) Events() <-chan T

func (*EventStream[T, R]) Push

func (s *EventStream[T, R]) Push(event T)

func (*EventStream[T, R]) Result

func (s *EventStream[T, R]) Result() R

type ImageContent

type ImageContent struct {
	Type     ContentType `json:"type"`
	Image    string      `json:"image"`
	MimeType string      `json:"mimeType"`
}

type Message

type Message interface {
	// contains filtered or unexported methods
}

func TransformMessages

func TransformMessages(messages []Message, model Model[API], allowedToolCallProviders map[Provider]struct{}) []Message

type Model

type Model[tApi API] struct {
	ID               string                 `json:"id"`
	Name             string                 `json:"name"`
	API              tApi                   `json:"api"`
	Provider         Provider               `json:"provider"`
	BaseURL          string                 `json:"baseUrl"`
	Reasoning        bool                   `json:"reasoning"`
	ThinkingLevelMap ThinkingLevelMap       `json:"thinkingLevelMap"`
	Input            []string               `json:"input"`
	Cost             Cost                   `json:"cost"` // $/million tokens
	ContextWindow    int                    `json:"contextWindow"`
	MaxTokens        int                    `json:"maxTokens"`
	Headers          *map[string]string     `json:"headers"`
	Compat           *OpenAIResponsesCompat `json:"compat"`
}

func GetModel

func GetModel(provider Provider, modelID string) (Model[API], bool)

func GetModels

func GetModels(provider Provider) []Model[API]

type ModelContext

type ModelContext struct {
	SystemPrompt *string   `json:"systemPrompt,omitempty"`
	Messages     []Message `json:"messages,omitempty"`
	Tools        []*Tool   `json:"tools,omitempty"`
}

type ModelThinkingLevel

type ModelThinkingLevel string
const (
	ThinkingLevelOff     ModelThinkingLevel = "off"
	ThinkingLevelMinimal ModelThinkingLevel = "minimal"
	ThinkingLevelLow     ModelThinkingLevel = "low"
	ThinkingLevelMedium  ModelThinkingLevel = "medium"
	ThinkingLevelHigh    ModelThinkingLevel = "high"
	ThinkingLevelXHigh   ModelThinkingLevel = "xhigh"
)

func ClampThinkingLevel

func ClampThinkingLevel[TApi API](model Model[TApi], level ModelThinkingLevel) ModelThinkingLevel

func GetSupportedThinkingLevels

func GetSupportedThinkingLevels[TApi API](model Model[TApi]) []ModelThinkingLevel

type OpenAIResponseOptions

type OpenAIResponseOptions struct {
	StreamOptions
	ReasoningEffort  *string `json:"reasoningEffort,omitempty"`
	ReasoningSummary *string `json:"reasoningSummary,omitempty"`
	ServiceTier      *string `json:"serviceTier,omitempty"`
}

type OpenAIResponsesCompat

type OpenAIResponsesCompat struct {
	SendSessionIdHeader        *bool `json:"send_session_id_header,omitempty"`
	SupportsLongCacheRetention *bool `json:"supports_long_cache_retention,omitempty"`
}

type ParsedTextSignature

type ParsedTextSignature struct {
	ID    string
	Phase *TextSignaturePhase
}

func ParseTextSignature

func ParseTextSignature(signature *string) *ParsedTextSignature

type Provider

type Provider string
const (
	ProviderOpenAI Provider = "openai"
)

func GetProviders

func GetProviders() []Provider

func (Provider) IsKnown

func (p Provider) IsKnown() bool

type ProviderResponse

type ProviderResponse struct {
	Status  int               `json:"status"`
	Headers map[string]string `json:"headers"`
}

type RegisteredApiProvider

type RegisteredApiProvider struct {
	Provider ApiProviderInternal
	SourceID *string
}

type ResolvedOpenAIResponsesCompat

type ResolvedOpenAIResponsesCompat struct {
	SendSessionIDHeader        bool
	SupportsLongCacheRetention bool
}

type Role

type Role string
const (
	RoleUser       Role = "user"
	RoleAssistant  Role = "assistant"
	RoleToolResult Role = "toolResult"
)

type SessionResourceCleanup

type SessionResourceCleanup func(SessionID *string) error

type SimpleStreamOptions

type SimpleStreamOptions struct {
	StreamOptions
	Reasoning       *ModelThinkingLevel
	ThinkingBudgets *ThinkingBudgets
}

type StartEvent

type StartEvent struct {
	Type    string           `json:"type"`
	Partial AssistantMessage `json:"partial"`
}

func (StartEvent) EventType

func (StartEvent) EventType() string

type StopReason

type StopReason string
const (
	StopReasonStop    StopReason = "stop"
	StopReasonLength  StopReason = "length"
	StopReasonToolUse StopReason = "toolUse"
	StopReasonError   StopReason = "error"
	StopReasonAborted StopReason = "aborted"
)

func MapOpenAIResponseStopReason

func MapOpenAIResponseStopReason(status responses.ResponseStatus) (StopReason, error)

type StreamFunction

type StreamFunction[TApi API, TOptions any] func(
	model Model[TApi],
	ModelContext ModelContext,
	options *TOptions,
) (*AssistantMessageEventStream, error)

type StreamOptions

type StreamOptions struct {
	Temperature       *decimal.Decimal                                        `json:"temperature,omitempty"`
	MaxTokens         *int64                                                  `json:"max_tokens,omitempty"`
	Signal            context.Context                                         `json:"signal,omitempty"`
	ApiKey            *string                                                 `json:"api_key,omitempty"`
	Transport         *Transport                                              `json:"transport,omitempty"`
	Cache             *CacheRetention                                         `json:"cache,omitempty"`
	SessionId         *string                                                 `json:"session_id,omitempty"`
	OnPayload         func(payload any, model Model[API]) (any, error)        `json:"on_payload,omitempty"`
	OnResponse        func(response ProviderResponse, model Model[API]) error `json:"on_response,omitempty"`
	Headers           map[string]string                                       `json:"headers,omitempty"`
	TimeoutMs         *int64                                                  `json:"timeout_ms,omitempty"`
	MaxRetries        *int64                                                  `json:"max_retries,omitempty"`
	MaxRetriesDelayMs *int64                                                  `json:"max_retries_delay_ms,omitempty"`
	Metadata          map[string]any                                          `json:"metadata,omitempty"`
}

type TextContent

type TextContent struct {
	Type          ContentType `json:"type"`
	Text          string      `json:"text"`
	TextSignature *string     `json:"textSignature,omitempty"`
}

type TextDeltaEvent

type TextDeltaEvent struct {
	Type         string           `json:"type"`
	ContentIndex int64            `json:"contentIndex"`
	Delta        string           `json:"delta"`
	Partial      AssistantMessage `json:"partial"`
}

func (TextDeltaEvent) EventType

func (TextDeltaEvent) EventType() string

type TextEndEvent

type TextEndEvent struct {
	Type         string           `json:"type"`
	ContentIndex int64            `json:"contentIndex"`
	Content      string           `json:"content"`
	Partial      AssistantMessage `json:"partial"`
}

func (TextEndEvent) EventType

func (TextEndEvent) EventType() string

type TextSignaturePhase

type TextSignaturePhase string
const (
	PhaseCommentary  TextSignaturePhase = "commentary"
	PhaseFinalAnswer TextSignaturePhase = "final_answer"
)

type TextStartEvent

type TextStartEvent struct {
	Type         string           `json:"type"`
	ContentIndex int64            `json:"contentIndex"`
	Partial      AssistantMessage `json:"partial"`
}

func (TextStartEvent) EventType

func (TextStartEvent) EventType() string

type ThinkingBudgets

type ThinkingBudgets struct {
	Minimal *int64 `json:"minimal,omitempty"`
	Low     *int64 `json:"low,omitempty"`
	Medium  *int64 `json:"medium,omitempty"`
	High    *int64 `json:"high,omitempty"`
}

type ThinkingContent

type ThinkingContent struct {
	Type              ContentType `json:"type"`
	Thinking          string      `json:"thinking"`
	ThinkingSignature *string     `json:"thinkingSignature,omitempty"`
	Redacted          *bool       `json:"redacted,omitempty"`
}

type ThinkingDeltaEvent

type ThinkingDeltaEvent struct {
	Type         string           `json:"type"`
	ContentIndex int64            `json:"contentIndex"`
	Delta        string           `json:"delta"`
	Partial      AssistantMessage `json:"partial"`
}

func (ThinkingDeltaEvent) EventType

func (ThinkingDeltaEvent) EventType() string

type ThinkingEndEvent

type ThinkingEndEvent struct {
	Type         string           `json:"type"`
	ContentIndex int64            `json:"contentIndex"`
	Content      string           `json:"content"`
	Partial      AssistantMessage `json:"partial"`
}

func (ThinkingEndEvent) EventType

func (ThinkingEndEvent) EventType() string

type ThinkingLevelMap

type ThinkingLevelMap map[ModelThinkingLevel]*string

type ThinkingStartEvent

type ThinkingStartEvent struct {
	Type         string           `json:"type"`
	ContentIndex int64            `json:"contentIndex"`
	Partial      AssistantMessage `json:"partial"`
}

func (ThinkingStartEvent) EventType

func (ThinkingStartEvent) EventType() string

type Tool

type Tool struct {
	Name        string         `json:"name"`
	Description string         `json:"description"`
	Parameters  map[string]any `json:"parameters"`
}

type ToolCall

type ToolCall struct {
	Type             ContentType `json:"type"`
	Id               string      `json:"id"`
	Name             string      `json:"name"`
	Args             any         `json:"args"`
	ThoughtSignature *string     `json:"thoughtSignature,omitempty"`
	PartialJson      *string     `json:"partialJson,omitempty"`
}

type ToolCallDeltaEvent

type ToolCallDeltaEvent struct {
	Type         string           `json:"type"`
	ContentIndex int64            `json:"contentIndex"`
	Delta        string           `json:"delta"`
	Partial      AssistantMessage `json:"partial"`
}

func (ToolCallDeltaEvent) EventType

func (ToolCallDeltaEvent) EventType() string

type ToolCallEndEvent

type ToolCallEndEvent struct {
	Type         string           `json:"type"`
	ContentIndex int64            `json:"contentIndex"`
	ToolCall     ToolCall         `json:"toolCall"`
	Partial      AssistantMessage `json:"partial"`
}

func (ToolCallEndEvent) EventType

func (ToolCallEndEvent) EventType() string

type ToolCallStartEvent

type ToolCallStartEvent struct {
	Type         string           `json:"type"`
	ContentIndex int64            `json:"contentIndex"`
	Partial      AssistantMessage `json:"partial"`
}

func (ToolCallStartEvent) EventType

func (ToolCallStartEvent) EventType() string

type ToolResultContent

type ToolResultContent interface {
	// contains filtered or unexported methods
}

func ReplaceToolResultImagesWithPlaceholder

func ReplaceToolResultImagesWithPlaceholder(content []ToolResultContent, placeholder string) []ToolResultContent

type ToolResultMessage

type ToolResultMessage struct {
	Role       Role                `json:"role"`
	ToolCallID string              `json:"toolCallId"`
	ToolName   string              `json:"toolName"`
	Content    []ToolResultContent `json:"content"`
	Details    any                 `json:"details,omitempty"`
	IsError    bool                `json:"isError"`
	Timestamp  int64               `json:"timestamp"` // Unix timestamp in milliseconds
}

func (ToolResultMessage) AgentMessageType

func (ToolResultMessage) AgentMessageType() string

type Transport

type Transport string
const (
	TransportSSE             Transport = "sse"
	TransportWebsocket       Transport = "websocket"
	TransportWebsocketCached Transport = "websocket-cached"
	TransportAuto            Transport = "auto"
)

type Usage

type Usage struct {
	Input      int64
	Output     int64
	CacheRead  int64
	CacheWrite int64
	Total      int64
	Cost       Cost
}

func CalculateCost

func CalculateCost(model Model[API], usage Usage) (Usage, error)

type UserContent

type UserContent interface {
	// contains filtered or unexported methods
}

func ReplaceUserImagesWithPlaceholder

func ReplaceUserImagesWithPlaceholder(content []UserContent, placeholder string) []UserContent

type UserMessage

type UserMessage struct {
	Role      Role          `json:"role"`
	Content   []UserContent `json:"content"`
	Timestamp int64         `json:"timestamp"` // Unix timestamp in milliseconds
}

func (UserMessage) AgentMessageType

func (UserMessage) AgentMessageType() string

AgentMessageType returns the message type as a string for use in the agent loop.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL