標準接入

    與 OpenAI API 完全相容,支援 Python、Node.js、curl 等生態工具。

    替換 Base URL ( https://api.gate.ai/openai/v1 )與 API 密鑰即可使用。

    1from openai import OpenAI2client = OpenAI(3api_key="GATEAI_API_KEY",  # get GATEAI_API_KEY from gate.ai (API Key)4base_url="https://api.gate.ai/openai/v1",5)6completion = client.chat.completions.create(7model="auto",8messages=[9{"role": "system", "content": "system prompt"},10{"role": "user", "content": "how are you?"}11],12)

    回應範例

    json
    1{2    "id": "243c850e-214c-431e-977f-ebaf4aa95f56",3    "choices": [4        {5            "index": 0,6            "message": {7                "role": "assistant",8                "content": "Hello! Nice to meet you. How can I help you?"9            },10            "finish_reason": "stop"11        }12    ],13    "created": 1773408946,14    "model": "deepseek.v3-v1:0",15    "object": "chat.completion",16    "usage": {17        "prompt_tokens": 5,18        "completion_tokens": 15,19        "total_tokens": 2020    }21}