Attaching image/pdf in chatgpt request

I am going to use the completion method for API requests. I need to attach a pdf/images with some prompts to extract key details I need from it. how can I do this? what models support this like 4o,mini40,turbo 3.5 etc…
give some detailed explanation, and if possible share example Python code.