> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orq.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Orq.ai is the control plane for model and MCP traffic: one key reaches the workspace's enabled models, MCP servers, and resources. The setup depends on where the agent runs.
> Hosted assistant (ChatGPT, claude.ai, a hosted sandbox): install nothing. Tell the human to add https://my.orq.ai/v2/mcp as a remote MCP connector and finish the Orq.ai sign-in. With OAuth, send no Authorization header; otherwise send an API key as a bearer token.
> Local coding agent (Claude Code, Codex, Cursor, OpenCode): run `curl -fsSL https://cli.orq.ai/install.sh | sh`. It installs the CLI and runs `orq setup`, which signs in, writes a project-scoped key to `~/.orq/env`, and wires the detected agents through the AI Gateway. It can also add the Orq MCP server and Orq Skills, the workflows for agents, evaluations, and traces: https://docs.orq.ai/ai-studio/integrations/code-assistants/orq-skills.md. Verify with `orq status`.
> Headless or CI: read `ORQ_API_KEY` from the environment; a human creates the key at https://docs.orq.ai/ai-studio/organization/api-keys.md.
> Send model traffic to https://my.orq.ai/v3/router with `Authorization: Bearer $ORQ_API_KEY`; the Anthropic SDK uses https://my.orq.ai/v3/anthropic. New integrations go on `/v3/router`: `/v2/router` stays published for backward compatibility, and `orq.prompt` works only on `/v2/router/chat/completions`.
> Enable a model for the workspace and use its exact `provider/model` id. `POST /v2/workspace-models` enables a model, and a call fails while the workspace has neither credits nor a provider key.
> On `/chat/completions`, a reasoning model rejects `tools` with a `reasoning_effort` other than `none`; `/responses` keeps reasoning.
> On a failure, branch on `error.code` and follow `error.doc_url`; a budget rejection answers 429.

# Search the web with a selected provider

> Search the web with Exa, Ceramic, Linkup, Tavily, Serper, OpenAI, Perplexity or DeepSeek and return page URLs, titles and descriptions in one shape.

> [!NOTE]
>
> **Related guide**: Web search guide. See the [Web search guide](https://docs.orq.ai/ai-gateway/features/web-search.md) for a walkthrough with examples.


## OpenAPI

````yaml post /v3/websearch
openapi: 3.1.0
info:
  title: orq.ai API
  version: '2.0'
  description: orq.ai API documentation
servers:
  - url: https://my.orq.ai
security:
  - ApiKey: []
tags:
  - name: Chunking
    description: Split text into smaller chunks for retrieval and generation workflows.
  - name: File Systems
    description: >-
      Create and manage persistent file systems that agents and MCP clients read
      from and write to.
  - name: Knowledge Bases
    description: Create and manage knowledge bases used by agents and retrieval workflows.
  - name: Memory Stores
    description: Create and manage memory stores, memories, and memory documents.
  - name: Evals
    description: Run an evaluator against a conversation and its result
  - description: >-
      API keys authenticate programmatic access to the workspace. They expose
      opaque tokens, per-domain access grants, and budget and rate-limit
      constraints.
    name: API keys
  - name: Logs
    description: >-
      OpenTelemetry log query API. Search, filter, aggregate, and facet log
      records ingested via OTLP.
  - name: Reporting
    description: >-
      GenAI reporting API over canonical analytics rollups. Accepts a metric
      name, time range, grain, group-by, and filters; returns a typed time
      series and optional totals.
  - name: Telemetry
    description: >-
      Unified query envelope for traces, metrics, and logs. One request shape,
      one filter dialect, and one response shape per source, validated by a
      per-source registry.
  - name: Telemetry Destinations
    description: >-
      OpenTelemetry destinations that receive a copy of the workspace's traces
      over OTLP/HTTP.
  - name: Traces
    description: >-
      Query and inspect ingested trace data: search trace summaries, aggregate
      metrics, and read individual traces and their spans.
  - name: Views
    description: Saved filters and columns for workspace observability pages.
  - name: Datasets
    description: >-
      Datasets store test cases and expected outputs used for evaluation and
      optimization workflows.
  - name: Experiments
    description: >-
      Create and run experiments: dataset rows against task columns, evaluators,
      and annotations.
  - description: List models available through the AI Router.
    name: Models
  - name: Agents
    description: External A2A agents registered for invocation through the ORQ AI Gateway.
  - name: Alerts
    description: >-
      Alerts evaluate a telemetry metric on a fixed interval and fire
      notifications through notifiers when the value breaches a threshold. Each
      breach opens a trigger that tracks the incident until the value recovers.
  - name: Annotation Queues
    description: Annotation queues collect spans for human review.
  - name: Audit Log Destinations
    description: >-
      Signed webhook destinations that receive workspace audit log events, for
      SIEM and compliance pipelines.
  - name: Budgets
    description: >-
      Budgets govern spend, token usage, and request rate across workspace,
      project, identity, API key, provider, model, factory, and category-default
      scopes. Category defaults provide a separate allowance for each entity; an
      active individual budget replaces its category default. Every applicable
      budget is enforced, and the most restrictive limit applies per dimension.
  - name: Environments
    description: Reusable workspace- and project-scoped deployment environments.
  - name: Files
    description: File upload and retrieval operations.
  - name: Guardrail Rules
    description: >-
      Guardrail Rules conditionally enforce evaluators and plugins for AI
      Gateway traffic. Rules may be scoped to a project or the whole workspace.
  - name: Hub
    description: Hub items are reusable templates available to a workspace.
  - name: Identities
    description: >-
      Identities represent end users from your system for usage and engagement
      tracking.
  - name: Management keys
    description: >-
      Management keys are workspace-scoped credentials that authenticate
      programmatic access to workspace administration surfaces (API keys,
      budgets). Unlike project-scoped API keys, a management key always operates
      at the workspace level.
  - name: MCP Gateway
    description: >-
      Register upstream MCP servers, discover and sync their tools, and assemble
      gateways that expose a curated tool surface to MCP clients.
  - name: Model Catalog
    description: >-
      Browse the orq.ai model catalog: every model orq offers, across every
      provider, with pricing, capabilities and benchmark data. List endpoints
      only return models that are not deprecated. This API is public, requires
      no authentication, and is rate limited to 120 requests per minute per IP.
      Responses carry a 5-minute cache-control max-age.
  - name: Model Fusions
    description: >-
      Model Fusions combine independent model answers through a panel, judge,
      and optional synthesizer.
  - name: Monitors
    description: >-
      Monitors are custom observability dashboards for traces, runtime metrics,
      and logs. Each monitor holds widgets that chart one telemetry query. List
      the metrics, operations, and dimensions available to your workspace with
      `GET /v3/telemetry/capabilities`, or start from a preset with `GET
      /v2/monitors/presets`.
  - name: Notifiers
    description: Notifier destinations used to send delivery and workflow notifications.
  - name: Projects
    description: Projects organize resources within a workspace
  - name: Routing Rules
    description: >-
      Routing Rules conditionally select models and enforce request plugins for
      AI Gateway traffic. Rules are evaluated by ascending priority and may be
      scoped to a project or the whole workspace.
  - name: Threads
    description: Threads group related trace invocations and their aggregate usage
  - name: Skills
    description: >-
      Skills are modular instructions you can use to codify processes and
      conventions
  - name: Smart Routers
    description: >-
      Create and manage workspace Smart Routers. A Smart Router selects a model
      from an eligible pool for each request according to a quality, balanced,
      or cost profile.
  - name: Users
    description: >-
      Workspace user administration. Requires a Management Key with user
      permissions or an authenticated workspace admin session. Standard API keys
      are not supported.
  - name: Webhooks
    description: >-
      Create and manage webhooks that deliver workspace events to external HTTPS
      endpoints.
  - name: Workspaces
    description: >-
      A workspace is the tenant. Create is called from a user session during
      onboarding; Get, List, and Update are the public management surface.
  - name: Workspace Security
    description: >-
      Workspace-level domain verification and IP allowlist controls. These
      operations are restricted to workspace administrators.
  - name: Workspace Settings
    description: >-
      Workspace-level settings managed with a workspace credential. A workspace
      is the tenant, so these settings are a singleton — there is nothing to
      create or delete, only read and update.
  - description: Search Gateway with managed credits or BYOK.
    name: Web Search
  - name: Live Sessions
  - name: Responses
  - description: Run agents on a cron cadence. Minimum firing interval is 1 hour.
    name: Agent Schedules
  - name: Embeddings
  - description: Beta. Run typed classification questions against a classify model.
    name: Classify
  - description: Beta. Run classification decisions with the classify contract.
    name: Decisions
  - description: >-
      Run large offline workloads as JSONL batches and download
      OpenAI-compatible result files.
    name: Batches
externalDocs:
  url: https://docs.orq.ai
  description: orq.ai Documentation
paths:
  /v3/websearch:
    post:
      tags:
        - Web Search
      summary: Search the web with a selected provider
      description: >-
        Search with Exa, Ceramic, Linkup, Tavily, Serper, OpenAI, Perplexity, or
        DeepSeek and return page URLs, titles, and descriptions in one response
        format. Authenticate with an API key that grants **websearch.execute**
        and send **Content-Type: application/json**.


        ### Provider and credentials


        Each request uses the selected provider. Exa uses **auto** search,
        Linkup uses **standard** depth, Tavily uses **basic** depth, and
        Perplexity and DeepSeek use their standard Search APIs. DeepSeek accepts
        queries of at most 128 characters. OpenAI runs one forced **web_search**
        tool call on gpt-5.6-luna through the Responses API and returns the raw
        search results.


        Credentials are selected from the authenticated workspace. A configured
        provider integration takes precedence over platform-managed credentials:
        the default integration is used, or the first configured integration if
        no default is set. Configure BYOK in the workspace integrations
        settings. Invalid integration credentials cause an error.


        ### Billing


        Managed searches use the same credits as the **AI Gateway** and charge
        the provider cost plus **US$0.001 per search** (US$1 per 1,000
        searches). BYOK searches consume no platform credits and add no platform
        markup; the provider bills the integration owner directly.


        Exa's published auto rate is **US$7 per 1,000 requests** for up to 10
        results, or **US$8 per 1,000** including the platform markup. Exa
        charges use the actual cost reported by the provider.


        Perplexity's published Search API rate is **US$5 per 1,000 requests**
        and DeepSeek's is **US$0.75 per 1,000 requests**. OpenAI web search
        costs **US$10 per 1,000 tool calls** plus the gpt-5.6-luna tokens of the
        Responses call, computed from the usage reported by OpenAI, so each
        search is typically US$0.012 to US$0.015 before the platform markup.


        A successful managed search is billable even if an output guardrail or
        output redaction failure prevents the results from being returned.


        ### Policies and observability


        PII Redaction is the only supported request plugin. Workspace PII
        settings and matching guardrail rules also apply. Query redaction runs
        before input guardrails and the provider call; result redaction runs
        before output guardrails and the response.


        Search spans and metrics record the provider, latency, result count, and
        cost. Use the **x-orq-trace-id** response header to find the trace.
      operationId: search-web
      requestBody:
        content:
          application/json:
            examples:
              basic:
                summary: Search with Exa auto
                value:
                  provider: exa
                  query: Things to do in Salt Lake City in fall
              customer_search:
                summary: Limit results and attribute usage to a customer
                value:
                  identity:
                    id: customer-123
                  limit: 10
                  provider: exa
                  query: Things to do in Salt Lake City in fall
              pii_redaction:
                summary: Apply PII Redaction to the query and results
                value:
                  limit: 5
                  plugins:
                    - id: pii_redaction
                  provider: exa
                  query: Travel advice for john.smith@example.com
            schema:
              additionalProperties: false
              properties:
                identity:
                  additionalProperties: false
                  description: >-
                    Customer or end-user identity for attributing this search
                    and its usage.
                  properties:
                    id:
                      description: >-
                        Customer or end-user identifier used consistently across
                        API requests.
                      minLength: 1
                      type: string
                  required:
                    - id
                  type: object
                limit:
                  default: 10
                  description: >-
                    Maximum number of results to return, from 1 to 10. Defaults
                    to 10. The provider may return fewer results.
                  maximum: 10
                  minimum: 1
                  type: integer
                plugins:
                  description: >-
                    Optional PII Redaction configuration. At most one plugin is
                    accepted, with id pii_redaction. Workspace and matching rule
                    requirements still apply when this field is omitted.
                  items:
                    additionalProperties: false
                    description: >-
                      Redact detected personal information from the search query
                      and result fields.
                    properties:
                      entities:
                        description: >-
                          Entity types to redact, using names supported by the
                          PII detector. Used alone, this is an allowlist;
                          combined with regions, both sets of detectors apply.
                        items:
                          type: string
                        type:
                          - array
                          - 'null'
                      entity_thresholds:
                        additionalProperties:
                          type: number
                          format: double
                        description: >-
                          Per-entity confidence cutoffs from 0 to 1, applied in
                          addition to threshold. Each key must also appear in
                          entities.
                        type: object
                      id:
                        description: Plugin identifier. Must be pii_redaction.
                        enum:
                          - pii_redaction
                        type: string
                      language:
                        description: >-
                          Language used by the PII detector. Omitting the field
                          defaults to auto, which detects the language per
                          request; supported languages depend on the detector
                          capabilities.
                        type: string
                      on_failure:
                        description: >-
                          Behavior when the PII detector fails: block rejects
                          the request (default); passthrough continues with the
                          original text. Workspace and rule requirements can
                          enforce blocking.
                        type: string
                      regions:
                        description: >-
                          Country codes that select regional PII detectors. Use
                          ["all"] on its own for all regions. Omitting both
                          regions and entities enables all regions.
                        items:
                          type: string
                        type:
                          - array
                          - 'null'
                      threshold:
                        description: >-
                          Minimum detection confidence from 0 to 1. Omit to use
                          the detector's default threshold.
                        format: double
                        maximum: 1
                        minimum: 0
                        type: number
                    required:
                      - id
                    type: object
                  maxItems: 1
                  type: array
                provider:
                  description: >-
                    Provider to run this search. Exa uses auto, Linkup uses
                    standard depth, Tavily uses basic depth, and OpenAI runs one
                    web_search tool call on gpt-5.6-luna. Workspace credentials
                    are selected automatically for this provider.
                  enum:
                    - exa
                    - ceramic
                    - linkup
                    - tavily
                    - serper
                    - openai
                    - perplexity
                    - deepseek
                  type: string
                query:
                  description: >-
                    Search text. Must not be blank or exceed 10,000 characters.
                    Ceramic accepts at most 50 words and DeepSeek at most 128
                    characters.
                  maxLength: 10000
                  minLength: 1
                  type: string
              required:
                - query
                - provider
              type: object
        description: >-
          Search query and provider, with optional result limit, customer
          identity, and PII settings.
        required: true
      responses:
        '200':
          content:
            application/json:
              examples:
                no_results:
                  summary: Search completed with no results
                  value:
                    items: []
                    metadata:
                      latencyMs: 612
                      provider: exa
                      query: Things to do in Salt Lake City in fall
                      requestId: 01ARZ3NDEKTSV4RRFFQ69G5FAV
                results:
                  summary: Search results
                  value:
                    items:
                      - description: >-
                          Scenic drives through Big Cottonwood Canyon and local
                          pumpkin patches.
                        title: 'Fall in Salt Lake City: A Local''s Guide'
                        url: https://example.com/salt-lake-city-fall-guide
                    metadata:
                      latencyMs: 612
                      provider: exa
                      query: Things to do in Salt Lake City in fall
                      requestId: 01ARZ3NDEKTSV4RRFFQ69G5FAV
              schema:
                properties:
                  items:
                    description: >-
                      Results in the provider's order, after any required PII
                      redaction. Empty when no results are found.
                    items:
                      properties:
                        description:
                          description: >-
                            Provider-supplied excerpt or description. May be
                            empty.
                          type: string
                        title:
                          description: >-
                            Page title. May be empty if the provider supplies no
                            title.
                          type: string
                        url:
                          description: >-
                            Page URL returned by the provider. PII redaction can
                            replace sensitive parts of the URL.
                          type: string
                      required:
                        - url
                        - title
                        - description
                      type: object
                    type: array
                  metadata:
                    description: Details about this search request.
                    properties:
                      latencyMs:
                        description: >-
                          Elapsed search processing time in milliseconds,
                          including applied policies.
                        format: int32
                        minimum: 0
                        type: integer
                      provider:
                        description: Provider that executed the search.
                        enum:
                          - exa
                          - ceramic
                          - linkup
                          - tavily
                          - serper
                          - openai
                          - perplexity
                          - deepseek
                        type: string
                      query:
                        description: >-
                          Query sent to the provider after any required PII
                          redaction.
                        type: string
                      requestId:
                        description: >-
                          Platform-generated identifier for this search request.
                          Distinct from the trace ID in the response headers.
                        type: string
                    required:
                      - query
                      - requestId
                      - latencyMs
                      - provider
                    type: object
                required:
                  - items
                  - metadata
                type: object
          description: >-
            Search completed. Results may be empty or fewer than the requested
            limit.
          headers:
            x-orq-trace-id:
              description: >-
                Trace identifier for inspecting this request and its search
                span.
              schema:
                type: string
            x-orq-trace-span-id:
              description: Span identifier for the HTTP request within the trace.
              schema:
                type: string
        '400':
          content:
            application/json:
              examples:
                invalid_request:
                  summary: Invalid query, provider, limit, or plugin
                  value:
                    error:
                      message: invalid web search request
                      type: web_search_error
                      param: null
                      code: null
              schema:
                type: object
                additionalProperties: false
                properties:
                  error:
                    $ref: '#/components/schemas/APIError'
                required:
                  - error
          description: >-
            Invalid request, unusable workspace integration, or a blocking
            guardrail. Check the request fields and workspace integration
            settings.
        '401':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  error:
                    $ref: '#/components/schemas/APIError'
                required:
                  - error
          description: >-
            Missing or invalid API key. Send a valid API key in the
            Authorization header.
        '402':
          content:
            application/json:
              examples:
                insufficient_credits:
                  summary: Managed search has no available platform credits
                  value:
                    error:
                      message: insufficient credits for managed web search
                      type: web_search_error
                      param: null
                      code: null
              schema:
                type: object
                additionalProperties: false
                properties:
                  error:
                    $ref: '#/components/schemas/APIError'
                required:
                  - error
          description: >-
            Managed search requires a positive platform credit balance. Add
            credits before retrying. BYOK does not require platform credits.
        '403':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  error:
                    $ref: '#/components/schemas/APIError'
                required:
                  - error
          description: The API key lacks websearch.execute permission.
        '415':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  error:
                    $ref: '#/components/schemas/APIError'
                required:
                  - error
          description: >-
            Unsupported or missing Content-Type. Send application/json; an
            optional charset parameter is accepted.
        '422':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  error:
                    $ref: '#/components/schemas/APIError'
                required:
                  - error
          description: A configured guardrail evaluator could not complete its evaluation.
        '429':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  error:
                    $ref: '#/components/schemas/APIError'
                required:
                  - error
          description: >-
            A workspace or provider rate limit, or a matching budget, was
            reached. Wait before retrying or raise the budget.
        '500':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  error:
                    $ref: '#/components/schemas/APIError'
                required:
                  - error
          description: >-
            Unexpected gateway error. Include the trace ID, if available, when
            reporting the failure.
        '502':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  error:
                    $ref: '#/components/schemas/APIError'
                required:
                  - error
          description: >-
            The search provider, PII detector, or guardrail service failed.
            Invalid upstream credentials can also produce this response.
        '503':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  error:
                    $ref: '#/components/schemas/APIError'
                required:
                  - error
          description: >-
            The gateway could not load workspace integrations. Retry when the
            credential store is available.
        '504':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  error:
                    $ref: '#/components/schemas/APIError'
                required:
                  - error
          description: The provider request timed out or was cancelled.
      x-code-samples:
        - label: Node.js
          lang: typescript
          source: >-
            import { Orq } from "@orq-ai/node";


            const orq = new Orq({ apiKey: process.env["ORQ_API_KEY"], serverURL:
            "https://my.orq.ai" });

            const result = await orq.websearch.search({
              query: "Things to do in Salt Lake City in fall",
              provider: "exa",
              limit: 10,
              identity: { id: "customer-123" },
            });
components:
  schemas:
    APIError:
      additionalProperties: false
      properties:
        code:
          type:
            - string
            - 'null'
        failures: {}
        message:
          type: string
        param:
          type:
            - string
            - 'null'
        type:
          type: string
      required:
        - message
        - type
        - param
        - code
      type: object
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.