models.mjs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
  2. import { APIResource } from "../core/resource.mjs";
  3. import { Page } from "../core/pagination.mjs";
  4. import { buildHeaders } from "../internal/headers.mjs";
  5. import { path } from "../internal/utils/path.mjs";
  6. export class Models extends APIResource {
  7. /**
  8. * Get a specific model.
  9. *
  10. * The Models API response can be used to determine information about a specific
  11. * model or resolve a model alias to a model ID.
  12. */
  13. retrieve(modelID, params = {}, options) {
  14. const { betas } = params ?? {};
  15. return this._client.get(path `/v1/models/${modelID}`, {
  16. ...options,
  17. headers: buildHeaders([
  18. { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
  19. options?.headers,
  20. ]),
  21. });
  22. }
  23. /**
  24. * List available models.
  25. *
  26. * The Models API response can be used to determine which models are available for
  27. * use in the API. More recently released models are listed first.
  28. */
  29. list(params = {}, options) {
  30. const { betas, ...query } = params ?? {};
  31. return this._client.getAPIList('/v1/models', (Page), {
  32. query,
  33. ...options,
  34. headers: buildHeaders([
  35. { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
  36. options?.headers,
  37. ]),
  38. });
  39. }
  40. }
  41. //# sourceMappingURL=models.mjs.map