Anti-idiotypic antibodies recognize the antigenic determinants of an antibody, thus they can be used as surrogate antigens. Single-domain antibodies from camlid heavy-chain antibodies with the benefit features of small size, thermostability, and ease in expression, are leading candidates to produce anti-idiotypic antibodies. In this work, we constructed an antibody phage library from the mRNA of an alpaca immunized with an antiaflatoxin monoclonal antibody (mAb) 1C11. Three anti-idiotypic VHH antibodies were isolated and applied to immunoassay toward aflatoxin as a coating antigen. The best immunoassay developed with one of these VHH antibodies shows an IC50 of 0.16 ng/mL toward aflatoxin B1 and cross-reactivity toward aflatoxin B2, G1, and G2 of 90.4%, 54.4%, and 37.7%, respectively. The VHH-based immunoassay was successfully applied to the analysis of peanuts, corn, and rice, which are the predominant commodities regularly contaminated by aflatoxins. A good correlation (r(2) = 0.89) was found between the data obtained from the conventional ELISA and the ELISA based on a VHH coating antigen for the analysis of aflatoxins in peanuts and feedstuff. The use of biotechnology in developing the surrogate, the absence of standard aflatoxin and organic solvents in the synthesis procedures, and the reproducibility of the VHH antibody makes it an ideal strategy for replacing conventional synthesized antigens.