🇬🇧 Limited Time — UK Only·🎓 Free Learning for 1 Month·🤖 Free AI Training Included·📚 4,000+ Lessons · 35,000+ Quizzes·🏆 GCSE Mocks · Olympiad Papers·⚡ Selected Students Only · Limited Places·🎁 Free Value Worth £2,000·🇬🇧 Limited Time — UK Only·🎓 Free Learning for 1 Month·🤖 Free AI Training Included·📚 4,000+ Lessons · 35,000+ Quizzes·🏆 GCSE Mocks · Olympiad Papers·⚡ Selected Students Only · Limited Places·🎁 Free Value Worth £2,000·🇬🇧 Limited Time — UK Only·🎓 Free Learning for 1 Month·🤖 Free AI Training Included·📚 4,000+ Lessons · 35,000+ Quizzes·🏆 GCSE Mocks · Olympiad Papers·⚡ Selected Students Only · Limited Places·🎁 Free Value Worth £2,000·
Generative AI

Calling an AI API with fetch()

AI models are accessed over the internet using APIs. You send a POST request with your prompt as JSON, the server runs the AI model, and sends back the response. Let's see the structure — even if you don't have an API key, you'll understand exactly how it works!

3 min 10 XP Lesson 3 of 7
Calling an AI API with fetch()

AI models are accessed over the internet using APIs. You send a POST request with your prompt as JSON, the server runs the AI model, and sends back the response. Let's see the structure — even if you don't have an API key, you'll understand exactly how it works!

Quick Quiz

1 / 2

What does the 'Authorization' header contain?