opencode-authentication
npx skills add https://github.com/supercent-io/skills-template --skill opencode-authentication
Agent 安装分布
Skill 文档
Opencode Authentication Guide
Opencodeìì Claude Code, Gemini/Antigravity, Codex ì¸ì¦ì ë°ì ì¬ì©íë íë¦ì ì 리í©ëë¤.
When to use this skill
- Opencode ì´ê¸° ì¤ì : ì²ì Opencode를 ì¤ì¹íê³ ì¸ì¦ ì¤ì ì
- ë©í° íë¡ë°ì´ë ì°ë: ì¬ë¬ AI ìë¹ì¤ë¥¼ Opencodeìì íµí© ì¬ì© ì
- ì¸ì¦ 문ì í´ê²°: OAuth í í° ë§ë£, ì¸ì¦ ì¤í¨ ë± ë¬¸ì ë°ì ì
- Rate Limit 극복: ë¤ì¤ ê³ì ë±ë¡ì¼ë¡ Rate Limit ì°í ì
1. Claude Code OAuth ì¸ì¦ (Opencode)
ì¸ì¦ íì´ì§ & íë¡ì°
Claude Codeë OAuth 2.0 + PKCE ë°©ìì ì¬ì©í©ëë¤.
https://console.anthropic.com/oauth/authorize
ëë
https://claude.ai/oauth/authorize
ì¸ì¦ íë¼ë¯¸í°:
const CLIENT_ID = "9d1c250a-e61b-44d9-88ed-5944d1962f5e"; // Opencode ê³µì CLIENT_ID
const { challenge, verifier } = await generatePKCE();
const authUrl = new URL("https://console.anthropic.com/oauth/authorize");
authUrl.searchParams.set("client_id", CLIENT_ID);
authUrl.searchParams.set("response_type", "code");
authUrl.searchParams.set("redirect_uri", "https://console.anthropic.com/oauth/code/callback");
authUrl.searchParams.set("scope", "org:create_api_key user:profile user:inference");
authUrl.searchParams.set("code_challenge", challenge);
authUrl.searchParams.set("code_challenge_method", "S256");
authUrl.searchParams.set("state", verifier);
í í° êµí (Token Exchange)
ì¬ì©ìê° ì¹ì¸íë©´ ì¸ì¦ ì½ë를 ë°ê³ , í í°ì¼ë¡ êµí:
const response = await fetch("https://console.anthropic.com/v1/oauth/token", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
code: authCode,
state: pkceVerifier,
grant_type: "authorization_code",
client_id: CLIENT_ID,
redirect_uri: "https://console.anthropic.com/oauth/code/callback",
code_verifier: verifier,
}),
});
const { access_token, refresh_token, expires_in } = await response.json();
API í¸ì¶ ì í¤ë
ì¤ì: Claude Code í í°ì ì¸ ëë ë¤ì í¤ë를 ë°ëì í¬í¨í´ì¼ í©ëë¤.
const headers = {
authorization: `Bearer ${access_token}`,
"anthropic-beta":
"oauth-2025-04-20,claude-code-20250219,interleaved-thinking-2025-05-14",
};
// x-api-key í¤ëë ì ê±°
주ì: 2026ë 1ì ì´í Anthropicì Claude Code 구ë í í°ì ìëíí° ì©ë ì¬ì©ì ì°¨ë¨íìµëë¤. íì¬ë API í¤ ë°©ìë§ ê°ë¥í©ëë¤.
2. Gemini/Antigravity OAuth ì¸ì¦ (Opencode)
íë¬ê·¸ì¸ ì¤ì¹
opencode-antigravity-auth íë¬ê·¸ì¸ì ì¬ì©í©ëë¤.
# Opencode configì íë¬ê·¸ì¸ ì¶ê°
# ~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-google-antigravity-auth"]
}
ì¸ì¦ íë¡ì°
opencode auth login
# -> "Google - OAuth with Google (AntiGravity)" ì í
# -> ë¸ë¼ì°ì ìì Google ê³ì ì¼ë¡ ë¡ê·¸ì¸
# -> Antigravity ì¡ì¸ì¤ ê¶í ì¹ì¸
Google OAuth ìëí¬ì¸í¸:
ì¸ì¦: https://accounts.google.com/o/oauth2/v2/auth
í í°: https://oauth2.googleapis.com/token
ì¤ì íì¼ ì ì¥ ìì¹
ì¸ì¦ ì ë³´ë ë¤ì ê²½ë¡ì ì ì¥ë©ëë¤:
$XDG_DATA_HOME/opencode/antigravity-accounts.json
# ëë ~/.local/share/opencode/antigravity-accounts.json (Linux)
ì¬ë¬ ê³ì ë±ë¡ (Rate Limit 극복):
opencode auth login
# -> 첫 ë²ì§¸ ê³ì ì¸ì¦
# -> "Add another? (y/n)" -> y
# -> ìµë 10ê°ê¹ì§ ì¶ê° ê°ë¥
ìëì¼ë¡ ì¬ë¬ ê³ì ê° ë¡ë ë°¸ë°ì±ì´ ì´ë£¨ì´ì§ëë¤.
API í¸ì¶ ìì
Opencode ì¤ì ìì ëª¨ë¸ ì ì:
{
"models": [
{
"id": "antigravity-gemini-3-pro-high",
"provider": "google",
"settings": { "model": "gemini-3-pro-high" }
},
{
"id": "antigravity-claude-opus-4-5-thinking-low",
"provider": "anthropic",
"settings": { "model": "claude-opus-4-5-thinking" }
}
]
}
3. Claude Code (CLI) ì¸ì¦ íì´ì§
ê³µì Claude Code ë¡ê·¸ì¸:
code login
# ëë
claude login
ì¸ì¦ íì´ì§:
https://console.anthropic.com/oauth/authorize
(ë¡ê·¸ì¸ ìì² ì ìëì¼ë¡ ë¸)
System Prompt ì구ì¬í:
Claude Codeë¡ ì¸ì ë°ì¼ë ¤ë©´ ë°ëì ë¤ì ìì¤í ë©ìì§ë¥¼ í¬í¨í´ì¼ í©ëë¤:
"You are Claude Code, Anthropic's official CLI for Claude."
í ê¸ìë¼ë í리면 API ê±°ì ìë¬ê° ë°ìí©ëë¤.
4. Codex (OpenAI) ì¸ì¦
íë¬ê·¸ì¸
opencode-openai-codex-auth íë¬ê·¸ì¸ ì¬ì©
opencode auth login
# -> "OpenAI - Use ChatGPT Plus/Pro subscription" ì í
ì¸ì¦ ë°©ì
opencode auth login
# -> API í¤ ì
ë ¥ (ëë OAuth ê¸°ë° subscription í í°)
5. Opencode íµí© ì¸ì¦ ëª ë ¹ì´
기본 íë¦
# 1. ì¸ì¦ ë¡ê·¸ì¸
opencode auth login
# 2. ì ê³µì ì í (TUI ë©ë´)
# ââ Anthropic (Claude Code OAuth / API Key)
# ââ Google (Antigravity OAuth)
# ââ OpenAI (Codex / ChatGPT Plus)
# ââ Local (ollama ë±)
# ââ 기í
# 3. ì¸ì¦ ì ë³´ ì ì¥
# ~/.config/opencode/auth.json (ëë íë«í¼ë³ ìì¹)
# 4. ëª¨ë¸ ì í
opencode models list # ì¸ì¦ë ëª¨ë¸ ëª©ë¡ ë³´ê¸°
ì격 ì¦ëª ê´ë¦¬
opencode auth list # ë±ë¡ë ì¸ì¦ ì ë³´ ì¡°í
opencode auth remove <name> # í¹ì ì¸ì¦ ì ê±°
opencode auth login --add # ì¶ê° ê³ì ë±ë¡
6. 주ì ì°¨ì´ì & 주ìì¬í
| ìë¹ì¤ | ì¸ì¦ ë°©ì | ìí | ë¹ê³ |
|---|---|---|---|
| Claude Code (OAuth) | OAuth 2.0 + PKCE | ì°¨ë¨ë¨ (2026.01~) | API í¤ë§ ì¬ì© ê°ë¥ |
| Claude API Key | API Key ë°©ì | íì± | ì ë£ API í¬ë ë§ íì |
| Antigravity (Gemini) | OAuth 2.0 + PKCE | íì± | íë¬ê·¸ì¸: opencode-google-antigravity-auth |
| ChatGPT Plus (Codex) | Subscription OAuth | íì± | íë¬ê·¸ì¸: opencode-openai-codex-auth |
| Local (Ollama) | ë¡ì»¬ ì°ê²° | íì± | API í¤ ë¶íì |
7. ì¤ì ì¤ì ìì (Opencode + Antigravity)
# 1. íë¬ê·¸ì¸ ì¤ì
cat > ~/.config/opencode/opencode.json << 'EOF'
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-google-antigravity-auth"],
"models": [
{
"id": "gemini-3-pro-high",
"provider": "google",
"settings": { "model": "gemini-3-pro-high" }
},
{
"id": "claude-opus-4-5-thinking",
"provider": "anthropic",
"settings": { "model": "claude-opus-4-5-thinking" }
}
]
}
EOF
# 2. ì¸ì¦
opencode auth login
# -> "Google - OAuth with Google (AntiGravity)" ì í
# -> ë¸ë¼ì°ì ìì Google ë¡ê·¸ì¸
# -> Antigravity ê¶í ì¹ì¸
# 3. ë¤ì¤ ê³ì ì¶ê° (ì íì¬í)
opencode auth login
# -> "Add another? (y/n)" -> y
# 4. Opencode ìì
opencode
ì´ì Opencode ë´ìì Antigravityì Gemini 3 Pro, Claude Opus 4.5 ë±ì ìì ë¡ê² ì ííë©° ì¬ì©í ì ììµëë¤.
Instructions
Step 1: íì¬ íê²½ íì¸
# Opencode ì¤ì¹ íì¸
which opencode || echo "Opencode not installed"
# 기존 ì¤ì íì¸
cat ~/.config/opencode/opencode.json 2>/dev/null || echo "No config found"
Step 2: ì¸ì¦ ë°©ì ì í
-
API í¤ ë°©ì (ê¶ì¥, ìì ì )
- Claude: Anthropic Consoleìì API í¤ ë°ê¸
- Gemini: Google AI Studioìì API í¤ ë°ê¸
- OpenAI: OpenAI Platformìì API í¤ ë°ê¸
-
OAuth ë°©ì (무ë£/구ë íì©)
- Antigravity íë¬ê·¸ì¸ ì¤ì¹ í Google OAuth ì¸ì¦
- ChatGPT Plus 구ë ìë Codex íë¬ê·¸ì¸ ì¬ì©
Step 3: íë¬ê·¸ì¸ ì¤ì¹ ë° ì¤ì
# Antigravity íë¬ê·¸ì¸ (Gemini ë¬´ë£ ì¬ì©)
opencode plugin add opencode-google-antigravity-auth
# Codex íë¬ê·¸ì¸ (ChatGPT Plus 구ë
íì©)
opencode plugin add opencode-openai-codex-auth
# ì¤ì íì¸
opencode config show
Step 4: ë¤ì¤ ê³ì ì¤ì (Rate Limit ëì)
# ì¬ë¬ Google ê³ì ë±ë¡
opencode auth login # 첫 ë²ì§¸ ê³ì
opencode auth login # "Add another?" -> y -> ë ë²ì§¸ ê³ì
# ìµë 10ê°ê¹ì§ ì¶ê° ê°ë¥
Constraints
íì ê·ì¹ (MUST)
- Claude Code OAuth ì°¨ë¨ ì¸ì§: 2026ë 1ìë¶í° ìëíí° ì¬ì© ì°¨ë¨ë¨
- System Prompt ì íí: Claude Code ì¸ìì ìí ì íí 문구 ì¬ì©
- API í¤ ë³´ì: íê²½ë³ìë ë³´ì ì ì¥ì ì¬ì©
ê¸ì§ ì¬í (MUST NOT)
- API í¤ íëì½ë© ê¸ì§: ìì¤ ì½ëì ì§ì ì ë ¥ ê¸ì§
- í í° ê³µì ê¸ì§: ì¸ì¦ í í°ì íì¸ê³¼ ê³µì ê¸ì§
- Rate Limit ë¨ì© ê¸ì§: ê³¼ëí ìì²ì¼ë¡ ìë¹ì¤ ì ì© ê¸ì§
Best Practices
1. íê²½ë³ ì¤ì ë¶ë¦¬
# ê°ë° íê²½
export OPENCODE_CONFIG=~/.config/opencode/dev.json
# íë¡ëì
íê²½
export OPENCODE_CONFIG=~/.config/opencode/prod.json
2. API í¤ ìì í ê´ë¦¬
# .env íì¼ ì¬ì©
ANTHROPIC_API_KEY=sk-ant-...
GOOGLE_API_KEY=AIza...
OPENAI_API_KEY=sk-...
# íê²½ë³ìë¡ ë¡ë
source .env
3. í í° ê°±ì ìëí
# cronì¼ë¡ í í° ì²´í¬ ë° ê°±ì
0 */6 * * * opencode auth refresh --silent
Troubleshooting
문ì 1: OAuth ì¸ì¦ ì¤í¨
# ìºì ìì í ì¬ì¸ì¦
rm -rf ~/.config/opencode/cache
opencode auth logout
opencode auth login
문ì 2: Rate Limit ì´ê³¼
# ë¤ì¤ ê³ì ë±ë¡ì¼ë¡ í´ê²°
opencode auth login --add
# ëë API í¤ ë°©ìì¼ë¡ ì í
문ì 3: Claude Code ì¸ì ì¤í¨
# System Prompt ì íí íì¸
"You are Claude Code, Anthropic's official CLI for Claude."
# ëì´ì°ê¸°, ëì문ì 모ë ì íí ì¼ì¹í´ì¼ í¨
References
- Opencode ê³µì 문ì
- Opencodeë ì´ë»ê² claude 구ë API를 ì¸ ì ìë?
- Anthropicì´ Claude Code 구ë ì ìëíí° ì¬ì©ì ì°¨ë¨
- shekohex/opencode-google-antigravity-auth
- Opencode & Google Antigravity íì©
- Opencode Ecosystem
Metadata
ë²ì
- íì¬ ë²ì : 1.0.0
- ìµì¢ ì ë°ì´í¸: 2026-01-10
- í¸í íë«í¼: Claude, ChatGPT, Gemini, Opencode
ê´ë ¨ ì¤í¬
íê·¸
#opencode #oauth #authentication #claude-code #gemini #antigravity #codex #multi-provider