API reference
Assistant
CogniChem Assistant sessions, turn estimates, SSE streams, and stop. JWT only. Wallet-billed at caller-tier token rates.
On this page
List Assistant threads
GET/api/v1/chat/sessions
Access token only
List the caller's Assistant threads.
Example request
curl "https://api.cognichem.com/api/v1/chat/sessions" \
-H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN"import os
from cognichem_client import CogniChem
client = CogniChem(access_token=os.environ["COGNICHEM_ACCESS_TOKEN"])
result = client.chat.sessions.list()
print(result)Python SDK pip install cognichem-client (1.1 or later).
Responses
Successful Response · application/json · ChatSessionListResponse
| Field | Type | Description |
|---|---|---|
items[]required | ChatSessionResponse[] | |
items.allow_structure_search | boolean | Default: |
items.created_atrequired | string | |
items.idrequired | string | |
items.title | string | null | |
items.updated_atrequired | string |
Errors are RFC 7807 problem details (application/problem+json) with status, title, detail, request_id, and a retryability hint (validation, auth, quota, conflict, upstream, timeout, or terminal). Handling errors
| Status | When |
|---|---|
400 | Invalid input or business rule violation. |
401 | Missing or invalid credentials. |
402 | Wallet cannot cover the Assistant turn hold. |
403 | Authenticated but not allowed to access the resource. |
404 | Resource not found or not owned by the user. |
409 | Conflict (e.g. idempotency key reuse with a different body). |
413 | Request body or workflow spec exceeds size caps. |
422 | Request body or query failed validation. |
429 | Rate limit exceeded. |
500 | Unexpected server error. |
503 | Dependency temporarily unavailable. |
Create an Assistant thread
POST/api/v1/chat/sessions
Access token only
Create an Assistant thread.
Request body
application/json · ChatSessionCreateRequest
| Field | Type | Description |
|---|---|---|
title | string | null | Limits: |
Example request
curl -X POST "https://api.cognichem.com/api/v1/chat/sessions" \
-H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "TITLE"
}'import os
from cognichem_client import CogniChem
client = CogniChem(access_token=os.environ["COGNICHEM_ACCESS_TOKEN"])
result = client.chat.sessions.create(title="TITLE")
print(result)Python SDK pip install cognichem-client (1.1 or later).
Responses
Successful Response · application/json · ChatSessionResponse
| Field | Type | Description |
|---|---|---|
allow_structure_search | boolean | Default: |
created_atrequired | string | |
idrequired | string | |
title | string | null | |
updated_atrequired | string |
Errors are RFC 7807 problem details (application/problem+json) with status, title, detail, request_id, and a retryability hint (validation, auth, quota, conflict, upstream, timeout, or terminal). Handling errors
| Status | When |
|---|---|
400 | Invalid input or business rule violation. |
401 | Missing or invalid credentials. |
402 | Wallet cannot cover the Assistant turn hold. |
403 | Authenticated but not allowed to access the resource. |
404 | Resource not found or not owned by the user. |
409 | Conflict (e.g. idempotency key reuse with a different body). |
413 | Request body or workflow spec exceeds size caps. |
422 | Request body or query failed validation. |
429 | Rate limit exceeded. |
500 | Unexpected server error. |
503 | Dependency temporarily unavailable. |
Get an Assistant thread
GET/api/v1/chat/sessions/{session_id}
Access token only
Fetch one Assistant thread.
Parameters
| Name | Type | Description |
|---|---|---|
session_idrequired | string |
Example request
curl "https://api.cognichem.com/api/v1/chat/sessions/SESSION_ID" \
-H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN"import os
from cognichem_client import CogniChem
client = CogniChem(access_token=os.environ["COGNICHEM_ACCESS_TOKEN"])
result = client.chat.sessions.get("SESSION_ID")
print(result)Python SDK pip install cognichem-client (1.1 or later).
Responses
Successful Response · application/json · ChatSessionResponse
| Field | Type | Description |
|---|---|---|
allow_structure_search | boolean | Default: |
created_atrequired | string | |
idrequired | string | |
title | string | null | |
updated_atrequired | string |
Errors are RFC 7807 problem details (application/problem+json) with status, title, detail, request_id, and a retryability hint (validation, auth, quota, conflict, upstream, timeout, or terminal). Handling errors
| Status | When |
|---|---|
400 | Invalid input or business rule violation. |
401 | Missing or invalid credentials. |
402 | Wallet cannot cover the Assistant turn hold. |
403 | Authenticated but not allowed to access the resource. |
404 | Resource not found or not owned by the user. |
409 | Conflict (e.g. idempotency key reuse with a different body). |
413 | Request body or workflow spec exceeds size caps. |
422 | Request body or query failed validation. |
429 | Rate limit exceeded. |
500 | Unexpected server error. |
503 | Dependency temporarily unavailable. |
Update an Assistant thread
PATCH/api/v1/chat/sessions/{session_id}
Access token only
Rename an Assistant thread or turn structure search on / off (E1).
Parameters
| Name | Type | Description |
|---|---|---|
session_idrequired | string |
Request body
application/json · ChatSessionRenameRequest
| Field | Type | Description |
|---|---|---|
allow_structure_search | boolean | null | Allow the Assistant to send structures (SMILES) to external databases for similarity / substructure search in this thread. Off by default; only the user sets it. |
title | string | null | Limits: |
Example request
curl -X PATCH "https://api.cognichem.com/api/v1/chat/sessions/SESSION_ID" \
-H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"allow_structure_search": false,
"title": "TITLE"
}'import os
from cognichem_client import CogniChem
client = CogniChem(access_token=os.environ["COGNICHEM_ACCESS_TOKEN"])
result = client.chat.sessions.update(
"SESSION_ID",
title="TITLE",
allow_structure_search=False,
)
print(result)Python SDK pip install cognichem-client (1.1 or later).
Responses
Successful Response · application/json · ChatSessionResponse
| Field | Type | Description |
|---|---|---|
allow_structure_search | boolean | Default: |
created_atrequired | string | |
idrequired | string | |
title | string | null | |
updated_atrequired | string |
Errors are RFC 7807 problem details (application/problem+json) with status, title, detail, request_id, and a retryability hint (validation, auth, quota, conflict, upstream, timeout, or terminal). Handling errors
| Status | When |
|---|---|
400 | Invalid input or business rule violation. |
401 | Missing or invalid credentials. |
402 | Wallet cannot cover the Assistant turn hold. |
403 | Authenticated but not allowed to access the resource. |
404 | Resource not found or not owned by the user. |
409 | Conflict (e.g. idempotency key reuse with a different body). |
413 | Request body or workflow spec exceeds size caps. |
422 | Request body or query failed validation. |
429 | Rate limit exceeded. |
500 | Unexpected server error. |
503 | Dependency temporarily unavailable. |
Delete an Assistant thread
DELETE/api/v1/chat/sessions/{session_id}
Access token only
Delete a thread owned by the current JWT user.
Messages and wallet holds cascade. Additive v1; no request body.
Parameters
| Name | Type | Description |
|---|---|---|
session_idrequired | string |
Example request
curl -X DELETE "https://api.cognichem.com/api/v1/chat/sessions/SESSION_ID" \
-H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN"import os
from cognichem_client import CogniChem
client = CogniChem(access_token=os.environ["COGNICHEM_ACCESS_TOKEN"])
result = client.chat.sessions.delete("SESSION_ID")
print(result)Python SDK pip install cognichem-client (1.1 or later).
Responses
Successful Response
Errors are RFC 7807 problem details (application/problem+json) with status, title, detail, request_id, and a retryability hint (validation, auth, quota, conflict, upstream, timeout, or terminal). Handling errors
| Status | When |
|---|---|
400 | Invalid input or business rule violation. |
401 | Missing or invalid credentials. |
402 | Wallet cannot cover the Assistant turn hold. |
403 | Authenticated but not allowed to access the resource. |
404 | Resource not found or not owned by the user. |
409 | Conflict (e.g. idempotency key reuse with a different body). |
413 | Request body or workflow spec exceeds size caps. |
422 | Request body or query failed validation. |
429 | Rate limit exceeded. |
500 | Unexpected server error. |
503 | Dependency temporarily unavailable. |
List messages in a thread
GET/api/v1/chat/sessions/{session_id}/messages
Access token only
Return thread history (no secrets).
Parameters
| Name | Type | Description |
|---|---|---|
session_idrequired | string |
Example request
curl "https://api.cognichem.com/api/v1/chat/sessions/SESSION_ID/messages" \
-H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN"import os
from cognichem_client import CogniChem
client = CogniChem(access_token=os.environ["COGNICHEM_ACCESS_TOKEN"])
result = client.chat.sessions.messages("SESSION_ID")
print(result)Python SDK pip install cognichem-client (1.1 or later).
Responses
Successful Response · application/json · ChatMessageListResponse
| Field | Type | Description |
|---|---|---|
items[]required | ChatMessageResponse[] | |
items.artifact_ids[] | string[] | null | |
items.billed_usd | number | null | |
items.cached_tokens | integer | null | |
items.citations[] | object[] | null | |
items.completion_tokens | integer | null | |
items.content | string | null | |
items.created_atrequired | string | |
items.embedding_tokens | integer | null | |
items.idrequired | string | |
items.job_ids[] | string[] | null | |
items.model_id | string | null | |
items.prompt_tokens | integer | null | |
items.reasoning_effort | string | null | One of: |
items.rolerequired | string | One of: |
items.session_idrequired | string | |
items.tool_calls[] | object[] | null | |
items.turn_id | string | null | |
items.workflow_run_ids[] | string[] | null |
Errors are RFC 7807 problem details (application/problem+json) with status, title, detail, request_id, and a retryability hint (validation, auth, quota, conflict, upstream, timeout, or terminal). Handling errors
| Status | When |
|---|---|
400 | Invalid input or business rule violation. |
401 | Missing or invalid credentials. |
402 | Wallet cannot cover the Assistant turn hold. |
403 | Authenticated but not allowed to access the resource. |
404 | Resource not found or not owned by the user. |
409 | Conflict (e.g. idempotency key reuse with a different body). |
413 | Request body or workflow spec exceeds size caps. |
422 | Request body or query failed validation. |
429 | Rate limit exceeded. |
500 | Unexpected server error. |
503 | Dependency temporarily unavailable. |
Estimate Assistant turn hold
POST/api/v1/chat/sessions/{session_id}/estimate
Access token only
Quote max-turn hold USD at the caller subscription tier (no side effects).
Parameters
| Name | Type | Description |
|---|---|---|
session_idrequired | string |
Request body
application/json · ChatEstimateRequest
| Field | Type | Description |
|---|---|---|
artifact_ids[] | string[] | |
messagerequired | string | User message (at most 16000 characters; attach files as artifacts instead of pasting them). Limits: |
model_id | string | Default: |
reasoning_effort | string | null | Assistant reasoning level. Higher levels run a stronger model at a higher per-token rate, which raises the turn hold and the bill. Omit for the catalog default (low). One of: |
Example request
curl -X POST "https://api.cognichem.com/api/v1/chat/sessions/SESSION_ID/estimate" \
-H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"message": "MESSAGE"
}'import os
from cognichem_client import CogniChem
client = CogniChem(access_token=os.environ["COGNICHEM_ACCESS_TOKEN"])
result = client.chat.estimate("SESSION_ID", "MESSAGE")
print(result)Python SDK pip install cognichem-client (1.1 or later).
Responses
Successful Response · application/json · ChatEstimateResponse
| Field | Type | Description |
|---|---|---|
hold_usdrequired | number | |
max_completion_tokensrequired | integer | |
model_idrequired | string | |
prompt_tokensrequired | integer | |
reasoning_effortrequired | string | One of: |
tierrequired | integer |
Errors are RFC 7807 problem details (application/problem+json) with status, title, detail, request_id, and a retryability hint (validation, auth, quota, conflict, upstream, timeout, or terminal). Handling errors
| Status | When |
|---|---|
400 | Invalid input or business rule violation. |
401 | Missing or invalid credentials. |
402 | Wallet cannot cover the Assistant turn hold. |
403 | Authenticated but not allowed to access the resource. |
404 | Resource not found or not owned by the user. |
409 | Conflict (e.g. idempotency key reuse with a different body). |
413 | Request body or workflow spec exceeds size caps. |
422 | Request body or query failed validation. |
429 | Rate limit exceeded. |
500 | Unexpected server error. |
503 | Dependency temporarily unavailable. |
Start an Assistant turn
POST/api/v1/chat/sessions/{session_id}/turns
Access token onlyCharges your wallet
Open a wallet hold and stream Assistant tokens as SSE.
Parameters
| Name | Type | Description |
|---|---|---|
session_idrequired | string |
| Name | Type | Description |
|---|---|---|
Idempotency-Key | string | A unique key (a UUID) for this request. Retrying with the same key and body returns the first result instead of repeating the work; the same key with a different body is a 409. |
Request body
application/json · ChatTurnRequest
| Field | Type | Description |
|---|---|---|
artifact_ids[] | string[] | |
messagerequired | string | User message (at most 16000 characters; attach files as artifacts instead of pasting them). Limits: |
model_id | string | Default: |
reasoning_effort | string | null | Assistant reasoning level. Higher levels run a stronger model at a higher per-token rate, which raises the turn hold and the bill. Omit for the catalog default (low). One of: |
Example request
curl -X POST "https://api.cognichem.com/api/v1/chat/sessions/SESSION_ID/turns" \
-H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"message": "MESSAGE"
}'import os
from cognichem_client import CogniChem
client = CogniChem(access_token=os.environ["COGNICHEM_ACCESS_TOKEN"])
result = client.chat.send("SESSION_ID", "MESSAGE")
print(result)Python SDK pip install cognichem-client (1.1 or later). The SDK sends an Idempotency-Key; pass idempotency_key= to reuse one when you retry.
Responses
Successful Response · application/json
Response fields: any
Errors are RFC 7807 problem details (application/problem+json) with status, title, detail, request_id, and a retryability hint (validation, auth, quota, conflict, upstream, timeout, or terminal). Handling errors
| Status | When |
|---|---|
400 | Invalid input or business rule violation. |
401 | Missing or invalid credentials. |
402 | Wallet cannot cover the turn hold. |
403 | Authenticated but not allowed to access the resource. |
404 | Resource not found or not owned by the user. |
409 |
|
413 | Request body or workflow spec exceeds size caps. |
422 | Invalid body (e.g. message over 16,000 characters). |
429 | Rate limit exceeded. |
500 | Unexpected server error. |
503 | Dependency temporarily unavailable. |
Get a thread's spend and cap
GET/api/v1/chat/sessions/{session_id}/spend-cap
Access token only
Server-side spend and cap of one owned thread (never client-computed).
Parameters
| Name | Type | Description |
|---|---|---|
session_idrequired | string |
| Name | Type | Description |
|---|---|---|
model_id | string | Default: |
Example request
curl "https://api.cognichem.com/api/v1/chat/sessions/SESSION_ID/spend-cap" \
-H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN"import os
from cognichem_client import CogniChem
client = CogniChem(access_token=os.environ["COGNICHEM_ACCESS_TOKEN"])
result = client.chat.spend_cap("SESSION_ID")
print(result)Python SDK pip install cognichem-client (1.1 or later).
Responses
Successful Response · application/json · ChatSpendCapResponse
| Field | Type | Description |
|---|---|---|
cap_usdrequired | number | Current thread spend cap. |
held_usdrequired | number | Holds of turns still in flight. |
raised | boolean | Continue only: whether this request raised the cap. Default: |
spent_usdrequired | number | Debited Assistant turns in this thread. |
step_usdrequired | number | How much one Continue raises the cap. |
{
"cap_usd": 1,
"held_usd": 0,
"raised": false,
"spent_usd": 0.97,
"step_usd": 1
}Errors are RFC 7807 problem details (application/problem+json) with status, title, detail, request_id, and a retryability hint (validation, auth, quota, conflict, upstream, timeout, or terminal). Handling errors
| Status | When |
|---|---|
400 | Invalid input or business rule violation. |
401 | Missing or invalid credentials. |
402 | Wallet cannot cover the Assistant turn hold. |
403 | Authenticated but not allowed to access the resource. |
404 | Resource not found or not owned by the user. |
409 | Conflict (e.g. idempotency key reuse with a different body). |
413 | Request body or workflow spec exceeds size caps. |
422 | Request body or query failed validation. |
429 | Rate limit exceeded. |
500 | Unexpected server error. |
503 | Dependency temporarily unavailable. |
Continue past the thread spend cap
POST/api/v1/chat/sessions/{session_id}/spend-cap/continue
Access token only
User Continue: raise this thread's cap by one catalog step.
current_cap_usd is the cap the prompt showed; a repeat after the cap moved returns the current state with raised: false. JWT only; no hosted Assistant tool can call this.
Parameters
| Name | Type | Description |
|---|---|---|
session_idrequired | string |
Request body
application/json · ChatSpendCapContinueRequest
| Field | Type | Description |
|---|---|---|
current_cap_usdrequired | number | The cap the Continue prompt showed. If the cap has already moved (double click, second tab), nothing changes. Limits: |
model_id | string | Default: |
Example request
curl -X POST "https://api.cognichem.com/api/v1/chat/sessions/SESSION_ID/spend-cap/continue" \
-H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"current_cap_usd": 1
}'import os
from cognichem_client import CogniChem
client = CogniChem(access_token=os.environ["COGNICHEM_ACCESS_TOKEN"])
result = client.chat.continue_spend_cap("SESSION_ID", 1)
print(result)Python SDK pip install cognichem-client (1.1 or later).
Responses
Successful Response · application/json · ChatSpendCapResponse
| Field | Type | Description |
|---|---|---|
cap_usdrequired | number | Current thread spend cap. |
held_usdrequired | number | Holds of turns still in flight. |
raised | boolean | Continue only: whether this request raised the cap. Default: |
spent_usdrequired | number | Debited Assistant turns in this thread. |
step_usdrequired | number | How much one Continue raises the cap. |
{
"cap_usd": 1,
"held_usd": 0,
"raised": false,
"spent_usd": 0.97,
"step_usd": 1
}Errors are RFC 7807 problem details (application/problem+json) with status, title, detail, request_id, and a retryability hint (validation, auth, quota, conflict, upstream, timeout, or terminal). Handling errors
| Status | When |
|---|---|
400 | Invalid input or business rule violation. |
401 | Missing or invalid credentials. |
402 | Wallet cannot cover the Assistant turn hold. |
403 | Authenticated but not allowed to access the resource. |
404 | Resource not found or not owned by the user. |
409 | Conflict (e.g. idempotency key reuse with a different body). |
413 | Request body or workflow spec exceeds size caps. |
422 | Request body or query failed validation. |
429 | Rate limit exceeded. |
500 | Unexpected server error. |
503 | Dependency temporarily unavailable. |
Stop an Assistant turn
POST/api/v1/chat/sessions/{session_id}/turns/{turn_id}/stop
Access token only
Interrupt an owned in-flight Assistant turn and release leftover hold.
Parameters
| Name | Type | Description |
|---|---|---|
session_idrequired | string | |
turn_idrequired | string |
Example request
curl -X POST "https://api.cognichem.com/api/v1/chat/sessions/SESSION_ID/turns/TURN_ID/stop" \
-H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN"import os
from cognichem_client import CogniChem
client = CogniChem(access_token=os.environ["COGNICHEM_ACCESS_TOKEN"])
result = client.chat.stop("SESSION_ID", "TURN_ID")
print(result)Python SDK pip install cognichem-client (1.1 or later).
Responses
Successful Response · application/json
Response fields: map<string, string>
Errors are RFC 7807 problem details (application/problem+json) with status, title, detail, request_id, and a retryability hint (validation, auth, quota, conflict, upstream, timeout, or terminal). Handling errors
| Status | When |
|---|---|
400 | Invalid input or business rule violation. |
401 | Missing or invalid credentials. |
402 | Wallet cannot cover the Assistant turn hold. |
403 | Authenticated but not allowed to access the resource. |
404 | Resource not found or not owned by the user. |
409 | Conflict (e.g. idempotency key reuse with a different body). |
413 | Request body or workflow spec exceeds size caps. |
422 | Request body or query failed validation. |
429 | Rate limit exceeded. |
500 | Unexpected server error. |
503 | Dependency temporarily unavailable. |
List Assistant run proposals for a thread
GET/api/v1/chat/sessions/{session_id}/proposals
Access token only
Plan cards for the thread (payload bodies are previewed, never returned).
Parameters
| Name | Type | Description |
|---|---|---|
session_idrequired | string |
Example request
curl "https://api.cognichem.com/api/v1/chat/sessions/SESSION_ID/proposals" \
-H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN"import os
from cognichem_client import CogniChem
client = CogniChem(access_token=os.environ["COGNICHEM_ACCESS_TOKEN"])
result = client.chat.proposals.list("SESSION_ID")
print(result)Python SDK pip install cognichem-client (1.1 or later).
Responses
Successful Response · application/json · ChatRunProposalListResponse
| Field | Type | Description |
|---|---|---|
items[]required | ChatRunProposal[] | |
items.accepted_estimate_usd | number | null | |
items.citations[] | ChatCitation[] | |
items.citations.title | string | null | |
items.citations.urlrequired | string | |
items.created_atrequired | string | |
items.display_name | string | null | |
items.estimate_breakdown | object | null | |
items.estimate_usdrequired | number | |
items.expires_atrequired | string | |
items.failure_code | string | null | |
items.idrequired | string | |
items.job_id | string | null | |
items.job_type | string | null | |
items.kindrequired | string | One of: |
items.last_failure_code | string | null | |
items.max_run_cost_usd | number | null | |
items.message_id | string | null | |
items.params_preview | object | null | |
items.payload_preview | object | null | |
items.resource | string | null | |
items.session_idrequired | string | |
items.spec_outline | object | null | |
items.statusrequired | string | One of: |
items.summary | string | null | |
items.tier | integer | null | |
items.turn_id | string | null | |
items.workflow_run_id | string | null | |
items.workflow_spec | object | null | Frozen WorkflowSpec (GET one proposal with include_spec=1). |
Errors are RFC 7807 problem details (application/problem+json) with status, title, detail, request_id, and a retryability hint (validation, auth, quota, conflict, upstream, timeout, or terminal). Handling errors
| Status | When |
|---|---|
400 | Invalid input or business rule violation. |
401 | Missing or invalid credentials. |
402 | Wallet cannot cover the Assistant turn hold. |
403 | Authenticated but not allowed to access the resource. |
404 | Resource not found or not owned by the user. |
409 | Conflict (e.g. idempotency key reuse with a different body). |
413 | Request body or workflow spec exceeds size caps. |
422 | Request body or query failed validation. |
429 | Rate limit exceeded. |
500 | Unexpected server error. |
503 | Dependency temporarily unavailable. |
Get one Assistant run proposal
GET/api/v1/chat/sessions/{session_id}/proposals/{proposal_id}
Access token only
One plan card; include_spec=1 adds the WorkflowSpec for the builder.
Parameters
| Name | Type | Description |
|---|---|---|
session_idrequired | string | |
proposal_idrequired | string |
| Name | Type | Description |
|---|---|---|
include_spec | boolean | Include the frozen workflow spec (Open in builder). Default: |
Example request
curl "https://api.cognichem.com/api/v1/chat/sessions/SESSION_ID/proposals/PROPOSAL_ID" \
-H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN"import os
from cognichem_client import CogniChem
client = CogniChem(access_token=os.environ["COGNICHEM_ACCESS_TOKEN"])
result = client.chat.proposals.get("SESSION_ID", "PROPOSAL_ID")
print(result)Python SDK pip install cognichem-client (1.1 or later).
Responses
Successful Response · application/json · ChatRunProposal
| Field | Type | Description |
|---|---|---|
accepted_estimate_usd | number | null | |
citations[] | ChatCitation[] | |
citations.title | string | null | |
citations.urlrequired | string | |
created_atrequired | string | |
display_name | string | null | |
estimate_breakdown | object | null | |
estimate_usdrequired | number | |
expires_atrequired | string | |
failure_code | string | null | |
idrequired | string | |
job_id | string | null | |
job_type | string | null | |
kindrequired | string | One of: |
last_failure_code | string | null | |
max_run_cost_usd | number | null | |
message_id | string | null | |
params_preview | object | null | |
payload_preview | object | null | |
resource | string | null | |
session_idrequired | string | |
spec_outline | object | null | |
statusrequired | string | One of: |
summary | string | null | |
tier | integer | null | |
turn_id | string | null | |
workflow_run_id | string | null | |
workflow_spec | object | null | Frozen WorkflowSpec (GET one proposal with include_spec=1). |
Errors are RFC 7807 problem details (application/problem+json) with status, title, detail, request_id, and a retryability hint (validation, auth, quota, conflict, upstream, timeout, or terminal). Handling errors
| Status | When |
|---|---|
400 | Invalid input or business rule violation. |
401 | Missing or invalid credentials. |
402 | Wallet cannot cover the Assistant turn hold. |
403 | Authenticated but not allowed to access the resource. |
404 | Unknown proposal or not the caller's ( |
409 | Conflict (e.g. idempotency key reuse with a different body). |
413 | Request body or workflow spec exceeds size caps. |
422 | Request body or query failed validation. |
429 | Rate limit exceeded. |
500 | Unexpected server error. |
503 | Dependency temporarily unavailable. |
Approve an Assistant run proposal
POST/api/v1/chat/sessions/{session_id}/proposals/{proposal_id}/approve
Access token onlyCharges your wallet
User Approve: re-validate, re-estimate at the current tier, then enqueue.
Idempotency-Key is required (JWT too): this is a spend mutation from a clickable card. Nothing here opens an LLM turn.
Parameters
| Name | Type | Description |
|---|---|---|
session_idrequired | string | |
proposal_idrequired | string |
| Name | Type | Description |
|---|---|---|
Idempotency-Key | string | A unique key (a UUID) for this request. Retrying with the same key and body returns the first result instead of repeating the work; the same key with a different body is a 409. |
Request body
application/json · ChatProposalApproveRequest
| Field | Type | Description |
|---|---|---|
accepted_estimate_usdrequired | number | Server estimate displayed on the plan card when clicked. Limits: |
max_run_cost_usd | number | null | Workflow max_run_cost (defaults to the estimate total). Limits: |
Example request
curl -X POST "https://api.cognichem.com/api/v1/chat/sessions/SESSION_ID/proposals/PROPOSAL_ID/approve" \
-H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"accepted_estimate_usd": 0.0421
}'import os
from cognichem_client import CogniChem
client = CogniChem(access_token=os.environ["COGNICHEM_ACCESS_TOKEN"])
result = client.chat.proposals.approve("SESSION_ID", "PROPOSAL_ID", 0.0421)
print(result)Python SDK pip install cognichem-client (1.1 or later). The SDK sends an Idempotency-Key; pass idempotency_key= to reuse one when you retry.
Responses
Successful Response · application/json · ChatRunProposal
| Field | Type | Description |
|---|---|---|
accepted_estimate_usd | number | null | |
citations[] | ChatCitation[] | |
citations.title | string | null | |
citations.urlrequired | string | |
created_atrequired | string | |
display_name | string | null | |
estimate_breakdown | object | null | |
estimate_usdrequired | number | |
expires_atrequired | string | |
failure_code | string | null | |
idrequired | string | |
job_id | string | null | |
job_type | string | null | |
kindrequired | string | One of: |
last_failure_code | string | null | |
max_run_cost_usd | number | null | |
message_id | string | null | |
params_preview | object | null | |
payload_preview | object | null | |
resource | string | null | |
session_idrequired | string | |
spec_outline | object | null | |
statusrequired | string | One of: |
summary | string | null | |
tier | integer | null | |
turn_id | string | null | |
workflow_run_id | string | null | |
workflow_spec | object | null | Frozen WorkflowSpec (GET one proposal with include_spec=1). |
Errors are RFC 7807 problem details (application/problem+json) with status, title, detail, request_id, and a retryability hint (validation, auth, quota, conflict, upstream, timeout, or terminal). Handling errors
| Status | When |
|---|---|
400 | Invalid input or business rule violation. |
401 | Missing or invalid credentials. |
402 | Wallet cannot cover the run ( |
403 | Authenticated but not allowed to access the resource. |
404 | Unknown proposal or not the caller's ( |
409 |
|
410 | Proposal TTL elapsed ( |
413 | Request body or workflow spec exceeds size caps. |
422 | Payload/spec no longer valid ( |
429 | Rate limit exceeded. |
500 | Unexpected server error. |
503 | Dependency temporarily unavailable. |
Dismiss an Assistant run proposal
POST/api/v1/chat/sessions/{session_id}/proposals/{proposal_id}/reject
Access token only
Dismiss a pending proposal. No spend.
Parameters
| Name | Type | Description |
|---|---|---|
session_idrequired | string | |
proposal_idrequired | string |
Example request
curl -X POST "https://api.cognichem.com/api/v1/chat/sessions/SESSION_ID/proposals/PROPOSAL_ID/reject" \
-H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN"import os
from cognichem_client import CogniChem
client = CogniChem(access_token=os.environ["COGNICHEM_ACCESS_TOKEN"])
result = client.chat.proposals.reject("SESSION_ID", "PROPOSAL_ID")
print(result)Python SDK pip install cognichem-client (1.1 or later).
Responses
Successful Response · application/json · ChatRunProposal
| Field | Type | Description |
|---|---|---|
accepted_estimate_usd | number | null | |
citations[] | ChatCitation[] | |
citations.title | string | null | |
citations.urlrequired | string | |
created_atrequired | string | |
display_name | string | null | |
estimate_breakdown | object | null | |
estimate_usdrequired | number | |
expires_atrequired | string | |
failure_code | string | null | |
idrequired | string | |
job_id | string | null | |
job_type | string | null | |
kindrequired | string | One of: |
last_failure_code | string | null | |
max_run_cost_usd | number | null | |
message_id | string | null | |
params_preview | object | null | |
payload_preview | object | null | |
resource | string | null | |
session_idrequired | string | |
spec_outline | object | null | |
statusrequired | string | One of: |
summary | string | null | |
tier | integer | null | |
turn_id | string | null | |
workflow_run_id | string | null | |
workflow_spec | object | null | Frozen WorkflowSpec (GET one proposal with include_spec=1). |
Errors are RFC 7807 problem details (application/problem+json) with status, title, detail, request_id, and a retryability hint (validation, auth, quota, conflict, upstream, timeout, or terminal). Handling errors
| Status | When |
|---|---|
400 | Invalid input or business rule violation. |
401 | Missing or invalid credentials. |
402 | Wallet cannot cover the Assistant turn hold. |
403 | Authenticated but not allowed to access the resource. |
404 | Unknown proposal or not the caller's ( |
409 |
|
410 | Proposal TTL elapsed ( |
413 | Request body or workflow spec exceeds size caps. |
422 | Request body or query failed validation. |
429 | Rate limit exceeded. |
500 | Unexpected server error. |
503 | Dependency temporarily unavailable. |