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.Get your credentials
Obtain your Client ID and Client Secret from the API Credentials page in Gloo AI Studio.
Python
The Python library is the standard for AI engineering and data science.Node.js / TypeScript
Perfect for full-stack developers and web applications.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
| Capability | OpenAI | Gloo AI |
|---|---|---|
| Authentication | Static API key | OAuth2 bearer token (1-hr TTL) — pass as api_key |
| Base URL | https://api.openai.com/v1 | https://platform.ai.gloo.com/ai/v2 |
messages | Required | Required — same format |
model | Required | Required by the SDK client; omit only when using auto_routing or model_family via direct HTTP |
stream | Supported | Supported |
temperature | Supported | Supported |
max_tokens | Supported | Supported |
tools / tool_choice | Supported | Supported |
auto_routing | Not supported | Gloo-specific — let Gloo pick the best model automatically |
model_family | Not supported | Gloo-specific — pick by provider (openai, anthropic, google, open source) |
tradition | Not supported | Gloo-specific — theological perspective filter (evangelical, catholic, mainline) |
| Response routing metadata | Not included | Gloo-specific — provider, model_family, routing_mechanism, routing_tier, routing_confidence added to every response |
| Grounded (RAG) completions | Not supported | Gloo-specific — separate path /v2/chat/completions/grounded; base_url and model differ |
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.
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.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
- Go to Settings > Models
- Add a Custom Provider
- Set URL:
https://platform.ai.gloo.com/ai/v2 - 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.Supported Models
When using the SDK, you must use the exact Model IDs supported by Gloo AI. Here are some commonly used models:| Provider | Model ID |
|---|---|
| Anthropic | gloo-anthropic-claude-sonnet-4.5 |
| Anthropic | gloo-anthropic-claude-haiku-4.5 |
| OpenAI | gloo-openai-gpt-5-mini |
gloo-google-gemini-2.5-flash | |
| Open Source | gloo-meta-llama-3.1-8b-instruct |

