Skip to main content

Connecting Your First AI Endpoint

Connect your AI service, workflow, or custom endpoint to AgentFlow. AgentFlow works with ANY AI endpoint that can receive webhooks and return responses—including OpenAI, Anthropic, custom AI services, N8N workflows, Make.com automations, and more.

Prerequisites

Before you start, you’ll need:
  • ✅ AgentFlow organization created
  • ✅ An AI endpoint URL (OpenAI API, custom webhook, etc.)
  • ✅ Authentication credentials (API key, bearer token, etc.)
  • ✅ Admin access to your organization

Step 1: Access the Admin Panel

After creating your organization, navigate to the admin panel:
  1. Click your organization name in the top navigation
  2. Select “Admin Panel” from the dropdown
  3. You’ll see tabs for Analytics, Models, Groups, and Users

Step 2: Start Connection Configuration

1

Go to Models Tab

Click the “Models” tab in the admin panel (this configures your AI connections)
2

Click Add Model

Click the ”+” (plus) button to start adding a new connection
The “Models” tab is where you configure all AI connections—whether they’re AI model APIs, workflows, or custom endpoints.

Step 3: Basic Information

Fill in the essential details for your AI connection:

Required Fields

Name *
Example: "GPT-4 Assistant"
A descriptive name shown in the model selection interface
Endpoint *
Example: "https://api.openai.com/v1/chat/completions"
The complete URL where POST requests will be sent
Must include protocol (https://)

Optional Fields

Model ID
Example: "gpt-4-assistant"
Auto-generated from name if left empty
Used for API calls and internal references
Schema
Example: "v1.0"
Optional version identifier for tracking API versions
Description
Example: "GPT-4 model for complex reasoning and analysis"
Brief explanation of what this model does

Request Headers

Add authentication headers required by your endpoint:

OpenAI Example

Key: Authorization Value: Bearer sk-...your-api-key...

Custom API Example

Key: X-API-Key Value: your-custom-token
Headers containing sensitive data (authorization, api-key, secret) are automatically masked for security.
To add headers:
  1. Click “Add Header”
  2. Enter the header key (e.g., “Authorization”)
  3. Enter the header value (will be masked if sensitive)
  4. Repeat for additional headers
  5. Click ”×” to remove unwanted headers

Suggestion Prompts

Add up to 3 suggested prompts to help users understand what your model can do: Examples:
1. "Analyze the sentiment of this customer review"
2. "Summarize this document in 3 bullet points"
3. "Generate creative product name ideas"
These appear in the chat interface to guide users.

Step 4: Field Mapping

Important: AgentFlow works with ANY endpoint that can respond to webhooks—not just pre-configured AI models.

What You Can Connect

AI APIs

  • OpenAI (GPT-4, GPT-3.5)
  • Anthropic (Claude)
  • Google (Gemini)
  • Custom AI services

Automation Tools

  • N8N workflows
  • Make.com scenarios
  • Zapier webhooks
  • Custom integrations

Agent Builders

  • ChatGPT Agent Builder
  • Custom agent endpoints
  • LangChain applications
  • AutoGPT instances

Any Webhook

  • HTTP endpoints
  • Serverless functions
  • Microservices
  • Custom APIs
Map your request and response fields to match your endpoint’s expected format. This step varies by endpoint type—refer to your endpoint’s documentation.

Step 5: Request Template

Configure how messages are sent to your endpoint.

Input Configuration

Define the request body structure: For OpenAI-style APIs:
{
  "messages": [
    {"role": "user", "content": "{{user_message}}"}
  ],
  "model": "gpt-4"
}
For custom endpoints:
{
  "input": "{{user_message}}",
  "parameters": {
    "temperature": 0.7,
    "max_tokens": 2000
  }
}

AJV Schema Validation

Add JSON Schema validation for your request/response format.
What is AJV? AJV (Another JSON Validator) ensures your requests and responses match the expected format, catching errors before they cause issues.Learn more: AJV Documentation
Example AJV Schema:
{
  "type": "object",
  "properties": {
    "messages": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "role": {"type": "string"},
          "content": {"type": "string"}
        },
        "required": ["role", "content"]
      }
    },
    "model": {"type": "string"}
  },
  "required": ["messages", "model"]
}

Test Variables

Provide sample data to test your configuration: Sample Payload:
{
  "messages": [
    {"role": "user", "content": "Hello, how are you?"}
  ],
  "model": "gpt-4"
}
Validate: Click “Validate” to ensure your configuration is correct.

