Codex Files or Sessions for more code

I setup a Python script that i can use the API. But it says 4000+ characters is allowed, but 3000 seems to be the actual limit. But i would like to setup a template file and have Codex chain to it. To create a version of the file with Codex filling in the blanks. This came up when I was trying to setup a script to read a json file that was to long.