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.

  1. 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."
      }'
  2. 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)
  3. 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)
  4. 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
Get API Key