RuntokenDocs

OpenAI Chat

Revision 1 · Updated 2026-11-12 · 1 min read

Call Chat Completions through Runtoken.

Prerequisites#

Before sending a request, prepare:

  • A Runtoken platform API key created in the console.
  • The exact ID of an OpenAI Chat-compatible model from the catalogue.
  • A server-side environment that can store the key safely and send HTTP requests; the example uses curl.

Endpoint and authentication#

Send a JSON request to the gateway with your platform key in the Authorization header.

POST/v1/chat/completions

For an OpenAI SDK, set base_url to https://api.runtoken.net/v1. For a direct HTTP request, use the complete endpoint shown below.

Send a request#

The example sends one user message and asks for streamed output.

Stream a conversationbash
curl -N 'https://api.runtoken.net/v1/chat/completions' \
  -H 'Authorization: Bearer YOUR_PLATFORM_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "YOUR_MODEL_ID",
    "messages": [{ "role": "user", "content": "Hello!" }],
    "stream": true
  }'

Replace these placeholders before running the example.

PlaceholderReplace with
YOUR_PLATFORM_KEYYour platform API key from the console.
YOUR_MODEL_IDAn OpenAI Chat model ID from the catalogue.

curl -N disables output buffering so you can see streamed data as it arrives.

Continue a conversation#

Keep the conversation history in your application and send the messages needed for the next turn. Runtoken inference is stateless; a later request does not inherit an earlier conversation.

The gateway does not convert protocols. If a model uses Anthropic Messages or Gemini v1beta, use that model's native endpoint instead.

Parameters and model support#

Image inputs, tool calling and structured output depend on the selected model and its supported request format. This page's text example does not establish support for those features.

Streaming and retries#

Automatic channel switching can happen before output begins. Once output starts, the request stays on that channel. If a stream is interrupted, retain the partial output and decide in your application whether to send a new request; an interrupted stream may require billing review.

A retry is a separate request. Avoid silently presenting repeated output as a continuation of the original stream.

Next steps#

For another request format, see OpenAI Responses. For shared routing, billing and error guidance, return to the integration guide.

Was this page helpful?