Cohere
JournaledCohere — drop-in replacement for the Cohere SDK that captures billed_units.
Usage
from tokenid import JournaledCohere
client = JournaledCohere(
api_key="…", # your Cohere API key
session_id="my-session",
)
resp = client.chat(
model="command-r-plus",
message="Summarize this for a five-year-old",
)
JournaledCohere accepts every argument the official cohere.Client accepts and forwards every method.
What's captured
Cohere bills on billed_units, not raw token counts. The wrapper reads
response.meta.billed_units.input_tokens and billed_units.output_tokens — using raw tokens would
produce inaccurate cost. This is the main correctness landmine on Cohere; TokenID handles it for you.
Supported models include Command R, Command R+, and Embed family.
Embed
resp = client.embed(
model="embed-english-v3.0",
texts=["hello world"],
input_type="search_document",
)
Token counts on embed responses are read from the same billed_units path.