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. Authentication works the same way as OpenAI — pass your API key as the api_key parameter, and it’s sent as a bearer token on every request. Get one from the API Keys page in Gloo AI Studio. What sets Gloo apart is the platform-specific extensions to the OpenAI specification — auto_routing, model_family, tradition, grounded completions, and response routing metadata. The compatibility matrix below maps the differences. Gloo supports both the Responses API and Chat Completions; Direct Responses is recommended for new integrations.
Recommended: build new integrations on Direct Responses. With the OpenAI SDK, point the client at the /ai/v2/direct base URL and call responses.create. For Gloo’s safety and values checks, use the /ai/v2/guarded base URL instead (Responses):
The Chat Completions examples below use the /ai/v2/guarded base URL. Each base URL serves both responses.create and chat.completions.create.
Using the Anthropic SDK? Keep it for Claude models: set the base URL to https://platform.ai.gloo.com/ai/v2/direct/anthropic and pass your Gloo API key as auth_token. See Anthropic Messages.
The OpenAI SDK also supports embeddings.create. For embedding examples and the /ai/v2/direct base URL, see the Embeddings guide. Embeddings requests use a dedicated endpoint and do not use the model routing options described below.
Authentication: use your API key the same way you would with OpenAI — pass it as the api_key parameter in the SDK client. Get a key from the API Keys page in Gloo AI Studio.

Python

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

Install the libraries

Use pip to install the OpenAI package.
2

Set up environment variables

Create a .env file with your API key:
3

Configure the client

Initialize the OpenAI client with your API key.
For production applications, store your API key in a secrets manager rather than in plaintext .env files. See the Authentication Tutorial for secure key handling patterns.

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 API key:
3

Configure the client

Initialize the OpenAI client with your API key.
For production applications, store your API key in a secrets manager rather than in plaintext .env files. See the Authentication Tutorial for secure key handling patterns.

OpenAI Compatibility

Gloo AI’s primary completions endpoint (/ai/v2/guarded/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: model, model_family, or auto_routing: true. Unlike the OpenAI API, model is not always required—use model_family or opt in to auto_routing: true to let Gloo choose the model.

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 (model_family or opt-in auto_routing) Both SDKs enforce model as a required argument client-side. Since Gloo’s routing modes are 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/v2/grounded) and requires rag_publisher and other Gloo-specific fields. Use the same direct HTTP approach above. See the Grounded Completions guide for full details.

Gloo Code — AI Coding Agent

If you want a fully autonomous coding agent rather than editor autocomplete, check out Gloo Code. It 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.
Gloo Code doesn’t use the credentials on this page. You sign in to it from the browser with your Gloo AI account, and it manages its own credential — no API key or Client ID to create. See the Gloo Code installation guide.

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/guarded
  4. Paste your API key

Agent Frameworks

Compatible with LangChain, CrewAI, and AutoGen by setting the openai_api_base parameter and providing your API key.
Your API key doesn’t expire, but if you rotate it, update the key in your editor’s custom provider settings. See the API Keys page to manage keys.
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.

Next Steps

Developer Quickstart

Make your first API call.

Responses

The Responses format with Gloo’s guardrails.

Authentication

Create and use API keys.