OhMyGPT API Docs
  1. Chat
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
        POST
      • Completion (Legacy)
        POST
    • Images
      • Create Image
    • Realtime API
  • Anthropic Claude
    • Deprecated
      • ChatCompletions
      • Claude2 API
    • Anthropic Official Claude API
  • 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. Chat

Chat Completion

POST
/v1/chat/completions
OpenAI's ChatCompletion API
Supports all OpenAI Chat models, including the latest versions
For detailed parameters about this API, you can refer to OpenAI's official documentation: https://platform.openai.com/docs/api-reference/chat/create
You can also use this API to call many non-OpenAI models in the format of OpenAI's ChatCompletion API, such as Anthropic's Claude series models, TA, ChatGLM, Cohere, etc. For the specific list of supported models, please refer to the model list on the website settings page, as the content in the documentation may not be maintained in a timely manner

Gemini Pro Vision Usage Example#

You can completely refer to OpenAI's Vision guide: https://platform.openai.com/docs/guides/vision
Example input:
{
    "model": "gemini-pro-vision",
    "messages": [
        {
            "role": "user",
            "content": [
                {
                    "type": "text", "text": "Describe this image"
                },
                {
                    "type": "image_url",
                    "image_url": "https://pbs.twimg.com/media/GBEB1CbbIAAC28o?format=jpg&name=small"
                }
            ]
        }
    ],
    "stream": false
}
Note: It also supports Base64 as image input, and Base64 has higher reliability. Base64 is recommended. The link is used here to avoid excessive word count.
Response result:
{
  "id": "chatcmpl-gPyHaMj77C8Uca3UudUL5zxvAvI3N",
  "object": "chat.completion",
  "created": 1702560711,
  "model": "gemini-pro-vision",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": " These are emoticons of five different characters. They are:\n- Hu Tao\n- Yao Yao\n- Sayu\n- Keqing\n- Sangonomiya Kokomi"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 8,
    "completion_tokens": 48,
    "total_tokens": 56
  }
}
Streaming request ("stream": true) response result:
data: {"id":"chatcmpl-6tzfeCctklU06xs8BmDo3b1YcCold","object":"chat.completion.chunk","created":1702562069,"model":"gemini-pro-vision","choices":[{"index":0,"delta":{"role":"assistant","content":" These are emoticons of five different characters. They are:\n- Hu Tao\n- Yao Yao\n- Sayu\n- Keqing\n- Sangonomiya"},"finish_reason":null}]}
data: {"id":"chatcmpl-6tzfeCctklU06xs8BmDo3b1YcCold","object":"chat.completion.chunk","created":1702562069,"model":"gemini-pro-vision","choices":[{"index":0,"delta":{"role":"assistant","content":" Kokomi"},"finish_reason":null}]}
data: [DONE]

Request

Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
Body Params application/json
model
string 
required
messages
array [object {2}] 
required
role
string 
required
content
string 
required
stream
boolean 
required
Example
{
    "model": "gpt-3.5-turbo",
    "messages": [
        {
            "role": "system",
            "content": "You are a helpful assistant."
        },
        {
            "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": "system",
            "content": "You are a helpful assistant."
        },
        {
            "role": "user",
            "content": "Say test"
        }
    ],
    "stream": false
}'

Responses

🟢200OK
application/json
Body
object {0}
Examples
{
    "id": "chatcmpl-8Je5EIkoizgX7HIZHCfak05B9YmYx",
    "object": "chat.completion",
    "created": 1699693004,
    "model": "gpt-3.5-turbo-1106",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "Test"
            },
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 19,
        "completion_tokens": 1,
        "total_tokens": 20
    },
    "system_fingerprint": "fp_eeff13170a"
}
Previous
Text To Speech API
Next
Completion (Legacy)
Built with