Skip to content

TypeScript guides have diverged from the current SDK request shapes #238

Description

@kritikmodi

Page URL

https://openrouter.ai/docs/quickstart

What's wrong?

I compiled the currently published TypeScript examples against @openrouter/sdk@1.2.26 and @openrouter/agent@0.9.0 using TypeScript 5.9.3.

I found 91 affected TypeScript blocks across 43 documentation pages, grouped into seven recurring documentation/SDK mismatches:

  1. 73 chat.send() examples pass model and messages at the top level, while the current SDK requires:
client.chat.send({
  chatRequest: {
    model,
    messages,
  },
});

The main quickstart consequently fails with TS2769.

  1. Five Agent SDK examples use messages, while callModel() now requires input. These fail with TS2353.

  2. Three embeddings examples pass model and input at the top level, while embeddings.generate() requires requestBody.

  3. API-key examples use the previous method signatures:

apiKeys.create({ name, limit });
apiKeys.get(keyHash);
apiKeys.update(keyHash, body);
apiKeys.delete(keyHash);

The current SDK expects requestBody and object arguments such as { hash }.

  1. STT and TTS examples pass their request bodies at the top level. The current SDK requires sttRequest and speechRequest.

  2. The Agent SDK migration guide recommends:

import { OpenRouter } from '@openrouter/agent/client';

However, @openrouter/agent@0.9.0 does not export the ./client subpath. The package root and @openrouter/agent/openrouter resolve successfully.

  1. The Agent SDK API reference lists ToolContextMap and ToolExecuteContext as exports from @openrouter/agent, but both types are currently available from @openrouter/agent/tool-types instead.
    Representative compiler errors include TS2769, TS2353, TS2345, TS2339, and TS2307.

I reproduced each pattern and verified that corrected request/import shapes compile.
I also have the complete page inventory, compiler output, and corrected examples available.

Expected content

The TypeScript guides should use the request wrappers and import paths exposed by the currently published packages:

  • chatRequest for chat.send()
  • input for Agent SDK callModel()
  • requestBody for embeddings and API-key creation
  • object arguments such as { hash } for API-key operations
  • sttRequest and speechRequest for audio operations
  • @openrouter/agent or @openrouter/agent/openrouter for the Agent client
  • @openrouter/agent/tool-types for ToolContextMap and ToolExecuteContext, unless those types are intentionally re-exported from the package root

Shall I open a PR for this issue ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions