Skip to main content

CLI for the TripAI skill endpoint.

Project description

tripai_cli

A lightweight command-line client for the TripAI (携程问道) travel assistant.

Ask Ctrip's travel AI anything from your terminal — flights, hotels, trains, attractions, trip planning — no browser, no app.

PyPI Python versions Apache-2.0 License

Overview · Features · Install · Usage · Security · License


Overview

tripai_cli is a thin wrapper around the TripAI skill endpoint powered by Ctrip (携程). It sends your natural-language query to https://wendao-skill-prod.ctrip.com/skill/query and prints the raw JSON response to stdout — ideal for shell pipelines, scripting, or wiring into other agents.

The underlying service is the same one that powers the TripAI skill in OpenClaw; this CLI lets you use it without an agent host.

Features

  • Natural Language Interface — Ask in plain English or Chinese.
  • Zero Dependencies — Pure Python standard library (urllib + json).
  • Comprehensive Travel Search — Hotels, flights, trains, attractions, trip planning, LBS-based recommendations.
  • Pipeline Friendly — Prints raw JSON to stdout; pipe into jq, downstream scripts, or other CLIs.
  • No API Key Required — Works out of the box (may be rate-limited).

Install

From PyPI:

pip install tripai_cli

From source:

git clone https://github.com/your-org/tripai_cli.git
cd tripai_cli
pip install .

Requires Python 3.8+.

Usage

tripai "帮我推荐几个三亚的景点"

The command prints the raw JSON body returned by the server. Pipe it into jq to pretty-print or extract fields:

tripai "三亚攻略" | jq .

Options

tripai [--source SOURCE] [--timeout SECONDS] QUERY...
  • --source — overrides the source field in the request body (default: xiaoyi).
  • --timeout — request timeout in seconds (default: 60).

As a module

python -m tripai_cli "你好"

As a library

from tripai_cli import cli

body = cli.query("三亚有什么好玩的")
print(body)

Usage Examples

Scenario 1: Pre-trip precise booking

Core point: Clear time, route, and transactional intent.

tripai "预订北京三里屯附近的酒店"
tripai "查一下明天北京到上海的高铁票"

Scenario 2: In-destination exploration

Core point: Immediate services and local exploration based on Location-Based Services (LBS).

tripai "下午去故宫,附近有什么高分的老字号餐厅?"
tripai "上海武康路附近哪里适合逛街?"

Scenario 3: Audience-specific and thematic travel

Core point: Vague time or location intent with strong attribute tags (e.g., family, business, budget).

tripai "想带孩子去三亚,推荐几个带水上乐园的亲子度假村"
tripai "五一去哈尔滨,有便宜的机票吗?"

Equivalent raw HTTP

tripai_cli is equivalent to the following shell command, but without requiring jq or curl:

jq -n --arg query "$USER_QUERY" '{query: $query, source: "xiaoyi"}' \
  | curl -s -X POST https://wendao-skill-prod.ctrip.com/skill/query \
      -H "Content-Type: application/json" -d @-

Security & Privacy

  • No credentials required — This CLI does not send an API token. If you need authenticated / higher-rate access, use the official TripAI skill and set TRIPAI_API_KEY.
  • Third-Party Content — All responses are generated by Ctrip's service. Do not assume the content is always accurate or safe; use discretion.
  • Endpoint — Hardcoded to the official production endpoint: https://wendao-skill-prod.ctrip.com.
  • Rate Limits — Anonymous requests may be rate-limited.

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tripai_cli-0.1.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tripai_cli-0.1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file tripai_cli-0.1.0.tar.gz.

File metadata

  • Download URL: tripai_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for tripai_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b24775c42fd890897ffc9a1497980012c70e1254830a482af421b043ae1cd2f4
MD5 4589d967e4ca8efc4bc58d1331941c52
BLAKE2b-256 fc5e94480a7b87e6e3e2916a8517d05ed5c44652d313e4fb335c42c2c4365246

See more details on using hashes here.

File details

Details for the file tripai_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tripai_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for tripai_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09c9c056ca53c75d0d8de6f2c51516823a971329b4b517ea3d3a0586d0580497
MD5 e04dcd0e10bbaa0df68d8efa818afbb0
BLAKE2b-256 25c9496b15257272f44f8031e4ff8d0f152c3bc6e2746e9622bc43d3178b8be7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page