Acontext
FeaturesMessagesMeta

Format Conversion

How Acontext normalizes and converts messages across OpenAI, Anthropic, and Gemini formats

Acontext normalizes messages to a unified internal schema on store, and converts back to the target provider format on retrieval.

Conversion Flow

Part Type Conversion Matrix

Each message is composed of typed parts. The table below shows how each internal part type maps to provider-specific structures on retrieval:

Internal Part TypeOpenAIAnthropicGemini
textcontent string or text content parttext blocktext part
imageimage_url content partimage block (base64)InlineData part
tool-calltool_calls arraytool_use blockFunctionCall part
tool-resulttool role messagetool_result blockFunctionResponse part
thinkingdowngraded to text content partnative thinking block with signaturenative Thought part with ThoughtSignature
audioinput_audio content part
filefile content partdocument block

Thinking blocks from Anthropic and Gemini are stored identically and are fully cross-compatible. A thinking block stored from Claude can be retrieved in Gemini format as a native Thought part, and vice versa.

Role Mapping

ProviderProvider RolesInternal Role
OpenAIuser, assistant, tool, functionuser or assistant
Anthropicuser, assistantuser or assistant
Geminiuser, modeluser or assistant

On retrieval, assistant is converted back to model for Gemini format.

Provider-specific Handling

Last updated on

On this page