How to call REST apis in python using Codex/GPT3?

We have custom web-services with REST apis (and other text based remote apis).
Some apis take input parameters and some give output values.

We want to use codex/gpt3 to convert plain text instructions into python code (to call these apis).

How do we train codex/gpt3 with a list of these APIs - to generate python code to call these apis ?
How do we formulate our prompts to accomplish this ?

Example:

Api: HTTP GET http://www.abc.com/users?firstname=‘john’&lastname=‘doe’

Prompt: Write a python program to get all users having first name as ‘john’ and last name as ‘doe’ from ‘http://www.abc.com’ .

I think the best solution for this is fine tuning. As far as I know, codex doesn’t have this feature right now. However, it seems to me that fine tuned text engines (especially davinci) can solve this problem if there are no complex code structures.