# gpt-6-astra API [Playground](/models/openai/gpt-6-astra) ยท [API reference](/docs/models/openai/gpt-6-astra) ## Responses API POST /v1/responses is available for this model, including SSE. Use input instead of messages and max_output_tokens instead of max_completion_tokens. Read output[].content[] blocks with type=output_text. Input/output counts are usage.input_tokens and usage.output_tokens. Streaming text uses response.output_text.delta; response.completed or response.incomplete contains terminal usage. Send conversation history explicitly; store must be false and previous_response_id is not enabled. A token limit may produce status=incomplete with valid billable usage. ## Authentication and model selection Use your Topview Platform API key, not a provider key. Send Authorization: Bearer YOUR_PLATFORM_API_KEY. Claude also accepts x-api-key. GET https://platform-backend.topview.ai/v1/models lists enabled models. Model-restricted keys must allow openai/gpt-6-astra. Select the model with model: "gpt-6-astra". Keep API keys on your server. ``` curl https://platform-backend.topview.ai/v1/models -H 'Authorization: Bearer YOUR_PLATFORM_API_KEY' ``` ## Request POST /v1/chat/completions. Text generation returns the response directly, or streams SSE; it does not use the image/video prediction submission and polling API. ``` curl https://platform-backend.topview.ai/v1/chat/completions \ -H 'Authorization: Bearer YOUR_PLATFORM_API_KEY' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: unique_request_0001' \ -d '{ "model": "gpt-6-astra", "messages": [ { "role": "user", "content": "Hello" } ], "max_completion_tokens": 1024 }' ``` ## Parameters and limits Required: model and messages (1โ€“64 messages). max_completion_tokens: integer 1โ€“8192, default 1024. stream: boolean, default false. Maximum request JSON: 32 MiB; attachments total at most 20 MiB. Send the conversation history with every request. Use system/developer messages for instructions. Optional fields: temperature, top_p, reasoning_effort, response_format, stop, seed, parallel_tool_calls and stream_options. max_tokens is accepted as an alias, but do not send both output-limit fields. Model-specific parameter compatibility still applies. tools, tool_choice and metadata are accepted; at most 16 client-side function tools. Hosted tools, premium processing tiers and stored server-side conversations are not enabled. ## Response and token usage Read choices[0].message.content and usage.prompt_tokens / usage.completion_tokens. Tool calls appear in choices[0].message.tool_calls. Cached input is reported in prompt_tokens_details.cached_tokens; output usage includes reasoning tokens. ``` { "object": "chat.completion", "model": "gpt-6-astra", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hello!" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 8, "completion_tokens": 3, "total_tokens": 11 } } ``` ## Streaming and tools Set stream: true and consume text/event-stream incrementally. Read choices[].delta and finish_reason; the stream ends with [DONE]. The gateway requests terminal usage with stream_options.include_usage. Assemble tool-call argument fragments before running the tool. Function tools run in your application: execute the requested function, append the tool result and send the next turn. A stream disconnect does not cancel the provider call or imply zero charge. ## Python Install requests. Use a new idempotency key for a new logical request; retain it for retries of that same request. ``` import os, uuid, requests response = requests.post( "https://platform-backend.topview.ai/v1/chat/completions", headers={"Authorization": "Bearer " + os.environ["TOPVIEW_API_KEY"], "Idempotency-Key": uuid.uuid4().hex}, json={"model":"gpt-6-astra","messages":[{"role":"user","content":"Hello"}],"max_completion_tokens":1024}, timeout=180, ) print("Request ID:", response.headers.get("X-Platform-Request-Id")) response.raise_for_status() print(response.json()) ``` ## JavaScript Run on your server. Inspect non-2xx responses before parsing generated output. ``` const response = await fetch("https://platform-backend.topview.ai/v1/chat/completions", { method: "POST", headers: {Authorization: "Bearer " + process.env.TOPVIEW_API_KEY, "Content-Type": "application/json", "Idempotency-Key": crypto.randomUUID()}, body: JSON.stringify({ "model": "gpt-6-astra", "messages": [ { "role": "user", "content": "Hello" } ], "max_completion_tokens": 1024 }), }); const data = await response.json(); if (!response.ok) throw new Error(JSON.stringify(data)); console.log(response.headers.get("X-Platform-Request-Id"), data); ``` ## Attachments and URLs Chat Completions accepts image_url blocks (public HTTPS or Base64 data URL) and PDF file blocks (filename + file_data). Responses accepts input_image and input_file: PDF/CSV/TSV/XLS/XLSX can use filename + file_data or file_url. The supplier currently ignores some non-PDF formats such as DOCX/TXT input_file even when HTTP is 200; those formats are rejected before submission. Convert them to PDF or send extracted text as input_text. Playground reads plain-text files as text. For GPT PDFs, the platform also renders each page as an image because the supplier otherwise extracts only PDF text. Page images have a maximum edge of 2048 pixels; keep originals for tasks requiring finer detail. ``` { "model": "gpt-6-astra", "max_output_tokens": 1024, "input": [ { "role": "user", "content": [ { "type": "input_file", "file_url": "https://example.com/document.pdf" }, { "type": "input_image", "image_url": "https://example.com/image.png" }, { "type": "input_text", "text": "Summarize the document and image." } ] } ] } ``` ## Attachment delivery and limits Platform limit: 20 MiB combined decoded attachments, including generated GPT PDF page images, and 32 MiB request JSON. Up to 600 images / PDF pages, subject to each model context and upstream limits. URLs must be publicly readable HTTPS direct file links without credentials or redirects; private networks are rejected. URLs are fetched and frozen before reservation. Base64 image sources use the matching media type; PDF uses application/pdf. GPT file_data accepts a data URL (or raw Base64 with a .pdf filename). Provider file_id/Files APIs are not exposed by this supplier. A web page URL in plain text is only text; hosted web-fetch/search tools are not enabled. Image and PDF page tokens contribute to input usage; an attachment reservation is conservative and unused funds are released. The API response retains PDF citations when requested through the native protocol. ## Pricing and billing Prices are USD per million tokens: input 7; output 35; cache read 0.7. The wallet reserves a conservative budget before submission, charges actual reported token usage and releases the unused reservation. The reservation is not the final charge. Check Usage for settlement and the request ID. Image/video promotions should not be assumed to apply to text. ## Errors, retries and idempotency Save X-Platform-Request-Id. Supply Idempotency-Key (16โ€“128 letters, digits, underscore or hyphen). Reuse the same key and identical payload with the same API credential when recovering the same request. A settled replay does not call the provider again; an active or uncertain request returns 409. A new key creates a new paid request. Invalid input returns 400; authentication or access errors use 401/403. Do not blindly resubmit after a timeout, 5xx or interrupted stream: provider execution may have occurred. Check Usage and the original request ID; uncertain usage requires reconciliation. A confirmed provider rejection releases the reservation.