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

}'

Last updated