# OpenAI Chat Completion Accomplish complex tasks like natural language processing, coding, translation, and creative writing with superior success using openai chat completion and its large context window. ## API Information - **Model Slug:** openai-chat-completion - **Branded URL:** https://www.eachlabs.ai/openai/gpt/openai-chat-completion - **Provider:** OpenAI - **Category:** Image to Text - **Output Type:** text - **Status:** active - **Base Cost:** $0.0525–$15.75 per million tokens, depending on model and token type - **Estimated Processing Time:** 1 seconds - **Interactive Demo:** https://www.eachlabs.ai/ai-models/openai-chat-completion ## Pricing - **Charge Type:** dynamic - **Estimate:** $0.0525–$15.75 per million tokens, depending on model and token type - **Pricing Details:** completion tokens: $15.75 - **Pricing Details:** prompt tokens: $2.63 - **Pricing Details:** completion tokens: $4.72 - **Pricing Details:** prompt tokens: $0.7875 - **Pricing Details:** completion tokens: $1.31 - **Pricing Details:** prompt tokens: $0.21 - **Pricing Details:** completion tokens: $14.70 - **Pricing Details:** prompt tokens: $1.84 - **Pricing Details:** completion tokens: $10.50 - **Pricing Details:** prompt tokens: $1.31 - **Pricing Details:** completion tokens: $10.50 - **Pricing Details:** prompt tokens: $1.31 - **Pricing Details:** completion tokens: $2.10 - **Pricing Details:** prompt tokens: $0.2625 - **Pricing Details:** completion tokens: $0.42 - **Pricing Details:** prompt tokens: $0.0525 - **Pricing Details:** completion tokens: $8.40 - **Pricing Details:** prompt tokens: $2.10 - **Pricing Details:** completion tokens: $1.68 - **Pricing Details:** prompt tokens: $0.42 - **Pricing Details:** completion tokens: $0.42 - **Pricing Details:** prompt tokens: $0.105 - **Pricing Details:** completion tokens: $0.63 - **Pricing Details:** prompt tokens: $0.1575 - **Pricing Details:** completion tokens: $8.40 - **Pricing Details:** prompt tokens: $2.10 - **Pricing Details:** completion tokens: $4.62 - **Pricing Details:** prompt tokens: $1.16 - **Pricing Details:** completion tokens: $4.62 - **Pricing Details:** prompt tokens: $1.16 - **Pricing Details:** completion tokens: $10.50 - **Pricing Details:** prompt tokens: $2.63 ## Input Schema | Parameter | Type | Required | Default | Constraints | Description | |-----------|------|----------|---------|-------------|-------------| | user_prompt | string | Yes | - | - | The user message or question for the model. Supports natural language instructions, questions, code tasks, and creative writing. | | image_url | string | No | - | - | Optional image for vision analysis. When provided, the model analyzes the image alongside the text prompt. Supports JPEG, PNG, GIF, and WebP. Use for image description, visual Q&A, document analysis, or content extraction. | | system_prompt | string | No | - | - | Instructions that define the model's behavior, tone, and constraints. Use for persona setup, output formatting, domain rules, or safety constraints. | | model | string | Yes | gpt-4o | gpt-4.1, gpt-4.1-mini, gpt-4.1-nano, gpt-4o, gpt-4o-mini, gpt-5.1, gpt-5, gpt-5-mini, gpt-5-nano, o3-mini, o4-mini | OpenAI model to use. gpt-4.1: best quality/price balance, strong at coding and instruction following. gpt-4.1-mini/nano: faster and cheaper for simpler tasks. gpt-4o/4o-mini: multimodal with vision support. gpt-5/5.1: latest generation, highest capability. o3-mini/o4-mini: reasoning models for complex logic and math. | | max_tokens | integer | No | 200 | 1–16384 | Maximum tokens in the response. 200 (default): concise answers. 512-1024: detailed explanations. 4096+: long-form content. | | temperature | number | No | - | 0–2 | Controls response randomness. 0: deterministic. 0.3-0.7: balanced. 1.0 (default): creative. Not supported by o-series reasoning models. | ## Example Request ```bash curl -X POST https://api.eachlabs.ai/v1/prediction/ \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "openai-chat-completion", "input": { "model": "gpt-4o", "user_prompt": "Hello from EachAI!" } }' ``` ## Output Schema Response returned by `GET /v1/prediction/{id}` when the job completes: ```json { "status": "success", "predictionID": "string", "output": "text", "metrics": { "predict_time": "number (seconds)" } } ``` ## Polling ```bash curl https://api.eachlabs.ai/v1/prediction/{PREDICTION_ID} \ -H "Authorization: Bearer YOUR_API_KEY" ``` | Status | Meaning | |--------|---------| | `processing` | Still running — poll again | | `success` | Done — read `output` | | `error` | Failed — read `message` / `details` | ## Webhook (alternative to polling) Pass `"webhook_url": "https://your.host/path"` in the create request. Eachlabs POSTs this payload when the job ends: ```json { "exec_id": "prediction-uuid", "status": "succeeded", "output": "https://...", "error": "" } ``` `status` is `"succeeded"` or `"failed"`. `exec_id` equals the `predictionID` from create. Return 2xx within 30 seconds. ## Errors Error body: `{ "status": "error", "message": "...", "details": "..." }` | Code | Meaning | |------|---------| | `400` | Invalid input | | `401` | Missing / invalid `Authorization` bearer token | | `404` | Unknown model or prediction id | | `429` | Rate limit — 100 creates / min, 10 concurrent per key | | `5xx` | Retry with backoff | ## Overview **openai-chat-completion — Text-to-Text AI Model** Developed by OpenAI as part of the **gpt** family, **openai-chat-completion** empowers developers and creators to tackle complex tasks like natural language processing, coding, translation, and creative writing with exceptional accuracy and efficiency. This **text-to-text AI model** stands out with its massive context window—up to 1 million tokens in advanced variants like GPT-4.1-mini—enabling processing of entire documents or lengthy conversations without losing key details. Whether you're building **OpenAI chat completion API** integrations for chatbots or automating content generation, **openai-chat-completion** delivers superior performance for **OpenAI text-to-text** workflows, handling intricate prompts with precise, context-aware responses. ## Usage Notes - API Base URL: `https://api.eachlabs.ai/v1` - Authentication: send `Authorization: Bearer YOUR_API_KEY`. Generate a key from the Eachlabs dashboard at https://www.eachlabs.ai/dashboard/api-keys. - File-typed parameters (`*_url`, `image_url`, `video_url`, `audio_url`, etc.) accept publicly-reachable HTTPS URLs only. Upload your asset first (GCS / S3 / your CDN) and pass the resulting URL. Data-URIs and localhost URLs are rejected. - For structured parameters (arrays / objects) send real JSON values, not stringified payloads. - Monetary values are reported in USD; per-token / per-megapixel rates may be billed in micro-cents internally. - Prefer `webhook_url` over polling for long-running predictions — see the Webhook Callback section.