Check my levelCoursesProgramsFor teamsPricing
UKSign inSign up
Check my levelCoursesProgramsFor teamsPricingClaude quizPromptsBlogFAQSearchSign upUK
AcademlCoursesPython with AI from Zero: Scripts for WorkCalling a model from Python: the official openai and anthropic SDKs
A five-line Python script finds unpaid clients in a sales tableClaude Code terminal: the claude -p command with Read and Edit allowedRetries after a 429 error: each pause is twice as long, then success
Course

Python with AI from Zero: Scripts for Work

Module 1 · First script
01Install Python and run your first AI-written script02Variables, lists, conditions and loops on real work examples
Module 2 · Files and spreadsheets
03Files and CSV: read, filter, save04Excel tables with pandas: summary, filter, .xlsx report
Module 3 · AI inside your script and automation
05Calling a model from Python: the official openai and anthropic SDKs06Automating chores and checking the code AI wrote
Python with AI from Zero: Scripts for Work · Lesson 5

Calling a model from Python: the official openai and anthropic SDKs

Connect ChatGPT and Claude to your own script: the key in an environment variable, a first request through the official libraries, and tagging a batch of reviews from a CSV into a new column. Test on three rows, catch network errors and keep customer data out of the requests.

35 min read4 questions in quizReady prompt included
🔒

Full lesson access

Calling a model from Python: the official openai and anthropic SDKs opens after free sign-up: 7 days of full access to every course, no card needed.

Start 7-day free trial
Then Pro: $9/mo or $79/yr

View plans →

One trial lesson is open without sign-up: what a large language model is →

In this lesson
Why call a model from a scriptWhat you needThe key lives in an environment variableFirst call: OpenAIFirst call: ClaudeA batch of reviews from a CSVThree rows firstWhen the network or the limits let you downmaxtokens and spendingCustomer data and privacyHow to ask AI to write this scriptPracticeReady promptQuiz
CoursesLLM coursesFor teamsPricingFAQBlogAboutPrivacy
© 2026 AcademlDevelopment & promotion —MMIX — Marketing Mix
Get started free