omnisearch-cli 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -33,6 +33,85 @@ omnisearch "quantum computing" -n 5
33
33
 
34
34
  ---
35
35
 
36
+ ## 🔑 Providing API Keys
37
+
38
+ The CLI supports 3 ways to provide API keys:
39
+
40
+ ### 1. Automatic `.env` File (Recommended)
41
+ Place a `.env` file in your current working directory. The CLI will automatically detect and load it on startup without requiring any flags or external dependencies:
42
+
43
+ ```env
44
+ # .env template — Fill only the providers you want to use:
45
+
46
+ # Brave Search
47
+ BRAVE_API_KEY=
48
+
49
+ # Tavily AI Search
50
+ TAVILY_API_KEY=
51
+
52
+ # Google Custom Search (Requires both)
53
+ GOOGLE_API_KEY=
54
+ GOOGLE_CX=
55
+
56
+ # Azure Bing Web Search
57
+ BING_API_KEY=
58
+
59
+ # You.com Search
60
+ YOU_API_KEY=
61
+
62
+ # Exa Neural Search
63
+ EXA_API_KEY=
64
+
65
+ # Perplexity AI
66
+ PERPLEXITY_API_KEY=
67
+
68
+ # Parallel Search
69
+ PARALLEL_API_KEY=
70
+
71
+ # SerpAPI
72
+ SERPAPI_KEY=
73
+
74
+ # Self-Hosted SearXNG Instance
75
+ SEARXNG_URL=
76
+
77
+ # GitHub (Optional, increases rate limit)
78
+ GITHUB_TOKEN=
79
+
80
+ # Semantic Scholar (Optional, increases rate limit)
81
+ SEMANTIC_SCHOLAR_API_KEY=
82
+
83
+ # PubMed / NCBI (Optional, increases rate limit)
84
+ PUBMED_API_KEY=
85
+ ```
86
+
87
+ Then simply run:
88
+ ```bash
89
+ npx omnisearch-cli "latest AI research"
90
+ ```
91
+
92
+ ### 2. Inline Environment Variable (One-off / CI)
93
+ Pass keys directly on the command line:
94
+
95
+ * **macOS / Linux / WSL / Git Bash:**
96
+ ```bash
97
+ BRAVE_API_KEY="your_key" npx omnisearch-cli "deep learning" -p brave
98
+ ```
99
+ * **Windows PowerShell:**
100
+ ```powershell
101
+ $env:BRAVE_API_KEY="your_key"; npx omnisearch-cli "deep learning" -p brave
102
+ ```
103
+
104
+ ### 3. Persistent Shell Profile
105
+ Export your keys in your `~/.bashrc`, `~/.zshrc`, or Windows Environment Variables:
106
+ ```bash
107
+ export BRAVE_API_KEY="your_key"
108
+ export TAVILY_API_KEY="your_key"
109
+ ```
110
+
111
+ > **Zero-Key Mode:** If no API keys are configured, `omnisearch-cli` automatically runs using free public providers (**DuckDuckGo**, **PubMed**, **Arxiv**, and **Semantic Scholar**) with no signup required.
112
+
113
+ ---
114
+
36
115
  ## 🛠 Command-Line Options
37
116
 
38
117
  ```text
package/dist/index.js CHANGED
@@ -20,6 +20,10 @@ import {
20
20
  createYouProvider,
21
21
  webSearch
22
22
  } from "omnisearch-sdk";
23
+ try {
24
+ process.loadEnvFile();
25
+ } catch {
26
+ }
23
27
  function showHelp() {
24
28
  console.log(`
25
29
  OmniSearch CLI - High-performance multi-provider search
@@ -48,7 +52,7 @@ function resolveProviders(providerName) {
48
52
  const registry = {
49
53
  duckduckgo: () => createDuckDuckGoProvider(),
50
54
  arxiv: () => createArxivProvider(),
51
- pubmed: () => createPubMedProvider(),
55
+ pubmed: () => createPubMedProvider({ apiKey: env.PUBMED_API_KEY }),
52
56
  github: () => createGitHubProvider({ apiKey: env.GITHUB_TOKEN || env.GITHUB_API_KEY }),
53
57
  brave: () => env.BRAVE_API_KEY || env.BRAVE_SEARCH_API_KEY ? createBraveProvider({ apiKey: env.BRAVE_API_KEY || env.BRAVE_SEARCH_API_KEY }) : null,
54
58
  google: () => env.GOOGLE_API_KEY && env.GOOGLE_CX ? createGoogleProvider({ apiKey: env.GOOGLE_API_KEY, cx: env.GOOGLE_CX }) : null,
@@ -58,9 +62,9 @@ function resolveProviders(providerName) {
58
62
  bing: () => env.BING_API_KEY ? createBingProvider({ apiKey: env.BING_API_KEY }) : null,
59
63
  you: () => env.YOU_API_KEY ? createYouProvider({ apiKey: env.YOU_API_KEY }) : null,
60
64
  parallel: () => env.PARALLEL_API_KEY ? createParallelProvider({ apiKey: env.PARALLEL_API_KEY }) : null,
61
- serpapi: () => env.SERPAPI_API_KEY ? createSerpApiProvider({ apiKey: env.SERPAPI_API_KEY }) : null,
62
- searxng: () => env.SEARXNG_BASE_URL ? createSearXNGProvider({ baseUrl: env.SEARXNG_BASE_URL }) : null,
63
- semanticscholar: () => createSemanticScholarProvider()
65
+ serpapi: () => env.SERPAPI_KEY || env.SERPAPI_API_KEY ? createSerpApiProvider({ apiKey: env.SERPAPI_KEY || env.SERPAPI_API_KEY }) : null,
66
+ searxng: () => env.SEARXNG_URL || env.SEARXNG_BASE_URL ? createSearXNGProvider({ baseUrl: env.SEARXNG_URL || env.SEARXNG_BASE_URL }) : null,
67
+ semanticscholar: () => createSemanticScholarProvider({ apiKey: env.SEMANTIC_SCHOLAR_API_KEY })
64
68
  };
65
69
  if (name) {
66
70
  const factory = registry[name];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnisearch-cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Command-line interface for OmniSearch SDK",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -15,7 +15,7 @@
15
15
  "node": ">=24.0.0"
16
16
  },
17
17
  "dependencies": {
18
- "omnisearch-sdk": "5.0.1"
18
+ "omnisearch-sdk": "5.1.0"
19
19
  },
20
20
  "devDependencies": {
21
21
  "tsup": "^8.5.1",