We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/dsouza-anush/browser-use-heroku'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
serializer.py•848 B
from openai.types.chat import ChatCompletionMessageParam
from browser_use.llm.messages import BaseMessage
from browser_use.llm.openai.serializer import OpenAIMessageSerializer
class OpenRouterMessageSerializer:
"""
Serializer for converting between custom message types and OpenRouter message formats.
OpenRouter uses the OpenAI-compatible API, so we can reuse the OpenAI serializer.
"""
@staticmethod
def serialize_messages(messages: list[BaseMessage]) -> list[ChatCompletionMessageParam]:
"""
Serialize a list of browser_use messages to OpenRouter-compatible messages.
Args:
messages: List of browser_use messages
Returns:
List of OpenRouter-compatible messages (identical to OpenAI format)
"""
# OpenRouter uses the same message format as OpenAI
return OpenAIMessageSerializer.serialize_messages(messages)