1
00:00:00,080 --> 00:00:00,320
Now.

2
00:00:00,320 --> 00:00:04,240
Steps three and four of the set of instructions are optional.

3
00:00:04,440 --> 00:00:10,320
I strongly recommend that you get an account with OpenAI if you don't have one already, so that we

4
00:00:10,320 --> 00:00:15,000
can use the most powerful models on the planet, and OpenAI is a good one to start with.

5
00:00:15,200 --> 00:00:16,440
But you don't need to.

6
00:00:16,600 --> 00:00:20,880
It requires a payment $5 up front, and you might not want to spend that.

7
00:00:20,880 --> 00:00:24,080
And you can use free models throughout this course.

8
00:00:24,080 --> 00:00:27,200
You can use Gemini or you can use llama.

9
00:00:27,200 --> 00:00:29,760
And there are detailed instructions for how to do it.

10
00:00:29,760 --> 00:00:33,080
And I will have an example lab as well.

11
00:00:33,240 --> 00:00:38,280
But assuming that you do want to go ahead and set up an OpenAI account, you may already have one as

12
00:00:38,280 --> 00:00:38,760
well.

13
00:00:38,760 --> 00:00:39,600
Let's do that.

14
00:00:39,600 --> 00:00:44,200
That is step three, and feel free to skip this or just watch what I do if you don't want to.

15
00:00:44,360 --> 00:00:46,000
So you go to a web browser.

16
00:00:46,000 --> 00:00:47,600
I've got an incognito tab here.

17
00:00:47,600 --> 00:00:55,400
So because I'm already logged into OpenAI, but you go to platform OpenAI, that is where you come to

18
00:00:55,440 --> 00:01:03,040
the kind of the API side of OpenAI, not to use ChatGPT, but to have your own account to use the API.

19
00:01:03,510 --> 00:01:05,070
and that's an important point.

20
00:01:05,110 --> 00:01:10,790
Some people are confused about the fact that there is ChatGPT the product which you can interact with

21
00:01:10,790 --> 00:01:15,750
and which has a paid plan for like $20 a month and an even higher tier paid plan.

22
00:01:15,990 --> 00:01:23,630
And then separate to that, there is an API, the OpenAI API, for connecting to the model directly.

23
00:01:23,630 --> 00:01:27,990
And people, some people are confused about that and say, hey, if I'm paying for one, why can't I

24
00:01:27,990 --> 00:01:28,630
have the other?

25
00:01:28,790 --> 00:01:31,710
Luckily, I've written a guide about exactly that.

26
00:01:31,750 --> 00:01:35,630
There's a guide called Technical Foundations, which you'll find in the guides folder.

27
00:01:35,630 --> 00:01:40,190
It takes you through some of the foundational information to help you navigate through some of these

28
00:01:40,190 --> 00:01:40,990
concepts.

29
00:01:40,990 --> 00:01:49,150
And I explain very clearly the difference between the product ChatGPT and using the API from an AI engineer's

30
00:01:49,190 --> 00:01:50,030
point of view.

31
00:01:50,030 --> 00:01:52,790
So do please read that if you've got any confusion.

32
00:01:52,990 --> 00:01:57,230
But assuming that that's that's obvious to you, then then great, come here.

33
00:01:57,270 --> 00:01:58,830
Come to platform OpenAI.

34
00:01:59,590 --> 00:02:01,950
And the first thing to do is to click sign up.

35
00:02:01,950 --> 00:02:08,340
And you can then come in and use like your your Google auth any or Microsoft account or an Apple account,

36
00:02:08,340 --> 00:02:10,540
or just create an account with an email address.

37
00:02:10,660 --> 00:02:15,140
I think people that are coming internationally outside the US, you might need to click a button like

38
00:02:15,140 --> 00:02:17,220
create organization or something first.

39
00:02:17,260 --> 00:02:20,980
You might need to click through some screen before you get to create your account, but it should be

40
00:02:20,980 --> 00:02:22,700
pretty obvious you should get here.

41
00:02:22,740 --> 00:02:24,020
Sign up for an account.

42
00:02:24,020 --> 00:02:25,660
So far, it's completely free.

43
00:02:25,860 --> 00:02:28,020
The money will come in just a second.

44
00:02:28,060 --> 00:02:29,660
The $5 spend.

45
00:02:29,900 --> 00:02:32,820
Uh, let's let's, uh, come back once you've set up your account.

