Skip to main content
The Gloo Completions V2 API is built on a layered, production-ready AI architecture that applies guardrails, moderation, and values alignment around today’s leading models, before and after each request. Use it when you want Gloo to choose or steer the model for you: pin a model, pick a model family, or opt in to auto-routing, with an optional tradition for a theological perspective. You get curated foundational models, the best available without decision fatigue or unsafe defaults. Guardrails, moderation, and values alignment consider six dimensions of AI safety (Physical, Ethical, Emotional, Factual, Theological, and Security). Comparing endpoints? See Endpoint types for how to choose between guarded, direct, and grounded endpoints.
For new integrations, the Responses API (POST /ai/v2/guarded/responses) runs this same guarded pipeline, including tradition, on the OpenAI-compatible Responses shape. Completions V2 remains fully supported and is the home of the routing, model_family, and grounded features below; use it when you need them.

Prerequisites

You need:

Quick start

URL: https://platform.ai.gloo.com/ai/v2/guarded/chat/completions Operation: POST
For a step-by-step build in six languages, follow the Completions V2 tutorial.

Choose how the model is selected

Completions V2 builds on the standard chat completions format and adds three ways to choose the model for each request: AI Select, AI Core Select and AI Core. Send exactly one of them. We recommend AI Select, naming the model you want, for most applications; the other two let Gloo choose for you when that suits your use case.

1. Pinned model

AI Select (recommended): specify the exact model for your output:
A pinned model gives you the same model on every call, so behavior, cost, and latency are predictable. It is the best fit for benchmarking, specialized workflows, tool calling, and strict reproducibility.

2. Model family

AI Core Select: specify a model provider (model_family) and let Gloo AI choose the model from within that group:

3. Auto-routing (opt-in)

AI Core: let Gloo AI analyze your query and choose a model:
With auto-routing, the model can change between calls. Avoid it when you need reproducible output or consistent tool calls, and pin a model instead.
Supported model IDs are on the Supported Models page.

Request parameters

Send messages and exactly one routing mechanism: model, model_family, or auto_routing: true. Add tradition for a theological perspective. For every parameter and response field, see the Completions V2 API reference.

Reasoning summaries

With reasoning_effort set to a level other than none, a model that returns a summary carries it in choices[0].message.reasoning_content (or delta.reasoning_content chunks before the answer on a stream). Grounded Completions works the same way. For effort levels and which models return a summary, see Reasoning; for examples on every endpoint, see the Reasoning tutorial. New to reasoning models? Models That Think Before They Answer explains what reasoning is and when it helps.

Features

Tradition-Aware

Customize responses based on theological perspectives:
Supported: "evangelical", "catholic", "mainline", "not_faith_specific", or omit for a general Christian perspective. The tradition value is sent with your request to steer the response; it is a prompt-level setting, not a guarantee of any particular doctrinal position. "not_faith_specific" requires an explicit model and cannot be combined with auto_routing or model_family.

Streaming Support

Get real-time responses for better UX (how streaming works):
Streams can fail after the response has started; see Handling Streaming Failures for retry, continuation, and partial-output guidance.

Tool Calling

Function calling works with all routing modes. Define tools in your request and the selected model invokes them as needed:
For full tool calling documentation, including:
  • Multiple SDK examples (Python, TypeScript, AgentKit)
  • Model compatibility and streaming support
  • Multi-step tool workflows
  • Best practices and patterns
See our Tool Use Guide.

Prompt Caching

Reduce costs and latency by caching prompt prefixes across requests. The caching type depends on your model provider:
  • Explicit caching (Anthropic): Add the X-Cache-TTL header to your request to opt in. System messages are automatically cached.
  • Implicit caching (OpenAI, DeepSeek): Caching is automatic for prompts with 1,024+ tokens. For OpenAI, you can optionally add prompt_cache_key to improve cache hit rates.
For billing rates, best practices, and provider-specific behavior, see the Prompt Caching Guide.

Response Metadata

The response is a standard chat.completion object with routing metadata added:
  • All modes: model (the Gloo model ID that handled the request), provider (always "Gloo AI"), model_family, auto_routing, and routing_mechanism (auto_routing, model_family, or direct_model_selection).
  • Auto-routing and model family modes only: routing_tier and routing_confidence (0-1). They are not included with direct model selection, since no routing decision is made.
  • If set in the request: tradition.
An auto-routing response:

Best practices

Put your task in the system message, pass outside text as delimited data, force a tool call for JSON, pin a model, and handle 403, content_filter, error.retryable and ignored_params. See Building with Guarded Endpoints, including a full suggested replies example.

Migrating from Completions V1

If you use the V1 completions endpoint (/ai/v1/chat/completions), here’s how to migrate to V2. Coming from the retired Chat and Message API instead? Follow the Chat migration guide.

Endpoint Change

Request Parameter Changes

The main difference is how you specify model selection: If you’re not specifying a model in V1, V1 used a fixed default model. V2 requires an explicit choice, so pin a model (the closest match to V1 behavior):
To have Gloo choose the model per request, opt in with "auto_routing": true instead. If you’re specifying a model in V1, you can continue using the model parameter in V2: V1 Request:
V2 Request (equivalent):

New V2-Only Parameters

Response Changes

V2 responses include routing metadata that varies by routing mode; see Response Metadata. Example (auto-routing with tradition):
routing_tier and routing_confidence are only included for auto-routing and model family modes. The tradition field is only included if specified in the request.

Migration Checklist

  1. Update the endpoint URL from /ai/v1/ to /ai/v2/
  2. Add a routing mechanism to your request:
    • Pin a model with model (auto_routing: false is optional)
    • Or use model_family to let Gloo select a model from a provider
    • Or opt in to auto_routing: true to let Gloo choose per request
  3. Update model IDs to V2-supported models
  4. (Optional) Add tradition parameter for theology-aware responses
  5. Update response handling to accommodate new metadata fields

Next steps

Step-by-step tutorial

Build with Completions V2 using code in six languages.

Grounded Completions

Ground answers in your own content.

Tool Use

Let models call your functions.

API Reference

Every request and response field, with a live playground.