Skip to main content
Use the OpenAI-compatible Chat Completions API to connect to GLM-5.2. You can use the OpenAI Python or JavaScript SDK, or send requests directly with cURL. If you need a new API key, create one.

Send a Request

1

Set Up Your API Key

In your terminal, run the following command:
Replace <FRIENDLIAI_API_KEY> with your API key.
2

Install the OpenAI SDK

In your terminal, run the following command:
3

Send Your Request to FriendliAI

Run the following code:
FriendliAI returns a response, similar to the following:
Last modified on July 19, 2026