OhMyGPT API Docs
  1. Deprecated
OhMyGPT API Docs
  • About This site
  • About new website
  • Midjourney Open API
    • About Midjourney Service
    • Midjourney Blend Image Generation Task Creation
      POST
    • Midjourney Text-to-Image Task Creation
      POST
    • Midjourney Execute Action Task Creation
      POST
    • Midjourney Query Specific Task ID Execution Status
      POST
    • Midjourney Paginated Bulk Query Tasks
      POST
    • Midjourney Describe Prompt Extraction Task Creation
      POST
    • Retrieve Images Generated by Midjourney from Object Storage
      GET
    • Retrieve Compressed Images Generated by Midjourney from Object Storage + WSRV
      GET
    • Retrieve Images Generated by Midjourney from Object Storage + WSRV
      GET
    • Proxy Discord Images via WSRV
      GET
    • Proxy and Compress Discord Images via WSRV
      GET
  • Management API
    • Create a New API Key
      POST
    • Update API Key Information
      POST
    • Query All of User's API Keys
      POST
    • Delete Specified API Key
      POST
    • Query User Membership Expiration Date
      POST
    • User Balance Query
      POST
    • Query the current model rates
      GET
  • OpenAI
    • About OpenAI Compatible API
    • About Azure OpenAI API
    • Audio
      • Text To Speech API
    • Chat
      • Chat Completion
      • Completion (Legacy)
    • Images
      • Create Image
    • Realtime API
  • Anthropic Claude
    • Deprecated
      • ChatCompletions
        POST
      • Claude2 API
        POST
    • Anthropic Official Claude API
      POST
  • Policies
    • Terms of Service
    • Privacy Policy
  • Other OpenAPIs
    • Search API
      • Google Custom Search API
      • Google Search By Serper
    • Azure API
      • Get Azure TTS voice list
      • Azure TTS
  1. Deprecated

ChatCompletions

Deprecated
POST
/v1/chat/completions
OhMyGPT公开API文档/大语言模型
Usage is the same as OpenAI's Chat/Completions interface, details can be found in the OpenAI documentation.
Here, let's discuss Claude in detail.

Things to note when using Claude2:
Please select the 'claude-2-web' model permission in Settings => Key Permissions List for the corresponding key.
The maximum model capacity is 100,000 tokens, and this interface has limited input to 90,000 tokens.
Rate limiting policy is: regular users 12 RPM, VIP users 60 RPM, PREMIUM users 90 RPM.
When using this model, only the model, messages, and stream parameters are meaningful; other parameters will be ignored.
If there are multiple messages in messages, they will be automatically serialized into a single string to meet the requirements of the Claude interface. If you don't want it to be automatically serialized by the backend, you can only place one element in the message list.
Example Claude2 request body:
{
    "model": "claude-2-web",
    "messages": [
        {
            "role": "system",
            "content": "You are Claude2, a large language model trained by the Anthropic company."
        },
        {
            "role": "user",
            "content": "Who are you?"
        }
    ],
    "stream": false
}
Example Claude2 request body (real-time stream output):
{
    "model": "claude-2-web",
    "messages": [
        {
            "role": "system",
            "content": "You are Claude2, a large language model trained by the Anthropic company."
        },
        {
            "role": "user",
            "content": "Who are you?"
        }
    ],
    "stream": true
}
The return format is consistent with OpenAI's ChatCompletions interface. In theory, programs that can use this interface and customize models should be directly compatible with the Claude provided by this interface."

Request

Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
Body Params application/json
object {0}
Example
{
    "model": "gpt-3.5-turbo",
    "messages": [
        {
            "role": "user",
            "content": "Say test"
        }
    ],
    "stream": false
}

Request samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.ohmygpt.com/v1/chat/completions' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "gpt-3.5-turbo",
    "messages": [
        {
            "role": "user",
            "content": "Say test"
        }
    ],
    "stream": false
}'

Responses

🟢200成功
application/json
Body
object {0}
Examples
{
    "id": "chatcmpl-75DH9Z5VONPBnj3OvPHsdQ1a9PQe6",
    "object": "chat.completion",
    "created": 1681477027,
    "model": "gpt-3.5-turbo-0301",
    "usage": {
        "prompt_tokens": 10,
        "completion_tokens": 2,
        "total_tokens": 12
    },
    "choices": [
        {
            "message": {
                "role": "assistant",
                "content": "Test."
            },
            "finish_reason": "stop",
            "index": 0
        }
    ]
}
Previous
Realtime API
Next
Claude2 API
Built with