continuedev/continue · error · Error

Method not implemented.

Error message

Method not implemented.

What it means

The Anthropic API has no legacy /v1/completions text-completion endpoint, so the adapter's completionNonStream is a permanent stub that throws. Anthropic only supports message-based (chat) APIs.

Source

Thrown at packages/openai-adapters/src/apis/Anthropic.ts:475

        method: "POST",
        headers: this.getHeaders(),
        body: JSON.stringify(this._convertBody(body)),
        signal,
      },
    );
    yield* this.handleStreamResponse(response, body.model);
  }

  private getHeaders(): Record<string, string> {
    const enableCaching = this.config?.cachingStrategy !== "none";
    return getAnthropicHeaders(this.config.apiKey, enableCaching, this.apiBase);
  }

  async completionNonStream(
    body: CompletionCreateParamsNonStreaming,
    signal: AbortSignal,
  ): Promise<Completion> {
    throw new Error("Method not implemented.");
  }
  async *completionStream(
    body: CompletionCreateParamsStreaming,
    signal: AbortSignal,
  ): AsyncGenerator<Completion> {
    throw new Error("Method not implemented.");
  }
  async *fimStream(
    body: FimCreateParamsStreaming,
    signal: AbortSignal,
  ): AsyncGenerator<ChatCompletionChunk> {
    throw new Error("Method not implemented.");
  }

  async embed(
    body: OpenAI.Embeddings.EmbeddingCreateParams,
  ): Promise<OpenAI.Embeddings.CreateEmbeddingResponse> {
    throw new Error("Method not implemented.");

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Use chatCompletionNonStream with messages instead of a raw prompt
  2. In generic routing layers, detect Anthropic and translate prompt→messages automatically
  3. Remove legacy completions call paths when targeting Claude models

Example fix

// before
const res = await api.completionNonStream({ model: 'claude-3-5-sonnet', prompt: 'Hi' }, signal);

// after
const res = await api.chatCompletionNonStream({ model: 'claude-3-5-sonnet', messages: [{ role: 'user', content: 'Hi' }] }, signal);
Defensive patterns

Strategy: type-guard

Validate before calling

if (api instanceof Anthropic) { throw new Error('Use chatCompletionNonStream for Anthropic'); }

Type guard

function supportsLegacyCompletions(api: BaseApi): boolean { return !(api instanceof Anthropic) && !(api instanceof AskSage); }

Try / catch

try { return await api.completionNonStream(body, signal); }
catch (e) { if (e.message === 'Method not implemented.') { return await api.chatCompletionNonStream(promptToChat(body), signal); } throw e; }

Prevention

When it happens

Trigger: Calling completionNonStream(body, signal) on the Anthropic adapter — i.e. sending CompletionCreateParamsNonStreaming to a provider configured as anthropic.

Common situations: Generic code that picks a completion method based on a model name or legacy config and routes legacy completions to Anthropic; migrating from OpenAI text-davinci-style calls to Claude without updating call sites.

Related errors


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