PipedreamHQ / PipedreamHQ/pipedream

[BUG] Errors out when using the core AutoRouter

Open
#17,819 1 comment 0 reactions 0 assignees View on GitHub
bug question triaged
Dominant language
JavaScript
Stars
11.7k
Forks
5.8k
Avg merge
3d 10h
Merged PRs (30d)
102

Description

**Describe the bug**
I get an error when setting model to AutoRouter instead of a specific model.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to Model and select AutoRouter.

**Expected behavior**
To Work as expected

**Screenshots**
If applicable, add screenshots to help explain your problem. Note that the screenshots will be displayed publicly.

**Additional context**
Looking at the error response, the issue is clear: you're using the `/completions` endpoint with a `prompt` parameter, but OpenRouter requires you to use the `messages` format instead.

The error message states: "You must submit 'messages' for routers"

Here's what you need to fix in your Pipedream component:

## 1. Change the Request Format

Instead of using:
```javascript
{
"model": "openrouter/auto",
"prompt": "Your long prompt here...",
"stream": false
}
```

You need to use:
```javascript
{
"model": "openrouter/auto",
"messages": [
{
"role": "user",
"content": "Your long prompt here..."
}
],
"stream": false
}
```

## 2. Update Your Pipedream Configuration

In your Pipedream component configuration:

1. **Remove the `prompt` parameter**
2. **Add a `messages` parameter** structured as an array with role/content objects

## 3. Example Fix

Change your data payload from:
```javascript
{
model: "openrouter/auto",
prompt: "**Role:** You are an expert teacher...",
stream: false,
models: ["anthropic/claude-3.7-sonnet"]
}
```

To:
```javascript
{
model: "openrouter/auto",
messages: [
{
role: "user",
content: "**Role:** You are an expert teacher..."
}
],
stream: false,
models: ["anthropic/claude-3.7-sonnet"]
}
```

## 4. If Using the Pipedream UI

If you're configuring this through Pipedream's UI:
- Look for a "Messages" field instead of "Prompt"
- Structure it as an array with objects containing `role` and `content` keys
- Set `role` to "user" and put your prompt text in `content`

This change aligns with OpenAI's chat completions API format, which is what OpenRouter expects for routing requests to different models.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.