Authentication
The SDK authenticates using bearer tokens. No OAuth, no API keys — just a token string.
Quickstart
Section titled “Quickstart”from githosted import Client
# Pass a token directlyclient = Client(token="gw_your_token")
# Or set GITHOSTED_TOKEN in your environment# export GITHOSTED_TOKEN=gw_your_tokenclient = Client()Token Types
Section titled “Token Types”| Prefix | Type | Scope | Use case |
|---|---|---|---|
gw_ | Workspace | All repos in workspace | Apps, agents, admin tools |
gr_ | Repo | Specific repos only | CI jobs, sandboxes, least-privilege |
Both token types work in the same Client constructor. The SDK auto-detects the type from the prefix.
Credential Resolution Order
Section titled “Credential Resolution Order”The SDK resolves credentials in this order (first match wins):
- Explicit:
Client(token="gw_xxx") - Environment:
GITHOSTED_TOKENenv var
Custom Base URL
Section titled “Custom Base URL”For local development or self-hosted instances:
client = Client( token="gw_xxx", base_url="http://localhost:8080",)The default base URL is https://api.githosted.dev.