continuedev/continue · error · Error

No API base URL provided. Please add the `apiBase` field in

Error message

No API base URL provided. Please add the `apiBase` field in your config.json.

What it means

Thrown by HuggingFaceInferenceAPI._streamComplete when the provider has no apiBase configured. Unlike other HuggingFace providers, this one talks to a self-hosted or custom Inference API endpoint, so an explicit base URL is mandatory before any completion request can be made.

Source

Thrown at core/llm/llms/HuggingFaceInferenceAPI.ts:23

class HuggingFaceInferenceAPI extends BaseLLM {
  static providerName = "huggingface-inference-api";

  private _convertArgs(options: CompletionOptions) {
    return {
      max_new_tokens: options.maxTokens ?? 1024,
      temperature: options.temperature,
      top_k: options.topK,
      top_p: options.topP,
    };
  }

  protected async *_streamComplete(
    prompt: string,
    signal: AbortSignal,
    options: CompletionOptions,
  ): AsyncGenerator<string> {
    if (!this.apiBase) {
      throw new Error(
        "No API base URL provided. Please add the `apiBase` field in your config.json.",
      );
    }

    const response = await this.fetch(this.apiBase, {
      headers: {
        Authorization: `Bearer ${this.apiKey}`,
        "Content-Type": "application/json",
        Accept: "application/json",
      },
      method: "POST",
      body: JSON.stringify({
        inputs: prompt,
        stream: true,
        parameters: this._convertArgs(options),
      }),
      signal,
    });

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Add an apiBase field to the model's config.json entry pointing at your inference endpoint (e.g. https://xxx.endpoints.huggingface.cloud) or local TEI/TGI server
  2. If you meant to use the public HF Inference API, switch provider to a supported one or run your own endpoint
  3. Restart/reload the extension window after editing config.json

Example fix

// before
{
  "models": [{
    "title": "HF",
    "provider": "huggingface-inference-api",
    "model": "zephyr-7b-beta",
    "apiKey": "hf_..."
  }]
}
// after
{
  "models": [{
    "title": "HF",
    "provider": "huggingface-inference-api",
    "model": "zephyr-7b-beta",
    "apiKey": "hf_...",
    "apiBase": "https://your-endpoint.endpoints.huggingface.cloud"
  }]
}
Defensive patterns

Strategy: validation

Validate before calling

const cfg = readConfig();
if (cfg.provider === 'huggingface-inference-api' && !cfg.apiBase) {
  failFast('Add apiBase to config.json before using this provider');
}

Type guard

const hasApiBase = (m: Record<string, unknown>): m is Record<string, unknown> & { apiBase: string } =>
  typeof m.apiBase === 'string' && m.apiBase.length > 0;

Try / catch

try {
  for await (const c of llm.streamComplete(prompt, signal)) yield c;
} catch (e) {
  if (e instanceof Error && e.message.includes('apiBase')) showConfigWarning();
  else throw e;
}

Prevention

When it happens

Trigger: Selecting the huggingface-inference-api provider in config.json without an apiBase field, then initiating a chat/autocomplete request that calls _streamComplete.

Common situations: Copying an example config that omits apiBase, or assuming the provider uses the public HF endpoint and only setting an API token.

Related errors


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