AI Engineering Basics Study Guide — AI Foundations

20% of the exam · domain 4 of 5 · AI Foundations · Free AI Engineering Basics practice questions

0 of 50 topics covered
What the exam asks here — tap to tick off0 / 10 covered
Domain 4 of 5

AI Engineering Basics

This domain tests your ability to work with production AI APIs across OpenAI, Anthropic, and Google platforms — covering authentication patterns, cost modeling, streaming architecture, error handling, and advanced features like caching, tool use, and batch processing. It represents 20% of the exam and rewards precise knowledge of parameter names, default values, service-specific requirements, and failure-mode patterns. Questions mix direct recall with scenario-based reasoning where you must select the correct API, parameter, or strategy given a constraint.


OpenAI API: Authentication, Models, and Chat Completions

Authentication uses an API key passed as a Bearer token in the Authorization header, or via the api_key parameter in the SDK. The key format begins with sk-. Organization IDs (org-) scope billing and usage tracking across projects. Never embed keys in client-side code.

Core endpoint: POST https://api.openai.com/v1/chat/completions

Models endpoint: GET https://api.openai.com/v1/models — returns all available models; useful for dynamic model selection and verifying deprecation status.

ParameterDefaultNotes
modelrequirede.g., gpt-4o, gpt-4o-mini, gpt-3.5-turbo
messagesrequiredArray of {role, content} objects
max_tokensNone (model max)Optional but recommended to cap cost
temperature1.0Range 0–2
streamfalseSet true for SSE streaming
n1Number of completions to generate

Message roles: system, user, assistant. The system role sets instructions and appears first.

Common traps:

  • Confusing max_tokens (OpenAI, optional) with Anthropic's max_tokens (required — see Anthropic section).
  • Using gpt-4 when the question specifies latest vision capability — correct answer is gpt-4o.
  • Assuming the Authorization header uses Bearer prefix — it does: Authorization: Bearer sk-....
  • The models endpoint is GET, not POST.
  • n > 1 multiplies token cost by n — exam may test this in cost scenarios.

Worked scenario: A developer needs to list all models available to their account programmatically. They should call GET /v1/models with their API key. The response includes an id field per model and a deprecated flag where applicable.


Anthropic API: Messages Endpoint, Model IDs, max_tokens Requirement

Base URL: https://api.anthropic.com/v1/messages
Method: POST
Authentication: x-api-key header (not Bearer token — this is a key exam differentiator from OpenAI) plus anthropic-version header (e.g., 2023-06-01).

max_tokens is REQUIRED in every Anthropic messages request. There is no default fallback. Omitting it returns a validation error.

Model ID format: claude-3-5-sonnet-20241022, claude-3-haiku-20240307, claude-3-opus-20240229. Note the date suffix in the ID — this is how versioning is embedded.

FieldRequired?Notes
modelYesFull versioned model ID
messagesYesArray of {role, content}
max_tokensYesNo default — must be explicit
systemNoTop-level string (not inside messages array)
streamNoBoolean, defaults false

System prompt placement: In Anthropic, the system prompt is a top-level parameter, not a message in the messages array. This differs from OpenAI where system is a role inside messages.

Common traps:

  • Forgetting max_tokens is mandatory — distractor answers omit it.
  • Placing the system prompt inside the messages array (OpenAI pattern) — wrong for Anthropic.
  • Using Authorization: Bearer header — Anthropic uses x-api-key.
  • Omitting the anthropic-version header — required and will cause errors.
  • Claude model IDs without date suffix (e.g., just claude-3-sonnet) are not valid API values.

Sign in and enroll free to read the full guide

11 more sections (about 2,480 words) continue below. This course is free: enroll from the course page to unlock every guide.