Overview
End Users endpointsAvailable Operations
- List - List registered end users
- Create - Register an end user
- Delete - Deactivate a registered end user
- Get - Get a registered end user
- Update - Update a registered end user
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
End Users endpoints
package main
import(
"context"
"os"
openrouter "github.com/OpenRouterTeam/go-sdk"
"github.com/OpenRouterTeam/go-sdk/optionalnullable"
"log"
)
func main() {
ctx := context.Background()
s := openrouter.New(
openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")),
)
res, err := s.EndUsers.List(ctx, optionalnullable.From(openrouter.Pointer[int64](0)), openrouter.Pointer[int64](50), nil, openrouter.Pointer(false))
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
}
}
}
}
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
ctx | context.Context | :heavy_check_mark: | The context to use for the request. | |
offset | optionalnullable.OptionalNullable[int64] | :heavy_minus_sign: | Number of records to skip for pagination | 0 |
limit | *int64 | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 |
user | *string | :heavy_minus_sign: | Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths. | employee_123 |
includeInactive | *bool | :heavy_minus_sign: | Include deactivated registrations. | false |
opts | []operations.Option | :heavy_minus_sign: | The options for this request. |
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.BadRequestResponseError | 400 | application/json |
| sdkerrors.UnauthorizedResponseError | 401 | application/json |
| sdkerrors.NotFoundResponseError | 404 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | */* |
package main
import(
"context"
"os"
openrouter "github.com/OpenRouterTeam/go-sdk"
"github.com/OpenRouterTeam/go-sdk/models/components"
"log"
)
func main() {
ctx := context.Background()
s := openrouter.New(
openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")),
)
res, err := s.EndUsers.Create(ctx, components.CreateEndUserRequest{
User: "employee_123",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx | context.Context | :heavy_check_mark: | The context to use for the request. |
request | components.CreateEndUserRequest | :heavy_check_mark: | The request object to use for the request. |
opts | []operations.Option | :heavy_minus_sign: | The options for this request. |
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.BadRequestResponseError | 400 | application/json |
| sdkerrors.UnauthorizedResponseError | 401 | application/json |
| sdkerrors.NotFoundResponseError | 404 | application/json |
| sdkerrors.ConflictResponseError | 409 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | */* |
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")),
)
err := s.EndUsers.Delete(ctx, "employee_123")
if err != nil {
log.Fatal(err)
}
}
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
ctx | context.Context | :heavy_check_mark: | The context to use for the request. | |
user | string | :heavy_check_mark: | Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths. | employee_123 |
opts | []operations.Option | :heavy_minus_sign: | The options for this request. |
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.BadRequestResponseError | 400 | application/json |
| sdkerrors.UnauthorizedResponseError | 401 | application/json |
| sdkerrors.NotFoundResponseError | 404 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | */* |
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.EndUsers.Get(ctx, "employee_123")
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
ctx | context.Context | :heavy_check_mark: | The context to use for the request. | |
user | string | :heavy_check_mark: | Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths. | employee_123 |
opts | []operations.Option | :heavy_minus_sign: | The options for this request. |
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.BadRequestResponseError | 400 | application/json |
| sdkerrors.UnauthorizedResponseError | 401 | application/json |
| sdkerrors.NotFoundResponseError | 404 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | */* |
package main
import(
"context"
"os"
openrouter "github.com/OpenRouterTeam/go-sdk"
"github.com/OpenRouterTeam/go-sdk/models/components"
"log"
)
func main() {
ctx := context.Background()
s := openrouter.New(
openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")),
)
res, err := s.EndUsers.Update(ctx, "employee_123", components.UpdateEndUserRequest{
IsActive: true,
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
ctx | context.Context | :heavy_check_mark: | The context to use for the request. | |
user | string | :heavy_check_mark: | Immutable case-sensitive tracking string supplied as user on inference requests. URL-encode it in resource paths. | employee_123 |
updateEndUserRequest | components.UpdateEndUserRequest | :heavy_check_mark: | N/A | { “is_active”: true } |
opts | []operations.Option | :heavy_minus_sign: | The options for this request. |
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.BadRequestResponseError | 400 | application/json |
| sdkerrors.UnauthorizedResponseError | 401 | application/json |
| sdkerrors.NotFoundResponseError | 404 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | */* |