anthropicMessageToOpenAI: ZodEffects<
    ZodObject<
        {
            content: ZodUnion<
                [
                    ZodString,
                    ZodArray<
                        ZodDiscriminatedUnion<
                            "type",
                            [
                                ZodObject<
                                    { text: ZodString; type: ZodLiteral<(...)> },
                                    "strip",
                                    ZodTypeAny,
                                    { text: string; type: "text" },
                                    { text: string; type: "text" },
                                >,
                                ZodObject<
                                    {
                                        source: ZodObject<(...), (...), (...), (...), (...)>;
                                        type: ZodLiteral<(...)>;
                                    },
                                    "strip",
                                    ZodTypeAny,
                                    {
                                        source: { data: ...; media_type: ...; type: ... };
                                        type: "image";
                                    },
                                    {
                                        source: { data: ...; media_type: ...; type: ... };
                                        type: "image";
                                    },
                                >,
                                ZodObject<
                                    {
                                        id: ZodString;
                                        input: ZodType<(...), (...), (...)>;
                                        name: ZodString;
                                        type: ZodLiteral<(...)>;
                                    },
                                    "strip",
                                    ZodTypeAny,
                                    { id: string; input: JSONLiteral; name: string; type: "tool_use" },
                                    { id: string; input: JSONLiteral; name: string; type: "tool_use" },
                                >,
                                ZodObject<
                                    {
                                        content: ZodUnion<(...)>;
                                        is_error: ZodOptional<(...)>;
                                        tool_use_id: ZodString;
                                        type: ZodLiteral<(...)>;
                                    },
                                    "strip",
                                    ZodTypeAny,
                                    {
                                        content: (...)
                                        | (...);
                                        is_error?: (...) | (...) | (...);
                                        tool_use_id: string;
                                        type: "tool_result";
                                    },
                                    {
                                        content: (...)
                                        | (...);
                                        is_error?: (...) | (...) | (...);
                                        tool_use_id: string;
                                        type: "tool_result";
                                    },
                                >,
                            ],
                        >,
                        "many",
                    >,
                ],
            >;
            role: ZodEnum<["user", "assistant"]>;
        },
        "passthrough",
        ZodTypeAny,
        objectOutputType<
            {
                content: ZodUnion<
                    [
                        ZodString,
                        ZodArray<
                            ZodDiscriminatedUnion<
                                "type",
                                [
                                    ZodObject<
                                        { text: ...; type: ... },
                                        "strip",
                                        ZodTypeAny,
                                        { text: ...; type: ... },
                                        { text: ...; type: ... },
                                    >,
                                    ZodObject<
                                        { source: ...; type: ... },
                                        "strip",
                                        ZodTypeAny,
                                        { source: ...; type: ... },
                                        { source: ...; type: ... },
                                    >,
                                    ZodObject<
                                        { id: ...; input: ...; name: ...; type: ... },
                                        "strip",
                                        ZodTypeAny,
                                        { id: ...; input: ...; name: ...; type: ... },
                                        { id: ...; input: ...; name: ...; type: ... },
                                    >,
                                    ZodObject<
                                        { content: ...; is_error: ...; tool_use_id: ...; type: ... },
                                        "strip",
                                        ZodTypeAny,
                                        { content: ...; is_error?: ...; tool_use_id: ...; type: ... },
                                        { content: ...; is_error?: ...; tool_use_id: ...; type: ... },
                                    >,
                                ],
                            >,
                            "many",
                        >,
                    ],
                >;
                role: ZodEnum<["user", "assistant"]>;
            },
            ZodTypeAny,
            "passthrough",
        >,
        objectInputType<
            {
                content: ZodUnion<
                    [
                        ZodString,
                        ZodArray<
                            ZodDiscriminatedUnion<
                                "type",
                                [
                                    ZodObject<
                                        { text: ...; type: ... },
                                        "strip",
                                        ZodTypeAny,
                                        { text: ...; type: ... },
                                        { text: ...; type: ... },
                                    >,
                                    ZodObject<
                                        { source: ...; type: ... },
                                        "strip",
                                        ZodTypeAny,
                                        { source: ...; type: ... },
                                        { source: ...; type: ... },
                                    >,
                                    ZodObject<
                                        { id: ...; input: ...; name: ...; type: ... },
                                        "strip",
                                        ZodTypeAny,
                                        { id: ...; input: ...; name: ...; type: ... },
                                        { id: ...; input: ...; name: ...; type: ... },
                                    >,
                                    ZodObject<
                                        { content: ...; is_error: ...; tool_use_id: ...; type: ... },
                                        "strip",
                                        ZodTypeAny,
                                        { content: ...; is_error?: ...; tool_use_id: ...; type: ... },
                                        { content: ...; is_error?: ...; tool_use_id: ...; type: ... },
                                    >,
                                ],
                            >,
                            "many",
                        >,
                    ],
                >;
                role: ZodEnum<["user", "assistant"]>;
            },
            ZodTypeAny,
            "passthrough",
        >,
    >,
    | objectOutputType<
        {
            content: ZodUnion<
                [
                    ZodArray<
                        ZodObject<
                            { text: ZodString; type: ZodLiteral<"text"> },
                            "strip",
                            ZodTypeAny,
                            { text: string; type: "text" },
                            { text: string; type: "text" },
                        >,
                        "many",
                    >,
                    ZodString,
                ],
            >;
            name: ZodOptional<ZodString>;
            role: ZodLiteral<"assistant">;
            tool_call_id: ZodOptional<ZodString>;
            tool_calls: ZodOptional<
                ZodArray<
                    ZodObject<
                        {
                            function: ZodObject<
                                { arguments: ZodString; name: ZodString },
                                "passthrough",
                                ZodTypeAny,
                                objectOutputType<
                                    { arguments: ...; name: ... },
                                    ZodTypeAny,
                                    "passthrough",
                                >,
                                objectInputType<
                                    { arguments: ...; name: ... },
                                    ZodTypeAny,
                                    "passthrough",
                                >,
                            >;
                            id: ZodString;
                            type: ZodEffects<
                                ZodOptional<ZodLiteral<(...)>>,
                                "function",
                                undefined | "function",
                            >;
                        },
                        "strip",
                        ZodTypeAny,
                        {
                            function: { arguments: string; name: string } & {
                                [k: string]: unknown;
                            };
                            id: string;
                            type: "function";
                        },
                        {
                            function: { arguments: string; name: string } & {
                                [k: string]: unknown;
                            };
                            id: string;
                            type?: "function";
                        },
                    >,
                    "many",
                >,
            >;
        },
        ZodTypeAny,
        "passthrough",
    >
    | objectOutputType<
        {
            content: ZodUnion<
                [
                    ZodArray<
                        ZodObject<
                            { text: ZodString; type: ZodLiteral<"text"> },
                            "strip",
                            ZodTypeAny,
                            { text: string; type: "text" },
                            { text: string; type: "text" },
                        >,
                        "many",
                    >,
                    ZodString,
                ],
            >;
            role: ZodLiteral<"tool">;
            tool_call_id: ZodString;
        },
        ZodTypeAny,
        "passthrough",
    >
    | objectOutputType<
        {
            content: ZodNullable<ZodString>;
            name: ZodString;
            role: ZodLiteral<"function">;
        },
        ZodTypeAny,
        "passthrough",
    >
    | objectOutputType<
        {
            content: ZodUnion<
                [
                    ZodArray<
                        ZodUnion<
                            [
                                ZodObject<
                                    { text: ...; type: ... },
                                    "strip",
                                    ZodTypeAny,
                                    { text: ...; type: ... },
                                    { text: ...; type: ... },
                                >,
                                ZodObject<
                                    { image_url: ...; type: ... },
                                    "strip",
                                    ZodTypeAny,
                                    { image_url: ...; type: ... },
                                    { image_url: ...; type: ... },
                                >,
                            ],
                        >,
                        "many",
                    >,
                    ZodString,
                ],
            >;
            name: ZodOptional<ZodString>;
            role: ZodLiteral<"user">;
        },
        ZodTypeAny,
        "passthrough",
    >
    | objectOutputType<
        {
            content: ZodUnion<
                [
                    ZodArray<
                        ZodObject<
                            { text: ZodString; type: ZodLiteral<"text"> },
                            "strip",
                            ZodTypeAny,
                            { text: string; type: "text" },
                            { text: string; type: "text" },
                        >,
                        "many",
                    >,
                    ZodString,
                ],
            >;
            name: ZodOptional<ZodString>;
            role: ZodLiteral<"system">;
        },
        ZodTypeAny,
        "passthrough",
    >
    | objectOutputType<
        {
            content: ZodUnion<
                [
                    ZodArray<
                        ZodObject<
                            { text: ZodString; type: ZodLiteral<"text"> },
                            "strip",
                            ZodTypeAny,
                            { text: string; type: "text" },
                            { text: string; type: "text" },
                        >,
                        "many",
                    >,
                    ZodString,
                ],
            >;
            name: ZodOptional<ZodString>;
            role: ZodLiteral<"developer">;
        },
        ZodTypeAny,
        "passthrough",
    >,
    objectInputType<
        {
            content: ZodUnion<
                [
                    ZodString,
                    ZodArray<
                        ZodDiscriminatedUnion<
                            "type",
                            [
                                ZodObject<
                                    { text: ZodString; type: ZodLiteral<(...)> },
                                    "strip",
                                    ZodTypeAny,
                                    { text: string; type: "text" },
                                    { text: string; type: "text" },
                                >,
                                ZodObject<
                                    {
                                        source: ZodObject<(...), (...), (...), (...), (...)>;
                                        type: ZodLiteral<(...)>;
                                    },
                                    "strip",
                                    ZodTypeAny,
                                    {
                                        source: { data: ...; media_type: ...; type: ... };
                                        type: "image";
                                    },
                                    {
                                        source: { data: ...; media_type: ...; type: ... };
                                        type: "image";
                                    },
                                >,
                                ZodObject<
                                    {
                                        id: ZodString;
                                        input: ZodType<(...), (...), (...)>;
                                        name: ZodString;
                                        type: ZodLiteral<(...)>;
                                    },
                                    "strip",
                                    ZodTypeAny,
                                    { id: string; input: JSONLiteral; name: string; type: "tool_use" },
                                    { id: string; input: JSONLiteral; name: string; type: "tool_use" },
                                >,
                                ZodObject<
                                    {
                                        content: ZodUnion<(...)>;
                                        is_error: ZodOptional<(...)>;
                                        tool_use_id: ZodString;
                                        type: ZodLiteral<(...)>;
                                    },
                                    "strip",
                                    ZodTypeAny,
                                    {
                                        content: (...)
                                        | (...);
                                        is_error?: (...) | (...) | (...);
                                        tool_use_id: string;
                                        type: "tool_result";
                                    },
                                    {
                                        content: (...)
                                        | (...);
                                        is_error?: (...) | (...) | (...);
                                        tool_use_id: string;
                                        type: "tool_result";
                                    },
                                >,
                            ],
                        >,
                        "many",
                    >,
                ],
            >;
            role: ZodEnum<["user", "assistant"]>;
        },
        ZodTypeAny,
        "passthrough",
    >,
> = ...

Spoke → Hub: Convert an Anthropic message to OpenAI format