OpenRouter Destination
OpenRouter
Create an OpenRouter Destination
-
Click the + icon on the Nexset that will be sent to the OpenRouter destination, and select the Send to Destination option from the menu.
-
Select the OpenRouter connector from the list of available destination connectors. Then, select the credential that will be used to connect to the OpenRouter organization, and click Next; or, create a new OpenRouter credential for use in this flow.
-
In Nexla, OpenRouter destinations can be created using pre-built endpoint templates, which expedite destination setup for common OpenRouter API endpoints. Each template is designed specifically for the corresponding OpenRouter API endpoint, making destination configuration easy and efficient.
• To configure this destination using a template, follow the instructions in Configure Using a Template.OpenRouter destinations can also be configured manually, allowing you to send data to OpenRouter API endpoints not included in the pre-built templates or apply further customizations to exactly suit your needs.
• To configure this destination manually, follow the instructions in Configure Manually.
Configure Using a Template
Nexla provides pre-built templates that can be used to rapidly configure destinations to send data to common OpenRouter API endpoints. Each template is designed specifically for the corresponding OpenRouter API endpoint, making destination setup easy and efficient.
-
To configure this destination using a template, select the endpoint to which data will be sent from the Endpoint pulldown menu. Then, click on the template in the list below to expand it, and follow the instructions to configure additional endpoint settings.
Configure Manually
OpenRouter destinations can be manually configured to send data to any valid OpenRouter API endpoint. Manual configuration provides maximum flexibility for accessing endpoints not covered by pre-built templates or when you need custom API configurations.
With manual configuration, you can also create more complex OpenRouter destinations, such as destinations that send data to multiple endpoints or destinations that require custom request parameters.
API Method
-
To manually configure this destination, select the Advanced tab at the top of the configuration screen.
-
Select the API method that will be used for calls to the OpenRouter API from the Method pulldown menu. The most common methods are:
- POST: For generating embeddings and other AI model interactions (most common for OpenRouter destinations)
Data Format
- Select the format in which the Nexset data will be sent to the OpenRouter API from the Content Format pulldown menu. Nexla will automatically convert the data to the selected format for each API call.
API Endpoint URL
- Enter the URL of the OpenRouter API endpoint to which you want to send the Nexset data in the URL field. This should be the complete URL including the protocol (https://) and any required path parameters. OpenRouter API endpoints typically follow the pattern
https://openrouter.ai/api/v1/{endpoint_name}, where{endpoint_name}is the specific API endpoint (e.g.,embeddings).
Request Headers
-
If Nexla should include any additional request headers in API calls to this destination, enter the headers & corresponding values as comma-separated pairs in the Request Headers field (e.g.,
header1:value1,header2:value2). Additional headers are often required for API versioning, content type specifications, or custom authentication requirements.You do not need to include any headers already present in the credentials. Common headers like Authorization, Content-Type, and Accept are typically handled automatically by Nexla based on your credential configuration. For OpenRouter, the API key is automatically included in the request headers from your credential, and Content-Type is typically set to
application/json.
Request Body Template
-
If the API endpoint requires a specific request body format, you can customize how Nexla formats the data before sending it to the OpenRouter API by entering a request body template in the Request Body Template field. The template should use
{message.json}to include the entire record as JSON, or you can specify individual fields using dot notation (e.g.,{message.field_name}).For most OpenRouter API endpoints, the default request body template
{message.json}will work correctly, sending the entire record as JSON. You may need to customize the template if the API requires a specific structure or if you need to transform the data before sending.
Save & Activate the Destination
- Once all of the relevant steps in the above sections have been completed, click the Create button in the upper right corner of the screen to save and create the new OpenRouter destination. Nexla will now begin sending data to the configured endpoint according to your data flow schedule.