AITRE API Documents(English)
    AITRE API Documents(English)
    • AITRE Introduction
    • Project Description
    • Send Request
    • Openai's format(Chat)
      • Gpt-4o-image(Generate Image)
        POST
      • Chat Completions Interface
        POST
    • Audio Interface(Audio)
      • TTS(speech-to-text)
        POST
      • Transcriptions
        POST
      • Translations
        POST
    • Embeddings Interface(Embeddings)
      • Embeddings
      • Create Embeddings
        POST
    • Images Generations(Images)
      • Openai's format Gpt-image-1
        POST
      • Openai's format Flux
        POST
      • Openai's format DALL·E 3
        POST
    • Models Interface(Models)
      • Model
        GET
    • Auto Completions Interface(Completions)
      • Completions
        POST
    • MidJourney
      • Description
      • Fetch task by id
        GET
      • Action
        POST
      • Blend(image to image)
        POST
      • Describe (image to text)
        POST
      • Imagine (text to image/image to image)
        POST
      • Modal(Partial redrawing、ZOOM)
        POST
      • Shorten(prompt analysis)
        POST

    Send Request

    You can paste the following command into your terminal to run your first API request. Make sure to replace YOUR_API_KEY with your secret API key.
    This request queries the model to complete the text starting with the prompt "Say this is a testgpt-4o-mini". You should receive a response similar to the following:
    
    1 {
    2    "id":"chatcmpl-abc123",
    3    "object":"chat.completion",
    4    "created":1677858242,
    5    "model":"gpt-4o-mini",
    6    "usage":{
    7       "prompt_tokens":13,
    8       "completion_tokens":7,
    9       "total_tokens":20
    10    },
    11    "choices":[
    12       {
    13          "message":{
    14             "role":"assistant",
    15             "content":"\n\nThis is a test!"
    16          },
    17          "finish_reason":"stop",
    18          "index":0
    19       }
    20    ]
    21 }
    Now you have generated your first chat completion. We can see that finish_reason is stop, which means the API returned a complete completion generated by the model. In the above request, we only generated one message, but you can set the parameter n to generate multiple message choices. In this example, gpt-4o-mini is more used for traditional text completion tasks. The model is also optimized for chat applications.
    Modified at 2025-03-30 03:03:37
    Previous
    Project Description
    Next
    Gpt-4o-image(Generate Image)
    Built with