OpenAI API Curl Tutorial
DEPRECATION NOTICE
These APIs are now DEPRECATED! Please refer to the new documentation available at console.groq.com
Note, you need to be using at least
curl
v7.82.0 for these to work with--json
, as well asjq
. For use with oldercurl
versions look here
curl -s -H"Authorization: Bearer ${APIKEY}" https://api.groq.com/openai/v1/chat/completions -H "Content-Type: application/json" -d '{ "model": "llama2-70b-4096", "stream": true, "messages": [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Hello!" } ] }'
Note Code-Llama is only available to select users at this time. If you are interested in testing Code-Llama, email us at api@groq.com.
curl -s -H"Authorization: Bearer ${APIKEY}" https://api.groq.com/openai/v1/completions -H "Content-Type: application/json" -d '{ "stream": true, "model": "codellama-34b", "prompt": "Say this is a test", "max_tokens": 7, "temperature": 0.9 }'
curl -s -H"Authorization: Bearer ${APIKEY}" https://api.groq.com/openai/v1/models | jq
If you are already using the Official OpenAI client SDK in your favorite language, feel free to just change the endpoint to https://api.groq.com/openai/v1
and you should be good to go.