In short.
OpenRouter’s Message Formats guide helps developers adapt existing OpenAI and Claude conversations for OpenRouter, but some Claude-specific information is lost during conversion. Its four TypeScript helpers translate message arrays into OpenResponses input and convert responses back into provider-style messages. Examples cover tool interactions, Claude image blocks, migration and conversation history. The documented loss of tool_result.is_error matters for applications that distinguish tool failures from successful results. Package versions, costs and runtime correctness are not established by the page; no examples were executed.
Researched and written by an AI model and checked by a second AI model. How it works
Covers the complete selected Message Formats page at [https://openrouter.ai/docs/agent-sdk/call-model/message-formats.md], including all four helpers, supported chat roles, tool interactions, Claude image examples, migrations, conversation history and the explicit conversion limitation. The linked documentation index and text-generation, tools and streaming pages are excluded. The page supplies no licensing or redistribution notice. Examples were not executed; package installation, live API behavior, exhaustive field preservation, current model availability and performance remain unverified.
The overview
identity
Message Formats is an OpenRouter documentation page about conversion helpers in the @openrouter/agent package. Its address is [https://openrouter.ai/docs/agent-sdk/call-model/message-formats.md]. It teaches one integration feature rather than documenting the entire Agent SDK.
assessment
The guide provides a concrete starting point for developers who already build OpenAI or Claude message arrays and want to pass them into OpenRouter calls. Its strongest material connects input conversion, response conversion and subsequent conversation turns.
Adoption depends on whether the demonstrated mappings cover the application’s actual messages. The explicit loss of Claude’s tool-result error flag requires attention wherever that flag affects application behavior. Conversion correctness and migration effort are not assessed.
users
The main audience is developers migrating existing OpenAI or Anthropic integrations, or maintaining conversation histories in those formats. Developers handling tool results or Claude image messages also receive targeted examples.
Beginners can follow the short text-conversation examples, but the page assumes familiarity with TypeScript imports, API keys, asynchronous calls and message roles. It does not explain those foundations in detail.
capabilities
fromChatMessages() converts OpenAI chat-style messages to OpenResponses input; toChatMessage() converts an OpenResponses response to chat message format. The documented chat roles are system, user, assistant, developer and tool. An example translates assistant tool calls and their associated tool responses.
fromClaudeMessages() and toClaudeMessage() provide the corresponding Claude conversions. Claude examples include text blocks, images supplied by URL or base64 data, tool_use blocks and tool_result blocks. A further example shows appending a converted assistant response to conversation history.
Using it
requirements
The examples import OpenRouter and conversion helpers from @openrouter/agent. They construct a client with an API key read from OPENROUTER_API_KEY and supply a model identifier to callModel(). Existing messages must follow the relevant OpenAI or Claude format.
The page does not specify a package version, minimum runtime version, supported execution environments or dependency compatibility matrix. Its example model identifiers do not establish current model availability.
mechanism
The helpers adapt message structure around a model call. An input helper converts an existing message array into OpenResponses input, which is passed to callModel(). After await result.getResponse(), an output helper converts the response into a provider-style message. Examples that only need generated text use result.getText().
The OpenAI tool example connects an assistant tool call to a tool response through matching identifiers. The Claude example similarly connects tool_use and tool_result blocks. These examples demonstrate message translation; they do not show tool execution.
setup
Following the examples requires making @openrouter/agent available in the project, supplying OPENROUTER_API_KEY and constructing an OpenRouter client. Import the helper for the existing message format and pass its result as callModel() input.
For a conversation that continues across calls, retrieve the response, convert it with the matching output helper, append it to history and add the next user message. Package installation commands and account setup instructions are absent from this page.
example
The conversation-history example begins with system and user messages, passes them through fromChatMessages(), and calls the example model openai/gpt-5-nano. It retrieves the response, converts it with toChatMessage(), appends the assistant message and a new user question, then submits the updated history.
A separate Claude example combines a text question with an image URL before conversion. These are documentation examples; their outputs, execution behavior and compatibility were not tested.
Assessment & evidence
limitations
The page explicitly states that some Claude-specific features are not preserved, naming the is_error flag on tool_result blocks. An application that relies on this flag needs to determine how tool failures will remain distinguishable after conversion.
The examples do not establish exhaustive preservation of provider fields, content blocks or metadata across a conversion and return conversion. Streaming is linked as a separate topic but is not demonstrated here. Runtime correctness, error handling and performance are not assessed.
reasoning
The likely practical benefit is retaining existing message-building code while adapting the model-call boundary. This is an inference from the examples, which pass existing arrays through helpers and convert responses back into familiar message objects; no reduction in development effort is measured.
The documented Claude limitation shows why structural compatibility alone is insufficient. If application logic depends on information a converter drops, a valid-looking converted message may still lack information the application needs.
alternatives
The migration examples show direct OpenAI SDK and Anthropic SDK calls as the existing approaches. Keeping a native integration is an option to assess when provider-specific fields are essential.
The page also demonstrates passing a simple string directly to callModel(), which may suffice for a single text prompt without an existing message history. It offers no comparative measurements of cost, speed or maintenance effort.
evidence
The evidence is the complete Message Formats page at [https://openrouter.ai/docs/agent-sdk/call-model/message-formats.md]. It provides helper descriptions, TypeScript examples, a supported-role table and an explicit Claude conversion limitation.
The page supports documentation-level claims about intended use. It includes no package implementation, test results or benchmarks. Nothing was executed, so successful conversion and live model responses remain unverified.
Access & freshness
costs
Costs are unknown from this page. It supplies no SDK pricing, model rates, free allowance or worked usage-cost example. The Anthropic migration example sets maxOutputTokens to 1024, but that output limit does not establish a price or total request cost.
rights
The page contains no licence text, redistribution permission or service terms. Rights to reuse its documentation and examples, and the licence governing @openrouter/agent, are unknown from this evidence. Data-handling and model-output terms are also not established.
freshness
The supplied page was captured on 13 November 2026 at 17:15:14 UTC. It shows no publication date, update date or package version, so the capture timestamp does not establish when its examples were last revised.
Compatibility with a currently installed SDK and availability of the example models remain unknown. The page provides no version-pinned compatibility guidance.
actions
Before adopting the helpers, compare the application’s message shapes with the documented examples. Pay particular attention to tool-call identifiers, Claude image sources and any logic that uses tool_result.is_error.
Verify conversion and conversation continuation using representative messages, then check package compatibility, model availability, pricing and applicable licences and terms. Applications requiring streaming or additional tool behavior need documentation beyond this page.
