Configure a Service
This guide will walk you through adding your first service in AI Gateway. A service represents your backend API or AI model endpoint that you want to expose through the gateway.
Prerequisites
Before you begin, make sure you have:
- AI Gateway installed and running
- An upstream configured (see Configure an Upstream)
- Access to the Admin API
Step 1: Plan Your Service
Decide on your service configuration:
- Choose a meaningful name for your service
- Determine which upstream to use
- Plan your service type (e.g., OpenAI, Anthropic, Custom)
- Identify required plugins
Step 2: Create the Service
Create your service using the Admin API:
curl -X POST http://localhost:8080/api/v1/gateways/{gateway-id}/services \
-H "Content-Type: application/json" \
-d '{
"name": "openai-service",
"upstream_id": "{upstream-id}",
"type": "openai",
"description": "OpenAI API Service"
}'
Step 3: Verify Configuration
Check that your service is properly configured:
curl http://localhost:8080/api/v1/gateways/{gateway-id}/services/{service-id}
Next Steps
Now that you have configured your service:
- Create Rules to route traffic to your service
Troubleshooting
Common issues and solutions:
- Connection Issues
- Verify upstream is healthy
- Check timeout settings
- Review network connectivity