Skip to content

Commit f09280f

Browse files
committed
Merge pull request #10 from lunov/main
feat: add OpenRouter support Closes #9
2 parents b4e345b + edb3b96 commit f09280f

4 files changed

Lines changed: 68 additions & 30 deletions

File tree

README.md

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ claude plugin install adversarial-spec
1515

1616
# 2. Set at least one API key
1717
export OPENAI_API_KEY="sk-..."
18+
# Or use OpenRouter for access to multiple providers with one key
19+
export OPENROUTER_API_KEY="sk-or-..."
1820

1921
# 3. Run it
2022
/adversarial-spec "Build a rate limiter service with Redis backend"
@@ -57,16 +59,17 @@ You describe product --> Claude drafts spec --> Multiple LLMs critique in parall
5759

5860
## Supported Models
5961

60-
| Provider | Env Var | Example Models |
61-
|-----------|----------------------|----------------------------------------------|
62-
| OpenAI | `OPENAI_API_KEY` | `gpt-4o`, `gpt-4-turbo`, `o1` |
63-
| Anthropic | `ANTHROPIC_API_KEY` | `claude-sonnet-4-20250514`, `claude-opus-4-20250514` |
64-
| Google | `GEMINI_API_KEY` | `gemini/gemini-2.0-flash`, `gemini/gemini-pro` |
65-
| xAI | `XAI_API_KEY` | `xai/grok-3`, `xai/grok-beta` |
66-
| Mistral | `MISTRAL_API_KEY` | `mistral/mistral-large`, `mistral/codestral` |
67-
| Groq | `GROQ_API_KEY` | `groq/llama-3.3-70b-versatile` |
68-
| Deepseek | `DEEPSEEK_API_KEY` | `deepseek/deepseek-chat` |
69-
| Zhipu | `ZHIPUAI_API_KEY` | `zhipu/glm-4`, `zhipu/glm-4-plus` |
62+
| Provider | Env Var | Example Models |
63+
|------------|------------------------|----------------------------------------------|
64+
| OpenAI | `OPENAI_API_KEY` | `gpt-4o`, `gpt-4-turbo`, `o1` |
65+
| Anthropic | `ANTHROPIC_API_KEY` | `claude-sonnet-4-20250514`, `claude-opus-4-20250514` |
66+
| Google | `GEMINI_API_KEY` | `gemini/gemini-2.0-flash`, `gemini/gemini-pro` |
67+
| xAI | `XAI_API_KEY` | `xai/grok-3`, `xai/grok-beta` |
68+
| Mistral | `MISTRAL_API_KEY` | `mistral/mistral-large`, `mistral/codestral` |
69+
| Groq | `GROQ_API_KEY` | `groq/llama-3.3-70b-versatile` |
70+
| OpenRouter | `OPENROUTER_API_KEY` | `openrouter/openai/gpt-4o`, `openrouter/anthropic/claude-3.5-sonnet` |
71+
| Deepseek | `DEEPSEEK_API_KEY` | `deepseek/deepseek-chat` |
72+
| Zhipu | `ZHIPUAI_API_KEY` | `zhipu/glm-4`, `zhipu/glm-4-plus` |
7073

7174
Check which keys are configured:
7275

@@ -97,6 +100,33 @@ When Bedrock is enabled, **all model calls route through Bedrock** - no direct A
97100

98101
Configuration is stored at `~/.claude/adversarial-spec/config.json`.
99102

