Skip to content

OpenClaw plugin

For OpenClaw, the recommended integration is the dedicated Cosine inference plugin published as:

@cosineai/claw-inference

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
Terminal window
openclaw plugins install @cosineai/claw-inference

The plugin uses Cosine OAuth rather than a static manually-entered API key flow.

In practice, the flow is:

  1. OpenClaw starts provider authentication for the cosine provider
  2. the plugin creates a login request against https://api.cosine.sh
  3. OpenClaw opens the Cosine browser login flow
  4. after you authenticate in the browser, the plugin receives the authenticated session token over the login WebSocket
  5. 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.

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/models
  • https://api.cosine.sh/responses

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.

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:

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.