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

# Models

> Model information endpoints

## Overview

Model information endpoints

### Available Operations

* [Get](#get) - Get a model by its slug
* [List](#list) - List all models and their properties
* [Count](#count) - Get total count of available models
* [ListForUser](#listforuser) - List models filtered by user provider preferences, privacy settings, and guardrails

## Get

Returns full details for a single model identified by its author and slug (e.g. openai/gpt-4). Supports variant suffixes (e.g. openai/gpt-4:free) and resolves known slug aliases.

### Example Usage

```go theme={null}
package main

import(
	"context"
	"os"
	openrouter "github.com/OpenRouterTeam/go-sdk"
	"log"
)

func main() {
    ctx := context.Background()

    s := openrouter.New(
        openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")),
    )

    res, err := s.Models.Get(ctx, "openai", "gpt-4")
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}
```

### Parameters

| Parameter | Type | Required | Description | Example |
| - | - | - | - | - |
| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy\_check\_mark: | The context to use for the request. | |
| `author` | `string` | :heavy\_check\_mark: | The author/organization of the model | openai |
| `slug` | `string` | :heavy\_check\_mark: | The model slug, optionally including a variant suffix (e.g. gpt-4 or gpt-4:free) | gpt-4 |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | :heavy\_minus\_sign: | The options for this request. | |

### Response

**[\*components.ModelResponse](../../models/components/modelresponse.mdx), error**

### Errors

| Error Type | Status Code | Content Type |
| - | - | - |
| sdkerrors.ForbiddenResponseError | 403 | application/json |
| sdkerrors.NotFoundResponseError | 404 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## List

List all models and their properties

### Example Usage

```go theme={null}
package main

import(
	"context"
	"os"
	openrouter "github.com/OpenRouterTeam/go-sdk"
	"github.com/OpenRouterTeam/go-sdk/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := openrouter.New(
        openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")),
    )

    res, err := s.Models.List(ctx, &operations.GetModelsRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        for {
            // handle items

            res, err = res.Next()

            if err != nil {
                // handle error
            }

            if res == nil {
                break
            }
        }
    }
}
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy\_check\_mark: | The context to use for the request. |
| `request` | [operations.GetModelsRequest](../../models/operations/getmodelsrequest.mdx) | :heavy\_check\_mark: | The request object to use for the request. |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | :heavy\_minus\_sign: | The options for this request. |

### Response

**[\*operations.GetModelsResponse](../../models/operations/getmodelsresponse.mdx), error**

### Errors

| Error Type | Status Code | Content Type |
| - | - | - |
| sdkerrors.BadRequestResponseError | 400 | application/json |
| sdkerrors.ForbiddenResponseError | 403 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## Count

Get total count of available models

### Example Usage

```go theme={null}
package main

import(
	"context"
	"os"
	openrouter "github.com/OpenRouterTeam/go-sdk"
	"log"
)

func main() {
    ctx := context.Background()

    s := openrouter.New(
        openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")),
    )

    res, err := s.Models.Count(ctx, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}
```

### Parameters

| Parameter | Type | Required | Description | Example |
| - | - | - | - | - |
| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy\_check\_mark: | The context to use for the request. | |
| `outputModalities` | `*string` | :heavy\_minus\_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or "all" to include all models. Defaults to "text". | text |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | :heavy\_minus\_sign: | The options for this request. | |

### Response

**[\*components.ModelsCountResponse](../../models/components/modelscountresponse.mdx), error**

### Errors

| Error Type | Status Code | Content Type |
| - | - | - |
| sdkerrors.BadRequestResponseError | 400 | application/json |
| sdkerrors.ForbiddenResponseError | 403 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## ListForUser

List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/provider-logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). Returns text-output models by default; pass `output_modalities` (a comma-separated list of `text`, `image`, `embeddings`, `audio`, `video`, `rerank`, `speech`, `transcription`, or `all`) to include other modalities. If requesting through a regional hostname, the results will be filtered to models that satisfy in-region routing for that region.

### Example Usage

```go theme={null}
package main

import(
	"context"
	openrouter "github.com/OpenRouterTeam/go-sdk"
	"os"
	"github.com/OpenRouterTeam/go-sdk/models/operations"
	"github.com/OpenRouterTeam/go-sdk/optionalnullable"
	"log"
)

func main() {
    ctx := context.Background()

    s := openrouter.New()

    res, err := s.Models.ListForUser(ctx, operations.ListModelsUserSecurity{
        Bearer: os.Getenv("OPENROUTER_BEARER"),
    }, optionalnullable.From(openrouter.Pointer[int64](0)), openrouter.Pointer[int64](500), nil)
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        for {
            // handle items

            res, err = res.Next()

            if err != nil {
                // handle error
            }

            if res == nil {
                break
            }
        }
    }
}
```

### Parameters

| Parameter | Type | Required | Description | Example |
| - | - | - | - | - |
| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy\_check\_mark: | The context to use for the request. | |
| `security` | [operations.ListModelsUserSecurity](../../models/operations/listmodelsusersecurity.mdx) | :heavy\_check\_mark: | The security requirements to use for the request. | |
| `offset` | optionalnullable.OptionalNullable\[`int64`] | :heavy\_minus\_sign: | Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned | 0 |
| `limit` | `*int64` | :heavy\_minus\_sign: | Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned | 500 |
| `outputModalities` | `*string` | :heavy\_minus\_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, decisions, speech, transcription) or "all" to include all models. Defaults to "text". | text |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | :heavy\_minus\_sign: | The options for this request. | |

### Response

**[\*operations.ListModelsUserResponse](../../models/operations/listmodelsuserresponse.mdx), error**

### Errors

| Error Type | Status Code | Content Type |
| - | - | - |
| sdkerrors.UnauthorizedResponseError | 401 | application/json |
| sdkerrors.ForbiddenResponseError | 403 | application/json |
| sdkerrors.NotFoundResponseError | 404 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |
