OroIntelDocs
For agents:start at/llms.txt·everything as Markdown at/llms-full.txt·or add theMCP server.

Use Oro Intel with OpenAI function calling

Expose Oro Intel's UK procurement endpoints as OpenAI function tools and let the model drive lookup → full profile over the plain REST API.

Prerequisites

  • An Oro Intel API key in ORO_API_KEY (create one, 250 free credits).
  • An OpenAI key in OPENAI_API_KEY.
  • pip install openai httpx

Code

agent.py
"""OpenAI function calling against the Oro Intel REST API (no MCP client needed)."""

import json
import os

import httpx
from openai import OpenAI

ORO_API_KEY = os.environ["ORO_API_KEY"]  # https://app.oro-intel.com/dashboard/developers
oro = httpx.Client(
    base_url="https://api.oro-intel.com/v1",
    headers={"Authorization": f"Bearer {ORO_API_KEY}"},
    timeout=30,
)

TOOLS = [
    {
        "type": "function",
        "function": {
            "name": "oro_lookup_company",
            "description": "Resolve a UK company by name. Costs 5 credits.",
            "parameters": {
                "type": "object",
                "properties": {"q": {"type": "string", "description": "Company name"}},
                "required": ["q"],
            },
        },
    },
    {
        "type": "function",
        "function": {
            "name": "oro_company_profile",
            "description": "Full supplier profile: core record plus every public contract won. Costs 12 credits.",
            "parameters": {
                "type": "object",
                "properties": {"company_number": {"type": "string"}},
                "required": ["company_number"],
            },
        },
    },
]


def call_tool(name: str, args: dict) -> dict:
    if name == "oro_lookup_company":
        return oro.get("/companies/search", params={"name": args["q"]}).raise_for_status().json()
    if name == "oro_company_profile":
        return oro.get(f"/companies/{args['company_number']}/profile").raise_for_status().json()
    raise ValueError(name)


client = OpenAI()
messages = [
    {
        "role": "user",
        "content": "Look up the UK company 'Serco' and summarise its full supplier "
        "profile: contracts won, plus credits_charged and credits_remaining.",
    }
]

while True:
    response = client.chat.completions.create(model="gpt-4o", messages=messages, tools=TOOLS)
    msg = response.choices[0].message
    messages.append(msg)
    if not msg.tool_calls:
        print(msg.content)
        break
    for tc in msg.tool_calls:
        result = call_tool(tc.function.name, json.loads(tc.function.arguments))
        print(f"[{tc.function.name}] credits_charged={result.get('credits_charged')} "
              f"credits_remaining={result.get('credits_remaining')}")
        messages.append({"role": "tool", "tool_call_id": tc.id, "content": json.dumps(result)})

Expected output

output (trimmed)
[oro_lookup_company] credits_charged=5 credits_remaining=245
[oro_company_profile] credits_charged=12 credits_remaining=233
Serco Limited (02048608) has won 132 public contracts...

Put the credit cost in each function description (as above) so the model can budget calls, exactly like the native MCP tools do.

Next steps