跳轉到主要內容
POST
/
v1
/
responses
Create response
curl --request POST \
  --url https://api.dgrid.ai/v1/responses \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "openai/gpt-4o",
  "input": "Hello from DGrid."
}
'
{
  "id": "<string>",
  "object": "<string>",
  "created_at": 123,
  "status": "<string>",
  "model": "<string>",
  "output": [
    {
      "type": "<string>",
      "id": "<string>",
      "status": "<string>",
      "role": "<string>",
      "content": [
        {
          "type": "<string>",
          "text": "<string>"
        }
      ]
    }
  ],
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123,
    "prompt_tokens_details": {
      "cached_tokens": 123,
      "text_tokens": 123,
      "audio_tokens": 123,
      "image_tokens": 123
    },
    "completion_tokens_details": {
      "text_tokens": 123,
      "audio_tokens": 123,
      "reasoning_tokens": 123
    }
  }
}

授權

Authorization
string
header
必填

Your DGrid API key. All endpoints use Authorization: Bearer <DGRID_API_KEY>.

主體

application/json
model
string
必填

Target model ID.

範例:

"openai/gpt-4o"

input

Input text or structured input items.

stream
boolean
預設值:false

Enable streaming.

回應

Response object.

id
string

Response identifier.

object
string

Always response.

created_at
integer

Creation timestamp.

status
string

Response lifecycle state.

model
string

Model used for inference.

output
object[]

Output items.

usage
object

Token usage breakdown.