#ChatML to Claude conversion

1 messages · Page 1 of 1 (latest)

peak zealot
#

Does OpenRouter handle the conversion from ChatML to Claude or can we do this manually and add it to prompt in the body? Same question for pruning to be within the context limits (since we normally handle that ourselves in a selective way).

When trying to pass in a prompt key, it seems to just return a 200 but doesn't stream back OpenAI format.

If I leave it in ChatML format, it seems to work fine.

Just can't find anything about this in the docs in terms of what's unified or what needs transforming.

Thanks!

tacit plume
#

If you send chatML (via messages: []), we will convert it to Claude prompt yeah

peak zealot
#

Okay, thanks! A few follow-ups:

  1. Do we only get charged for the prompts (tokens length) after it's been converted into Claude prompt?
  2. Do you strip out function roles or do those get converted to Assistant?
  3. Can we send OpenRouter the Claude format or only supports ChatML?
tacit plume
#

Do we only get charged for the prompts (tokens length) after it's been converted into Claude prompt?

Just the prompt

Do you strip out function roles or do those get converted to Assistant

We do include the content in a newline, no role assigned atm.

Can we send OpenRouter the Claude format or only supports ChatML?

Yes. We pass the prompt down as-is. Note that you can't include both

peak zealot
#

Thanks! And lastly, do we need to handle pruning ourselves to keep messages and/or prompts within the context limits?