Files
hack/tools/scripts/llm-key-hunter/results/_cache/content/brittonhayes_vala.json
T
OpenCode 68a9071cf1 feat: reconcile local master with origin (exa/hot-platform hunters, leaks ledger, latest results)
Local branch had diverged from origin/master (sibling commits on the same base). Rewrote local history linearly on top of origin/master, folding in all local content: exa/hot-platform discovery hunters, leaks ledger, nightly sweep orchestrator, updated .gitignore and skill docs, plus the latest hunt output and vault state. Remote-only files (vault keys, channel scripts) were restored rather than dropped, so the resulting tree is a full union of both sides.
2026-08-07 12:53:47 +08:00

1 line
5.1 KiB
JSON

{"repo": "brittonhayes/vala", "files": {"internal/llm/registry.go": {"a63f62f9364e40ea8393c2cca27b1440770c16c5": {"t": 1786068297.2956016, "n": 4692, "h": "75e1d2644b71c65c", "c": "package llm\n\nimport \"sort\"\n\n// Protocol names the wire format a provider speaks. vala ships two, which\n// between them cover every provider it supports: Anthropic's Messages API and\n// the OpenAI Chat Completions API. The latter is spoken (with only a different\n// base URL) by OpenAI, Google's OpenAI-compatible endpoint, OpenRouter, Groq,\n// DeepSeek, xAI, and local runtimes like Ollama and LM Studio.\ntype Protocol string\n\nconst (\n\tProtocolAnthropic Protocol = \"anthropic\"\n\tProtocolOpenAI Protocol = \"openai\"\n)\n\n// ProviderInfo is the static description of a known provider: which protocol it\n// speaks, where it lives, how to authenticate, and a sensible default model.\n// It is the single place a new provider is registered.\ntype ProviderInfo struct {\n\t// ID is the short identifier used in config and the connect flow.\n\tID string\n\t// Name is the human label shown in the connect picker.\n\tName string\n\t// Protocol is the wire format the provider speaks.\n\tProtocol Protocol\n\t// BaseURL is the API endpoint. Empty means the protocol's own default\n\t// (Anthropic's SDK default for ProtocolAnthropic).\n\tBaseURL string\n\t// APIKeyEnv is the environment variable checked for an API key before the\n\t// stored credential. Empty for providers that need no key (local runtimes).\n\tAPIKeyEnv string\n\t// DefaultModel is selected when config names the provider but no model.\n\tDefaultModel string\n\t// Local marks a provider that runs on the operator's machine and needs no\n\t// API key (Ollama, LM Studio). The connect flow asks for a base URL instead.\n\tLocal bool\n\t// OAuth marks a provider that supports a browser-based subscription login\n\t// (e.g. Claude Pro/Max), letting an operator connect without a raw API key.\n\t// The connect flow offers it as an alternative to pasting a key.\n\tOAuth bool\n}\n\n// builtins is vala's registry of known providers. The OpenAI-compatible entries\n// differ only by base URL and default model — the protocol code is shared.\nvar builtins = map[string]ProviderInfo{\n\t\"anthropic\": {\n\t\tID: \"anthropic\", Name: \"Anthropic (Claude)\",\n\t\tProtocol: ProtocolAnthropic, APIKeyEnv: \"ANTHROPIC_API_KEY\",\n\t\tDefaultModel: \"claude-opus-4-8\", OAuth: true,\n\t},\n\t\"openai\": {\n\t\tID: \"openai\", Name: \"OpenAI (ChatGPT)\",\n\t\tProtocol: ProtocolOpenAI, BaseURL: \"https://api.openai.com/v1\",\n\t\tAPIKeyEnv: \"OPENAI_API_KEY\", DefaultModel: \"gpt-5\",\n\t},\n\t\"google\": {\n\t\tID: \"google\", Name: \"Google (Gemini)\",\n\t\tProtocol: ProtocolOpenAI,\n\t\tBaseURL: \"https://generativelanguage.googleapis.com/v1beta/openai\",\n\t\tAPIKeyEnv: \"GEMINI_API_KEY\", DefaultModel: \"gemini-2.5-pro\",\n\t},\n\t\"openrouter\": {\n\t\tID: \"openrouter\", Name: \"OpenRouter (any model)\",\n\t\tProtocol: ProtocolOpenAI, BaseURL: \"https://openrouter.ai/api/v1\",\n\t\tAPIKeyEnv: \"OPENROUTER_API_KEY\", DefaultModel: \"anthropic/claude-opus-4-8\",\n\t},\n\t\"groq\": {\n\t\tID: \"groq\", Name: \"Groq (fast inference)\",\n\t\tProtocol: ProtocolOpenAI, BaseURL: \"https://api.groq.com/openai/v1\",\n\t\tAPIKeyEnv: \"GROQ_API_KEY\", DefaultModel: \"llama-3.3-70b-versatile\",\n\t},\n\t\"deepseek\": {\n\t\tID: \"deepseek\", Name: \"DeepSeek\",\n\t\tProtocol: ProtocolOpenAI, BaseURL: \"https://api.deepseek.com/v1\",\n\t\tAPIKeyEnv: \"DEEPSEEK_API_KEY\", DefaultModel: \"deepseek-chat\",\n\t},\n\t\"xai\": {\n\t\tID: \"xai\", Name: \"xAI (Grok)\",\n\t\tProtocol: ProtocolOpenAI, BaseURL: \"https://api.x.ai/v1\",\n\t\tAPIKeyEnv: \"XAI_API_KEY\", DefaultModel: \"grok-4\",\n\t},\n\t\"ollama\": {\n\t\tID: \"ollama\", Name: \"Ollama (local)\",\n\t\tProtocol: ProtocolOpenAI, BaseURL: \"http://localhost:11434/v1\",\n\t\tLocal: true, DefaultModel: \"llama3.1\",\n\t},\n\t\"lmstudio\": {\n\t\tID: \"lmstudio\", Name: \"LM Studio (local)\",\n\t\tProtocol: ProtocolOpenAI, BaseURL: \"http://localhost:1234/v1\",\n\t\tLocal: true, DefaultModel: \"local-model\",\n\t},\n}\n\n// Builtin returns the registered provider with the given id, if known.\nfunc Builtin(id string) (ProviderInfo, bool) {\n\tinfo, ok := builtins[id]\n\treturn info, ok\n}\n\n// Providers returns every known provider id, sorted, with recommended providers\n// first so the connect picker leads with the most common choices.\nfunc Providers() []ProviderInfo {\n\t// Recommendation order mirrors what most operators reach for first.\n\tpriority := map[string]int{\n\t\t\"anthropic\": 0, \"openai\": 1, \"google\": 2,\n\t\t\"openrouter\": 3, \"ollama\": 4, \"lmstudio\": 5,\n\t}\n\tids := make([]string, 0, len(builtins))\n\tfor id := range builtins {\n\t\tids = append(ids, id)\n\t}\n\tsort.Slice(ids, func(i, j int) bool {\n\t\tpi, oki := priority[ids[i]]\n\t\tpj, okj := priority[ids[j]]\n\t\tif oki != okj {\n\t\t\treturn oki // prioritized ids sort before unprioritized\n\t\t}\n\t\tif oki && okj && pi != pj {\n\t\t\treturn pi < pj\n\t\t}\n\t\treturn ids[i] < ids[j]\n\t})\n\tout := make([]ProviderInfo, 0, len(ids))\n\tfor _, id := range ids {\n\t\tout = append(out, builtins[id])\n\t}\n\treturn out\n}\n"}}}}