N·00Calling the API
Calling the models from your code
Call the models from your own code, with no client in between, over either of OpenAI's two protocols: the recommended Responses API, or Chat Completions, the older protocol nearly everything supports. Both live at https://api.xylemnode.com/v1, and one key works for both (a few groups are Responses-only, as their names say).
Responses API
The protocol OpenAI recommends today: content goes in input and the system prompt in instructions, and with the official SDKs the answer is ready in output_text. Reasoning models do better on it, and file search, code execution, image generation and reasoning summaries are only offered here.
- 01
Send your first request
POST /v1/responses with Bearer auth. input can be a single sentence or an array of messages; instructions works as the system prompt. This is the macOS / Linux form; for Windows, see the note at the bottom of the page.
terminal curl https://api.xylemnode.com/v1/responses \ -H "Content-Type: application/json" \ -H "Authorization: Bearer sk-your-key" \ -d '{ "model": "gpt-6.1-sol", "instructions": "You are a concise assistant.", "input": "Introduce yourself in one sentence." }' - 02
Read the result with the SDK
Install the official SDK (pip install openai, Python 3.10 or later) and point base_url at XylemNode. The returned output is a list of items, often a reasoning item before the message, so don't hard-code output[0]; the SDK's output_text has the text joined up for you. You can also set OPENAI_BASE_URL (to https://api.xylemnode.com/v1) and OPENAI_API_KEY and just write OpenAI().
python from openai import OpenAI client = OpenAI(base_url="https://api.xylemnode.com/v1", api_key="sk-your-key") response = client.responses.create( model="gpt-6.1-sol", instructions="You are a concise assistant.", input="Introduce yourself in one sentence.", ) print(response.output_text) - 03
Stream the output
Add stream=True and the result arrives as events: join the delta of each response.output_text.delta event, and stop at response.completed, which also carries the usage.
python from openai import OpenAI client = OpenAI(base_url="https://api.xylemnode.com/v1", api_key="sk-your-key") stream = client.responses.create( model="gpt-6.1-sol", input="Introduce yourself in one sentence.", stream=True, ) for event in stream: if event.type == "response.output_text.delta": print(event.delta, end="", flush=True) elif event.type == "response.completed": print("\nusage:", event.response.usage) - 04
Multi-turn conversations
The robust way is to keep the context yourself: add the previous reply back to input as an assistant message, then the new question. previous_response_id relies on the server having stored the last turn; it isn't supported on Claude or Gemini models and may not be found if the request reaches a different upstream, so the sample doesn't use it.
python from openai import OpenAI client = OpenAI(base_url="https://api.xylemnode.com/v1", api_key="sk-your-key") history = [{"role": "user", "content": "Recommend a book on distributed systems."}] first = client.responses.create(model="gpt-6.1-sol", input=history) print(first.output_text) # Add the previous reply back, then the new question history += [ {"role": "assistant", "content": first.output_text}, {"role": "user", "content": "Is it good for beginners?"}, ] second = client.responses.create(model="gpt-6.1-sol", input=history) print(second.output_text)
Common parameters
- Endpoint
POST https://api.xylemnode.com/v1/responses- input
A sentence, or an array of user / assistant messages- instructions
System prompt- max_output_tokens
Output limit, reasoning tokens included- reasoning
Set effort like { "effort": "high" }; values depend on the model- text.format
Structured output (JSON Schema)- stream
true returns an event stream
Chat Completions (older protocol)
OpenAI's previous-generation protocol, and where the phrase "OpenAI-compatible" comes from: most third-party SDKs, frameworks and clients send their requests this way by default. OpenAI still supports it long term, so code already using it doesn't need rewriting for Responses.
- 01
Send your first request
POST /v1/chat/completions with Bearer auth. messages is the conversation: developer carries the system prompt (recommended for newer models; system still works) and user the question. This is the macOS / Linux form; for Windows, see the note at the bottom of the page.
terminal curl https://api.xylemnode.com/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer sk-your-key" \ -d '{ "model": "gpt-6.1-sol", "messages": [ { "role": "developer", "content": "You are a concise assistant." }, { "role": "user", "content": "Introduce yourself in one sentence." } ] }' - 02
Read the result with the SDK
The same official SDK, with base_url pointed at XylemNode. The text is in choices[0].message.content; a finish_reason of length means the answer hit the output limit. Node.js works the same way (Node.js 22 or later): npm install openai, then new OpenAI({ baseURL, apiKey }).
python from openai import OpenAI client = OpenAI(base_url="https://api.xylemnode.com/v1", api_key="sk-your-key") completion = client.chat.completions.create( model="gpt-6.1-sol", messages=[ {"role": "developer", "content": "You are a concise assistant."}, {"role": "user", "content": "Introduce yourself in one sentence."}, ], ) print(completion.choices[0].message.content) - 03
Stream the output
Add stream=True and the result arrives as data: chunks: join each chunk's choices[0].delta.content and stop at data: [DONE]. There is usually one last chunk with empty choices that only carries the usage, so check before reading choices[0].
python from openai import OpenAI client = OpenAI(base_url="https://api.xylemnode.com/v1", api_key="sk-your-key") stream = client.chat.completions.create( model="gpt-6.1-sol", messages=[{"role": "user", "content": "Introduce yourself in one sentence."}], stream=True, ) for chunk in stream: if chunk.choices and chunk.choices[0].delta.content: print(chunk.choices[0].delta.content, end="", flush=True) - 04
Multi-turn conversations
Chat Completions keeps no context on the server, so every request carries the full messages: add the model's previous reply back as an assistant message, then the new question.
python from openai import OpenAI client = OpenAI(base_url="https://api.xylemnode.com/v1", api_key="sk-your-key") messages = [{"role": "user", "content": "Recommend a book on distributed systems."}] first = client.chat.completions.create(model="gpt-6.1-sol", messages=messages) reply = first.choices[0].message.content print(reply) # Add the previous reply back, then the new question messages += [ {"role": "assistant", "content": reply}, {"role": "user", "content": "Is it good for beginners?"}, ] second = client.chat.completions.create(model="gpt-6.1-sol", messages=messages) print(second.choices[0].message.content)
Common parameters
- Endpoint
POST https://api.xylemnode.com/v1/chat/completions- messages
developer (or system) · user · assistant · tool- max_completion_tokens
Output limit, reasoning tokens included; replaces the deprecated max_tokens- reasoning_effort
Reasoning effort; values depend on the model- response_format
Structured output (json_schema)- stream
true returns data: chunks ending in [DONE]