Add Devin (Cognition) as a provider
Request
Add Devin (Cognition, https://devin.ai) as a built-in provider so users can /login devin and use Devin's models (e.g. swe-1-6) from prime-agent.
Why
Devin ships a CLI auth flow (devin CLI uses it) and exposes its models via a chat API. The @oh-my-pi/pi-coding-agent (omp) fork — which also builds on pi — already implements a full Devin provider: OAuth PKCE login, token refresh, and a streaming client. Since prime-agent shares the same pi / pi-ai base, porting it should be low-effort for maintainers who already have the omp implementation as a reference.
OAuth flow (from omp's implementation)
- PKCE S256, loopback callback
127.0.0.1:59653/callback - Authorize URL:
https://app.devin.ai/auth/cli/continue?redirect_uri=...&state=...&prompt=select_account&code_challenge=...&code_challenge_method=S256 - Token exchange:
POST https://api.devin.ai/auth/cli/tokenwith{ code, code_verifier }→{ token }(JWT) - Stored as
devin-session-token$<jwt>; expiry from JWTexpclaim DEVIN_API_KEYenv var also supported (same token format)
Streaming API
Devin does not speak OpenAI/Anthropic/Gemini. It uses Codeium's Connect-protocol protobuf API:
- Chat:
POST https://server.codeium.com/exa.api_server_pb.ApiServerService/GetChatMessage(application/connect+proto, 5-byte envelope framing, gzip) - Auth prelude:
GetUserJwtat/exa.auth_pb.AuthService/GetUserJwt(session token → user JWT) - Custom protobuf schemas for request (messages/tools/images/thinking) and response (text/thinking/tool-call/tool-result events)
This is the main porting cost — there is no OpenAI-compatible Devin endpoint.
Suggested API key / env var
| Provider | Environment Variable | auth.json key |
|---|---|---|
| Devin | DEVIN_API_KEY |
devin |
References
- omp package:
@oh-my-pi/pi-coding-agent(npm) - prime-agent extension API:
pi.registerProvider("devin", { api, apiKey, models, oauth, streamSimple })— seeexamples/extensions/custom-provider-gitlab-duo/ - Devin CLI: https://github.com/devin-ai-integration/devin-cli
Happy to help test or contribute if there's interest.
Solved via the published pi-devin-auth npm package — it's a standard pi extension that works with prime-agent out of the box:
prime-agent package install npm:pi-devin-auth
The extension registers the devin provider with OAuth login (/login devin), dynamic model catalog, and native streaming via Devin's gRPC API. No prime-agent-specific changes needed since prime-agent inherits pi's ExtensionAPI.
Same approach works for xAI OAuth: prime-agent package install npm:pi-xai-oauth.
Closing this as resolved by the existing package ecosystem. Maintainers may still want to consider linking these from the providers docs for discoverability.