mirror of
https://github.com/agentrhq/authsome.git
synced 2026-09-19 01:34:19 +08:00
71b89fd036
The skill rewrite (PR #284) and README update standardized on "authsome <command>" (assumes "uv tool install authsome") and on agent-driven login flows. The docs site still spoke "uvx authsome" everywhere and didn't surface the auth-error decision tree the skill teaches. This brings the docs in line. Four kinds of change in one PR. 1. CLI prefix sweep ("uvx authsome" to "authsome"). Mechanical find/replace across docs/site/ excluding installation.mdx. 812 occurrences updated. installation.mdx keeps the literal "uvx" references because they explain the one-off run path. 2. installation.mdx rewrite. - "uv (recommended)" tab leads, with "uv tool install authsome". - pip second. - uvx demoted to "one-off, no install" with @latest pattern shown. - From source unchanged. - A Note at the top declares: every command in the docs is the installed form; uvx users prefix with "uvx authsome@latest". - All subsequent code blocks updated to bare "authsome". 3. New troubleshooting/auth-errors.mdx page. Captures the decision tree the skill teaches: 401 -> revoke + re-login; 403 -> "authsome login --scopes" (not re-registering); wrong client creds -> "authsome remove" then re-login. Registered in docs.json under Troubleshooting. 4. quickstart.mdx pivoted to two paths + help reflex. Path 1: agent-driven. Install the skill, ask the agent to do a task that needs an external service. The agent runs login itself. Path 2: CLI-driven. The existing manual walkthrough, preserved. Adds a Tip about reading "authsome --help" and "authsome <cmd> --help" before guessing flags. 5. Agent-mode note on the four skill-based integration pages. claude-code, codex, cursor, opencode each get a one-paragraph Note clarifying that the agent runs login, opens the browser on the user's machine for OAuth, and that users should not paste keys into prompts or pre-run login commands. The four SDK-style integration pages (langchain, llamaindex, openai-agents-sdk, anthropic-sdk) are unchanged because their pattern is developer-driven, not agent-driven. Verified clean: no "uvx authsome" outside installation.mdx, docs.json valid, no em-dashes introduced.
66 lines
2.4 KiB
Plaintext
66 lines
2.4 KiB
Plaintext
---
|
|
title: "OpenCode"
|
|
sidebarTitle: "OpenCode"
|
|
description: "Run OpenCode agents under authsome. Same proxy and library patterns as the rest of the CLI."
|
|
icon: "code"
|
|
keywords: ["opencode authsome", "opencode credentials", "opencode github", "opencode oauth"]
|
|
---
|
|
|
|
[OpenCode](https://opencode.ai) is an open-source AI coding agent. It runs as a CLI, calls LLMs over HTTPS, and shells out to local tools. Authsome plugs in via the same two patterns we use everywhere: wrap the agent under `authsome run --`, or call the library from inside.
|
|
|
|
<Note>
|
|
**The agent drives login.** When OpenCode hits a missing credential it can run `authsome login <provider>` itself, opening a browser on your machine for OAuth consent. Don't paste keys into prompts; pre-seed a credential only when an agent can't reach a browser (CI, SSH).
|
|
</Note>
|
|
|
|
## Recommended pattern: wrap the agent
|
|
|
|
```bash
|
|
authsome login github
|
|
authsome login openai
|
|
authsome run -- opencode
|
|
```
|
|
|
|
OpenCode sees placeholder env vars (`OPENAI_API_KEY=authsome-proxy-managed`) but never the real key. Outbound HTTPS to matched provider hosts is authenticated by the proxy.
|
|
|
|
## Embedding the library
|
|
|
|
If you're orchestrating OpenCode from a larger Python program and need explicit per-call control, drop below the proxy:
|
|
|
|
```python
|
|
from authsome.server.dependencies import create_auth_service
|
|
|
|
auth = create_auth_service()
|
|
key = auth.get_access_token("openai", connection="default")
|
|
```
|
|
|
|
See [Python library](/reference/python-library).
|
|
|
|
## Multi-account
|
|
|
|
```bash
|
|
authsome login github --connection personal
|
|
authsome login github --connection work
|
|
authsome login github --connection work --force
|
|
authsome run -- opencode
|
|
```
|
|
|
|
The proxy uses each provider's default connection. To switch which connection the proxy uses, set it as default with `--force`. See [Multiple connections per provider](/guides/multiple-connections).
|
|
|
|
## Troubleshooting
|
|
|
|
| Symptom | Fix |
|
|
|---------|-----|
|
|
| `OPENAI_API_KEY` rejected as invalid | OpenCode is running outside `authsome run`. Wrap it. |
|
|
| TLS errors against `api.openai.com` | Trust the mitmproxy CA. See [Proxy networking](/troubleshooting/proxy-networking). |
|
|
|
|
## What's next
|
|
|
|
<Columns cols={2}>
|
|
<Card title="Run agents with the proxy" icon="shield-halved" href="/guides/run-agents-with-proxy">
|
|
Full proxy walkthrough.
|
|
</Card>
|
|
<Card title="Generic Python agent" icon="python" href="/integrations/agents/python">
|
|
The library pattern for any Python script.
|
|
</Card>
|
|
</Columns>
|