Class: LLM::OpenRouter
- Defined in:
- lib/llm/providers/openrouter.rb
Overview
The OpenRouter class implements a provider for OpenRouter through its OpenAI-compatible API.
Constant Summary collapse
- HOST =
"openrouter.ai"- BASE_PATH =
"/api/v1"
Instance Method Summary collapse
- #audio ⇒ Object
-
#default_model ⇒ String
Returns the default model for chat completions.
-
#embed(input, model: "openai/text-embedding-3-small", **params) ⇒ LLM::Response
Provides an embedding.
- #files ⇒ Object
- #images ⇒ Object
- #initialize(host: HOST, base_path: BASE_PATH) ⇒ LLM::OpenRouter constructor
- #moderations ⇒ Object
-
#name ⇒ Symbol
Returns the provider's name.
- #vector_stores ⇒ Object
Methods inherited from OpenAI
#adapt_function, #assistant_role, #complete, #models, #responses, #server_tools, #web_search
Methods included from LLM::OpenAI::RequestAdapter
Methods inherited from Provider
#adapt_function, #assistant_role, #build_messages, #chat, #complete, #developer_role, #inspect, #interrupt!, #key?, #models, #ocr, #registry, #request_owner, #respond, #responses, #schema, #server_tool, #server_tools, #system_role, #tool_role, #tracer, #tracer=, #user_role, #web_search, #with, #with_tracer
Constructor Details
#initialize(host: HOST, base_path: BASE_PATH) ⇒ LLM::OpenRouter
26 27 28 |
# File 'lib/llm/providers/openrouter.rb', line 26 def initialize(host: HOST, base_path: BASE_PATH, **) super end |
Instance Method Details
#audio ⇒ Object
63 64 65 |
# File 'lib/llm/providers/openrouter.rb', line 63 def audio raise NotImplementedError end |
#default_model ⇒ String
Returns the default model for chat completions
83 84 85 |
# File 'lib/llm/providers/openrouter.rb', line 83 def default_model "openrouter/auto" end |
#embed(input, model: "openai/text-embedding-3-small", **params) ⇒ LLM::Response
Provides an embedding.
45 46 47 |
# File 'lib/llm/providers/openrouter.rb', line 45 def (input, model: "openai/text-embedding-3-small", **params) super end |
#files ⇒ Object
51 52 53 |
# File 'lib/llm/providers/openrouter.rb', line 51 def files raise NotImplementedError end |
#images ⇒ Object
57 58 59 |
# File 'lib/llm/providers/openrouter.rb', line 57 def images raise NotImplementedError end |
#moderations ⇒ Object
69 70 71 |
# File 'lib/llm/providers/openrouter.rb', line 69 def moderations raise NotImplementedError end |
#name ⇒ Symbol
Returns the provider's name
33 34 35 |
# File 'lib/llm/providers/openrouter.rb', line 33 def name :openrouter end |
#vector_stores ⇒ Object
75 76 77 |
# File 'lib/llm/providers/openrouter.rb', line 75 def vector_stores raise NotImplementedError end |