Skip to main content

Which Cohere API endpoints and models does Coolhand support?

Last updated 5 min read

Coolhand supports Cohere's `/v2/chat` endpoint and `/v1/embed` and `/v2/embed` endpoints across `api.cohere.com` and `api.cohere.ai`. Supported chat models include Command R, Command R+, and Aya Expanse with per-token pricing and cache tracking. Endpoints like `/v1/chat`, `rerank`, `classify`, and batch embed jobs, as well as Cloudflare AI Gateway proxying, are unsupported.

Coolhand automatically captures and analyzes traffic to Cohere's modern Chat and Embed APIs. Interception is built into Coolhand's Python SDK (0.8.0+), Node SDK (0.14.0+), and Ruby SDK (0.7.0+).

Because Cohere uses distinct payload formats across its API versions and task types, Coolhand explicitly routes and supports specific endpoints while flagging incompatible routes as unsupported.


Supported endpoints and domains

Coolhand intercepts and parses requests sent to the following endpoints on api.cohere.com and api.cohere.ai:

Endpoint Method Status Notes
/v2/chat POST Supported Full chat completions envelope, prompt caching, streaming, and tool use.
/v1/embed POST Supported Text embeddings. Captured and logged with usage.
/v2/embed POST Supported Multimodal and text embeddings. Captured and logged with usage.

Unsupported Cohere endpoints

Older endpoints and specialized task APIs use different request and response envelopes:

  • Legacy Chat (/v1/chat): Cohere's older v1 chat API returns a flat text field and legacy meta.billed_units format rather than the v2 typed message blocks. These calls are flagged as unsupported. Migrate your requests to /v2/chat.
  • Rerank (/v1/rerank): The Rerank API scores document relevance and bills per search query rather than per token. It is not currently ingested.
  • Classification & Tokenization (/v1/classify, /v1/tokenize, /v1/detokenize): Non-generative utility endpoints are not ingested.
  • Batch Embedding Jobs (/v1/embed-jobs): Asynchronous bulk embedding jobs are excluded by default in the SDK deny-lists.

Calls to unsupported endpoints are flagged as unsupported APIs in Coolhand and will not generate standard LLM request logs.


Cloudflare AI Gateway routing

If you route Cohere traffic through Cloudflare AI Gateway via the /cohere/ path (such as gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/cohere/...), that traffic is not yet supported.

While Coolhand intercepts the gateway.ai.cloudflare.com domain, gateway-proxied Cohere requests are not currently recognized by the ingest pipeline and will be flagged as unsupported. Send your Cohere requests directly to api.cohere.com or api.cohere.ai to ensure capture.


Model support and cost tracking

Coolhand records token usage and calculates costs based on published per-token pricing:

Generative chat models

The following chat models used with /v2/chat are fully supported for token and cost tracking:

  • Command R+ (command-r-plus, including versioned snapshots like command-r-plus-08-2024)
  • Command R (command-r, including command-r-08-2024 and command-r-03-2024)
  • Command Light (command-light)
  • Aya Expanse (c4ai-aya-expanse-8b, c4ai-aya-expanse-32b)

Models with $0 cost tracking

Certain Cohere models are ingested, but appear in Coolhand with $0 cost:

  • Aya Vision models (c4ai-aya-vision-8b, c4ai-aya-vision-32b): Multimodal vision models that do not have published per-token API pricing.
  • North Mini Code (north-mini-code-1-0): Experimental or preview models without official API token pricing.
  • Embeddings (embed-english-v3.0, embed-multilingual-v3.0, embed-english-light-v3.0, etc.): Requests to /v1/embed and /v2/embed are captured with their full request and response metadata, but direct Cohere embedding models currently report $0 cost in Coolhand.

How Coolhand captures Cohere requests

Because Cohere's v2 API differs from OpenAI and Anthropic specifications, Coolhand handles several provider-specific behaviors:

Request-based model resolution

Cohere's API response does not include a model field. Coolhand extracts the model name directly from the model parameter inside the incoming request body.

Billed units vs. token counts

Cohere reports token usage divided into two objects:

  • tokens: The raw token counts processed by the model.
  • billed_units: The units actually billed by Cohere.

Cohere excludes its own internal preambles from billed_units. Coolhand extracts billed_units.input_tokens and billed_units.output_tokens (falling back to tokens if billed_units is absent). This ensures your recorded token metrics and cost calculations match your actual Cohere invoice.

Prompt caching

When Cohere serves a request using cached tokens, it reports usage.cached_tokens. Coolhand records this value as Cached Input Tokens. If no cache was hit, this field remains blank.

Truncation detection

When a response reaches your configured max_tokens ceiling, Cohere sets finish_reason: "MAX_TOKENS". Coolhand detects this finish reason and records that the response was truncated. This signal is tracked internally rather than exposed as a direct log field in the API. Learn more in How to tell if a model response was truncated.

Streaming responses

Coolhand supports streaming on POST /v2/chat when using server-sent events (stream: true). Coolhand reassembles the content-delta stream events, captures thinking blocks in the Thinking Response field, and extracts final token counts from the terminal message-end event.


SDK configuration

Coolhand SDKs automatically intercept Cohere calls using path-scoped rules. Unlike host-wide integrations, interception is pinned specifically to /v2/chat, /v1/embed, and /v2/embed to prevent capturing unsupported Cohere routes.

If you customize intercept_addresses in your application, ensure you retain the path anchors:

from coolhand import Coolhand, DEFAULT_INTERCEPT_ADDRESSES

# Keep default Cohere anchors when extending intercept addresses
Coolhand(
    intercept_addresses=DEFAULT_INTERCEPT_ADDRESSES + [
        "custom-proxy.internal/v2/chat",
    ]
)

For more details on SDK setup and network interceptors, refer to the Python SDK, Node.js SDK, or Ruby SDK integration guides.

Related articles

  • Google Vertex AI best practices

    Vertex AI's preferred request format puts system instructions in a top-level `system_instruction` field, outside the ...

  • Google Gemini best practices

    The Gemini API carries system instructions in a top-level `system_instruction` field rather than a system-role messag...

  • Anthropic API best practices

    Anthropic's Messages API carries the system prompt in a top-level `system` field rather than a message with a system ...

  • Azure OpenAI best practices

    Azure logs record your deployment name, not the underlying model version, so `my-gpt4o-prod` appears where you might ...