Skip to main content

Chat completions

client.chat.complete() sends a request and returns the full response as a dict.

Basic usage​

response = client.chat.complete(
model="auto",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain quantum computing in one sentence."},
],
)

print(response["choices"][0]["message"]["content"])

Parameters​

ParameterTypeRequiredDescription
modelstrYesauto for automatic selection by Artemis Task (auto-artemis-task and auto-v2 mean the same), or a specific model identifier, e.g. gpt-4o, claude-sonnet-4-6
messageslist[ChatMessage]YesConversation history
temperaturefloat | NoneNoSampling temperature 0–2
max_tokensint | NoneNoMaximum tokens in the response. Over a project policy's max_tokens limit, the request is refused with 400; left out, the project's limit applies
providerstr | NoneNoForce a specific provider, e.g. anthropic. No router runs: with model="auto" the provider serves the first model it lists
routerRouterChoice | None ("artemis" or "v2")NoNot needed: Artemis Task decides every model="auto" request, so both values change nothing. Sent as the x-nuroute-router header; any other value raises NuRouteError with status 400

With model="auto", Artemis Task picks the model and the provider. If it cannot decide, fallback-router:apollo does, and the request log says why (Which router decided): the SDK returns the response body only, not the gateway's X-Router-* headers. A request that names a model uses no router.

Targeting a specific provider​

response = client.chat.complete(
model="claude-haiku-4-5-20251001",
messages=[{"role": "user", "content": "Hello!"}],
provider="anthropic",
)

Multi-turn conversations​

messages = [{"role": "system", "content": "You are a helpful assistant."}]

def chat(user_message: str) -> str:
messages.append({"role": "user", "content": user_message})
response = client.chat.complete(model="auto", messages=messages)
reply = response["choices"][0]["message"]
messages.append(reply)
return reply["content"]

print(chat("What is 2 + 2?"))
print(chat("And multiply that by 10?"))