Your First Minimal LLM API Call (curl-Style)
Explore how to create a minimal LLM API call using curl-style HTTP requests. Understand the required headers, JSON prompt structure, and how to locate and interpret generated response fields and metadata for reliable workflow integration.
We'll cover the following...
A minimal LLM API call is just an HTTP request that contains an auth header, a JSON body with a prompt, and enough information for the server to route the request to a model. Below is an end-to-end curl-style template that takes one support email and asks for triage JSON.
Note the systemInstruction field sitting outside contents. That is the instruction layer Chapter 3 Lesson 5 described, expressed as a real request field rather than a heading typed into the prompt.
Not every API carries the key the same way. Many send Authorization: Bearer ... as a header; Gemini accepts either an x-goog-api-key header or a key query parameter. The credential's location is vendor-specific, so a debugging habit that only ever looks for a Bearer header will miss it here.
Here’s a representative response shape, where one field contains the generated content and the rest is wrapper ...