Cohere
Cohere Adapter
Section titled “Cohere Adapter”AgentRuntime implementation backed by a native client that posts directly to the Cohere v2 Chat API (POST /v2/chat) over java.net.http.HttpClient — no SDK dependency, no OpenAI-compatible translation layer in between. The runtime forwards Cohere’s native SSE event types (content-delta, tool-plan-delta, tool-call-start, tool-call-delta, citation-start), so streaming “thinking” tokens and RAG citations render on the client without lossy translation through an OpenAI-shaped proxy.
Maven Coordinates
Section titled “Maven Coordinates”<dependency> <groupId>org.atmosphere</groupId> <artifactId>atmosphere-cohere</artifactId> <version>${project.version}</version></dependency>How It Works
Section titled “How It Works”Drop the dependency alongside atmosphere-ai and the framework auto-detects it via ServiceLoader. CohereAgentRuntime has priority 100, taking precedence over the built-in client (priority 0):
@AiEndpoint(path = "/ai/chat", systemPrompt = "You are a helpful assistant")public class MyChat {
@Prompt public void onPrompt(String message, StreamingSession session) { session.stream(message); // uses the Cohere v2 Chat API automatically }}Configuration
Section titled “Configuration”Set the API key via the framework’s llm.api-key, an environment variable, or a system property:
export LLM_API_KEY=your-cohere-key# or, equivalently:java -Dcohere.api.key=your-cohere-key -jar app.jarThe runtime registers itself at priority 100 and the framework picks it up when the jar is on the classpath alongside a configured key.
Sovereign / self-hosted endpoint
Section titled “Sovereign / self-hosted endpoint”Point the runtime at any environment that speaks the Cohere v2 wire protocol (for example Command A+ deployed on customer infrastructure) by overriding cohere.base.url.
Samples
Section titled “Samples”- Spring Boot AI Chat — drop
atmosphere-cohereon the classpath and the same@AiEndpointcode switches to Cohere
See Also
Section titled “See Also”- AI Reference —
AgentRuntimeSPI,@AiEndpoint, capability matrix, tool calling - Anthropic Adapter — the other native, SDK-free runtime
- Module README