ื›ื™ืฆื“ ืœื”ืฉืชืžืฉ ื‘-GPTBiz API

๐ŸŽ‰ ืื ื• ืฉืžื—ื™ื ืœื”ื•ื“ื™ืข ืฉ-GPTBiz API ื™ืขืœื” ื‘ืงืจื•ื‘! ื–ื”ื• ืžืžืฉืง ื™ืฆื™ืจืช ื˜ืงืกื˜ ืžืชืงื“ื ื”ืžืฉื•ืœื‘ ื‘ืคื•ื ืงืฆื™ื•ืช ืžื•ืœื˜ื™-ืžื•ื“ืืœื™ื•ืช. ื‘ื ื•ืกืฃ ืœื™ืฆื™ืจืช ื˜ืงืกื˜ ืžืกื•ืจืชื™ืช, ื”-API ืชื•ืžืš ื’ื ื‘ื—ื™ืคื•ืฉ, ืฆื™ื•ืจ ื•ืขื•ื“ ืคื•ื ืงืฆื™ื•ืช ืจื‘ื•ืช, ื›ื“ื™ ืœืกืคืง ืคืชืจื•ื ื•ืช ื—ื›ืžื™ื ืžืงื™ืคื™ื ืœื™ื™ืฉื•ืžื™ื ืฉืœื›ื. ืžืืžืจ ื–ื” ื™ืกื‘ื™ืจ ื‘ืคืจื˜ื™ื ื›ื™ืฆื“ ืœื ืฆืœ ืืช ื”-API ื”ื–ื” ื‘ื™ืขื™ืœื•ืช ืœื™ืฆื™ืจืช ื˜ืงืกื˜ ืื•ื˜ื•ืžื˜ื™ืช ื‘ื™ื™ืฉื•ืžื›ื, ื•ื‘ื›ืš ืœืฉืคืจ ืืช ื—ื•ื•ื™ืช ื”ืžืฉืชืžืฉ ื•ื™ืขื™ืœื•ืช ื”ืขืกืง.

1. ืงื‘ืœืช ืžืคืชื— API

ื›ืจื’ืข, ื”ื’ื™ืฉื” ืœ-GPTBiz API ืคืชื•ื—ื” ืจืง ืœืžืฉืชืžืฉื™ื ืžืกื•ื™ืžื™ื. ื›ื“ื™ ืœืงื‘ืœ ืžืคืชื— API, ืื ื ืฆืจื• ืงืฉืจ ืขื ืฆื•ื•ืช ื”ืชืžื™ื›ื” ืฉืœื ื•.

2. ืงืจื™ืื•ืช API

ื”ืฉืชืžืฉื• ื‘ืงื•ื“ ื”ื“ื•ื’ืžื” ื”ื‘ื ืœืงืจื™ืืช GPTBiz API ื•ืœื™ืฆื™ืจืช ืชื•ื›ืŸ. ื“ื•ื’ืžื” ื–ื• ืžืฉืชืžืฉืช ื‘ืกืคืจื™ื™ืช requests ืฉืœ ืคื™ื™ืชื•ืŸ, ื•ืœื›ืŸ ืขืœื™ื›ื ืœื•ื•ื“ื ืฉื”ืกืคืจื™ื™ื” ืžื•ืชืงื ืช ื‘ืกื‘ื™ื‘ื” ืฉืœื›ื.

import requests

def generate_text(prompt):
    url = "https://api.gpt.biz/v1/chat/completions"
    payload = {
      "model": "gpt-4",
      "messages": [
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": prompt},
      ]
    }
    headers = {
        "Authorization": "Bearer YOUR_API_KEY_HERE",
        "Content-Type": "application/json"
    }

    response = requests.post(url, json=payload, headers=headers)
    return response.json()

# ื“ื•ื’ืžืช ืงืจื™ืื” ืœืคื•ื ืงืฆื™ื”
result = generate_text("Hello, world!")
print(result["choices"][0]["message"]["content"])

ื”ืขืจื•ืช

  • ื•ื“ืื• ืฉืืชื ืžื—ืœื™ืคื™ื ืืช “YOUR_API_KEY_HERE” ื‘ืžืคืชื— ื”-API ื”ืืžื™ืชื™ ืฉืœื›ื.
  • ื ื›ื•ืŸ ืœืขื›ืฉื™ื•, ื”ืกื•ื’ื™ื ื”ื ืชืžื›ื™ื ืฉืœ ื”ืžื•ื“ืœื™ื ื”ื “text-davinci-002-render-sha” ื•-“gpt-4”. ืœื”ืœืŸ ื”ืฉื•ื•ืื” ื‘ื™ืŸ ืฉื ื™ ื”ืžื•ื“ืœื™ื:
ืกื•ื’ ื”ืžื•ื“ืœ ืžื”ื™ืจื•ืช ืชืืจื™ืš ืกื™ื•ื ืื™ืžื•ืŸ ืžืืคื™ื™ื ื™ื
text-davinci-002-render-sha ืžื”ื™ืจื•ืช ื’ื‘ื•ื”ื” ื™ื ื•ืืจ 2022 ืžืกื•ื’ืœ ืœื™ืฆื•ืจ ื˜ืงืกื˜ ื‘ืœื‘ื“
gpt-4 ืžื”ื™ืจื•ืช ื‘ื™ื ื•ื ื™ืช ื“ืฆืžื‘ืจ 2023 ืชื•ืžืš ื‘ืฆื™ื•ืจ, ื—ื™ืคื•ืฉ ืžืงื•ื•ืŸ ื•ืขื•ื“

ื‘ื—ืจื• ืืช ื”ืžื•ื“ืœ ื”ืžืชืื™ื ืœืฆืจื›ื™ื ืฉืœื›ื.


GTBiz API ืžืกืคืง ื“ืจืš ื ื•ื—ื” ืœืฉื™ืœื•ื‘ ืžื•ื“ืœื™ื ืžืชืงื“ืžื™ื ืฉืœ ืฉืคื” ื‘ื™ื™ืฉื•ืžื›ื. ื‘ืืžืฆืขื•ืช ืงืจื™ืืช REST API ืคืฉื•ื˜ื”, ืชื•ื›ืœื• ืœื”ื•ืกื™ืฃ ื‘ืงืœื•ืช ืคื•ื ืงืฆื™ื•ืช ืœื™ืฆื™ืจืช ื˜ืงืกื˜ ืื•ื˜ื•ืžื˜ื™ืช ื‘ืคืจื•ื™ืงื˜ ืฉืœื›ื. ืื ื• ืžืงื•ื•ื™ื ืฉื”ืžื™ื“ืข ื™ืขื–ื•ืจ ืœื›ื ืœืฉืœื‘ ืืช GPTBiz API ื‘ื”ืฆืœื—ื” ื‘ืคืจื•ื™ืงื˜ ืฉืœื›ื.

ืžืงื•ืจ ื”ืžืืžืจ: ืื™ืš ืœื”ืฉืชืžืฉ ื‘-GPTBiz API

ื”ื‘ื
ื”ืงื•ื“ื