> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gloo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart: Developers

> Go from sign-up to your first API call.

Get started with Gloo AI Studio. This walks you through what to expect when you create an account as well as how you can make your first API call.

### Step 1: Create Your Account & Organization

Start by creating your account at [Gloo AI Studio](https://studio.ai.gloo.com/).

Once your email is verified, the onboarding wizard will guide you through setting up your organization:

1. **Create your Organization:** Give your team a name to manage projects and collaboration.
2. **Invite your Team:** (Optional) Add email addresses to invite collaborators immediately, or skip this step.

<Note>
  As the account creator, you are the Organization Admin. You can invite team members, create Publishers, and manage your organization at any time from the Studio sidebar. See the [Admin Quickstart](/getting-started/quickstart-admins) for a full walkthrough.
</Note>

### Step 2: Set Up Billing & Spend Limits

Adding a payment method is required to activate Studio on a **Pay-As-You-Go** plan. This unlocks API access and is a prerequisite for using the Studio Playground.

* **Add a Payment Method:** Enter your credit card details to activate your account. You are only charged for what you use.
* **Set a Spend Limit:** You can define a weekly spending limit (e.g., \$50/week) to control costs. If you don't set a limit, you'll be capped at \$100/week which is also the maximum you can spend in a week for the Pay-As-You-Go plan.

<Tip>
  **Want more details?** See our comprehensive guides:

  * [Billing & Plans](/studio/billing) - Plan comparison, upgrades, and payment management
  * [API Usage](/studio/api-usage) - Monitor your consumption and costs
</Tip>

Once your payment method is added, continue below to generate API credentials. After your credentials are created, you can either call the API directly or open the **Studio Playground** to chat with models in the browser — both routes use the same credentials and count against your spend limit.

### Step 3: Create Your API Credentials

The Gloo AI APIs use OAuth2 client credentials flow for authentication. To make an API call, you:

1. Get API Credentials (Client ID and Client Secret) from Gloo AI Studio
2. Use those credentials to get a short-lived access token
3. Use the access token to authenticate your API calls
4. Repeat step (2) whenever the access token expires

Here's how to get your API credentials:

1. Navigate to **API Credentials** in the Studio Dashboard.
2. Copy the **Client ID** and **Client Secret** values if there are existing credentials, otherwise go to the next step.
3. Click **Create New Key** to generate a **Client ID** and **Client Secret**.

<Tip>
  **Prefer using an SDK?** Now that you have credentials, you can use the OpenAI Python or Node.js libraries with Gloo AI Studio. See [Libraries & SDKs](/api-guides/sdks-and-libraries) for a streamlined approach that handles token exchange for you.
</Tip>

### Step 4: Generate an Access Token

Once you have a Client ID and Client Secret, you can generate an access token using one of the following methods:

<CodeGroup>
  ```python Python theme={null}
  import base64
  import requests

  def get_access_token(client_id: str, client_secret: str) -> dict:
      auth = base64.b64encode(f"{client_id}:{client_secret}".encode()).decode()

      response = requests.post(
          "https://platform.ai.gloo.com/oauth2/token",
          headers={
              "Content-Type": "application/x-www-form-urlencoded",
              "Authorization": f"Basic {auth}"
          },
          data={
              "grant_type": "client_credentials",
              "scope": "api/access"
          }
      )

      return response.json()

  # Check token expiration
  from jwt import decode
  token_data = get_access_token(client_id, client_secret)
  decoded = decode(token_data["access_token"], verify=False)
  expiration = decoded["exp"]
  ```

  ```bash cURL theme={null}
  curl -X POST \
    https://platform.ai.gloo.com/oauth2/token \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Authorization: Basic <Base64("client_id:client_secret")>' \
    -d 'grant_type=client_credentials&scope=api/access'
  ```

  ```typescript TypeScript theme={null}
  import { Buffer } from 'buffer';

  async function getAccessToken(clientId: string, clientSecret: string): Promise<string> {
    const auth = Buffer.from(`${clientId}:${clientSecret}`).toString('base64');

    const response = await fetch(
      'https://platform.ai.gloo.com/oauth2/token',
      {
        method: 'POST',
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
          'Authorization': `Basic ${auth}`
        },
        body: new URLSearchParams({
          'grant_type': 'client_credentials',
          'scope': 'api/access'
        })
      }
    );

    const data = await response.json();

    // Check token expiration
    const decoded = JSON.parse(
      Buffer.from(data.access_token.split('.')[1], 'base64').toString()
    );
    const expiration = decoded.exp;

    return data.access_token;
  }
  ```

  ```ruby Ruby theme={null}
  require 'base64'
  require 'net/http'
  require 'json'
  require 'jwt'

  def access_token(client_id, client_secret)
    auth = Base64.strict_encode64("#{client_id}:#{client_secret}")

    uri = URI('https://platform.ai.gloo.com/oauth2/token')
    request = Net::HTTP::Post.new(uri)
    request['Content-Type'] = 'application/x-www-form-urlencoded'
    request['Authorization'] = "Basic #{auth}"
    request.set_form_data(
      'grant_type' => 'client_credentials',
      'scope' => 'api/access'
    )

    response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
      http.request(request)
    end

    data = JSON.parse(response.body)

    # Check token expiration
    decoded = JWT.decode(data['access_token'], nil, false).first
    expiration = decoded['exp']

    data['access_token']
  end
  ```

  ```go Go theme={null}
  package main

  import (
      "encoding/base64"
      "encoding/json"
      "fmt"
      "net/http"
      "net/url"
      "strings"
      "time"
  )

  func getAccessToken(clientID, clientSecret string) (string, error) {
      auth := base64.StdEncoding.EncodeToString([]byte(clientID + ":" + clientSecret))

      data := url.Values{}
      data.Set("grant_type", "client_credentials")
      data.Set("scope", "api/access")

      req, err := http.NewRequest("POST",
          "https://platform.ai.gloo.com/oauth2/token",
          strings.NewReader(data.Encode()))
      if err != nil {
          return "", err
      }

      req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
      req.Header.Set("Authorization", "Basic " + auth)

      resp, err := http.DefaultClient.Do(req)
      if err != nil {
          return "", err
      }
      defer resp.Body.Close()

      var result struct {
          AccessToken string `json:"access_token"`
      }
      if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
          return "", err
      }

      // Check token expiration from JWT payload
      parts := strings.Split(result.AccessToken, ".")
      if len(parts) != 3 {
          return "", fmt.Errorf("invalid token format")
      }

      var payload struct {
          Exp int64 `json:"exp"`
      }

      payloadBytes, _ := base64.RawURLEncoding.DecodeString(parts[1])
      json.Unmarshal(payloadBytes, &payload)

      expiration := time.Unix(payload.Exp, 0)

      return result.AccessToken, nil
  }
  ```
</CodeGroup>

The response will include an access token that you can use to authenticate your API calls. It should look like this:

```json theme={null}
{
  "access_token":"eyJraWQiOiJ...jwvh2t..cumG9g",
  "expires_in":3600,
  "token_type":"Bearer"
}
```

<Note>
  Access tokens expire after one hour. Monitor the token's expiration by checking the 'exp' claim in the JWT payload. Since refresh tokens are not provided with client credentials, you will need to request a new access token when the current one expires.
</Note>

### Step 5: Make An API Call

Using the `get_access_token` function from Step 4, make a call to the [Responses API](/api-guides/responses-v1), the recommended endpoint for OpenAI-compatible, multimodal integrations.

<CodeGroup>
  ```python Python theme={null}
  # Uses get_access_token() from Step 4
  token = get_access_token(client_id, client_secret)["access_token"]

  response = requests.post(
      "https://platform.ai.gloo.com/ai/v1/responses",
      headers={
          "Content-Type": "application/json",
          "Authorization": f"Bearer {token}"
      },
      json={
          "model": "gloo-openai-gpt-5-mini",
          "instructions": "You are a human-flourishing assistant.",
          "input": [
              {"role": "user", "content": "How do I discover my purpose?"}
          ]
      }
  )

  # Find the assistant message in the typed output array (a reasoning item
  # may precede it on reasoning-capable models).
  output = response.json()["output"]
  message = next(item for item in output if item["type"] == "message")
  print(message["content"][0]["text"])
  ```

  ```bash cURL theme={null}
  # Replace CLIENT_ACCESS_TOKEN with the token from Step 4
  curl https://platform.ai.gloo.com/ai/v1/responses \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer CLIENT_ACCESS_TOKEN" \
    -d '{
      "model": "gloo-openai-gpt-5-mini",
      "instructions": "You are a human-flourishing assistant.",
      "input": [
        {
          "role": "user",
          "content": "How do I discover my purpose?"
        }
      ]
    }'
  ```
</CodeGroup>

The response should look like this:

```json theme={null}
{
    "id": "resp_1768500882-56HaBYeuAb4pLpv8PXqh",
    "object": "response",
    "created_at": 1768500882,
    "model": "gloo-openai-gpt-5-mini",
    "output": [
        {
            "type": "message",
            "role": "assistant",
            "status": "completed",
            "content": [
                {
                    "type": "output_text",
                    "text": "What a profound and meaningful question! ..."
                }
            ]
        }
    ],
    "usage": {
        "input_tokens": 1115,
        "output_tokens": 459,
        "total_tokens": 1574
    }
}
```

<Note>
  Prefer routing, values-aligned (`tradition`) responses, or grounded/RAG completions? Use [Completions V2](/api-guides/completions-v2) — it's fully supported and backwards-compatible.
</Note>

## Next Steps

<CardGroup cols={3}>
  <Card title="Libraries & SDKs" icon="code" href="/api-guides/sdks-and-libraries">
    Use the OpenAI Python or Node.js SDK with Gloo AI to skip the manual token exchange code.
  </Card>

  <Card title="Supported Models" icon="microchip" href="/api-guides/supported-models">
    Explore all available models and their capabilities.
  </Card>

  <Card title="GlooCode" icon="terminal" href="/gloocode/overview">
    Use your credentials with GlooCode — an AI coding agent that plans, builds, and tests from your terminal.
  </Card>
</CardGroup>