46
00:02:32,820 --> 00:02:33,180
Okay.

47
00:02:33,220 --> 00:02:39,980
So this is what you see once you come to platform and once you've signed in with an account, and the

48
00:02:39,980 --> 00:02:45,460
navigation is just a little bit confusing, but you have to be aware that at the top here there's dashboard.

49
00:02:45,460 --> 00:02:47,820
And over on the right there's settings.

50
00:02:48,060 --> 00:02:53,700
And the first thing to do is to go over to settings, which is where the billing information is, and

51
00:02:53,700 --> 00:02:57,380
go to settings and then come down to billing right here.

52
00:02:57,780 --> 00:03:02,220
And this is where you get to put a balance on OpenAI.

53
00:03:02,580 --> 00:03:08,570
OpenAI is a pay as you go model, which means you put down an amount of money and then you draw down

54
00:03:08,570 --> 00:03:11,210
against that over time and you only spend.

55
00:03:11,250 --> 00:03:13,410
Tiny amounts of money on this course.

56
00:03:13,410 --> 00:03:17,370
We will spend fractions of a cent, typically for each of our projects.

57
00:03:17,370 --> 00:03:23,450
Except where I tell you otherwise, you should always track your your spend always come back here.

58
00:03:23,450 --> 00:03:28,570
The nice thing about this is that because it's a pay as you go model, you're always paying up front.

59
00:03:28,570 --> 00:03:33,050
You're not likely to get some kind of surprise as long as you only top up with a small amount.

60
00:03:33,050 --> 00:03:37,090
There are some some other services like AWS where it doesn't work that way, which I don't like.

61
00:03:37,130 --> 00:03:41,130
This one is better because you get to be in complete control of your spend.

62
00:03:41,170 --> 00:03:43,210
Nonetheless, you should come back and have a look at it.

63
00:03:43,450 --> 00:03:45,890
You should always have auto recharge off.

64
00:03:45,930 --> 00:03:47,850
You don't want it to automatically recharge.

65
00:03:47,850 --> 00:03:48,530
Don't press that.

66
00:03:48,530 --> 00:03:50,170
Enable auto recharge button.

67
00:03:50,170 --> 00:03:54,650
You don't want it automatically billing to your credit card, unless this is something that you're in

68
00:03:54,650 --> 00:03:56,610
production and you know exactly what you're doing.

69
00:03:56,850 --> 00:04:00,930
So the first thing you do when you come in here, you should see zero credit balance.

70
00:04:00,930 --> 00:04:03,970
And you will want to press the Add to credit balance button.

71
00:04:03,970 --> 00:04:06,210
And you'll want to to type in an amount there.

72
00:04:06,210 --> 00:04:08,370
And you'll want to select a payment method.

73
00:04:08,530 --> 00:04:14,270
And then once you've done that, you would then add that amount and sorry, $5 is the minimum.

74
00:04:14,270 --> 00:04:15,550
You don't need to spend $10.

75
00:04:15,590 --> 00:04:17,750
$5 is the minimum payment amount.

76
00:04:17,790 --> 00:04:19,950
You will then draw down and that lasts a year.

77
00:04:20,270 --> 00:04:23,990
So you've got you've got plenty of time to spend that $5.

78
00:04:23,990 --> 00:04:29,870
You need to make sure that your payment methods includes a valid credit card that you can charge against.

79
00:04:29,910 --> 00:04:32,230
Otherwise, OpenAI will throw various errors.

80
00:04:32,230 --> 00:04:35,390
So make sure that you add a proper payment method which it can use.

81
00:04:35,670 --> 00:04:41,310
And I should mention a lot of students do have problems with payments not being accepted, getting declined

82
00:04:41,670 --> 00:04:42,830
through through OpenAI.

83
00:04:42,950 --> 00:04:48,150
And it's worth pointing out that almost always most of the time, any time that I've been aware of that

84
00:04:48,150 --> 00:04:55,390
problem is with your credit card not accepting OpenAI's charge as an international vendor, OpenAI is

85
00:04:55,390 --> 00:04:57,270
happy to take your money if you let it.

86
00:04:57,310 --> 00:04:59,630
It's unlikely to be a problem with OpenAI.

87
00:04:59,910 --> 00:05:05,310
It's more likely that your credit card company, for whatever reason, is refusing an international

88
00:05:05,310 --> 00:05:05,910
charge.

89
00:05:05,910 --> 00:05:10,470
And so you might need to go into your to your bank account and select something which enables that kind

90
00:05:10,470 --> 00:05:11,070
of charge.

91
00:05:11,110 --> 00:05:13,260
Perhaps something to look out for.

92
00:05:13,420 --> 00:05:17,740
Otherwise, if you if you really can't get past this and can't get a balance on there, then you can

93
00:05:17,740 --> 00:05:19,100
contact OpenAI support.

94
00:05:19,100 --> 00:05:20,700
They're actually really responsive.

95
00:05:21,140 --> 00:05:21,660
Okay.

96
00:05:21,700 --> 00:05:23,060
But let me assume you've done this.

97
00:05:23,060 --> 00:05:26,060
This is now showing $5 and it's looking great.

98
00:05:26,060 --> 00:05:29,540
You've got a good payment method associated with your account.

99
00:05:29,580 --> 00:05:31,900
We're ready to set up an API key.

100
00:05:32,060 --> 00:05:32,500
Okay.

101
00:05:32,540 --> 00:05:34,180
So you're still in settings.

102
00:05:34,220 --> 00:05:36,420
You're still seeing this menu up here.

103
00:05:36,420 --> 00:05:42,500
And the first thing to do is to select API keys up here making sure you're under the organization heading.

104
00:05:42,500 --> 00:05:44,740
You're right up here API keys.

105
00:05:44,900 --> 00:05:45,780
And here you go.

106
00:05:45,820 --> 00:05:48,660
You can see that that I have some API keys.

107
00:05:48,820 --> 00:05:50,740
And you're going to make one yourself.

108
00:05:50,780 --> 00:05:53,500
Right now these are your API keys.

109
00:05:53,500 --> 00:05:57,780
And it's super important to be careful about what you do next.

110
00:05:58,060 --> 00:06:02,500
You're going to press the Create new Secret key button like so.

111
00:06:03,020 --> 00:06:05,300
You're going to want to create a new secret key.

112
00:06:05,340 --> 00:06:08,900
It is owned by you not service account.

113
00:06:09,060 --> 00:06:15,170
You can give it whatever name you want, but something that you remember, like, uh, LM engineering

114
00:06:16,090 --> 00:06:16,650
key.

115
00:06:17,130 --> 00:06:20,450
And now be careful with this for the project.

116
00:06:20,450 --> 00:06:26,010
Select default project because you don't want to have any extra constraints.

117
00:06:26,010 --> 00:06:31,050
If people if you do anything clever here that that constrains it in some way, then you might get errors

118
00:06:31,050 --> 00:06:31,690
later.

119
00:06:31,690 --> 00:06:38,050
So just have default project, which means any project can access this and leave permissions at all.

120
00:06:38,170 --> 00:06:41,410
And then you're going to press the Create secret key button.

121
00:06:41,690 --> 00:06:46,410
And when you do that which I will do it now it will come up with a key like this.

122
00:06:46,650 --> 00:06:49,090
And fear not I'm going to delete this key right afterwards.

123
00:06:49,370 --> 00:06:49,610
Aha.

124
00:06:49,930 --> 00:06:54,090
Uh this key is your key with OpenAI.

125
00:06:54,130 --> 00:06:57,610
It's your way to link your code to using OpenAI.

126
00:06:57,930 --> 00:07:03,010
And it begins ESC hyphen, hyphen.

127
00:07:03,010 --> 00:07:05,490
And then this long thing right here.

128
00:07:05,730 --> 00:07:07,290
And that is your secret key.

129
00:07:07,450 --> 00:07:10,210
And that's something which we're going to be using in our code.

130
00:07:10,410 --> 00:07:14,930
And if you get this wrong, if you type, if you, if you change one of these numbers or one of these

131
00:07:14,930 --> 00:07:17,000
letters, it's like a password.

132
00:07:17,160 --> 00:07:18,440
Everything has to be right.

133
00:07:18,440 --> 00:07:20,880
If something's wrong, it's not going to work.

134
00:07:21,280 --> 00:07:23,880
So copy it into your clipboard by pressing copy.

135
00:07:23,920 --> 00:07:24,600
It's now copied.

136
00:07:24,600 --> 00:07:26,520
So when you press paste, it's going to paste.

137
00:07:26,520 --> 00:07:28,560
And in a minute we're going to paste it somewhere.

138
00:07:28,600 --> 00:07:34,520
And please now don't don't paste it somewhere else first and then copy it again or anything that might

139
00:07:34,520 --> 00:07:35,480
mess with the key.

