feat: Claude Opus via cliproxy 프록시 설정 + base_url 지원
- ClaudeWriter에 base_url 파라미터 추가 (프록시 지원) - engine.json: provider=claude, cliproxy.gru.farm 프록시 설정 - fallback_chain: claude → gemini → groq 순서 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -66,13 +66,14 @@ BaseVideoGenerator = object
|
|||||||
# ─── Writer 구현체 ──────────────────────────────────────
|
# ─── Writer 구현체 ──────────────────────────────────────
|
||||||
|
|
||||||
class ClaudeWriter(BaseWriter):
|
class ClaudeWriter(BaseWriter):
|
||||||
"""Anthropic Claude API를 사용하는 글쓰기 엔진"""
|
"""Anthropic Claude API를 사용하는 글쓰기 엔진 (프록시 base_url 지원)"""
|
||||||
|
|
||||||
def __init__(self, cfg: dict):
|
def __init__(self, cfg: dict):
|
||||||
self.api_key = os.getenv(cfg.get('api_key_env', 'ANTHROPIC_API_KEY'), '')
|
self.api_key = os.getenv(cfg.get('api_key_env', 'ANTHROPIC_API_KEY'), '')
|
||||||
self.model = cfg.get('model', 'claude-opus-4-5')
|
self.model = cfg.get('model', 'claude-sonnet-4-6')
|
||||||
self.max_tokens = cfg.get('max_tokens', 4096)
|
self.max_tokens = cfg.get('max_tokens', 4096)
|
||||||
self.temperature = cfg.get('temperature', 0.7)
|
self.temperature = cfg.get('temperature', 0.7)
|
||||||
|
self.base_url = cfg.get('base_url', '') # 프록시 URL (옵션)
|
||||||
|
|
||||||
def write(self, prompt: str, system: str = '') -> str:
|
def write(self, prompt: str, system: str = '') -> str:
|
||||||
if not self.api_key:
|
if not self.api_key:
|
||||||
@@ -80,7 +81,10 @@ class ClaudeWriter(BaseWriter):
|
|||||||
return ''
|
return ''
|
||||||
try:
|
try:
|
||||||
import anthropic
|
import anthropic
|
||||||
client = anthropic.Anthropic(api_key=self.api_key)
|
client_kwargs = {'api_key': self.api_key}
|
||||||
|
if self.base_url:
|
||||||
|
client_kwargs['base_url'] = self.base_url
|
||||||
|
client = anthropic.Anthropic(**client_kwargs)
|
||||||
kwargs: dict = {
|
kwargs: dict = {
|
||||||
'model': self.model,
|
'model': self.model,
|
||||||
'max_tokens': self.max_tokens,
|
'max_tokens': self.max_tokens,
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
"_comment": "The 4th Path 블로그 자동 수익 엔진 — 엔진 설정 (v3)",
|
"_comment": "The 4th Path 블로그 자동 수익 엔진 — 엔진 설정 (v3)",
|
||||||
"_updated": "2026-03-29",
|
"_updated": "2026-03-29",
|
||||||
"writing": {
|
"writing": {
|
||||||
"provider": "gemini",
|
"provider": "claude",
|
||||||
"fallback_chain": ["groq"],
|
"fallback_chain": ["gemini", "groq"],
|
||||||
"_comment_provider": "openclaw=ChatGPT Pro(OAuth), claude_web=Claude Max(웹쿠키), gemini_web=Gemini Pro(웹쿠키), claude=Anthropic API키, gemini=Google AI API키, groq=Groq API키",
|
"_comment_provider": "openclaw=ChatGPT Pro(OAuth), claude_web=Claude Max(웹쿠키), gemini_web=Gemini Pro(웹쿠키), claude=Anthropic API키, gemini=Google AI API키, groq=Groq API키",
|
||||||
"options": {
|
"options": {
|
||||||
"openclaw": {
|
"openclaw": {
|
||||||
@@ -20,7 +20,8 @@
|
|||||||
"psidts_env": "GEMINI_WEB_1PSIDTS"
|
"psidts_env": "GEMINI_WEB_1PSIDTS"
|
||||||
},
|
},
|
||||||
"claude": {
|
"claude": {
|
||||||
"api_key_env": "ANTHROPIC_API_KEY",
|
"api_key_env": "CLIPROXY_API_KEY",
|
||||||
|
"base_url": "https://cliproxy.gru.farm",
|
||||||
"model": "claude-opus-4-6",
|
"model": "claude-opus-4-6",
|
||||||
"max_tokens": 4096,
|
"max_tokens": 4096,
|
||||||
"temperature": 0.7
|
"temperature": 0.7
|
||||||
|
|||||||
Reference in New Issue
Block a user