73 lines
2.5 KiB
Org Mode
73 lines
2.5 KiB
Org Mode
#+TITLE: SKILL: OpenRouter Provider Agent (Universal Literate Note)
|
|
#+ID: skill-provider-openrouter
|
|
#+STARTUP: content
|
|
#+FILETAGS: :llm:provider:openrouter:unified:psf:
|
|
|
|
* Overview
|
|
The *OpenRouter Provider Agent* acts as a unified gateway to hundreds of LLMs. It provides flexibility by dynamically switching between models based on intelligence tiers while maintaining architectural alignment.
|
|
|
|
* Phase A: Demand (PRD)
|
|
:PROPERTIES:
|
|
:STATUS: FROZEN
|
|
:END:
|
|
|
|
** 1. Purpose
|
|
Define the interface for unified communication with the OpenRouter API.
|
|
|
|
** 2. User Needs
|
|
- *Abstraction:* OpenAI-compatible interface for all OpenRouter models.
|
|
- *Dynamic Routing:* Support for intelligence tiers (:POWERFUL, :FAST, :FREE).
|
|
- *Resilience:* Leverage auto-routing fallbacks.
|
|
- *Transparency:* Proper identification via Referer and Title headers.
|
|
|
|
** 3. Success Criteria
|
|
*** TODO Tiered Model Resolution
|
|
*** TODO OpenAI-Compatible Payload Generation
|
|
*** TODO Header Compliance Verification
|
|
|
|
* Phase B: Blueprint (PROTOCOL)
|
|
:PROPERTIES:
|
|
:STATUS: SIGNED
|
|
:END:
|
|
|
|
** 1. Architectural Intent
|
|
Interfaces for executing neural completion requests via the unified OpenRouter gateway.
|
|
|
|
** 2. Semantic Interfaces
|
|
#+begin_src lisp
|
|
(defun execute-openrouter-request (prompt system-prompt)
|
|
"Executes a completion request via the OpenRouter API.")
|
|
|
|
(defun get-openrouter-models ()
|
|
"Returns a curated list of models across tiers.")
|
|
#+end_src
|
|
|
|
* Phase D: Build (Implementation)
|
|
|
|
** Request Execution
|
|
#+begin_src lisp :tangle projects/org-skill-provider-openrouter/src/provider-logic.lisp
|
|
(defun execute-openrouter-request (prompt system-prompt)
|
|
(let ((api-key (uiop:getenv "OPENROUTER_API_KEY")))
|
|
(unless api-key (return-from execute-openrouter-request "ERROR: Key missing"))
|
|
(let ((model (get-tiered-model :fast "meta-llama/llama-3-70b-instruct")))
|
|
;; Physical API call logic (mocked for refactor)
|
|
(format nil "Executing OpenRouter request on ~a" model))))
|
|
#+end_src
|
|
|
|
** Model Discovery
|
|
#+begin_src lisp :tangle projects/org-skill-provider-openrouter/src/provider-logic.lisp
|
|
(defun get-openrouter-models ()
|
|
'((:id "anthropic/claude-3.5-sonnet" :context "200k" :tier :powerful)
|
|
(:id "google/gemini-flash-1.5" :context "1m" :tier :fast)
|
|
(:id "openrouter/auto" :context "varying" :tier :free)))
|
|
#+end_src
|
|
|
|
* Registration
|
|
#+begin_src lisp
|
|
(defskill :skill-provider-openrouter
|
|
:priority 100
|
|
:trigger (lambda (context) nil)
|
|
:neuro (lambda (context) nil)
|
|
:symbolic (lambda (action context) action))
|
|
#+end_src
|