Skip to main content
Menu
Build / OpenAI compatibility
Build

OpenAI compatibility and differences

What works unchanged with OpenAI clients, what differs, and what is not offered.

8 minute readUpdated 13 November 2026Python · TypeScript · curl

What works unchanged#

Change the base URL to https://api.panward.ai/v1 and the key to a Panward key, and the official OpenAI SDKs work as they are: the request and response shapes, the event-stream format and the error envelope keyed by error.

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.panward.ai/v1",  # was https://api.openai.com/v1
    api_key=os.environ["PANWARD_API_KEY"],
)

reply = client.chat.completions.create(
    model="z-ai/glm-5.3",
    messages=[{"role": "user", "content": "Summarise this discharge note."}],
)
print(reply.choices[0].message.content)

Endpoints#

The contract describes these OpenAI-style endpoints. Rerank is a Panward addition. What is not served yet is marked, and the API reference has every operation.

EndpointWhat it doesToday
POST /v1/chat/completionsCreate a chat completionServed
POST /v1/completionsCreate a text completionServed
POST /v1/embeddingsCreate embeddingsServed
POST /v1/rerankRerank documents against a queryServed
POST /v1/audio/transcriptionsTranscribe audioServed
POST /v1/images/generationsGenerate imagesServed
GET /v1/modelsList modelsServed

Not offered: the Responses API, Assistants and threads, Files, Fine-tuning, Batch, Moderations, audio speech and translations, image edits and variations, Realtime, vector stores and uploads.

Parameters#

The request fields of POST /v1/chat/completions, as the contract defines them:

FieldRequiredValuesLimitsNotes
modelYesstringCanonical model id. Aliases are not resolved.
messagesYesarray of ChatMessagemin items 1
max_completion_tokensNointegermin 1Upper bound on generated tokens, including reasoning tokens. Capped by the model's `max_output_tokens`.
max_tokensNointegermin 1Older name of `max_completion_tokens`. If both are sent they must be equal.
temperatureNonumbermin 0; max 2
top_pNonumbermax 1
top_kNointegermin 1Not supported by every model.
frequency_penaltyNonumbermin -2; max 2
presence_penaltyNonumbermin -2; max 2
seedNointegerBest-effort determinism; the same seed and parameters usually give the same output on the same offer.
stopNostring | array of stringUp to 4 sequences at which generation stops.
nNointegermin 1; max 1Number of choices. Only 1 is supported.
logprobsNoboolean
top_logprobsNointegermin 0; max 20Needs `logprobs: true`.
streamNobooleanReturn the response as an event stream.
stream_optionsNoobjectOnly valid with `stream: true`.
toolsNoarray of Toolmax items 128
tool_choiceNostring | object`none`, `auto` (default when tools are present), `required`, or one named function.
parallel_tool_callsNoboolean
response_formatNoobject | object | objectOutput format. `json_schema` needs a model with the `json_schema` capability.
reasoningNoobjectCanonical reasoning control, translated by the gateway for the model that serves the request. On a model without the `reasoning` capability it is rejected with `400 unsupported_parameter`. Reasoning tokens are billed as output tokens.
reasoning_effortNonone, low, medium, highOpenAI-style shorthand for `reasoning.effort`. If both are sent they must agree.
userNostringmax length 256Accepted for compatibility and ignored. It is never stored and never forwarded upstream.

An unknown parameter is refused with 400 invalid_request and param naming it. A parameter the model cannot honour, such as tools on a model without tool support, is refused with 400 unsupported_parameter before any upstream call. Panward does not drop a parameter silently.

  • max_completion_tokens and its older name max_tokens mean the same; if you send both they must be equal.
  • n can only be 1. stop takes up to 4 sequences.
  • top_k is not supported by every model. seed is best effort.
  • user is accepted for compatibility and ignored. It is never stored and never forwarded upstream.
Not available yet
A table of which parameters each model honours is not published yet. The model catalog shows whether a model takes tools and images. What is not available yet.

Reasoning#

Reasoning has one control, reasoning (effort: none, low, medium, high, and enabled), and the OpenAI-style shorthand reasoning_effort. The reasoning text is always in reasoning_content, in messages and in stream deltas, and reasoning tokens are billed as output. Reasoning has the details.

Response differences#

  • Ids are Panward's (chatcmpl-…), and model is the canonical id of the model that answered.
  • The response has no system_fingerprint and no service_tier.
  • finish_reason is stop, length, tool_calls or content_filter.
  • usage has prompt_tokens, completion_tokens, total_tokens, prompt_tokens_details.cached_tokens and completion_tokens_details.reasoning_tokens. These are the quantities that are billed.

Streaming differences#

Streams use the OpenAI chunk format and end with data: [DONE]. Usage is sent only with stream_options.include_usage. A failure after the first byte is an event: error frame, and the stream then ends without [DONE] (Streaming).

Headers Panward adds#

Request headers: panward-tier, panward-fallback, panward-hold-until-verified and X-Request-Id (Tiers and routing headers). Nothing is added to the response body or the stream; these response headers carry what Panward adds:

HeaderMeaning
panward-request-idPanward's id for this request (`req_…`). Quote it to support.
panward-receipt-idId of the receipt for this request (`rcpt_…`), on streamed and non-streamed responses and on refusals that produce a receipt (policy denial, no eligible Sealed offer, limit reached). Read it with `GET /receipts/{id}`.
panward-tierTier the request was served in.
panward-regionGateway region that served the request.
panward-modelCanonical id of the model that answered. Differs from the requested model only when a fallback model was used.
panward-client-request-idEcho of the request's `X-Request-Id`, when one was sent.
panward-ratelimit-limitRequest limit (requests per minute) of the current window: the tightest that applies (key, project or organization).
panward-ratelimit-remainingRequests left in the current window of that limit.
panward-ratelimit-resetSeconds until the current window resets.
panward-ratelimit-limit-tokensToken limit (tokens per minute) of the current window: the tightest tokens-per-minute limit that applies to this request (key, project or organization). Sent only when such a limit applies.
panward-ratelimit-remaining-tokensTokens left in the current window of that limit (input, cached input included, and output, as counted).
panward-ratelimit-reset-tokensSeconds until the current window of that limit resets.

Errors#

The error body is {"error": {"type", "message", "param", "request_id", "doc_url"}}. Branch on error.type, a stable value; the body has no code field. Common cases:

SituationStatus and type
The key is unknown, revoked or expired401 invalid_api_key
A rate limit was reached429 rate_limit_exceeded
The input and the maximum output exceed the context400 context_length_exceeded
The balance is too low402 insufficient_credit
A monthly spend limit is reached402 spend_limit_reached

Errors lists every type, what causes it and whether to retry.

Images and files#

Generated images are returned inline as base64; response_format: "url" is refused with 400 unsupported_parameter. Images sent to a chat model are data: URLs. An audio upload may be up to 25 MB, and any other request body up to 10 MB.

Idempotency#

Inference requests do not accept Idempotency-Key. Responses are never stored, so they cannot be replayed; a retry is a new request with its own receipt.

Timestamps#

Timestamps on the public API are Unix seconds.

Was this page helpful?Suggest an edit