To get started with a free API key, click here.
- Setting up your developer environment
- Installing the Cerebras Inference library
- Making your first request to the Cerebras API
Prerequisites
To complete this guide, you will need:- A Cerebras account
- A Cerebras Inference API key
- Python 3.7+ or TypeScript 4.5+
1
Set up your API key
The first thing you will need is a valid API key. Please visit this link and navigate to “API Keys” on the left nav bar.For security reasons and to avoid configuring your API key each time, it is recommended to set your API key as an environment variable. You can do this by running the following command in your terminal:
2
Install the Cerebras Inference library
The Cerebras Inference library is available for download and installation through the Python Package Index (PyPI) and the npm package manager. To install the library run either of the following commands in your terminal, based on your language of choice:
Note: You can also call the underlying API directly (see cURL request example below in Step 3).
3
Making an API request
If your request is being blocked by CloudFront, ensure that
User-Agent
is included in your headersNext Steps
- Visit our repositories for our Python and Node.js libraries
- Check out our API Reference to learn about the details of our available endpoints and request parameters.
- Learn how to stream responses.
- Learn about tool use.