Skip to main content
This API is deprecated. Follow the Completions V2 API tutorial instead.
This guide walks you through authenticating with the Gloo AI API and making a basic call to the Chat Completions endpoint. Want the concepts first? Read the Concepts guide. There are two steps:
  1. Get an API Key: Create an API key in Gloo AI Studio.
  2. Make an API Call: Use the API key to make an authenticated request to the /chat/completions endpoint.

Prerequisites

You need:
The Completions API requires an API key for authentication.

Make a Chat Completion Call

With a valid API key from the Authentication Tutorial, you can call the Completions API:

Complete Examples

These examples combine the API key and the API call into one runnable script per language. First set your environment variables in an .env file:
Or export them in your shell for Go and Java:

Working Code Sample

View Complete Code

Clone or browse the complete working examples for all 6 languages (JavaScript, TypeScript, Python, PHP, Go, Java) with setup instructions.

Next Steps

Explore next:
  1. Authentication Tutorial - For detailed authentication setup
  2. Completions API - For additional API information
  3. Chat Tutorial - For stateful chat interactions
  4. Tool Use - For enhanced completion capabilities