Anthropic has now released its latest and new state-of-the-art chatbot, Claude 3. They claim to be the most powerful and capable model today. But how to get access to Claude 3? How to get API Keys for the AI models? Let’s find out that!
How to Access Claude 3?
Claude 3 comes in a family of three AI models namely Claude 3 Haiku, Claude 3 Sonnet, and Claude 3 Opus. You can access Opus and Sonnet starting today through Claude’s official website and the widely released API. Haiku, the fastest model was also released later on 14 March 2024, by Anthropic.
The models come in order of increasing capabilities, performance benchmarks, and costs. You can log in via the claude.ai website:
Sonnet is the version that is freely available for use as of now and is also available today through Amazon Bedrock and in private preview on Google Cloud’s Vertex AI Model Garden.
Opus is the most powerful version of Claude 3 which is claimed by Anthropic to have almost near human processing capabilities. You can also access Opus through claude.ai, however, it is not free of cost and you need to have a Claude Pro subscription. It comes with several enhancements which makes it a big competitor to ChatGPT and Gemini.
The third version namely Claude 3 Haiku model is also claimed to be the world’s fastest AI chatbot as of now. It is said to offer near-instant responsiveness to user prompts and queries. You can access Haiku through Claude 3’s API or by having a Claude Pro subscription on claude.ai.
How Can You Access Claude 3’s API?
To get access to Claude 3’s Sonnet, Opus and Haiku models you will need API access. You can get free API access when you log in to Claude 3 via console.anthropic.com.
Once you create an account and log in, on the home page you will see a banner that says you can claim 5$ in free credits for testing Claude. Click on that (You will need a mobile number verification for the process):
After this, click on “Get API Keys”. To obtain Claude 3 API keys, you can also go to console.anthropic.com/settings/keys:
Following this step, you will be given the option to create the API key. Press on the “Create Key” button following which you will be prompted to give a name for the key. Give it any name and create the key:
You will have the generated API key:
Copy it, and store it securely for future use.
Guide to Using Claude 3 APIs
To run Claude 3 APIs for access to all Sonnet, Opus and Haiku models you will need to run Python 3.7.1 or higher, through your terminal. If you don’t have it, set up Python on your system using pip.
To get started you will need to install the Claude Library through your terminal. Enter the following command:
pip install anthropic
The next step is setting up your generated API key.
If you are a macOS or Linux user follow these steps:
- Launch the terminal and enter nano ~/.bash_profile (or, if you’re using a more recent version of macOS, type nano ~/.zshrc).
- Replace your-api-key-here with your actual API key and add this line to the file: export ANTHROPIC_API_KEY=’your-api-key-here’
- After saving the file, close the editor by pressing Ctrl+O, Enter, and Ctrl+X.
- Run source ~/.bash_profile (or source ~/.zshrc) to load the new profile.
For Windows users, perform the following steps:
- Enter setx ANTHROPIC_API_KEY “your-api-key-here” at the command prompt, substituting “your-api-key-here” with the actual API key.
You will need to make this a permanent setting. To do that:
- Use the right-click menu to choose “Properties” from “This PC” or “My Computer.”
- Click on ‘Advanced system settings’
- Click the ‘Environment Variables’ button
- Click ‘New…’ in the ‘System variables’ section, then type your API key as the variable value and ANTHROPIC_API_KEY as the variable name.
As of now, you must have successfully set up your generated API key to be used with Claude 3. The next step is to send your API request to Claude. Make a new Python file (claude_test.py, for example) and include the following code in it:
import anthropic
client = anthropic.Anthropic(
# defaults to os.environ.get("ANTHROPIC_API_KEY")
api_key="my_api_key",
)
message = client.messages.create(
model="claude-3-opus-20240229",
max_tokens=1000,
temperature=0.0,
system="Respond only in Yoda-speak.",
messages=[
{"role": "user", "content": "How are you today?"}
]
)
print(message.content)
The code snippet has been obtained from Claude 3 API’s official documentation website. It contains the Opus model version by default. To have access to the Sonnet version change “claude-3-opus-20240229” to “claude-3-sonnet-20240229” and similarly to “claude-3-haiku-20240307” to access the Haiku version.
You can save the .py file on any of your preferred locations but make sure the .py extension is added.
Just enter python claude_test.py ( or the file name you have given to the .py file) on the terminal or command prompt to begin running the code. Claude should respond to you like a proverb!
Congratulations, you have successfully sent your first API request to Claude and now you can access all the three Opus ,Sonnet and Haiku models based on your needs.
Access Claude 3 Haiku through Amazon Bedrock
You can also access the newly released Claude 3 Haiku model through Amazon Bedrock. To use the fastest Claude model, go to Amazon Bedrock Console and select Model access from the window on the bottom left. For Claude 3 Haiku, make a separate request for access.
You can start testing your prompt texts with Haiku in the console. To begin the process from the Playgrounds menu pane on the left, select Text or Chat. Next, select Claude 3 Haiku as the model and Anthropic as the category under Select model.
Congratulations! You are good to go with Claude 3 family’s fastest model, Haiku. Do give it your prompts and experience the lightning fast responses generated with very less processing times.
Future Updates from Anthropic
All the Claude 3 models have shown Increased skills in analysis and forecasting, complex content production, code generation, and speaking non-English languages including French, Spanish, and Japanese. You can check the benchmarks of Claude 3 here.
Both Claude 3 Opus and Haiku models will soon be released on Google Cloud Vertex AI in the upcoming days.
Anthropic also stated that they plan to release consistent updates to their new Claude 3 IAI models in the coming months, along with new features for enterprise use cases and large-scale deployments.
Some of these upcoming features they mentioned are Tool Use (aka function calling), and interactive coding (aka REPL). We will have to see how good they are compared to existing models.
The official announcement clearly stated the safety guidelines as well:
As we push the boundaries of AI capabilities, we’re equally committed to ensuring that our safety guardrails keep pace with these leaps in performance. Our hypothesis is that being at the frontier of AI development is the most effective way to steer its trajectory toward positive societal outcomes.
They are testing it ethically and getting feedback from users to make it better and safer.
For new users, here are 100+ Claude 3 prompts to test it thoroughly and find out how it can be used by people in different sectors like education, sales, marketing, developers, etc.
Conclusion
Claude 3 has just launched and is already making wonders with its seamless and unending benefits. Go try Sonnet, Opus and Haiku for yourselves and join the updated GenAI developer community. All three models have strong potential and all already leading the race of AI giants.