diff --git a/README.md b/README.md index 5354f64f7..e3503825f 100644 --- a/README.md +++ b/README.md @@ -224,6 +224,7 @@ api_keys: auth_token: "your-huggingface-token-for-authorized-models" cache_dir: "your-cache-dir-for-saving-models" novita: "your-novita-api-key" + orcarouter: "your-orcarouter-api-key" ``` To obtain these API keys: @@ -234,6 +235,7 @@ To obtain these API keys: 5. HuggingFace Token: Visit https://huggingface.co/settings/tokens 6. Anthropic API: Visit https://console.anthropic.com/keys 7. Novita AI API: Visit https://novita.ai/api-keys +8. OrcaRouter API: Visit https://www.orcarouter.ai #### Configure LLM Models You can configure which LLM models to use in the same `aios/config/config.yaml` file. Here's an example configuration: @@ -250,6 +252,10 @@ llms: - name: "meta-llama/Llama-3.1-8B-Instruct" backend: "vllm" hostname: "http://localhost:8091/v1" # Make sure to run vllm server + + # OrcaRouter Models + - name: "orcarouter/auto" + backend: "orcarouter" # Routes via https://api.orcarouter.ai/v1 ``` **Using Ollama Models:** @@ -286,6 +292,16 @@ You can configure HuggingFace models with specific GPU memory allocation: eval_device: "cuda:0" # Device for model evaluation ``` +**Using OrcaRouter Models:** +[OrcaRouter](https://www.orcarouter.ai) is an OpenAI-compatible gateway that exposes 160+ models (OpenAI, Anthropic, DeepSeek, Qwen, and more) behind a single API key. Add the `orcarouter` backend to use it: + +```yaml +- name: "orcarouter/auto" + backend: "orcarouter" +``` + +The gateway endpoint defaults to `https://api.orcarouter.ai/v1` (override with `hostname`). Set your key via `ORCAROUTER_API_KEY` or the `orcarouter` entry under `api_keys` in `aios/config/config.yaml`. + #### Set up interactively Alternatively, you can set up aios configurations interactively by using the following command. @@ -305,6 +321,7 @@ When no environment variables are set, the following API keys will be shown: - `HF_AUTH_TOKEN`: HuggingFace authentication token for accessing models - `HF_HOME`: Optional path to store HuggingFace models - `NOVITA_API_KEY`: Novita AI API key for accessing Novita AI services +- `ORCAROUTER_API_KEY`: OrcaRouter API key for accessing OrcaRouter gateway models #### Launch AIOS After you setup your keys or environment parameters, then you can follow the instructions below to start. @@ -378,6 +395,7 @@ Make sure you have installed a virtualized environment with GUI, then you can re | ollama | [All Models](https://ollama.com/search) | ✅ | model-name | ollama | - | | vLLM | [All Models](https://docs.vllm.ai/en/latest/) | ✅ | model-name | vllm | - | | Novita | [All Models](https://novita.ai/models/llm) | ✅ | model-name | novita | NOVITA_API_KEY | +| [OrcaRouter](https://www.orcarouter.ai) | [All Models](https://www.orcarouter.ai) | ✅ | model-name | orcarouter | ORCAROUTER_API_KEY | ## 🔧 Experimental Rust Rewrite (aios-rs) An early experimental Rust scaffold lives in `aios-rs/` providing trait definitions and minimal placeholder implementations (context, memory, storage, tool, scheduler, llm). This is NOT feature-parity yet; it's a foundation for incremental porting and performance-focused components. diff --git a/aios/config/config.yaml.example b/aios/config/config.yaml.example index a33f36d5e..7da7e10f9 100644 --- a/aios/config/config.yaml.example +++ b/aios/config/config.yaml.example @@ -9,6 +9,7 @@ api_keys: huggingface: auth_token: "" # Your HuggingFace auth token for authorized models cache_dir: "" # Your cache directory for saving huggingface models + orcarouter: "" # OrcaRouter API key # LLM Configuration llms: @@ -54,6 +55,12 @@ llms: # backend: "vllm" # hostname: "http://localhost:8091" + # OrcaRouter Models + # OrcaRouter (https://www.orcarouter.ai) is an OpenAI-compatible gateway that + # routes to 160+ models (OpenAI, Anthropic, DeepSeek, Qwen, ...) from one API key. + # - name: "orcarouter/auto" + # backend: "orcarouter" + router: strategy: "sequential" bootstrap_url: "https://drive.google.com/file/d/1SF7MAvtnsED7KMeMdW3JDIWYNGPwIwL7/view" diff --git a/aios/config/config_manager.py b/aios/config/config_manager.py index 77049e302..b14e89171 100644 --- a/aios/config/config_manager.py +++ b/aios/config/config_manager.py @@ -140,7 +140,8 @@ def get_api_key(self, provider: str) -> Optional[str]: "gemini": "GEMINI_API_KEY", "groq": "GROQ_API_KEY", "anthropic": "ANTHROPIC_API_KEY", - "huggingface": "HF_AUTH_TOKEN" + "huggingface": "HF_AUTH_TOKEN", + "orcarouter": "ORCAROUTER_API_KEY" } if provider in env_var_map: env_var = env_var_map[provider] diff --git a/aios/llm_core/adapter.py b/aios/llm_core/adapter.py index 3104eea00..3b51525cd 100644 --- a/aios/llm_core/adapter.py +++ b/aios/llm_core/adapter.py @@ -158,6 +158,7 @@ def _setup_api_keys(self) -> None: "anthropic": "ANTHROPIC_API_KEY", "huggingface": "HF_AUTH_TOKEN", "novita": "NOVITA_API_KEY", + "orcarouter": "ORCAROUTER_API_KEY", } logger.info("=== LLMAdapter Initialization ===") @@ -250,7 +251,21 @@ def _initialize_single_llm(self, config: LLMConfig) -> Optional[Union[str, HfLoc base_url=config.hostname, api_key=config.api_key or "sk-placeholder" # Use provided key or a placeholder ) - + + case "orcarouter": + # OrcaRouter is an OpenAI-compatible gateway (https://api.orcarouter.ai/v1) + # that routes to 160+ models from a single API key. + base_url = config.hostname or "https://api.orcarouter.ai/v1" + api_key = ( + config.api_key + or os.getenv("ORCAROUTER_API_KEY") + or "sk-placeholder" + ) + return OpenAI( + base_url=base_url, + api_key=api_key, + ) + case _: # Handle LiteLLM supported backends backend_name = config.backend diff --git a/aios/utils/commands/launch.py b/aios/utils/commands/launch.py index f1a8ed24d..dc8d5751e 100644 --- a/aios/utils/commands/launch.py +++ b/aios/utils/commands/launch.py @@ -11,6 +11,7 @@ def show_available_api_keys(): print("- GROQ_API_KEY (Groq API key)") print("- HF_AUTH_TOKEN (HuggingFace authentication token)") print("- HF_HOME (Optional: Path to store HuggingFace models)") + print("- ORCAROUTER_API_KEY (OrcaRouter API key)") def handle_env_command(args): env_file = os.path.expanduser("~/.aios-1/.env")