MARJ
SIGN IN
IL3checked 1d ago
I · Using AIAI-1516 MIN

Calling AI From Your Own Code: The API, Explained Properly

A working script that sends a prompt to a model's API and uses the response
Before this

⚠️ Version note. API endpoints, SDK names and field names change. The shape — authenticate, send messages, read the reply — is stable across providers. Code below is illustrative; check your provider's current docs for exact names. Last checked: 25 July 2026.

What you'll have at the end

  • A working script that sends a prompt to a model and prints the reply
  • The request anatomy understood: key, model, messages, parameters
  • Your API key handled safely (never in the code, never in Git)
Members

You've read the summary — the full breakdown is for members

Behind this: the complete method, the worked example, the exercise, and the cheatsheet. Everything you've read above stays free, always.

$7.99/mo · 7-day free trialWeekly $2.99Yearly $59
See plansCancel in two clicks. No dark patterns.
Mark it when you've got the output in hand.

← All Using AI lessons