efugier/smartcat

Support openrouter.ai

Opened this issue · 1 comments

a-b commented

Hi, and thanks for a fantastic product! Your POSIX approach, which enables Vim and other cli programs, speaks a lot!

Please consider adding support for the https://openrouter.ai/

I attempted to reuse Openai API

[openai]
url = "https://openrouter.ai/api/v1"
# default_model = "meta-llama/llama-3-70b-instruct"
# default_model = "openai/gpt-4o-mini"
# default_model = "google/gemini-flash-1.5"
# default_model = "anthropic/claude-3.5-sonnet:beta"
default_model = "openai/gpt-4o-mini"
api_key = "...."

but ended up with

RUST_BACKTRACE=full sc openai "hello ai"
thread 'main' panicked at /Users/ab/.cargo/registry/src/index.crates.io-6f17d22bba15001f/smartcat-2.2.0/src/utils.rs:9:30:
called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Decode, source: Error("expected value", line: 1, column: 1) }
stack backtrace:
   0:        0x105fc7148 - __mh_execute_header
   1:        0x105de490b - __mh_execute_header
   2:        0x105fc6bae - __mh_execute_header
   3:        0x105fe3d28 - __mh_execute_header
   4:        0x105fe56e5 - __mh_execute_header
   5:        0x105fca275 - __mh_execute_header
   6:        0x105fca1d9 - __mh_execute_header
   7:        0x105fe41a4 - __mh_execute_header
   8:        0x10606ff52 - __mh_execute_header
   9:        0x106070305 - __mh_execute_header
  10:        0x105d66906 - __mh_execute_header
  11:        0x105d6d1e2 - __mh_execute_header
[1]    94438 abort      RUST_BACKTRACE=full sc openai "hello ai"

Hey, thank you for the kind words 🙂

That error is a bit weird, I'll look into it when I get some time!