continuedev/continue · error · CometAPIError

Invalid CometAPI base URL: ${options.apiBase}. Expected http

Error message

Invalid CometAPI base URL: ${options.apiBase}. Expected https://api.cometapi.com/v1/ or compatible endpoint

What it means

Validation error thrown by CometAPI.validateConfig (invoked from the constructor) when a custom apiBase is supplied that fails CometAPI.isValidApiBase — i.e. it is not https://api.cometapi.com/v1/ or a compatible OpenAI-style endpoint. Prevents constructing a client pointed at an unusable URL.

Source

Thrown at core/llm/llms/CometAPI.ts:85

  }

  /**
   * Validate CometAPI configuration
   */
  private static validateConfig(options: LLMOptions): void {
    // Allow constructing without API key (tests that only instantiate should pass).
    // Enforce credentials at request time instead.
    if (!options.apiKey) {
      if (typeof process !== "undefined" && process.env?.NODE_ENV !== "test") {
        console.warn(
          "CometAPI: No API key provided. Requests will fail until an API key is configured. Get one at https://api.cometapi.com/console/token",
        );
      }
      return;
    }

    if (options.apiBase && !CometAPI.isValidApiBase(options.apiBase)) {
      throw new CometAPIError(
        `Invalid CometAPI base URL: ${options.apiBase}. Expected https://api.cometapi.com/v1/ or compatible endpoint`,
      );
    }

    if (
      options.model &&
      !CometAPI.isValidModelFormat(options.model) &&
      typeof process !== "undefined" &&
      process.env?.NODE_ENV !== "test"
    ) {
      console.warn(
        `CometAPI: Model "${options.model}" may not be supported. Check CometAPI documentation for available models.`,
      );
    }
  }

  /**
   * Validate API base URL format

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Use exactly https://api.cometapi.com/v1/ as apiBase
  2. If you need a proxy/custom gateway, ensure its URL ends with a /v1/-style OpenAI-compatible path accepted by isValidApiBase, or omit apiBase entirely
  3. Remove the apiBase option if you intend the default endpoint
  4. Check for typos: scheme (https), host, and /v1/ suffix

Example fix

// before
new CometAPI({ apiBase: 'https://api.cometapi.com', ... });
// after
new CometAPI({ apiBase: 'https://api.cometapi.com/v1/', ... });
Defensive patterns

Strategy: validation

Validate before calling

const BASE = 'https://api.cometapi.com/v1/';
if (apiBase && !/^https:\/\/[^/]+\/v1\/?$/.test(apiBase)) apiBase = BASE;

Type guard

function isValidCometBase(u: string): boolean {
  try { const x = new URL(u); return x.pathname.replace(/\/+$/, '') === '/v1'; } catch { return false; }
}

Try / catch

try { new CometAPI(opts); } catch (e) {
  if (e instanceof Error && e.message.startsWith('Invalid CometAPI base URL')) opts.apiBase = 'https://api.cometapi.com/v1/';
  throw e;
}

Prevention

When it happens

Trigger: Instantiating CometAPI with options.apiBase set to a typo'd domain, a non-/v1/ path, a URL missing the protocol, or a third-party proxy that doesn't mimic the CometAPI OpenAI-compatible shape.

Common situations: Copy-pasting an OpenAI base URL (https://api.openai.com/v1/) instead of CometAPI's, trailing-slash or /v1/-missing variants, self-hosted proxy URLs that need to be allowlisted/extended in isValidApiBase.

Related errors


AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27). Data as JSON: /api/errors/07d8b8d189cc6a69. Report an issue: GitHub.