/compat endpoint with a tool. The OpenAI tools / tool_calls schema is forwarded as-is by the gateway; the upstream Workers AI model must support function calling. @cf/zai-org/glm-4.7-flash does.
tool_use.py
Run the Example
1
Set up your virtual environment
2
Install dependencies
3
Export environment variables
4
Run the example
Save the code above as
tool_use.py, then run: