Browse Source

Updated README with Free API code snippet

pull/40/head
Edward Donner 5 months ago
parent
commit
ecb2a0a649
  1. 25
      README.md

25
README.md

@ -39,9 +39,30 @@ Hopefully I've done a decent job of making these guides bulletproof - but please
During the course, I'll suggest you try out the leading models at the forefront of progress, known as the Frontier models. I'll also suggest you run open-source models using Google Colab. These services have some charges, but I'll keep cost minimal - like, a few cents at a time. And I'll provide alternatives if you'd prefer not to use them. During the course, I'll suggest you try out the leading models at the forefront of progress, known as the Frontier models. I'll also suggest you run open-source models using Google Colab. These services have some charges, but I'll keep cost minimal - like, a few cents at a time. And I'll provide alternatives if you'd prefer not to use them.
Please do monitor your API usage to ensure you're comfortable with spend; I've included links below. There's no need to spend anything more than a couple of dollars for the entire course. Some AI providers such as OpenAI require a minimum credit like \$5 or local equivalent; we should only spend a fraction of it, and you'll have plenty of opportunity to put it to good use in your own projects. During Week 7 you have an option to spend a bit more if you're enjoying the process - I spend about $10 myself and the results make me very happy indeed! But it's not necessary in the least; the important part is that you focus on learning. Please do monitor your API usage to ensure you're comfortable with spend; I've included links below. There's no need to spend anything more than a couple of dollars for the entire course. Some AI providers such as OpenAI require a minimum credit like \$5 or local equivalent; we should only spend a fraction of it, and you'll have plenty of opportunity to put it to good use in your own projects. During Week 7 you have an option to spend a bit more if you're enjoying the process - I spend about \$10 myself and the results make me very happy indeed! But it's not necessary in the least; the important part is that you focus on learning.
I'll also show you an alternative if you'd rather not spend anything on APIs. ### Free alternative to Paid APIs
Early in the course, I show you an alternative if you'd rather not spend anything on APIs:
Any time that we have code like:
`openai = OpenAI()`
You can use this as a direct replacement:
`openai = OpenAI(base_url='http://localhost:11434/v1', api_key='ollama')`
Below is a full example:
```
from openai import OpenAI
MODEL = "llama3.2"
openai = OpenAI(base_url='http://localhost:11434/v1';, api_key='ollama')
response = openai.chat.completions.create(
model=MODEL,
messages=[{"role": "user", "content": "What is 2 + 2?"}]
)
print(response.choices[0].message.content)
```
### How this Repo is organized ### How this Repo is organized

Loading…
Cancel
Save