Skip to main content
Docs

Search guides and API endpoints, for example “Idempotency-Key” or “submit job”.

    API reference

    Assistant

    On this page

    List Assistant threads

    GET/api/v1/chat/sessions

    Access token only

    Example request

    curl "https://api.cognichem.com/api/v1/chat/sessions" \
      -H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN"

    Responses

    Successful Response · application/json · ChatSessionListResponse

    Response fields
    FieldTypeDescription
    items[]requiredChatSessionResponse[]
    items.allow_structure_searchboolean

    Default: false

    items.created_atrequiredstring
    items.idrequiredstring
    items.titlestring | null
    items.updated_atrequiredstring

    Create an Assistant thread

    POST/api/v1/chat/sessions

    Access token only

    Request body

    application/json · ChatSessionCreateRequest

    Request fields
    FieldTypeDescription
    titlestring | null

    Limits: max length 200

    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"
    }'

    Responses

    Successful Response · application/json · ChatSessionResponse

    Response fields
    FieldTypeDescription
    allow_structure_searchboolean

    Default: false

    created_atrequiredstring
    idrequiredstring
    titlestring | null
    updated_atrequiredstring

    Get an Assistant thread

    GET/api/v1/chat/sessions/{session_id}

    Access token only

    Parameters

    Path parameters
    NameTypeDescription
    session_idrequiredstring

    Example request

    curl "https://api.cognichem.com/api/v1/chat/sessions/SESSION_ID" \
      -H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN"

    Responses

    Successful Response · application/json · ChatSessionResponse

    Response fields
    FieldTypeDescription
    allow_structure_searchboolean

    Default: false

    created_atrequiredstring
    idrequiredstring
    titlestring | null
    updated_atrequiredstring

    Update an Assistant thread

    PATCH/api/v1/chat/sessions/{session_id}

    Access token only

    Parameters

    Path parameters
    NameTypeDescription
    session_idrequiredstring

    Request body

    application/json · ChatSessionRenameRequest

    Request fields
    FieldTypeDescription
    allow_structure_searchboolean | null
    titlestring | null

    Limits: max length 200

    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"
    }'

    Responses

    Successful Response · application/json · ChatSessionResponse

    Response fields
    FieldTypeDescription
    allow_structure_searchboolean

    Default: false

    created_atrequiredstring
    idrequiredstring
    titlestring | null
    updated_atrequiredstring

    Delete an Assistant thread

    DELETE/api/v1/chat/sessions/{session_id}

    Access token only

    Parameters

    Path parameters
    NameTypeDescription
    session_idrequiredstring

    Example request

    curl -X DELETE "https://api.cognichem.com/api/v1/chat/sessions/SESSION_ID" \
      -H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN"

    Responses

    Successful Response

    List messages in a thread

    GET/api/v1/chat/sessions/{session_id}/messages

    Access token only

    Parameters

    Path parameters
    NameTypeDescription
    session_idrequiredstring

    Example request

    curl "https://api.cognichem.com/api/v1/chat/sessions/SESSION_ID/messages" \
      -H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN"

    Responses

    Successful Response · application/json · ChatMessageListResponse

    Response fields
    FieldTypeDescription
    items[]requiredChatMessageResponse[]
    items.artifact_ids[]string[] | null
    items.billed_usdnumber | null
    items.cached_tokensinteger | null
    items.citations[]object[] | null
    items.completion_tokensinteger | null
    items.contentstring | null
    items.created_atrequiredstring
    items.embedding_tokensinteger | null
    items.idrequiredstring
    items.job_ids[]string[] | null
    items.model_idstring | null
    items.prompt_tokensinteger | null
    items.reasoning_effortstring | null

    One of: "low", "medium", "high"

    items.rolerequiredstring

    One of: "user", "assistant", "tool", "system"

    items.session_idrequiredstring
    items.tool_calls[]object[] | null
    items.turn_idstring | null
    items.workflow_run_ids[]string[] | null

    Estimate Assistant turn hold

    POST/api/v1/chat/sessions/{session_id}/estimate

    Access token only

    Parameters

    Path parameters
    NameTypeDescription
    session_idrequiredstring

    Request body

    application/json · ChatEstimateRequest

    Request fields
    FieldTypeDescription
    artifact_ids[]string[]
    messagerequiredstring

    Limits: min length 1, max length 16000

    model_idstring

    Default: "cognichem-assistant"

    reasoning_effortstring | null

    One of: "low", "medium", "high"

    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"
    }'

    Responses

    Successful Response · application/json · ChatEstimateResponse

    Response fields
    FieldTypeDescription
    hold_usdrequirednumber
    max_completion_tokensrequiredinteger
    model_idrequiredstring
    prompt_tokensrequiredinteger
    reasoning_effortrequiredstring

    One of: "low", "medium", "high"

    tierrequiredinteger

    Start an Assistant turn

    POST/api/v1/chat/sessions/{session_id}/turns

    Access token onlyCharges your wallet

    Parameters

    Path parameters
    NameTypeDescription
    session_idrequiredstring
    Headers
    NameTypeDescription
    Idempotency-Keystring

    Request body

    application/json · ChatTurnRequest

    Request fields
    FieldTypeDescription
    artifact_ids[]string[]
    messagerequiredstring

    Limits: min length 1, max length 16000

    model_idstring

    Default: "cognichem-assistant"

    reasoning_effortstring | null

    One of: "low", "medium", "high"

    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"
    }'

    Responses

    Successful Response · application/json

    Response fields: any

    Get a thread's spend and cap

    GET/api/v1/chat/sessions/{session_id}/spend-cap

    Access token only

    Parameters

    Path parameters
    NameTypeDescription
    session_idrequiredstring
    Query parameters
    NameTypeDescription
    model_idstring

    Default: "cognichem-assistant"

    Example request

    curl "https://api.cognichem.com/api/v1/chat/sessions/SESSION_ID/spend-cap" \
      -H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN"

    Responses

    Successful Response · application/json · ChatSpendCapResponse

    Response fields
    FieldTypeDescription
    cap_usdrequirednumber
    held_usdrequirednumber
    raisedboolean

    Default: false

    spent_usdrequirednumber
    step_usdrequirednumber
    Example 200 response
    {
      "cap_usd": 1,
      "held_usd": 0,
      "raised": false,
      "spent_usd": 0.97,
      "step_usd": 1
    }

    Continue past the thread spend cap

    POST/api/v1/chat/sessions/{session_id}/spend-cap/continue

    Access token only

    Parameters

    Path parameters
    NameTypeDescription
    session_idrequiredstring

    Request body

    application/json · ChatSpendCapContinueRequest

    Request fields
    FieldTypeDescription
    current_cap_usdrequirednumber

    Limits: > 0

    model_idstring

    Default: "cognichem-assistant"

    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
    }'

    Responses

    Successful Response · application/json · ChatSpendCapResponse

    Response fields
    FieldTypeDescription
    cap_usdrequirednumber
    held_usdrequirednumber
    raisedboolean

    Default: false

    spent_usdrequirednumber
    step_usdrequirednumber
    Example 200 response
    {
      "cap_usd": 1,
      "held_usd": 0,
      "raised": false,
      "spent_usd": 0.97,
      "step_usd": 1
    }

    Stop an Assistant turn

    POST/api/v1/chat/sessions/{session_id}/turns/{turn_id}/stop

    Access token only

    Parameters

    Path parameters
    NameTypeDescription
    session_idrequiredstring
    turn_idrequiredstring

    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"

    Responses

    Successful Response · application/json

    Response fields: map<string, string>

    List Assistant run proposals for a thread

    GET/api/v1/chat/sessions/{session_id}/proposals

    Access token only

    Parameters

    Path parameters
    NameTypeDescription
    session_idrequiredstring

    Example request

    curl "https://api.cognichem.com/api/v1/chat/sessions/SESSION_ID/proposals" \
      -H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN"

    Responses

    Successful Response · application/json · ChatRunProposalListResponse

    Response fields
    FieldTypeDescription
    items[]requiredChatRunProposal[]
    items.accepted_estimate_usdnumber | null
    items.citations[]ChatCitation[]
    items.citations.titlestring | null
    items.citations.urlrequiredstring
    items.created_atrequiredstring
    items.display_namestring | null
    items.estimate_breakdownobject | null
    items.estimate_usdrequirednumber
    items.expires_atrequiredstring
    items.failure_codestring | null
    items.idrequiredstring
    items.job_idstring | null
    items.job_typestring | null
    items.kindrequiredstring

    One of: "job", "workflow"

    items.last_failure_codestring | null
    items.max_run_cost_usdnumber | null
    items.message_idstring | null
    items.params_previewobject | null
    items.payload_previewobject | null
    items.resourcestring | null
    items.session_idrequiredstring
    items.spec_outlineobject | null
    items.statusrequiredstring

    One of: "pending", "approving", "submitted", "rejected", "expired", "failed"

    items.summarystring | null
    items.tierinteger | null
    items.turn_idstring | null
    items.workflow_run_idstring | null
    items.workflow_specobject | null

    Get one Assistant run proposal

    GET/api/v1/chat/sessions/{session_id}/proposals/{proposal_id}

    Access token only

    Parameters

    Path parameters
    NameTypeDescription
    session_idrequiredstring
    proposal_idrequiredstring
    Query parameters
    NameTypeDescription
    include_specboolean

    Default: false

    Example request

    curl "https://api.cognichem.com/api/v1/chat/sessions/SESSION_ID/proposals/PROPOSAL_ID" \
      -H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN"

    Responses

    Successful Response · application/json · ChatRunProposal

    Response fields
    FieldTypeDescription
    accepted_estimate_usdnumber | null
    citations[]ChatCitation[]
    citations.titlestring | null
    citations.urlrequiredstring
    created_atrequiredstring
    display_namestring | null
    estimate_breakdownobject | null
    estimate_usdrequirednumber
    expires_atrequiredstring
    failure_codestring | null
    idrequiredstring
    job_idstring | null
    job_typestring | null
    kindrequiredstring

    One of: "job", "workflow"

    last_failure_codestring | null
    max_run_cost_usdnumber | null
    message_idstring | null
    params_previewobject | null
    payload_previewobject | null
    resourcestring | null
    session_idrequiredstring
    spec_outlineobject | null
    statusrequiredstring

    One of: "pending", "approving", "submitted", "rejected", "expired", "failed"

    summarystring | null
    tierinteger | null
    turn_idstring | null
    workflow_run_idstring | null
    workflow_specobject | null

    Approve an Assistant run proposal

    POST/api/v1/chat/sessions/{session_id}/proposals/{proposal_id}/approve

    Access token onlyCharges your wallet

    Parameters

    Path parameters
    NameTypeDescription
    session_idrequiredstring
    proposal_idrequiredstring
    Headers
    NameTypeDescription
    Idempotency-Keystring

    Request body

    application/json · ChatProposalApproveRequest

    Request fields
    FieldTypeDescription
    accepted_estimate_usdrequirednumber

    Limits: ≥ 0

    max_run_cost_usdnumber | null

    Limits: > 0

    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
    }'

    Responses

    Successful Response · application/json · ChatRunProposal

    Response fields
    FieldTypeDescription
    accepted_estimate_usdnumber | null
    citations[]ChatCitation[]
    citations.titlestring | null
    citations.urlrequiredstring
    created_atrequiredstring
    display_namestring | null
    estimate_breakdownobject | null
    estimate_usdrequirednumber
    expires_atrequiredstring
    failure_codestring | null
    idrequiredstring
    job_idstring | null
    job_typestring | null
    kindrequiredstring

    One of: "job", "workflow"

    last_failure_codestring | null
    max_run_cost_usdnumber | null
    message_idstring | null
    params_previewobject | null
    payload_previewobject | null
    resourcestring | null
    session_idrequiredstring
    spec_outlineobject | null
    statusrequiredstring

    One of: "pending", "approving", "submitted", "rejected", "expired", "failed"

    summarystring | null
    tierinteger | null
    turn_idstring | null
    workflow_run_idstring | null
    workflow_specobject | null

    Dismiss an Assistant run proposal

    POST/api/v1/chat/sessions/{session_id}/proposals/{proposal_id}/reject

    Access token only

    Parameters

    Path parameters
    NameTypeDescription
    session_idrequiredstring
    proposal_idrequiredstring

    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"

    Responses

    Successful Response · application/json · ChatRunProposal

    Response fields
    FieldTypeDescription
    accepted_estimate_usdnumber | null
    citations[]ChatCitation[]
    citations.titlestring | null
    citations.urlrequiredstring
    created_atrequiredstring
    display_namestring | null
    estimate_breakdownobject | null
    estimate_usdrequirednumber
    expires_atrequiredstring
    failure_codestring | null
    idrequiredstring
    job_idstring | null
    job_typestring | null
    kindrequiredstring

    One of: "job", "workflow"

    last_failure_codestring | null
    max_run_cost_usdnumber | null
    message_idstring | null
    params_previewobject | null
    payload_previewobject | null
    resourcestring | null
    session_idrequiredstring
    spec_outlineobject | null
    statusrequiredstring

    One of: "pending", "approving", "submitted", "rejected", "expired", "failed"

    summarystring | null
    tierinteger | null
    turn_idstring | null
    workflow_run_idstring | null
    workflow_specobject | null