Hello,
is it possible to call the generativelanguage
APIs using gRPC?
I’m exploring using the generativelanguage
APIs with gRPC in a Swift project, and I’m running into some configuration issues. Specifically, I’m getting the “Channel isn’t ready.” error, and I’m unclear on how to correctly configure the host, port, and API key for gRPC calls.
I’ve generated Swift code from the proto files, but I’m struggling to determine:
- The correct host address and port to use for the
generativelanguage
gRPC endpoint. Is there a specific gRPC endpoint published for these APIs? Do we includev1beta
etc. in the URL? - The proper method for authenticating my gRPC requests with an API key. I’m not seeing explicit examples of how to add the API key in the gRPC context.
I’ve created a minimal example demonstrating my setup, including the generated Swift code. You can find it in this repository:
Trying evans
CLI
evans --tls --host generativelanguage.googleapis.com -r repl
evans: failed to run REPL mode: failed to instantiate a new spec: failed to instantiate the spec: failed to list packages by gRPC reflection: failed to list services from reflection enabled gRPC server: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial tcp [2a00:1450:4001:82f::200a]:50051: i/o timeout"