140
00:07:35,640 --> 00:07:38,880
Let it be in your clipboard in pristine shape.

141
00:07:38,880 --> 00:07:39,920
We're not going to change it.

142
00:07:39,920 --> 00:07:45,000
We're going to paste it exactly as it is into our actual inter cursor.

143
00:07:45,000 --> 00:07:46,680
So keep it like this.

144
00:07:46,720 --> 00:07:48,600
In fact, you don't even need to press the done button yet.

145
00:07:48,600 --> 00:07:50,200
You can keep this screen up here.

146
00:07:50,200 --> 00:07:54,120
We're going to go back to cursor and put this in cursor right away.

147
00:07:54,240 --> 00:07:55,240
Let's go do that.

148
00:07:55,240 --> 00:07:57,480
So here I am back in cursor.

149
00:07:57,520 --> 00:08:02,280
By the way if you have one of your terminal screens appearing like this, you can close it just by pressing

150
00:08:02,280 --> 00:08:03,240
the X button there.

151
00:08:03,240 --> 00:08:05,320
So you've got nice clean screen.

152
00:08:06,000 --> 00:08:06,600
Okay.

153
00:08:06,960 --> 00:08:14,440
What we're going to do now is create a file called the file, which is a file that contains your secrets.

154
00:08:14,680 --> 00:08:17,680
And it's super important that you do this carefully.

155
00:08:17,680 --> 00:08:20,350
It's got to be right or things ain't going to work.

156
00:08:20,590 --> 00:08:20,910
So?

157
00:08:20,910 --> 00:08:22,110
So this needs to be right.

158
00:08:22,310 --> 00:08:26,950
The EMV file is a new file we're going to create, which has to be at the top level.

159
00:08:26,950 --> 00:08:32,230
It has to be a file within LM engineering not inside any of these directories.

160
00:08:32,390 --> 00:08:37,590
So what we can do is we can get this little blank space just here underneath the bottom of this list

161
00:08:37,590 --> 00:08:38,390
of files.

162
00:08:38,390 --> 00:08:41,550
You can right click there and say new file.

163
00:08:41,670 --> 00:08:43,670
And you can see it's now giving me a new file.

164
00:08:43,670 --> 00:08:44,790
And you can just double check.

165
00:08:44,790 --> 00:08:48,790
It's at the same top level as all these other top level files.

166
00:08:48,790 --> 00:08:54,790
And I'm going to call it it's going to be called exactly a period dot like that.

167
00:08:55,030 --> 00:09:04,030
And then the letter E and the letter n and the letter v e v and it can't be called dot EMV dot txt.

168
00:09:04,070 --> 00:09:06,750
It can't be called EMV in your name.

169
00:09:06,790 --> 00:09:09,710
It can't be called EMV dot it.

170
00:09:10,150 --> 00:09:14,750
In case you didn't get the message, it's got to be called EMV and only that and it's got to be in the

171
00:09:14,750 --> 00:09:16,550
project root in this top folder.

172
00:09:16,550 --> 00:09:17,670
And there it is.

173
00:09:17,990 --> 00:09:21,340
That is the right place to be Okay.

174
00:09:21,900 --> 00:09:25,580
And now what I'm going to put in here is going to be my open AI key.

175
00:09:25,700 --> 00:09:27,180
And here's how you do it.

176
00:09:27,180 --> 00:09:33,260
You have to type open AI underscore API underscore key.

177
00:09:34,300 --> 00:09:40,740
And it's got to be exactly this open AI underscore API underscore key.

178
00:09:41,100 --> 00:09:43,180
It's got to be in block capitals.

179
00:09:43,340 --> 00:09:47,260
It's not this it's not open API key.

180
00:09:47,420 --> 00:09:49,860
It's open AI API key.

181
00:09:50,140 --> 00:09:52,180
Now you wonder why I'm going on about this.

182
00:09:52,180 --> 00:09:57,380
I get more than a thousand emails every couple of during every few weeks.

183
00:09:57,380 --> 00:10:01,500
I get that many emails from people that have mistyped these words.

184
00:10:01,500 --> 00:10:03,420
So don't do that.

185
00:10:03,540 --> 00:10:06,900
Spell it open AI API key exactly like this.

186
00:10:07,420 --> 00:10:11,980
Uh, then equals it's open ai API key equals.

187
00:10:11,980 --> 00:10:14,620
And then you're going to press paste.

