Introduction¶
dsh-flight-compare is a DeepSeek Harness (DSH) plugin used to register the flight_compare tool. This tool fetches airline ticket prices for a single route from multiple data sources, aggregates them by “flight number + departure date,” identifies the lowest price and its source for each flight across data sources, and finally outputs a Markdown table sorted by lowest price in ascending order.
The plugin is maintained by user 123wansui-989 and belongs to the network tool category.
Core Capabilities¶
The plugin implements the following functions:
- Tool Registration: Registers the
flight_comparetool for invocation by DSH. - Multi-source Retrieval: Supports Travelpayouts and Amadeus as data sources.
- Travelpayouts: The endpoint is
GET /v2/prices/month-matrix. It supports full-month queries and queries by city IATA code. - Amadeus: The endpoint is
GET /v2/shopping/flight-offers. It uses the official Self-Service API for real-time offers, queries by airport IATA code, and supports only single-day queries.
- Travelpayouts: The endpoint is
- Data Aggregation and Comparison: Returns unified
Flightobjects, including flight number, airline, times, price, currency, source, and other information. A query failure from one data source does not cause the overall call to fail; failure reasons are listed in the result. - Result Output: Outputs a Markdown table containing the lowest price, source, and sorting information.
Installation and Build¶
The plugin is built on Node.js and requires installation and compilation steps.
cd dsh-flight-compare
pnpm install
pnpm build
The build artifacts are located in the lib/ directory and include the entry file index.js and type definitions index.d.ts.
Configuration¶
Plugin credentials are read only from environment variables and are not written in code. Configuration overrides must be done through the cordis.patch.yml file.
Environment Variables¶
The Travelpayouts Token must be set. The Amadeus Client ID and Secret are optional. If both are left empty, that source will be skipped automatically, and the plugin will degrade to single-source price comparison.
export TRAVELPAYOUTS_TOKEN="<your-travelpayouts-token>"
# 可选:启用 Amadeus
export AMADEUS_CLIENT_ID="<your-amadeus-api-key>"
export AMADEUS_CLIENT_SECRET="<your-amadeus-api-secret>"
export AMADEUS_PRODUCTION="false" # false 使用 test.api.amadeus.com,true 使用 api.amadeus.com
Configuration Options¶
The plugin package version is 0.2.0, and core dependencies include @deepseek-ai/cosmokit and @deepseek-ai/dsh-tools. The main configuration options are as follows:
| Option | Default/Source | Description |
|---|---|---|
travelpayoutsToken |
process.env.TRAVELPAYOUTS_TOKEN |
Travelpayouts token, required and sent as X-Access-Token. |
amadeusClientId |
process.env.AMADEUS_CLIENT_ID |
Amadeus API key. |
amadeusClientSecret |
process.env.AMADEUS_CLIENT_SECRET |
Amadeus API secret, used for OAuth2 authentication. |
amadeusProduction |
false |
Controls whether to use the production API. |
amadeusMaxResults |
20 |
Maximum number of offers requested from Amadeus per search. |
currency |
RUB |
Price currency, for example RUB or USD. |
maxRows |
30 |
Maximum number of rows in the output table. |
timeoutMs |
20000 |
Timeout in milliseconds for a single request to each data source. |
Configuration Override Example¶
Use cordis.patch.yml to override the default configuration:
- insert:
- id: dsh-flight-compare
name: dsh-flight-compare
config:
travelpayoutsToken: !!js process.env.TRAVELPAYOUTS_TOKEN
amadeusClientId: !!js process.env.AMADEUS_CLIENT_ID
amadeusClientSecret: !!js process.env.AMADEUS_CLIENT_SECRET
amadeusProduction: !!js process.env.AMADEUS_PRODUCTION === 'true'
currency: USD
maxRows: 30
Usage¶
After setting the environment variables and configuration file, load the plugin using DSH’s --patch parameter.
# 设置环境变量
export TRAVELPAYOUTS_TOKEN="<your-travelpayouts-token>"
export AMADEUS_CLIENT_ID="<your-amadeus-api-key>"
export AMADEUS_CLIENT_SECRET="<your-amadeus-api-secret>"
# 启动 DSH 并加载插件补丁
dsh --profile web --patch ./cordis.patch.yml
After startup, the flight_compare tool can be invoked. When the departDate parameter is passed as YYYY-MM-DD, both sources are queried; when it is passed as YYYY-MM or omitted, only Travelpayouts participates in the comparison.
Notes¶
- Permission Scope: The plugin runs with the permissions of the current DSH process. When calling APIs, ensure that the environment variables contain valid authorization credentials.
- Data Source Limitations: Travelpayouts supports full-month queries, while the Amadeus search interface accepts only a single day. If both the Amadeus Client ID and Secret are empty, that source will be skipped automatically.
- Source Code Review: Before use, check the plugin source code and its license status (currently undefined).
- Debugging: You can use the
--dump-configparameter to verify the combined configuration result before starting.