Zorveus LogoZorveusDOCS
Inference API

Tool calling

View Markdown

Execute structured function calls and JSON schema tools across supported models.

POST/v1/chat/completions
API Key (Bearer zrv_...)

Zorveus passes OpenAI-compatible tool definitions and returned tool-call arguments through supported model routes. Your application executes the tool and sends the tool result in a later request.

Optional key for interactive API requests. Stored in memory only.


Code example

Client SDK / Framework:
import json
from openai import OpenAI

client = OpenAI(
    base_url="https://api.zorveus.com/v1",
    api_key="zrv_your_api_key",
)

tools = [
    {
        "type": "function",
        "function": {
            "name": "get_stock_price",
            "description": "Fetch real-time stock ticker price",
            "parameters": {
                "type": "object",
                "properties": {
                    "symbol": {"type": "string", "description": "Ticker symbol, e.g. AAPL"},
                },
                "required": ["symbol"],
            },
        },
    }
]

response = client.chat.completions.create(
    model="openai/gpt-4.1-mini",
    messages=[{"role": "user", "content": "What is the stock price of NVDA?"}],
    tools=tools,
    tool_choice="auto",
)

tool_calls = response.choices[0].message.tool_calls
if tool_calls:
    for tool_call in tool_calls:
        print(f"Tool to invoke: {tool_call.function.name}")
        print(f"Arguments: {tool_call.function.arguments}")

Complete the tool loop

  1. Send the tool schema with the conversation.
  2. Validate the returned function name and JSON arguments.
  3. Execute only an allowlisted function with validated inputs.
  4. Append the assistant tool call and your tool result to the messages.
  5. Send another completion request to obtain the final answer.

Do not execute a function name or argument solely because a model returned it. Apply the same authorization checks that you use for any other application input.

Tool support varies by model. Check GET /v1/models, then run a small tool-call test before enabling a model in production.

Was this page helpful?
Edit this page on GitHub

On this page