Files
hack/tools/scripts/llm-key-hunter/results/_cache/content/alabasi1980_teraopencode.json
T

1 line
18 KiB
JSON

{"repo": "alabasi1980/teraopencode", "files": {"clients/TeraAi/packages/llm/test/auth-options.types.ts": {"2c88af4869c7ddf6546e6a0449c40bd46f8ac22c": {"t": 1785746520.2752943, "n": 8381, "h": "facbb670816111de", "c": "import { Config } from \"effect\"\nimport type { Auth } from \"../src/route/auth\"\nimport type { ModelFactory } from \"../src/route/auth-options\"\nimport { Auth as RuntimeAuth } from \"../src/route/auth\"\nimport * as OpenAIChat from \"../src/protocols/openai-chat\"\nimport * as AmazonBedrock from \"../src/providers/amazon-bedrock\"\nimport * as Anthropic from \"../src/providers/anthropic\"\nimport * as Azure from \"../src/providers/azure\"\nimport * as Cloudflare from \"../src/providers/cloudflare\"\nimport * as GitHubCopilot from \"../src/providers/github-copilot\"\nimport * as Google from \"../src/providers/google\"\nimport * as OpenAI from \"../src/providers/openai\"\nimport * as OpenAICompatible from \"../src/providers/openai-compatible\"\nimport * as OpenRouter from \"../src/providers/openrouter\"\nimport * as XAI from \"../src/providers/xai\"\n\ntype BaseOptions = {\n readonly baseURL?: string\n readonly headers?: Record<string, string>\n}\n\ntype Model = {\n readonly id: string\n}\n\ndeclare const auth: Auth\ndeclare const optionalAuthModel: ModelFactory<BaseOptions, \"optional\", Model>\ndeclare const requiredAuthModel: ModelFactory<BaseOptions, \"required\", Model>\nconst configApiKey = Config.redacted(\"OPENAI_API_KEY\")\n\nOpenAIChat.route.model({ id: \"gpt-4.1-mini\" })\n\n// @ts-expect-error route model selection does not configure endpoints.\nOpenAIChat.route.model({ id: \"gpt-4.1-mini\", baseURL: \"https://gateway.example.com/v1\" })\n\n// @ts-expect-error route model selection does not configure query params.\nOpenAIChat.route.model({ id: \"gpt-4.1-mini\", queryParams: { debug: \"1\" } })\n\n// @ts-expect-error route model selection does not configure auth.\nOpenAIChat.route.model({ id: \"gpt-4.1-mini\", auth })\n\n// @ts-expect-error route model selection does not configure api keys.\nOpenAIChat.route.model({ id: \"gpt-4.1-mini\", apiKey: \"sk-test\" })\n\noptionalAuthModel(\"gpt-4.1-mini\")\noptionalAuthModel(\"gpt-4.1-mini\", {})\noptionalAuthModel(\"gpt-4.1-mini\", { apiKey: \"sk-test\" })\noptionalAuthModel(\"gpt-4.1-mini\", { apiKey: configApiKey })\noptionalAuthModel(\"gpt-4.1-mini\", { auth })\noptionalAuthModel(\"gpt-4.1-mini\", { auth, baseURL: \"https://gateway.example.com/v1\" })\noptionalAuthModel(\"gpt-4.1-mini\", { apiKey: \"sk-test\", headers: { \"x-source\": \"test\" } })\n\n// @ts-expect-error auth is an override, so apiKey cannot be supplied with it.\noptionalAuthModel(\"gpt-4.1-mini\", { apiKey: \"sk-test\", auth })\n\nrequiredAuthModel(\"custom-model\", { apiKey: \"key\" })\nrequiredAuthModel(\"custom-model\", { apiKey: configApiKey })\nrequiredAuthModel(\"custom-model\", { auth })\nrequiredAuthModel(\"custom-model\", { auth, headers: { \"x-tenant-id\": \"tenant\" } })\n\n// @ts-expect-error providers without config fallback need apiKey or auth.\nrequiredAuthModel(\"custom-model\")\n\n// @ts-expect-error providers without config fallback need apiKey or auth.\nrequiredAuthModel(\"custom-model\", {})\n\n// @ts-expect-error auth is an override, so apiKey cannot be supplied with it.\nrequiredAuthModel(\"custom-model\", { apiKey: \"key\", auth })\n\nOpenAI.responses(\"gpt-4.1-mini\")\nOpenAI.configure({}).responses(\"gpt-4.1-mini\")\nOpenAI.configure({ apiKey: \"sk-test\" }).responses(\"gpt-4.1-mini\")\nOpenAI.configure({ apiKey: configApiKey }).responses(\"gpt-4.1-mini\")\nOpenAI.configure({ auth: RuntimeAuth.bearer(\"oauth-token\") }).responses(\"gpt-4.1-mini\")\nOpenAI.configure({\n auth: RuntimeAuth.headers({ authorization: \"Bearer gateway\" }),\n baseURL: \"https://gateway.example.com/v1\",\n}).responses(\"gpt-4.1-mini\")\nOpenAI.configure({\n generation: { maxTokens: 100 },\n providerOptions: { openai: { store: false } },\n}).responses(\"gpt-4.1-mini\")\n\n// @ts-expect-error OpenAI model selectors only accept model ids.\nOpenAI.configure({ apiKey: \"sk-test\" }).responses(\"gpt-4.1-mini\", {})\n\n// @ts-expect-error apiKey only accepts string, Redacted<string>, or Config<string | Redacted<string>>.\nOpenAI.configure({ apiKey: 123 })\n\n// @ts-expect-error provider helpers reject unknown top-level options.\nOpenAI.configure({ bogus: true })\n\n// @ts-expect-error common generation options remain typed.\nOpenAI.configure({ generation: { maxTokens: \"many\" } })\n\n// @ts-expect-error provider-native options remain typed.\nOpenAI.configure({ providerOptions: { openai: { store: \"false\" } } })\n\n// @ts-expect-error auth is an override, so OpenAI rejects apiKey with auth.\nOpenAI.configure({ apiKey: \"sk-test\", auth: RuntimeAuth.bearer(\"oauth-token\") })\n\nOpenAI.chat(\"gpt-4.1-mini\")\nOpenAI.configure({ apiKey: \"sk-test\" }).chat(\"gpt-4.1-mini\")\nOpenAI.configure({ apiKey: configApiKey }).chat(\"gpt-4.1-mini\")\nOpenAI.configure({ auth: RuntimeAuth.bearer(\"oauth-token\") }).chat(\"gpt-4.1-mini\")\n\n// @ts-expect-error OpenAI chat selectors only accept model ids.\nOpenAI.configure({ apiKey: \"sk-test\" }).chat(\"gpt-4.1-mini\", {})\n\n// @ts-expect-error auth is an override, so OpenAI Chat rejects apiKey with auth.\nOpenAI.configure({ apiKey: \"sk-test\", auth: RuntimeAuth.bearer(\"oauth-token\") })\n\n// @ts-expect-error Azure requires at least one of `resourceName` or `baseURL`.\nAzure.configure()\nAzure.configure({ apiKey: \"azure-key\", resourceName: \"resource\" }).responses(\"deployment\")\nAzure.configure({ apiKey: configApiKey, resourceName: \"resource\" }).responses(\"deployment\")\nAzure.configure({ auth: RuntimeAuth.header(\"api-key\", \"azure-key\"), resourceName: \"resource\" }).responses(\"deployment\")\n\n// @ts-expect-error Azure model selectors only accept deployment ids.\nAzure.configure({ apiKey: \"azure-key\", resourceName: \"resource\" }).responses(\"deployment\", {})\n\n// @ts-expect-error auth is an override, so Azure rejects apiKey with auth.\nAzure.configure({ resourceName: \"resource\", apiKey: \"azure-key\", auth: RuntimeAuth.header(\"api-key\", \"override\") })\n\nAzure.configure({ apiKey: \"azure-key\", resourceName: \"resource\" }).chat(\"deployment\")\nAzure.configure({ apiKey: configApiKey, resourceName: \"resource\" }).chat(\"deployment\")\nAzure.configure({ auth: RuntimeAuth.header(\"api-key\", \"azure-key\"), resourceName: \"resource\" }).chat(\"deployment\")\n\n// @ts-expect-error Azure chat model selectors only accept deployment ids.\nAzure.configure({ apiKey: \"azure-key\", resourceName: \"resource\" }).chat(\"deployment\", {})\n\n// @ts-expect-error auth is an override, so Azure Chat rejects apiKey with auth.\nAzure.configure({ resourceName: \"resource\", apiKey: \"azure-key\", auth: RuntimeAuth.header(\"api-key\", \"override\") })\n\nAnthropic.configure({ apiKey: \"anthropic-key\" }).model(\"claude-haiku\")\n// @ts-expect-error Anthropic model selectors only accept model ids.\nAnthropic.configure({ apiKey: \"anthropic-key\" }).model(\"claude-haiku\", {})\n\nGoogle.configure({ apiKey: \"google-key\" }).model(\"gemini-2.5-flash\")\n// @ts-expect-error Google model selectors only accept model ids.\nGoogle.configure({ apiKey: \"google-key\" }).model(\"gemini-2.5-flash\", {})\n\nAmazonBedrock.configure({ apiKey: \"bedrock-key\" }).model(\"anthropic.claude\")\n// @ts-expect-error Bedrock model selectors only accept model ids.\nAmazonBedrock.configure({ apiKey: \"bedrock-key\" }).model(\"anthropic.claude\", {})\n\nOpenRouter.configure({ apiKey: \"openrouter-key\" }).model(\"openai/gpt-4o-mini\")\n// @ts-expect-error OpenRouter model selectors only accept model ids.\nOpenRouter.configure({ apiKey: \"openrouter-key\" }).model(\"openai/gpt-4o-mini\", {})\n\nXAI.configure({ apiKey: \"xai-key\" }).responses(\"grok-4\")\nXAI.configure({ apiKey: \"xai-key\" }).chat(\"grok-4\")\n// @ts-expect-error xAI Responses selectors only accept model ids.\nXAI.configure({ apiKey: \"xai-key\" }).responses(\"grok-4\", {})\n// @ts-expect-error xAI Chat selectors only accept model ids.\nXAI.configure({ apiKey: \"xai-key\" }).chat(\"grok-4\", {})\n\nOpenAICompatible.deepseek.configure({ apiKey: \"deepseek-key\" }).model(\"deepseek-chat\")\n// @ts-expect-error OpenAI-compatible family selectors only accept model ids.\nOpenAICompatible.deepseek.configure({ apiKey: \"deepseek-key\" }).model(\"deepseek-chat\", {})\n\nCloudflare.CloudflareWorkersAI.configure({ accountId: \"account\", apiKey: \"cf-key\" }).model(\"@cf/meta/llama\")\n// @ts-expect-error Cloudflare Workers AI model selectors only accept model ids.\nCloudflare.CloudflareWorkersAI.configure({ accountId: \"account\", apiKey: \"cf-key\" }).model(\"@cf/meta/llama\", {})\n\nGitHubCopilot.configure({ baseURL: \"https://copilot.test\", apiKey: \"copilot-key\" }).model(\"gpt-4.1\")\n// @ts-expect-error GitHub Copilot model selectors only accept model ids.\nGitHubCopilot.configure({ baseURL: \"https://copilot.test\", apiKey: \"copilot-key\" }).model(\"gpt-4.1\", {})\n"}, "58409b574c92d72ae4129ce3595e866e918a74cb": {"t": 1785765227.4572492, "n": 8381, "h": "facbb670816111de", "c": "import { Config } from \"effect\"\nimport type { Auth } from \"../src/route/auth\"\nimport type { ModelFactory } from \"../src/route/auth-options\"\nimport { Auth as RuntimeAuth } from \"../src/route/auth\"\nimport * as OpenAIChat from \"../src/protocols/openai-chat\"\nimport * as AmazonBedrock from \"../src/providers/amazon-bedrock\"\nimport * as Anthropic from \"../src/providers/anthropic\"\nimport * as Azure from \"../src/providers/azure\"\nimport * as Cloudflare from \"../src/providers/cloudflare\"\nimport * as GitHubCopilot from \"../src/providers/github-copilot\"\nimport * as Google from \"../src/providers/google\"\nimport * as OpenAI from \"../src/providers/openai\"\nimport * as OpenAICompatible from \"../src/providers/openai-compatible\"\nimport * as OpenRouter from \"../src/providers/openrouter\"\nimport * as XAI from \"../src/providers/xai\"\n\ntype BaseOptions = {\n readonly baseURL?: string\n readonly headers?: Record<string, string>\n}\n\ntype Model = {\n readonly id: string\n}\n\ndeclare const auth: Auth\ndeclare const optionalAuthModel: ModelFactory<BaseOptions, \"optional\", Model>\ndeclare const requiredAuthModel: ModelFactory<BaseOptions, \"required\", Model>\nconst configApiKey = Config.redacted(\"OPENAI_API_KEY\")\n\nOpenAIChat.route.model({ id: \"gpt-4.1-mini\" })\n\n// @ts-expect-error route model selection does not configure endpoints.\nOpenAIChat.route.model({ id: \"gpt-4.1-mini\", baseURL: \"https://gateway.example.com/v1\" })\n\n// @ts-expect-error route model selection does not configure query params.\nOpenAIChat.route.model({ id: \"gpt-4.1-mini\", queryParams: { debug: \"1\" } })\n\n// @ts-expect-error route model selection does not configure auth.\nOpenAIChat.route.model({ id: \"gpt-4.1-mini\", auth })\n\n// @ts-expect-error route model selection does not configure api keys.\nOpenAIChat.route.model({ id: \"gpt-4.1-mini\", apiKey: \"sk-test\" })\n\noptionalAuthModel(\"gpt-4.1-mini\")\noptionalAuthModel(\"gpt-4.1-mini\", {})\noptionalAuthModel(\"gpt-4.1-mini\", { apiKey: \"sk-test\" })\noptionalAuthModel(\"gpt-4.1-mini\", { apiKey: configApiKey })\noptionalAuthModel(\"gpt-4.1-mini\", { auth })\noptionalAuthModel(\"gpt-4.1-mini\", { auth, baseURL: \"https://gateway.example.com/v1\" })\noptionalAuthModel(\"gpt-4.1-mini\", { apiKey: \"sk-test\", headers: { \"x-source\": \"test\" } })\n\n// @ts-expect-error auth is an override, so apiKey cannot be supplied with it.\noptionalAuthModel(\"gpt-4.1-mini\", { apiKey: \"sk-test\", auth })\n\nrequiredAuthModel(\"custom-model\", { apiKey: \"key\" })\nrequiredAuthModel(\"custom-model\", { apiKey: configApiKey })\nrequiredAuthModel(\"custom-model\", { auth })\nrequiredAuthModel(\"custom-model\", { auth, headers: { \"x-tenant-id\": \"tenant\" } })\n\n// @ts-expect-error providers without config fallback need apiKey or auth.\nrequiredAuthModel(\"custom-model\")\n\n// @ts-expect-error providers without config fallback need apiKey or auth.\nrequiredAuthModel(\"custom-model\", {})\n\n// @ts-expect-error auth is an override, so apiKey cannot be supplied with it.\nrequiredAuthModel(\"custom-model\", { apiKey: \"key\", auth })\n\nOpenAI.responses(\"gpt-4.1-mini\")\nOpenAI.configure({}).responses(\"gpt-4.1-mini\")\nOpenAI.configure({ apiKey: \"sk-test\" }).responses(\"gpt-4.1-mini\")\nOpenAI.configure({ apiKey: configApiKey }).responses(\"gpt-4.1-mini\")\nOpenAI.configure({ auth: RuntimeAuth.bearer(\"oauth-token\") }).responses(\"gpt-4.1-mini\")\nOpenAI.configure({\n auth: RuntimeAuth.headers({ authorization: \"Bearer gateway\" }),\n baseURL: \"https://gateway.example.com/v1\",\n}).responses(\"gpt-4.1-mini\")\nOpenAI.configure({\n generation: { maxTokens: 100 },\n providerOptions: { openai: { store: false } },\n}).responses(\"gpt-4.1-mini\")\n\n// @ts-expect-error OpenAI model selectors only accept model ids.\nOpenAI.configure({ apiKey: \"sk-test\" }).responses(\"gpt-4.1-mini\", {})\n\n// @ts-expect-error apiKey only accepts string, Redacted<string>, or Config<string | Redacted<string>>.\nOpenAI.configure({ apiKey: 123 })\n\n// @ts-expect-error provider helpers reject unknown top-level options.\nOpenAI.configure({ bogus: true })\n\n// @ts-expect-error common generation options remain typed.\nOpenAI.configure({ generation: { maxTokens: \"many\" } })\n\n// @ts-expect-error provider-native options remain typed.\nOpenAI.configure({ providerOptions: { openai: { store: \"false\" } } })\n\n// @ts-expect-error auth is an override, so OpenAI rejects apiKey with auth.\nOpenAI.configure({ apiKey: \"sk-test\", auth: RuntimeAuth.bearer(\"oauth-token\") })\n\nOpenAI.chat(\"gpt-4.1-mini\")\nOpenAI.configure({ apiKey: \"sk-test\" }).chat(\"gpt-4.1-mini\")\nOpenAI.configure({ apiKey: configApiKey }).chat(\"gpt-4.1-mini\")\nOpenAI.configure({ auth: RuntimeAuth.bearer(\"oauth-token\") }).chat(\"gpt-4.1-mini\")\n\n// @ts-expect-error OpenAI chat selectors only accept model ids.\nOpenAI.configure({ apiKey: \"sk-test\" }).chat(\"gpt-4.1-mini\", {})\n\n// @ts-expect-error auth is an override, so OpenAI Chat rejects apiKey with auth.\nOpenAI.configure({ apiKey: \"sk-test\", auth: RuntimeAuth.bearer(\"oauth-token\") })\n\n// @ts-expect-error Azure requires at least one of `resourceName` or `baseURL`.\nAzure.configure()\nAzure.configure({ apiKey: \"azure-key\", resourceName: \"resource\" }).responses(\"deployment\")\nAzure.configure({ apiKey: configApiKey, resourceName: \"resource\" }).responses(\"deployment\")\nAzure.configure({ auth: RuntimeAuth.header(\"api-key\", \"azure-key\"), resourceName: \"resource\" }).responses(\"deployment\")\n\n// @ts-expect-error Azure model selectors only accept deployment ids.\nAzure.configure({ apiKey: \"azure-key\", resourceName: \"resource\" }).responses(\"deployment\", {})\n\n// @ts-expect-error auth is an override, so Azure rejects apiKey with auth.\nAzure.configure({ resourceName: \"resource\", apiKey: \"azure-key\", auth: RuntimeAuth.header(\"api-key\", \"override\") })\n\nAzure.configure({ apiKey: \"azure-key\", resourceName: \"resource\" }).chat(\"deployment\")\nAzure.configure({ apiKey: configApiKey, resourceName: \"resource\" }).chat(\"deployment\")\nAzure.configure({ auth: RuntimeAuth.header(\"api-key\", \"azure-key\"), resourceName: \"resource\" }).chat(\"deployment\")\n\n// @ts-expect-error Azure chat model selectors only accept deployment ids.\nAzure.configure({ apiKey: \"azure-key\", resourceName: \"resource\" }).chat(\"deployment\", {})\n\n// @ts-expect-error auth is an override, so Azure Chat rejects apiKey with auth.\nAzure.configure({ resourceName: \"resource\", apiKey: \"azure-key\", auth: RuntimeAuth.header(\"api-key\", \"override\") })\n\nAnthropic.configure({ apiKey: \"anthropic-key\" }).model(\"claude-haiku\")\n// @ts-expect-error Anthropic model selectors only accept model ids.\nAnthropic.configure({ apiKey: \"anthropic-key\" }).model(\"claude-haiku\", {})\n\nGoogle.configure({ apiKey: \"google-key\" }).model(\"gemini-2.5-flash\")\n// @ts-expect-error Google model selectors only accept model ids.\nGoogle.configure({ apiKey: \"google-key\" }).model(\"gemini-2.5-flash\", {})\n\nAmazonBedrock.configure({ apiKey: \"bedrock-key\" }).model(\"anthropic.claude\")\n// @ts-expect-error Bedrock model selectors only accept model ids.\nAmazonBedrock.configure({ apiKey: \"bedrock-key\" }).model(\"anthropic.claude\", {})\n\nOpenRouter.configure({ apiKey: \"openrouter-key\" }).model(\"openai/gpt-4o-mini\")\n// @ts-expect-error OpenRouter model selectors only accept model ids.\nOpenRouter.configure({ apiKey: \"openrouter-key\" }).model(\"openai/gpt-4o-mini\", {})\n\nXAI.configure({ apiKey: \"xai-key\" }).responses(\"grok-4\")\nXAI.configure({ apiKey: \"xai-key\" }).chat(\"grok-4\")\n// @ts-expect-error xAI Responses selectors only accept model ids.\nXAI.configure({ apiKey: \"xai-key\" }).responses(\"grok-4\", {})\n// @ts-expect-error xAI Chat selectors only accept model ids.\nXAI.configure({ apiKey: \"xai-key\" }).chat(\"grok-4\", {})\n\nOpenAICompatible.deepseek.configure({ apiKey: \"deepseek-key\" }).model(\"deepseek-chat\")\n// @ts-expect-error OpenAI-compatible family selectors only accept model ids.\nOpenAICompatible.deepseek.configure({ apiKey: \"deepseek-key\" }).model(\"deepseek-chat\", {})\n\nCloudflare.CloudflareWorkersAI.configure({ accountId: \"account\", apiKey: \"cf-key\" }).model(\"@cf/meta/llama\")\n// @ts-expect-error Cloudflare Workers AI model selectors only accept model ids.\nCloudflare.CloudflareWorkersAI.configure({ accountId: \"account\", apiKey: \"cf-key\" }).model(\"@cf/meta/llama\", {})\n\nGitHubCopilot.configure({ baseURL: \"https://copilot.test\", apiKey: \"copilot-key\" }).model(\"gpt-4.1\")\n// @ts-expect-error GitHub Copilot model selectors only accept model ids.\nGitHubCopilot.configure({ baseURL: \"https://copilot.test\", apiKey: \"copilot-key\" }).model(\"gpt-4.1\", {})\n"}}}}