Endpoints
Generate Agent Completion
Description
This endpoint processes messages for a specific agent, generating a response using one of your AI agents.
Endpoint
Headers
- Content-Type:
application/json
- Authorization: Bearer
<API_KEY>
(required)
Request Body
messages
: An array of message objects, each containing:role
: Either “user” or “assistant”content
: The content of the message
agentId
: The unique identifier of the agent to use for processingparseJson
: Whether to try and parse the JSON in the response into a JSON object
Responses
Success (200 OK)
Returns the generated response and usage information.
Error Responses
- 400 Bad Request: If the request is invalid
- 401 Unauthorized: If the API key is invalid or the user doesn’t have access to the specified agent
- 403 Forbidden: If the user doesn’t have enough credits
- 404 Not Found: If the specified agent is not found
Notes
- This endpoint uses 1 credit per 1000 total tokens used.
- The agent must belong to the project owned by the authenticated user.
Rate Limiting
Rate limiting is applied based on the user’s subscription.