OpenClaw plugin
For OpenClaw, the recommended integration is the dedicated Cosine inference plugin published as:
@cosineai/claw-inferenceWhat the plugin does
Section titled “What the plugin does”The plugin adds a cosine provider to OpenClaw and is wired for the Cosine
Inference gateway.
It is configured for:
- inference via
https://api.cosine.sh/responses - model discovery via
https://api.cosine.sh/models - the required request header:
cosine-origin: openclaw
Install
Section titled “Install”openclaw plugins install @cosineai/claw-inferenceAuthentication flow
Section titled “Authentication flow”The plugin uses Cosine OAuth rather than a static manually-entered API key flow.
In practice, the flow is:
- OpenClaw starts provider authentication for the
cosineprovider - the plugin creates a login request against
https://api.cosine.sh - OpenClaw opens the Cosine browser login flow
- after you authenticate in the browser, the plugin receives the authenticated session token over the login WebSocket
- OpenClaw stores the resulting OAuth credential for runtime use
The plugin is also designed to refresh the OAuth credential when needed, rather than forcing you to manually re-enter credentials on every expiry boundary.
What gets stored and used
Section titled “What gets stored and used”The plugin works with a Cosine OAuth/session credential that includes the runtime bearer token plus the refresh token and related account metadata needed to keep the session usable.
For runtime requests, the plugin uses that OAuth credential to call:
https://api.cosine.sh/modelshttps://api.cosine.sh/responses
Runtime request behavior
Section titled “Runtime request behavior”At inference time, the plugin sends the request through the Cosine gateway and adds the header expected by the gateway:
cosine-origin: openclaw
It may also attach optional request metadata when configured, such as project or subagent identifiers.
Existing token / environment-based auth
Section titled “Existing token / environment-based auth”The plugin can also pick up an already-available Cosine session from the local environment or Cosine auth state, which is useful if the token is already present in the machine environment and OpenClaw should reuse it instead of starting a fresh browser login.
Relevant environment variables are documented in the public plugin guide:
Full plugin documentation
Section titled “Full plugin documentation”The plugin lives in the public claw repository:
Direct references:
Why use the plugin instead of a raw custom provider
Section titled “Why use the plugin instead of a raw custom provider”OpenClaw has its own provider extension model. The Cosine plugin handles the OpenClaw-specific integration points so you do not have to manually recreate them in user config.
That includes:
- provider registration
- Cosine OAuth flow support
- OAuth credential refresh support
- model discovery against the Cosine gateway
- runtime request headers expected by the gateway
If you are using OpenClaw, use the plugin rather than trying to treat Cosine Inference as a generic raw endpoint by hand.