Skip to content
NEWMarketplace and the trig8n Agent: sell what you build, and get plans and changes that are tested before you see them. See what is new

Library / Building Blocks & Utilities

Building Blocks & Utilities

Structure OAuth Guidance with OpenRouter LLM

When called by another workflow, it sends input to an OpenRouter language model and returns conformed, structured JSON output.

What it does

## Purpose This template is designed to assist users in obtaining OAuth2 settings using AI-powered insights. It is ideal for developers, IT professionals, or anyone working with APIs that require OAuth2 authentication. By leveraging the AI agent, users can simplify the process of extracting and validating key details such as the authorization_url, token_url, and audience. ## Value Obtaining OAuth2 details via AI saves time and reduces the risk of human error. The confidence scoring system provides an indication of the trustworthiness of the results, empowering users to make informed decisions. ## Setup Instructions ### 1. Configuration Nodes - Structured Output Node: Parses the AI model's output using a predefined JSON schema. This ensures the data is structured for downstream processing. - Code Node: If the AI model’s output does not match the required format, use the Code node to re-arrange and transform the data. Example code snippets are provided below for common scenarios. ### 2. AI Model Prompt The prompt for the AI model includes: - A detailed structure and objectives of the query. - Flexibility for the model to improvise when accurate results cannot be determined. ### 3. Confidence Scoring The AI model assigns a confidence score (0 < x ≤ 1) to indicate the reliability of the extracted data. Scores are provided in increments of 0.01 for granularity. ## Configuration Example This is an example of the Code node can be configured to reformat the data: const items =$input.all(); const originalText = items[0].json.output.text; const lines = originalText.split('\n'); const service_name = lines[0].split(': ')[1]; const audience = lines[1].split(': ')[1]; const authorization_uri = lines[2].split(': ')[1]; const token_uri = lines[3].split(': ')[1]; const details = lines[4].split(': ')[1]; const confidence = parseFloat(lines[5].split(': ')[1]); return [ { json: { output: { service_name, audience, authorization_uri, token_uri, details, confidence } } } ];

The steps

  1. When Executed by Another Workflow
  2. LLM Bus
  3. Structured Output Parser
  4. OpenRouter Chat Model
  5. Conform JSON

Similar automations