Documentation

Python quickstart

Drop-in replacement for the OpenAI Python client. Streaming, tool use, and function calling work out of the box — just point the base URL at Meridian.

1. Install the SDK

Meridian is fully compatible with the official OpenAI Python client. Install it via pip:

pip install openai

2. Configure environment

Set the base URL to your Meridian endpoint and provide your API key. You can find your key in the dashboard.

import os

os.environ["OPENAI_BASE_URL"] = "https://api.getnimbus.net/v1"
os.environ["OPENAI_API_KEY"] = "sk-your-meridian-key"

3. Streaming responses

Server-sent events deliver tokens as they are generated. Set stream=True and iterate:

from openai import OpenAI

client = OpenAI()

stream = client.chat.completions.create(
    model="meridian-1",
    messages=[{"role": "user", "content": "Summarise the last three commits."}],
    stream=True,
)

for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

4. Tool use & function calling

Define tools with JSON Schema and let the model decide when to invoke them. The response includes the function name and parsed arguments:

tools = [
    {
        "type": "function",
        "function": {
            "name": "get_weather",
            "description": "Get current temperature for a city.",
            "parameters": {
                "type": "object",
                "properties": {
                    "city": {"type": "string"}
                },
                "required": ["city"],
            },
        },
    }
]

response = client.chat.completions.create(
    model="meridian-1",
    messages=[{"role": "user", "content": "What is the weather in London?"}],
    tools=tools,
    tool_choice="auto",
)

tool_call = response.choices[0].message.tool_calls[0]
print(f"Function: {tool_call.function.name}")
print(f"Arguments: {tool_call.function.arguments}")

Next steps