188
00:10:14,780 --> 00:10:21,180
And when you do paste it's going to paste in that key that you copied from the open AI screen.

189
00:10:21,180 --> 00:10:22,220
Let's check it out.

190
00:10:22,260 --> 00:10:23,600
Look it's open OpenAI.

191
00:10:23,720 --> 00:10:26,360
API key equals sq.

192
00:10:26,680 --> 00:10:27,880
Proj dash.

193
00:10:28,080 --> 00:10:30,280
And then this long funny thing.

194
00:10:30,680 --> 00:10:32,960
And there's nothing crazy at the end of it.

195
00:10:33,000 --> 00:10:35,360
We haven't pasted in an extra space.

196
00:10:35,400 --> 00:10:36,280
An extra empty.

197
00:10:36,320 --> 00:10:37,320
We've been careful.

198
00:10:37,400 --> 00:10:39,360
It is exactly this.

199
00:10:39,840 --> 00:10:45,040
Now, that white blob just to the right there means that I haven't yet saved this file.

200
00:10:45,160 --> 00:10:46,120
It's not been saved.

201
00:10:46,120 --> 00:10:50,120
It's not on the disk, which means it's empty as far as my computer is concerned.

202
00:10:50,200 --> 00:10:57,680
So I have to press command S Ctrl s on a PC, command S on a mac or file save to save it, and the white

203
00:10:57,720 --> 00:10:59,200
blob goes away.

204
00:10:59,200 --> 00:11:01,080
And that means it's now saved.

205
00:11:01,200 --> 00:11:05,880
This is now in the file I get, I get, I get hundreds of emails from people that haven't saved the

206
00:11:05,880 --> 00:11:06,240
files.

207
00:11:06,320 --> 00:11:07,000
Saved the file.

208
00:11:07,400 --> 00:11:10,720
You'll see that there is a little stop sign next to it.

209
00:11:10,720 --> 00:11:14,520
I also get hundreds of emails from people that are worried about that stop sign.

210
00:11:14,520 --> 00:11:17,120
But that stop sign is actually good news.

211
00:11:17,120 --> 00:11:21,280
That stop sign is cursor telling you if you hover over it, it will tell you.

212
00:11:21,320 --> 00:11:25,400
It's telling you that AI features are disabled for this file.

213
00:11:25,750 --> 00:11:29,310
And the reason for that is that this file contains your secrets.

214
00:11:29,310 --> 00:11:34,430
This contains your precious key that connects you to OpenAI and to your credit card.

215
00:11:34,670 --> 00:11:36,910
And we don't want that leaking out.

216
00:11:36,950 --> 00:11:42,510
And particularly we don't want cursor sending this off to different AI to get some sort of information

217
00:11:42,510 --> 00:11:43,030
on it.

218
00:11:43,150 --> 00:11:45,750
So as a result, cursor is saying, hey, hands off.

219
00:11:45,790 --> 00:11:47,550
I'm I'm not going to touch this file.

220
00:11:47,550 --> 00:11:50,750
I'm not going to do AI suggestions for this file.

221
00:11:50,750 --> 00:11:53,110
This file is secretly just for you.

222
00:11:53,110 --> 00:11:54,910
So we like to see that stop sign.

223
00:11:54,910 --> 00:11:56,110
That is good news.

224
00:11:56,150 --> 00:11:58,670
Look out for it in anything with secrets in it.

225
00:11:58,670 --> 00:12:00,310
Like the EMV file.

226
00:12:00,630 --> 00:12:02,790
All right I think I belabored this one enough.

227
00:12:02,830 --> 00:12:04,270
You've got a EMV file.

228
00:12:04,270 --> 00:12:06,190
It's called exactly EMV.

229
00:12:06,350 --> 00:12:07,870
It's in your project root.

230
00:12:07,870 --> 00:12:08,950
In the top level.

231
00:12:09,070 --> 00:12:13,110
It says OpenAI API key in block capitals equals.

232
00:12:13,110 --> 00:12:19,950
And then it's got this key right here that you have taken from your your actual API key that you took

233
00:12:19,950 --> 00:12:20,710
from OpenAI.

234
00:12:20,710 --> 00:12:22,030
And you pasted it in here.

235
00:12:22,070 --> 00:12:23,430
Congratulations.

236
00:12:23,430 --> 00:12:27,550
You've got through the hardest part of the whole course getting the API key in there.

237
00:12:27,590 --> 00:12:28,630
Let's move on.