Step 6: Test Endpoint

Critical: AgentFlow requires your endpoint to work before saving the configuration.
1

Run Test

Click “Run Test” to send a request to your endpoint
2

Check Response

You should see a 200 (Success) response
3

Fix if Needed

If you get any other status code, review and fix your configuration
4

Retry

Keep testing until you get a successful response
AgentFlow will NOT allow you to save a connection that doesn’t work. This ensures users can always rely on functional AI endpoints.
Response Status Codes:
CodeMeaningAction
200✅ SuccessProceed to next step
401❌ UnauthorizedCheck your API key/auth headers
404❌ Not FoundVerify endpoint URL is correct
500❌ Server ErrorCheck endpoint is online and working

Step 7: Define Output

Parse the response from your endpoint to extract the agent’s message.

Nested JSON Route

Specify the path to the message content in the response: OpenAI Response Example:
{
  "choices": [
    {
      "message": {
        "content": "Hello! I'm doing great, thanks for asking!"
      }
    }
  ]
}
JSON Path:
choices[0].message.content
Custom Endpoint Example:
{
  "output": {
    "response": "Your message here"
  }
}
JSON Path:
output.response
The JSON path tells AgentFlow where to find the agent’s response text in your endpoint’s response.

Step 8: Create Group & Assign Access

Before you can use your AI connection, you must create a group and assign permissions:
1

Go to Groups Tab

Click the “Groups” tab in the admin panel
2

Create New Group

Click “Create Group” button
  • Name: e.g., “GPT-4 Users”
  • Description: Who should have access
3

Add Connection to Group

  • Find your newly created AI connection
  • Check the box to add it to this group
4

Add Yourself to Group

  • Find your user in the members list
  • Add yourself to the group
Why groups? Groups control access to AI connections. Only users in a group can see and use the connections assigned to that group.

Step 9: Start Conversing

Now you’re ready to use your AI connection!
  1. Go to the Chat page
  2. Click “New Conversation”
  3. Select your AI connection from the dropdown
  4. Start chatting!

Next: Start Your First Conversation

Learn how to use your newly connected AI endpoint

Configuration Examples

OpenAI GPT-4

Name: GPT-4 Assistant
Endpoint: https://api.openai.com/v1/chat/completions
Headers:
  - Authorization: Bearer sk-...
  - Content-Type: application/json

Request Template:
  {
    "model": "gpt-4",
    "messages": [{"role": "user", "content": "{{message}}"}]
  }

Output Path: choices[0].message.content

Anthropic Claude

Name: Claude Sonnet
Endpoint: https://api.anthropic.com/v1/messages
Headers:
  - x-api-key: sk-ant-...
  - anthropic-version: 2023-06-01
  - Content-Type: application/json

Request Template:
  {
    "model": "claude-3-sonnet-20240229",
    "messages": [{"role": "user", "content": "{{message}}"}],
    "max_tokens": 4096
  }

Output Path: content[0].text

Custom N8N Workflow

Name: Custom Support Agent
Endpoint: https://n8n.yourcompany.com/webhook/support-agent
Headers:
  - X-API-Key: your-webhook-secret

Request Template:
  {
    "input": "{{message}}",
    "context": "customer_support"
  }

Output Path: response

Troubleshooting

Problem: Authentication failedSolutions:
  • Verify API key is correct
  • Check header key name (e.g., “Authorization” vs “X-API-Key”)
  • Ensure “Bearer ” prefix for OpenAI
  • Check if API key has expired
Problem: Endpoint URL is incorrectSolutions:
  • Double-check the endpoint URL
  • Ensure it includes https://
  • Verify the path is correct (/v1/chat/completions)
  • Test the URL in Postman or curl first
Problem: Endpoint or service is having issuesSolutions:
  • Check if the service is online
  • Verify your request format matches their API
  • Test with their official documentation examples
  • Contact the service provider’s support
Problem: Missing group assignmentSolutions:
  • Go to Groups tab
  • Create a group if you haven’t
  • Add the AI connection to the group
  • Add yourself as a member of that group
Problem: Wrong output pathSolutions:
  • Check the actual response structure from test
  • Use browser console to inspect response
  • Verify JSON path syntax (e.g., choices[0].message.content)
  • Test the path with a JSON path validator

What’s Next?


Need Help?

Contact support@agentflow.live for assistance with connecting AI endpoints
I