Free practice topic

Python dictionaries for GenAI APIs

Learn Python dicts as JSON bodies for LLM APIs: model names, messages, safe .get() defaults. Practice free in the browser.

What you will learn

  • +Keys, values, and safe lookup
  • +Nested messages for chat APIs
  • +Real-time LLM request body examples

Starter idea: Build a small request dict with model and messages.

Tiny example

Create a dict and read a key.

config = {"model": "gpt-4.1-mini"}
print(config["model"])
print(config.get("top_p", 1.0))