chief-go is the official Go client
for the Chief API. Use it to build Chief into a Go service or automation: start
chats over your project, upload and label assets, schedule actions, and page
through results with typed methods instead of hand-rolled HTTP.
It’s also the foundation the chief CLI and
MCP server are built on — so anything they do, you can do directly
in Go. It depends only on the standard library, so you can vendor it into external
tools without pulling in third-party packages.
Install
Requirements
Go 1.26 or newer. The client depends only on the standard library, so it adds no third-party transitive dependencies to your module.Credentials
A Personal Access Token is required and sent as theX-API-Key header. Most
routes are project-scoped and also need a project id (X-Project-Id). The
Projects.List call is the exception — it works with only an API key and
returns the projects the key can reach.
Create a token in the Chief app under Settings → API tokens — see
Introduction for details on tokens and project
ids, or API access & personal access tokens
in the help center for the in-app walkthrough.
Pass credentials as options or let the client read them from the environment:
Resources
Each resource is its own service on the client:client.Chats,
client.Assets, client.Labels, client.Actions, client.Sessions,
client.Skills, client.Memories, and client.Projects.
Chats
Chat turns run asynchronously:Create and SendMessage return as soon as the
workflow is accepted. WaitForResponse polls GetMessage until the turn
finishes — or call GetMessage directly to poll on your own schedule.
Assets
UploadFile runs the full three-step flow — create the asset row, PUT the
bytes to the signed URL, then complete the upload to start ingest. The returned
bool is true when the content was a dedup hit and no bytes were uploaded.
Actions
Actions run a prompt on a schedule or in response to events, optionally emailing the result.Pagination
List calls are cursor-paginated. Size a page withWithLimit, then feed the
page’s LastID to WithAfterID to fetch the next one until HasMore is false:
WithBeforeID pages backward instead. The two cursors are mutually exclusive.
Errors
Every non-2xx response is returned as an*APIError carrying the HTTP status, a
stable machine-readable Code, and a user-facing Humane message. Helpers
cover the common cases:
Debugging
PassWithDebug(true) when building the client to dump every HTTP request and
response to the standard logger:
Versioning
The package follows semantic versioning. Pin a version in yourgo.mod and review the release notes
before upgrading across a major version:
FAQ
What Go version does the SDK require?
What Go version does the SDK require?
Go 1.26 or newer. The client depends only on the standard library, so it adds no third-party transitive dependencies to your module.
Do I have to write my own polling loop for chat responses?
Do I have to write my own polling loop for chat responses?
No.
WaitForResponse polls GetMessage until the turn finishes. Call GetMessage directly only when you want to poll on your own schedule.Which calls work without a project id?
Which calls work without a project id?
Projects.List is the exception — it needs only an API key and returns the projects that key can reach. Most other routes are project-scoped.How do I see the raw HTTP traffic?
How do I see the raw HTTP traffic?
Build the client with
WithDebug(true) to dump every request and response to the standard logger.Reference
- Package documentation — pkg.go.dev/github.com/Storytell-ai/chief-go/chief
- Source and releases — github.com/Storytell-ai/chief-go