Model Information
| Model ID | openai/gpt-4o |
| Category | Text |
| Endpoint | /api/v1/chat/completions |
| Protocols | OpenAI Chat Completions |
| Input Modalities | text, image |
Request
POST https://shark.ai/api/v1/chat/completionsAuthentication: Authorization: Bearer <api-key>
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | ✓ | Model ID |
| messages | array | ✓ | Array of message objects with role and content |
| stream | boolean | Enable SSE streaming | |
| temperature | number | 0.0 – 2.0 | |
| max_tokens | integer | Maximum output tokens | |
| top_p | number | Nucleus sampling, 0.0 – 1.0 |
Multimodal Input
This model supports image input. Use the content array format:
{
"role": "user",
"content": [
{
"type": "text",
"text": "Describe this"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/photo.jpg"
}
}
]
}Code Examples
curl -X POST https://shark.ai/api/v1/chat/completions \
-H "Authorization: Bearer <api-key>" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o",
"messages": [
{
"role": "user",
"content": "Hello!"
}
],
"stream": false
}'Response
Response (200 OK)
{
"id": "chatcmpl-xxx",
"object": "chat.completion",
"created": 1700000000,
"model": "openai/gpt-4o",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 20,
"total_tokens": 30
},
"credit": 4.5
}Error Codes
| HTTP | Type | Description |
|---|---|---|
| 400 | invalid_request_error | Invalid parameters |
| 400 | content_moderation | Content blocked by safety system |
| 400 | input_too_large | Input exceeds model limit |
| 401 | auth_error | Invalid API key |
| 402 | insufficient_credits | Not enough credits |
| 429 | rate_limit_error | Too many requests |
| 502 | provider_error | Upstream error, retry later |
| 504 | timeout_error | Request timed out |