gmAI
  • Introduction
    • ◼️Introducing gmAI
    • ⛓️gmAI Framework
    • 🏰The landscape
    • 🔑The opportunity
    • Roadmap
    • 🪙$GM Token
      • 🪙Tokenomics
      • $GM Anchor Program
        • How to join?
  • gmAI Ecosystem
    • 📱gmAI Mini App
      • 🔐2FA authentication
    • 🔲Intent Trade
    • gmINFRA
      • AI Multi-Agents
      • AI Multi-LLM
      • Importance of AI Multi-Agent and Multi-LLM System
      • ⚙️gmMODEL
        • Features
        • gmiNFRA Chatbot
        • Developer Guideline
          • API Documentation Stream API
          • Swap API
    • 👬AnotherUs
  • KEEP IN TOUCH
    • Website
    • X
    • Telegram Announcement
    • Discord
    • Brand kit
Powered by GitBook
On this page
  1. gmAI Ecosystem
  2. gmINFRA
  3. gmMODEL
  4. Developer Guideline

Swap API

To swap tokens, use the following endpoint and command:

Endpoint: https://model.gm.ai/v1/chat/completions

curl -X POST https://model.gm.ai/v1/chat/completions -H "Content-Type: application/json" -d '{

"model": "gm-01-8B",
"messages": [
    {
        "role": "user",
        "content": "Swap 10 USDT from SOL?"
    }
],
"tools": [
    {
        "type": "function",
        "function": {
            "name": "swap_token",
            "description": "Convenient for buying, selling, or swapping",
            "parameters": {
                "type": "object",
                "properties": {
                    "outputTokenAmount": {
                        "type": "number",
                        "description": "The amount of the output token to buy"
                    },
                    "inputTokenAmount": {
                        "type": "number",
                        "description": "The amount of the input token"
                    },
                    "inputTokenSymbol": {
                        "type": "string",
                        "description": "The symbol of the input token"
                    },
                    "outputTokenSymbol": {
                        "type": "string",
                        "description": "The symbol of the output token to buy"
                    }
                },
                "required": ["inputTokenSymbol", "outputTokenSymbol"],
                "additionalProperties": false,
                "$schema": "http://json-schema.org/draft-07/schema#"
            }
        }
    }
],
"stream": "False",
"temperature": 0

}'

PreviousAPI Documentation Stream APINextAnotherUs

Last updated 9 months ago

⚙️