plandex-ai / plandex

AI driven development in your terminal. Designed for large, real-world tasks.
https://plandex.ai
GNU Affero General Public License v3.0
10.76k stars 750 forks source link

Api base url should be required when adding a custom model #108

Closed cschneid closed 6 months ago

cschneid commented 6 months ago

I am getting this error after a trivial 'tell' command. One file is in context.

$ plandex tell 'Write a unit test'
✅ Context is up to date

 💬 User prompt 👇

  Write a unit test

🚨 Server error
  → Error starting reply stream
    → Error, status code
      → 401, message
        → Incorrect API key provided
          → Sk-or-v1*************************************************************de1a. You can find your API key at https://platform.openai.com/account/api-keys.

The Sk-or-v1*** key is my OPENROUTER_API_KEY.

🤖 Models
+-----------------+----------+----------------------------------+-------------+-------+
|      ROLE       | PROVIDER |              MODEL               | TEMPERATURE | TOP P |
+-----------------+----------+----------------------------------+-------------+-------+
| planner         | custom   | mistralai/mixtral-8x22b-instruct |         0.3 |   0.3 |
| summarizer      | custom   | mistralai/mixtral-8x22b-instruct |         0.2 |   0.2 |
| builder         | openai   | gpt-4-turbo                      |         0.1 |   0.1 |
| names           | openai   | gpt-3.5-turbo                    |         0.8 |   0.5 |
| commit-messages | openai   | gpt-3.5-turbo                    |         0.8 |   0.5 |
| auto-continue   | openai   | gpt-4-turbo                      |         0.1 |   0.1 |
+-----------------+----------+----------------------------------+-------------+-------+
🛠️  Custom Models
+---+------------+----------------------------------+-------+--------------------+
| # |  PROVIDER  |               NAME               |  🪙   |         🔑         |
+---+------------+----------------------------------+-------+--------------------+
| 1 | openrouter | mistralai/mixtral-8x22b-instruct | 65536 | OPENROUTER_API_KEY |
+---+------------+----------------------------------+-------+--------------------+
cschneid commented 6 months ago

Update: I figured out what happened. Probably a UX issue with adding custom models. I forgot to set the base url for openrouter, so I think it's still defaulting to openai.

I needed https://openrouter.ai/api/v1 in that field.

Maybe reject a blank, or at least confirm if that field is left blank on a new custom model?

danenania commented 6 months ago

@cschneid I see, yes I'll make the base url a required field.