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.
| Parameter | Default | Notes |
|---|---|---|
model | required | e.g., gpt-4o, gpt-4o-mini, gpt-3.5-turbo |
messages | required | Array of {role, content} objects |
max_tokens | None (model max) | Optional but recommended to cap cost |
temperature | 1.0 | Range 0–2 |
stream | false | Set true for SSE streaming |
n | 1 | Number 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'smax_tokens(required — see Anthropic section). - Using
gpt-4when the question specifies latest vision capability — correct answer isgpt-4o. - Assuming the
Authorizationheader usesBearerprefix — it does:Authorization: Bearer sk-.... - The models endpoint is
GET, notPOST. n > 1multiplies token cost byn— 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.
| Field | Required? | Notes |
|---|---|---|
model | Yes | Full versioned model ID |
messages | Yes | Array of {role, content} |
max_tokens | Yes | No default — must be explicit |
system | No | Top-level string (not inside messages array) |
stream | No | Boolean, 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_tokensis mandatory — distractor answers omit it. - Placing the system prompt inside the
messagesarray (OpenAI pattern) — wrong for Anthropic. - Using
Authorization: Bearerheader — Anthropic usesx-api-key. - Omitting the
anthropic-versionheader — 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.