Tikway

Gemini API · generateContent

Connect to Gemini with the right path and input format

Integrating Gemini takes more than changing a model name. Use Tikway's native-protocol resources to match the model's input capabilities to the generateContent request structure and budget.

How does generateContent differ from Chat Completions?

The native Gemini protocol puts the model and action in the URL. It uses a contents array for conversation turns and parts for text or other inputs. Do not send an unchanged OpenAI messages body to generateContent or try to read candidates with a choices parser.

Check the model resource name in the catalog. If it already includes models/, avoid adding that segment twice. Configure the ID, namespace and action path according to the selected model's example.

  • Authenticate with a Tikway key in the x-goog-api-key header.
  • Read returned content from candidates and check the completion status.
  • Use Gemini's role and content structure for conversation history.

Check input types and context before choosing a Gemini model

Models in the same family may support different inputs. Text, image, audio and video support and billing depend on the selected model and protocol. The Gemini name alone does not establish that every multimodal feature is available.

For long documents, check context limits. For batch jobs, consider output length and failed-request retries too. Validate text first, then add each required input type so you can identify format or capability problems.

  • Verify input capabilities separately from generation capabilities.
  • A long context window does not mean unlimited input or output.
  • Check resource formats, size limits and additional charges separately.

Keep streaming actions and response parsing aligned

generateContent and streamGenerateContent are different actions. Use the appropriate path, parameters and event handling. Do not process a regular JSON response as a streaming event. If a stream disconnects, inspect received content, errors and request records together.

Begin cost estimates with the selected model's ordinary input and output rates. Image, audio, video and cache usage may use different billing fields; the text calculator is not a complete multimodal budget.

Endpoints & protocol

SettingValue or verification step
Native text endpointPOST https://api.tikway.ai/v1beta/models/{model}:generateContent
Authenticationx-goog-api-key: your Tikway key
Request & responsecontents[].parts[]; inspect candidates content and completion status

Check prices before estimating a budget

Base text cost = input tokens × input rate + output tokens × output rate

Base catalog prices are in USD per token. Multiply by 1,000,000 to compare a per-million-token quote. The calculator estimates ordinary text input and output only. Check cache, image, video and other charges separately; account billing rules and request records determine the final charge.

Integration & troubleshooting resources

Frequently asked questions

Does a native Gemini request need a root model field?

A minimal generateContent request obtains the model from the URL. If your application also sends a model field, check that it agrees with the path and protocol example.

Can every Gemini model accept images or video?

Do not infer capabilities from the family name. Check the specific model's inputs, protocol and rates, then validate the input types your workload needs.

Can I enable native streaming with stream: true?

Check the streamGenerateContent action, its parameters and response handling. The Chat Completions stream field is not a substitute for the native Gemini protocol.

Explore other APIs

Choose the model, protocol and budget before integrating

Send a minimal request with your Tikway API key, then check usage in your request records. Model calls are billed under the applicable rules. These introductions, guides and the calculator are public.

Tikway is an independent AI API service, not an official service of OpenAI, Anthropic or Google. Brand names identify models and protocols.