Skip to main content
Gloo AI is OpenAI-compatible, so you can use the official OpenAI SDKs for Python and Node.js without learning a new syntax. Gloo supports both the Responses API (recommended for new integrations) and Chat Completions. The key difference is authentication. Gloo uses OAuth2 client credentials rather than a static API key. Gloo also extends the API with platform-specific capabilities not found in the OpenAI specification. The compatibility matrix below covers both.
Recommended: build new integrations on the Responses API (v1). With the OpenAI SDK, point the client at the /ai/v1 base URL and call responses.create:
The Chat Completions examples below use the /ai/v2 base URL and remain fully supported. (Note: /ai/v1 routes to the Responses API — use /ai/v2 for chat.completions.)

Prerequisites: Authentication

Before using the SDK, you need to obtain an access token using your Client ID and Client Secret. Gloo AI uses OAuth2 client credentials flow—there are no long-lived API keys.
1

Get your credentials

Obtain your Client ID and Client Secret from the API Credentials page in Gloo AI Studio.
2

Exchange for access token

Use your credentials to get a temporary bearer token (expires in 1 hour).
3

Use token in SDK

Pass the access token as the api_key parameter in the OpenAI client.
Access tokens expire after 1 hour. Your application must handle token refresh. See the Authentication Tutorial for complete token management patterns.

Python

The Python library is the standard for AI engineering and data science.
1

Install the libraries

Use pip to install the OpenAI package and requests for token exchange.
2

Set up environment variables

Create a .env file with your credentials:
3

Get access token and configure the client

Exchange your credentials for an access token, then initialize the OpenAI client.
For production applications, implement token caching and automatic refresh. See the Authentication Tutorial for a complete TokenManager class.

Node.js / TypeScript

Perfect for full-stack developers and web applications.
1

Install the libraries

2

Set up environment variables

Create a .env file with your credentials:
3

Get access token and configure the client

Exchange your credentials for an access token, then initialize the OpenAI client.
For production applications, implement token caching and automatic refresh. See the Authentication Tutorial for complete token management patterns.

OpenAI Compatibility

Gloo AI’s primary completions endpoint (/ai/v2/chat/completions) is shaped like OpenAI Chat Completions, so any client that accepts a custom base_url and api_key works with minimal changes. The table below maps standard fields to Gloo AI equivalents and highlights differences unique to the platform.

Compatibility Matrix

Exactly one routing mechanism must be specified on every V2 request: auto_routing: true, model, or model_family. Unlike the OpenAI API, model is not always required—set auto_routing: true to have Gloo choose the best model automatically.

Passing Gloo-Specific Parameters

How you pass Gloo-specific fields depends on whether you’re specifying a model directly or using Gloo’s routing. Using a model directly with optional filters (e.g. tradition) When model is present, the SDK is satisfied and you only need to forward the extra Gloo fields. In Python, use extra_body. In TypeScript, the OpenAI SDK doesn’t have extra_body, so use the client’s low-level .post() method instead.
Using Gloo routing (auto_routing or model_family) Both SDKs enforce model as a required argument client-side. Since Gloo’s routing modes are designed to be used without a model field, you need to bypass the SDK validation entirely and call the API directly.
The Grounded Completions endpoint uses a different base URL (https://platform.ai.gloo.com/ai, without /v2) and requires rag_publisher and other Gloo-specific fields. Use the same direct HTTP approach above. See the Grounded Completions guide for full details.

GlooCode — AI Coding Agent

If you want a fully autonomous coding agent rather than editor autocomplete, check out GlooCode. It uses the same Gloo AI credentials and models, but runs as a standalone terminal agent that can plan, build, test, and commit code on its own — at up to 60–70% lower cost than equivalent direct-provider pricing.

Vibe Coding & Editor Setup

Because Gloo AI adheres to open standards, you can use it directly inside AI-native code editors (like Cursor, Windsurf, or VS Code) to “vibe code” with values-aligned models.

Cursor / VS Code

  1. Go to Settings > Models
  2. Add a Custom Provider
  3. Set URL: https://platform.ai.gloo.com/ai/v2
  4. Generate an access token and paste it as the API key

Agent Frameworks

Compatible with LangChain, CrewAI, and AutoGen by setting the openai_api_base parameter and providing an access token.
Access tokens expire after 1 hour. For editor integrations, you’ll need to generate a new token periodically via the API Credentials page or programmatically using the OAuth2 flow.
Connect our docs to your AI tools via MCP. Get accurate API references, model IDs, and code examples directly in your editor or AI assistant. See the MCP Integration guide to set up in one click.

Supported Models

When using the SDK, you must use the exact Model IDs supported by Gloo AI. Here are some commonly used models:
See the Supported Models page for the full list of available Model IDs and their capabilities.