Troubleshooting · Cline

Cline 401 Invalid API Key (OpenAI Compatible) — Fix

Cline returns 401 when the OpenAI-compatible endpoint rejects the key: wrong base URL field, whitespace in the key, or a revoked key. The fix checklist.

What you see

HTTP 401
{"error":{"message":"Invalid or missing API key.","type":"invalid_request_error","param":null,"code":"invalid_api_key"}}

Why it happens

  • The Base URL field is empty or points at another provider, so the key goes to an endpoint that has never seen it.
  • The key was pasted with leading or trailing whitespace, or truncated.
  • The base URL is missing /v1 or carries an extra path, so requests go to a URL the endpoint does not serve.
  • The key was revoked or expired.

How to fix it

  • In Cline's settings, choose the OpenAI Compatible provider and set Base URL to https://router.apitoken.sale/v1.
  • Re-paste the key cleanly and confirm it is active in the issuer's dashboard.
  • Verify the pair with curl before returning to Cline.

Cline provider settings

API Provider:  OpenAI Compatible
Base URL:      https://router.apitoken.sale/v1
API Key:       sk-pool-•••
Model ID:      gpt-6.1-terra

Related searches

  • cline 401 unauthorized
  • cline invalid api key

FAQ

Why does Cline reject a key that works elsewhere?+
Cline sends the key to whatever Base URL the provider settings hold. If that field is empty or points at another provider, the endpoint seeing the key is not the one that issued it.
Does the Cline base URL need /v1?+
Yes, for the OpenAI Compatible provider: https://router.apitoken.sale/v1. Cline appends the API path itself, so add nothing after /v1.
Which models can I select after the key works?+
The GPT and Gemini models the endpoint serves. List them with GET /v1/models against the same base URL and key, and paste the id into Model ID.

Skip the broken setup

apiToken.sale serves GPT and Gemini models through OpenAI-compatible, Messages (Anthropic format) and native Gemini endpoints — standard SDKs, one key, one prepaid balance. Point your tool's base URL at it, and the config on this page works as written.