models.do
Version:
128 lines (99 loc) • 4.33 kB
Markdown
[](https://www.npmjs.com/package/models.do)
[](https://www.npmjs.com/package/models.do)
[](https://github.com/drivly/ai/blob/main/LICENSE)
[](https://www.typescriptlang.org/)
[](https://discord.gg/tafnNeUQdm)
[](https://github.com/drivly/ai/issues)
[](https://github.com/drivly/ai)
Models.do enables developers to search, filter, and compare Large Language Models based on their capabilities and attributes.
```bash
npm install models.do
yarn add models.do
pnpm add models.do
```
```typescript
import { ModelsSDK } from 'models.do'
// Create the SDK client
const models = new ModelsSDK({
apiKey: 'your-api-key',
})
// Resolve a specific model
await models.get('gemini') // -> { model: ModelDetails, parsed: { model: 'gemini' } }
await models.get('gemini(seed:1)') // -> { model: ModelDetails, parsed: { model: 'gemini', systemConfig: { seed: 1 } } }
await models.get('claude-3.7:reasoning') // -> { model: ModelDetails, parsed: { model: 'claude', capabilities: ['reasoning'] } }
// Find models by filters and sorting
// For most use cases, you'll most likely use the find method as its more flexible
await models.find({
author: 'google',
capabilities: ['reasoning', 'structuredOutput'],
sortBy: 'pricingLowToHigh',
})
// Returns both model's details, as well as a diff of the capabilities and attributes
await models.compare(['gemini', 'gpt-4o'])
// Retrieve a group of pre-parsed models
const frontierModels: Model[] = await models.group('frontier')
const wideRange: Model[] = await models.group('wideRange')
```
The main client for interacting with Models.do. Fetches data using the models API provided by Drivly.ai, making the SDK both slim and fast.
```typescript
new ModelsSDK(options?: { apiKey?: string, baseUrl?: 'https://models.do' | string })
```
#### Methods
- `get(modelIdentifier: string): Promise<{ model: ModelDetails }>`
Get details about a specific model
- `find(filters?: ModelFilters): Promise<Record<string, ModelDetails>>`
Find models that match the filters
- `compare(modelIdentifiers: string[]): Promise<Record<string, ModelDetails>>`
Compare models based on their capabilities
- `group(groupName: string): Promise<Model[]>`
Retrieve a group of models pre-parsed
```typescript
type Capability = 'code' | 'online' | 'reasoning' | 'tools' | 'structuredOutput' | 'responseFormat'
type Model = {
isComposite?: boolean
name: string
author: string
modelIdentifier?: string
openRouterSlug?: string
provider: Provider
capabilities?: Capability[]
alias?: string
sorting: {
topWeekly: number
newest: number
throughputHighToLow: number
latencyLowToHigh: number
pricingLowToHigh: number
pricingHighToLow: number
}
}
type ModelFilters = {
provider?: string
author?: string
sortBy?: 'topWeekly' | 'newest' | 'throughputHighToLow' | 'latencyLowToHigh' | 'pricingLowToHigh' | 'pricingHighToLow'
capabilities?: Capability | Capability[]
// Shortcuts for different capabilities
// For example, instead of writing `capabilities: ['structuredOutput', 'tools']`
// you can write `outputType: 'Object'`
outputType?: 'Object' | 'ObjectArray' | 'Text' | 'TextArray' | 'Markdown' | 'Code'
}
```
- [functions.do](https://functions.do) - Typesafe AI Functions
- [workflows.do](https://workflows.do) - Business Process Automation
- [agents.do](https://agents.do) - Autonomous Digital Workers
- [apis.do](https://apis.do) - Clickable Developer Experiences
- [llm.do](https://llm.do) - Intelligent AI Gateway
MIT
- [apis.do](https://www.npmjs.com/package/apis.do) - Unified API Gateway for all domains and services in the `.do` ecosystem