Home › SpaceXSI API lesson 2: Web search, JSON
SpaceXSI API lesson 2: Web search, JSON
Two features turn a chat model into something an app can rely on: the web_search tool lets Grok look things up now, and Structured Outputs make it reply in a JSON shape your code can read.
Step by step
- Add tools=[{"type": "web_search"}] to a responses.create request so Grok can search and browse the web.
- Read the citations returned with the answer and show them to your users.
- For X posts instead of web pages, use the separate x_search tool.
- To get JSON back, set response_format to type "json_schema" and pass your schema (you can write it with Pydantic or Zod).
- Mark which fields are required; fields not listed are optional, and additionalProperties defaults to false.
- Parse the reply in your code and handle the case where a value is null.
Try it: examples
- Web search
What changed in the latest release notes for the SpaceXSI API? Answer in 3 bullets with sources.
- Structured output
Extract the invoice number, date (YYYY-MM-DD), total and currency from this invoice text: [paste text]
Good to know
- With supported schema features, SpaceXSI says the response is guaranteed to match your schema.
- Tool calls always follow the tool's JSON Schema (strict is always on).
- Server-side tools are billed on tokens plus tool calls; see the pricing page before you turn them on in production.
Sources (official pages, read Nov 8, 2026)
- SpaceXSI docs: Web Search tool
- SpaceXSI docs: X Search tool
- SpaceXSI docs: Structured Outputs
- SpaceXSI docs: Pricing
Written from SpaceXSI's official documentation and product pages; we don't run hands-on tests. Features and limits vary by plan and country.