Authentication:
- Set cookies from your browser
Step 1: GET https://beta.character.ai/chat/curated_categories/characters/
. It returns JSON. You are looking for external_id
of the character you want. This will be used for all following steps (external_id
or character_external_id
)
Step 2: POST https://beta.character.ai/chat/character/info/
with {"external_id":"..."}
as payload. Keep track of identifier
from the response as tgt
for step 4
Step 3: POST https://beta.character.ai/chat/history/create/
with the same payload as step 2. Keep track of external_id
in the response as history_external_id
.
Step 4: POST https://beta.character.ai/chat/streaming/
with payload:
{
"history_external_id": "<HISTORY ID from STEP 3>",
"character_external_id": "<CHARACTER ID from STEP 1>",
"text": "<YOUR PROMPT>",
"tgt": "<TGT from STEP 2>",
"ranking_method": "random",
"staging": false,
"model_server_address": null,
"model_server_address_exp_chars": null,
"override_prefix": null,
"override_rank": null,
"rank_candidates": null,
"filter_candidates": null,
"unsanitized_characters": null,
"prefix_limit": null,
"prefix_token_limit": null,
"stream_params": null,
"model_properties_version_keys": "",
"enable_tti": null,
"initial_timeout": null,
"insert_beginning": null,
"stream_every_n_steps": 16,
"chunks_to_pad": 8,
"is_proactive": false,
"image_rel_path": "",
"image_description": "",
"image_description_type": "",
"image_origin_type": "",
"voice_enabled": false,
"parent_msg_uuid": null,
"seen_msg_uuids": [],
"retry_last_user_msg_uuid": null,
"num_candidates": 1,
"give_room_introductions": true,
"mock_response": false
}
CLOUDFLARE!!! Use TLS spoofing! If you need help with this, look at my ChatGPT-Proxy-V4 code. You must write the program in Go or else it won't stream.
Use https://github.com/bogdanfinn/tls-client (or https://github.com/FlorianREGAZ/Python-Tls-Client which is the Python equivalent)