103+
## OpenRouter Support
104+
105+
[OpenRouter](https://openrouter.ai) provides unified access to multiple LLM providers through a single API. This is useful for:
106+
- Accessing models from multiple providers with one API key
107+
- Comparing models across different providers
108+
- Automatic fallback and load balancing
109+
- Cost optimization across providers
110+
111+
**Setup:**
112+
113+
```bash
114+
# Get your API key from https://openrouter.ai/keys
115+
export OPENROUTER_API_KEY="sk-or-..."
116+
117+
# Use OpenRouter models (prefix with openrouter/)
118+
python3 debate.py critique --models openrouter/openai/gpt-4o,openrouter/anthropic/claude-3.5-sonnet < spec.md
119+
```
120+
121+
**Popular OpenRouter models:**
122+
- `openrouter/openai/gpt-4o` - GPT-4o via OpenRouter
123+
- `openrouter/anthropic/claude-3.5-sonnet` - Claude 3.5 Sonnet
124+
- `openrouter/google/gemini-2.0-flash` - Gemini 2.0 Flash
125+
- `openrouter/meta-llama/llama-3.3-70b-instruct` - Llama 3.3 70B
126+
- `openrouter/qwen/qwen-2.5-72b-instruct` - Qwen 2.5 72B
127+
128+
See the full model list at [openrouter.ai/models](https://openrouter.ai/models).
129+
100130
## OpenAI-Compatible Endpoints
101131

102132
For models that expose an OpenAI-compatible API (local LLMs, self-hosted models, alternative providers), set `OPENAI_API_BASE`:

skills/adversarial-spec/SKILL.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,18 @@ Generate and refine specifications through iterative debate with multiple LLMs u
1717

1818
## Supported Providers
1919

20-
| Provider | API Key Env Var | Example Models |
21-
|-----------|----------------------|---------------------------------------------|
22-
| OpenAI | `OPENAI_API_KEY` | `gpt-5.2`, `gpt-4o`, `gpt-4-turbo`, `o1` |
23-
| Anthropic | `ANTHROPIC_API_KEY` | `claude-sonnet-4-20250514`, `claude-opus-4-20250514` |
24-
| Google | `GEMINI_API_KEY` | `gemini/gemini-2.0-flash`, `gemini/gemini-pro` |
25-
| xAI | `XAI_API_KEY` | `xai/grok-3`, `xai/grok-beta` |
26-
| Mistral | `MISTRAL_API_KEY` | `mistral/mistral-large`, `mistral/codestral`|
27-
| Groq | `GROQ_API_KEY` | `groq/llama-3.3-70b-versatile` |
28-
| Deepseek | `DEEPSEEK_API_KEY` | `deepseek/deepseek-chat` |
29-
| Zhipu | `ZHIPUAI_API_KEY` | `zhipu/glm-4`, `zhipu/glm-4-plus` |
30-
| Codex CLI | (ChatGPT subscription) | `codex/gpt-5.2-codex`, `codex/gpt-5.1-codex-max` |
20+
| Provider | API Key Env Var | Example Models |
21+
|------------|------------------------|---------------------------------------------|
22+
| OpenAI | `OPENAI_API_KEY` | `gpt-5.2`, `gpt-4o`, `gpt-4-turbo`, `o1` |
23+
| Anthropic | `ANTHROPIC_API_KEY` | `claude-sonnet-4-20250514`, `claude-opus-4-20250514` |
24+
| Google | `GEMINI_API_KEY` | `gemini/gemini-2.0-flash`, `gemini/gemini-pro` |
25+
| xAI | `XAI_API_KEY` | `xai/grok-3`, `xai/grok-beta` |
26+
| Mistral | `MISTRAL_API_KEY` | `mistral/mistral-large`, `mistral/codestral`|
27+
| Groq | `GROQ_API_KEY` | `groq/llama-3.3-70b-versatile` |
28+
| OpenRouter | `OPENROUTER_API_KEY` | `openrouter/openai/gpt-4o`, `openrouter/anthropic/claude-3.5-sonnet` |
29+
| Deepseek | `DEEPSEEK_API_KEY` | `deepseek/deepseek-chat` |
30+
| Zhipu | `ZHIPUAI_API_KEY` | `zhipu/glm-4`, `zhipu/glm-4-plus` |
31+
| Codex CLI | (ChatGPT subscription) | `codex/gpt-5.2-codex`, `codex/gpt-5.1-codex-max` |
3132

3233
**Codex CLI Setup:**
3334
- Install: `npm install -g @openai/codex && codex login`

skills/adversarial-spec/scripts/debate.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,16 @@
2121
python3 debate.py sessions
2222
2323
Supported providers (set corresponding API key):
24-
OpenAI: OPENAI_API_KEY models: gpt-4o, gpt-4-turbo, o1, etc.
25-
Anthropic: ANTHROPIC_API_KEY models: claude-sonnet-4-20250514, claude-opus-4-20250514, etc.
26-
Google: GEMINI_API_KEY models: gemini/gemini-2.0-flash, gemini/gemini-pro, etc.
27-
xAI: XAI_API_KEY models: xai/grok-3, xai/grok-beta, etc.
28-
Mistral: MISTRAL_API_KEY models: mistral/mistral-large, etc.
29-
Groq: GROQ_API_KEY models: groq/llama-3.3-70b, etc.
30-
Codex CLI: (ChatGPT subscription) models: codex/gpt-5.2-codex, codex/gpt-5.1-codex-max
31-
Install: npm install -g @openai/codex && codex login
32-
Reasoning: --codex-reasoning xhigh (minimal, low, medium, high, xhigh)
24+
OpenAI: OPENAI_API_KEY models: gpt-4o, gpt-4-turbo, o1, etc.
25+
Anthropic: ANTHROPIC_API_KEY models: claude-sonnet-4-20250514, claude-opus-4-20250514, etc.
26+
Google: GEMINI_API_KEY models: gemini/gemini-2.0-flash, gemini/gemini-pro, etc.
27+
xAI: XAI_API_KEY models: xai/grok-3, xai/grok-beta, etc.
28+
Mistral: MISTRAL_API_KEY models: mistral/mistral-large, etc.
29+
Groq: GROQ_API_KEY models: groq/llama-3.3-70b, etc.
30+
OpenRouter: OPENROUTER_API_KEY models: openrouter/openai/gpt-4o, openrouter/anthropic/claude-3.5-sonnet, etc.
31+
Codex CLI: (ChatGPT subscription) models: codex/gpt-5.2-codex, codex/gpt-5.1-codex-max
32+
Install: npm install -g @openai/codex && codex login
33+
Reasoning: --codex-reasoning xhigh (minimal, low, medium, high, xhigh)
3334
3435
Document types:
3536
prd - Product Requirements Document (business/product focus)

skills/adversarial-spec/scripts/providers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,11 @@ def list_providers():
279279
("Mistral", "MISTRAL_API_KEY", "mistral/mistral-large, mistral/codestral"),
280280
("Groq", "GROQ_API_KEY", "groq/llama-3.3-70b-versatile"),
281281
("Together", "TOGETHER_API_KEY", "together_ai/meta-llama/Llama-3-70b"),
282+
(
283+
"OpenRouter",
284+
"OPENROUTER_API_KEY",
285+
"openrouter/openai/gpt-4o, openrouter/anthropic/claude-3.5-sonnet",
286+
),
282287
("Deepseek", "DEEPSEEK_API_KEY", "deepseek/deepseek-chat"),
283288
("Zhipu", "ZHIPUAI_API_KEY", "zhipu/glm-4, zhipu/glm-4-plus"),
284289
]
@@ -350,6 +355,7 @@ def get_available_providers() -> list[tuple[str, Optional[str], str]]:
350355
("xAI", "XAI_API_KEY", "xai/grok-3"),
351356
("Mistral", "MISTRAL_API_KEY", "mistral/mistral-large"),
352357
("Groq", "GROQ_API_KEY", "groq/llama-3.3-70b-versatile"),
358+
("OpenRouter", "OPENROUTER_API_KEY", "openrouter/openai/gpt-4o"),
353359
("Deepseek", "DEEPSEEK_API_KEY", "deepseek/deepseek-chat"),
354360
("Zhipu", "ZHIPUAI_API_KEY", "zhipu/glm-4"),
355361
]

0 commit comments

Comments
 (0)