{"record":{"id":"73d7a2eabe79e6aa","repo":"charmbracelet/crush","slug":"not-a-valid-vercel-api-key","errorCode":null,"errorMessage":"not a valid vercel api key","messagePattern":"not a valid vercel api key","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/config/config.go","lineNumber":1011,"sourceCode":"\t\theaders[\"anthropic-version\"] = \"2023-06-01\"\n\tcase catwalk.TypeGoogle:\n\t\tbaseURL, _ := resolver.ResolveValue(c.BaseURL)\n\t\tbaseURL = cmp.Or(baseURL, \"https://generativelanguage.googleapis.com\")\n\t\ttestURL = baseURL + \"/v1beta/models?key=\" + url.QueryEscape(apiKey)\n\tcase catwalk.TypeBedrock:\n\t\t// NOTE: Bedrock has a `/foundation-models` endpoint that we could in\n\t\t// theory use, but apparently the authorization is region-specific,\n\t\t// so it's not so trivial.\n\t\tif strings.HasPrefix(apiKey, \"ABSK\") { // Bedrock API keys\n\t\t\treturn nil\n\t\t}\n\t\treturn errors.New(\"not a valid bedrock api key\")\n\tcase catwalk.TypeVercel:\n\t\t// NOTE: Vercel does not validate API keys on the `/models` endpoint.\n\t\tif strings.HasPrefix(apiKey, \"vck_\") { // Vercel API keys\n\t\t\treturn nil\n\t\t}\n\t\treturn errors.New(\"not a valid vercel api key\")\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\tclient := &http.Client{}\n\treq, err := http.NewRequestWithContext(ctx, \"GET\", testURL, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create request for provider %s: %w\", c.ID, err)\n\t}\n\tfor k, v := range headers {\n\t\treq.Header.Set(k, v)\n\t}\n\tfor k, v := range c.ExtraHeaders {\n\t\treq.Header.Set(k, v)\n\t}\n\n\tresp, err := client.Do(req)","sourceCodeStart":993,"sourceCodeEnd":1029,"githubUrl":"https://github.com/charmbracelet/crush/blob/7944b8e52225d8805e31eacbf7ef24856b0dfb7a/internal/config/config.go#L993-L1029","documentation":"Vercel does not validate API keys on its /models endpoint, so the provider validator cannot verify Vercel keys over HTTP. Instead it uses a prefix check: the key must start with 'vck_'. A Vercel-provider key lacking that prefix fails with this error before any network request is made.","triggerScenarios":"Configuring a provider of type vercel whose apikey value does not start with 'vck_' — e.g. pasting a Vercel team/token of a different kind, an env var that resolved to an empty or wrong value, or a copied key that got truncated before the prefix.","commonSituations":"Using an old-format Vercel token, a deployment token, or an OIDC/other credential in the apikey slot; whitespace or quote-wrapping in crushrc/env; users of Bedrock hitting the sibling 'not a valid bedrock api key' error under the same validator.","solutions":["Set apikey to a current Vercel AI Gateway key that starts with 'vck_'.","Verify the env var resolves correctly and has no surrounding whitespace or quotes.","If you believe your valid key lacks the prefix, check for a crush update — prefix rules track the provider's current key format."],"exampleFix":"// before\napikey \"${VERCEL_TOKEN}\" // resolves to an old-style token\n// after\napikey \"vck_1a2b3c...\" // key with the vck_ prefix","handlingStrategy":"validation","validationCode":"apiKey := os.Getenv(\"VERCEL_API_KEY\")\nif !strings.HasPrefix(strings.TrimSpace(apiKey), \"vck_\") {\n    return fmt.Errorf(\"vercel key must start with vck_\")\n}","typeGuard":null,"tryCatchPattern":"if err := config.ValidateAPIKey(ctx, providerCfg); err != nil {\n    if strings.Contains(err.Error(), \"vercel\") {\n        return fmt.Errorf(\"regenerate a vck_-prefixed Vercel AI Gateway key: %w\", err)\n    }\n    return err\n}","preventionTips":["Generate current Vercel AI Gateway keys (vck_ prefix) rather than reusing legacy tokens.","Quote env-derived keys carefully in crushrc to avoid whitespace/quote contamination.","Re-validate keys after rotating credentials on the Vercel dashboard."],"tags":["config","vercel","api-key","validation"],"backgroundTag":"invalid-api-key-format","analyzedSha":"7944b8e52225d8805e31eacbf7ef24856b0dfb7a","analyzedAt":"2026-08-29T12:48:59.079Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}