Skip to content

Quickstart

Get your first GateFlow API call working in under 5 minutes.

Prerequisites

  • A GateFlow account (sign up here)
  • An API key from at least one AI provider (OpenAI, Anthropic, etc.)

Step 1: Get Your API Key

  1. Log in to the GateFlow Dashboard
  2. Navigate to Settings → API Keys
  3. Click Create Key
  4. Choose a name and select production or development scope
  5. Copy the key (it starts with gw_prod_ or gw_dev_)

Keep Your Key Safe

Your API key grants access to your GateFlow account. Never commit it to version control or expose it in client-side code.

Step 2: Configure a Provider

Before making requests, connect at least one AI provider:

  1. Go to Settings → Providers
  2. Click Add Provider
  3. Select OpenAI (or your preferred provider)
  4. Enter your provider API key
  5. Click Save

Step 3: Make Your First Request

Using Python (OpenAI SDK)

Install the OpenAI SDK if you haven't already:

bash
pip install openai

Make a request through GateFlow:

python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.gateflow.ai/v1",
    api_key="gw_prod_your_key_here"
)

response = client.chat.completions.create(
    model="gpt-5.2",
    messages=[
        {"role": "user", "content": "What is an AI gateway?"}
    ]
)

print(response.choices[0].message.content)

Using Sustain Mode

Enable carbon-optimized routing for sustainable AI:

python
# Enable Sustain Mode for carbon-optimized routing
response = client.chat.completions.create(
    model="auto",  # Auto-select most sustainable model
    routing_mode="sustain_optimized",
    minimum_quality_score=85,  # Maintain quality while optimizing for sustainability
    messages=[{"role": "user", "content": "What are the latest advances in green AI?"}]
)

print(response.choices[0].message.content)
print(f"Carbon footprint: {response.sustainability.carbon_gco2e} gCO₂e")
print(f"Carbon saved: {response.sustainability.carbon_saved_gco2e} gCO₂e")

Using TypeScript/Node.js

typescript
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://api.gateflow.ai/v1',
  apiKey: 'gw_prod_your_key_here',
});

const response = await client.chat.completions.create({
  model: 'gpt-5.2',
  messages: [
    { role: 'user', content: 'What is an AI gateway?' }
  ],
});

console.log(response.choices[0].message.content);

Using cURL

bash
curl https://api.gateflow.ai/v1/chat/completions \
  -H "Authorization: Bearer gw_prod_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.2",
    "messages": [{"role": "user", "content": "What is an AI gateway?"}]
  }'

Step 4: Verify in Dashboard

After your request completes, check the dashboard:

  1. Go to Analytics → Requests
  2. You should see your request with:
    • Model used
    • Token count
    • Latency
    • Cost

What Just Happened?

Your request flowed through GateFlow:

Your App → GateFlow → OpenAI → GateFlow → Your App

GateFlow:

  1. Authenticated your request
  2. Routed to OpenAI (based on your model choice)
  3. Logged the request for analytics
  4. Returned the response

Next Steps

Now that you've made your first request, explore:

Next Steps - Sustainability Features

Troubleshooting

"Invalid API Key" Error

Make sure your GateFlow API key:

  • Starts with gw_prod_ or gw_dev_
  • Is copied completely (no extra spaces)
  • Hasn't been revoked

"Provider Not Configured" Error

You need to add the provider in your dashboard:

  1. Go to Settings → Providers
  2. Add the provider for the model you're trying to use
  3. Enter valid provider credentials

Rate Limit Errors

GateFlow respects provider rate limits. If you hit limits:

  • Add a fallback model from another provider
  • Enable request queuing in your settings
  • Upgrade your provider tier

Need more help? Check the FAQ or contact support.

Built with reliability in mind.