How do I pass an organic groups GID to a view in a pane?
Solved it like this:


Create a "Content pane" view mode of your view, and set "Argument input: Input on pane config".
Create a contextual filter in your view that expects a group ID value.
Enable the "Tokens" display mode for content type with the og_group_ref field. According to here:


Go to "Structure → Content Types → [your content type] → Manage Display".
Click "Custom Display Settings" below the field list, enable the "Token" option and save.
Go to the new "Token" display mode in the horizontal tabs on the top.
For yourog_group_ref field, set "Format: Entity id" and save.

In the Panels configuration of your list, insert your View pane.
In the View pane config form, there will be a single input field expecting a gid value and saying "You may use keywords for substitutions." below. Enter %node:og_group_ref.


How I think it works: Panels allows CTools context keywords when supplying arguments to panels. These context keywords are automatically available for all fields (%node:nid works out of the box) and all defined tokens (examples). But for fields, they evaluate to the formatted field value, such as your group's name. We could change this behavior by defining a token of the same name, and choosing a formatter that outputs the raw value (the number) when that token is evaluated.

References:


This Drupal SO question, providing the basic technique.