Mintplex-Labs/anything-llm · error · Error

TogetherAI chat: is not valid for chat completion!

Error message

TogetherAI chat: ${this.model} is not valid for chat completion!

What it means

Pre-flight guard in TogetherAiLLM.getChatCompletion: the model is not in Together AI's valid (live or cached) model list, so the completion is rejected before calling the API with an unavailable model.

Solutions

  1. Select a TogetherAI model valid for chat completion.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown when the configured TogetherAI model is not a chat model.

Common situations: Model preference set to an invalid model.


AI-assisted analysis of Mintplex-Labs/anything-llm@f92433b4ea (2026-08-18). Data as JSON: /api/errors/f021360e4f037a87. Report an issue: GitHub.

Appendix: source

Thrown at server/utils/AiProviders/togetherAi/index.js:200

    attachments = [],
  }) {
    const prompt = {
      role: "system",
      content: `${systemPrompt}${this.#appendContext(contextTexts)}`,
    };
    return [
      prompt,
      ...formatChatHistory(chatHistory, this.#generateContent),
      {
        role: "user",
        content: this.#generateContent({ userPrompt, attachments }),
      },
    ];
  }

  async getChatCompletion(messages = null, { temperature = 0.7 }) {
    if (!(await this.isValidChatCompletionModel(this.model)))
      throw new Error(
        `TogetherAI chat: ${this.model} is not valid for chat completion!`
      );

    const result = await LLMPerformanceMonitor.measureAsyncFunction(
      this.openai.chat.completions
        .create({
          model: this.model,
          messages,
          temperature,
        })
        .catch((e) => {
          throw new Error(e.message);
        })
    );

    if (
      !result.output.hasOwnProperty("choices") ||
      result.output.choices.length === 0

View on GitHub (pinned to f92433b4ea)