承接 tokenmixai/tokenmix-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tokenmixai/tokenmix-php

Composer 安装命令:

composer require tokenmixai/tokenmix-php

包简介

PHP client for TokenMix — one API key for GPT-5, Claude, Gemini, DeepSeek and 155+ LLMs

README 文档

README

Your own AI chatbot on Telegram. One file, one command, 155+ models.

Supports any OpenAI-compatible API. Streams responses in real time. Send photos and the bot can see them (vision). Switch models mid-conversation.

Setup

Two things you need:

  1. Telegram bot token — message @BotFather, type /newbot, follow the steps
  2. LLM API key — from TokenMix.ai ($1 free credit, 155+ models) or any OpenAI-compatible provider

Deploy with Docker (recommended)

git clone https://github.com/diaoyulao9657/tg-ai-bot
cd tg-ai-bot
cp .env.example .env
# edit .env — fill in BOT_TOKEN and API_KEY
docker compose up -d

Done. Open your bot on Telegram and say hi.

Run without Docker

git clone https://github.com/diaoyulao9657/tg-ai-bot
cd tg-ai-bot
pip install -r requirements.txt
cp .env.example .env
# edit .env
python bot.py

Features

  • Streaming — responses appear word-by-word, not after a long wait
  • Vision — send a photo with a question, the bot understands it
  • Voice messages — send a voice note, it gets transcribed and answered
  • Markdown — code blocks, bold, and other formatting render properly
  • Group chat — in groups, responds only when @mentioned or replied to
  • Model switching/model gpt-4o to try a different model anytime
  • Conversation memory — keeps context across messages (configurable depth)
  • Long replies — responses over 4096 chars are split across multiple messages
  • Access control — optionally restrict to specific Telegram user IDs

Commands

/model <name>  — switch to a different model
/clear         — wipe conversation history
/help          — show commands

Configuration

Everything is in .env:

Variable Required Default
BOT_TOKEN yes From @BotFather
API_KEY yes LLM API key
BASE_URL no https://api.tokenmix.ai/v1 API endpoint
MODEL no gpt-4o-mini Default model
MAX_HISTORY no 20 Messages kept in context
ALLOWED_USERS no (everyone) Comma-separated user IDs
SYSTEM_PROMPT no You are a helpful assistant. System prompt

Find your Telegram user ID by messaging @userinfobot.

How it works

It's one Python file. The bot receives messages via Telegram's API, forwards them to an LLM through the OpenAI-compatible chat completions endpoint, and streams the response back by editing the message as tokens arrive. Photos are base64-encoded and sent as vision inputs.

Conversation history is stored in memory (resets when the bot restarts). For most use cases this is fine — if you need persistence, a database would be straightforward to add.

License

MIT

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: Python

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固