2.5.1 · Lesson 20 of 25
FM API Interfaces
A GenAI API has unique requirements compared with traditional APIs.
Overview
A GenAI API has unique requirements compared with traditional APIs.
Important considerations:
- streaming
- token limits
- timeouts
- retries
- request validation
- response handling
Token Limits
Models have limits around how much input/output they can process.
Conceptually:
System Prompt + Conversation + Retrieved Context + User Input + Output = Token Usage
Therefore applications should manage context carefully.
Retry Strategy
AI APIs can timeout.
Request ↓ Timeout ↓ Retry ↓ Success
But don't retry indefinitely.
Use controlled retries with appropriate limits.
API Gateway
A common architecture:
Frontend ↓ API Gateway ↓ Lambda / Service ↓ Bedrock ↓ FM
API Gateway can provide the application-facing API layer.
Key points
- streaming
- token limits
- timeouts
- retries
- request validation
- response handling
- Token Limits
- Retry Strategy
Exam focus
Know when and how to apply FM API Interfaces in production GenAI implementations.