ruvnet/ruflo · error

No API key for provider: ${providerName}

Error message

No API key for provider: ${providerName}

What it means

POST /chat/completions resolved the model to a provider route, but provider.getKey() returned an empty API key. The proxy has no credentials configured for the target provider (missing environment variable for that provider's key), so it cannot forward the request upstream.

Source

Thrown at ruflo/src/mcp-bridge/index.js:1611

  const content = detailStore.get(req.params.token);
  if (content) {
    res.json({ content });
  } else {
    res.status(404).json({ error: 'Detail expired or not found' });
  }
});

// =============================================================================
// CHAT COMPLETIONS PROXY
// =============================================================================

app.post("/chat/completions", async (req, res) => {
  const model = req.body?.model;
  const providerName = resolveProvider(model);
  const provider = PROVIDER_ROUTES[providerName];
  const apiKey = provider.getKey();

  if (!apiKey) return res.status(401).json({ error: { message: `No API key for provider: ${providerName}` } });

  // Inject comprehensive system prompt as the first message
  const body = { ...req.body };
  if (body.messages && Array.isArray(body.messages)) {
    let systemPrompt = buildSystemPrompt();
    // Add autopilot instructions if autopilot mode is active
    const isAutopilot = req.headers['x-autopilot'] === 'true';
    if (isAutopilot) {
      systemPrompt = AUTOPILOT_SYSTEM_PROMPT + '\n\n' + systemPrompt;
    }
    // Prepend our system prompt before any existing messages
    const hasSystemMsg = body.messages[0]?.role === "system";
    if (hasSystemMsg) {
      // Merge with existing system message
      body.messages = [
        { role: "system", content: systemPrompt + "\n\n" + body.messages[0].content },
        ...body.messages.slice(1),
      ];

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Configure an API key for the named provider in the bridge's credential store/environment.
  2. Register the provider with valid credentials before making requests.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at ruflo/src/mcp-bridge/index.js:1611 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/c9c6468b52fefeae. Report an issue: GitHub.